:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1b1f25;
  --line: #2b3038;
  --text: #f4f6f8;
  --muted: #949ca8;
  --accent: #75e1b7;
  --accent-2: #4cb88f;
  --danger: #ff7a8a;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% -20%, #1d3130 0, transparent 38%), var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; }
.topbar { height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(11,13,16,.82); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: -.02em; }
.brand em { color: var(--muted); font-style: normal; font-weight: 500; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; color: #07100d; font-weight: 900; background: linear-gradient(135deg, #b3f7dd, #45b98c); box-shadow: 0 0 28px rgba(117,225,183,.2); }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #d4a74b; }
.status.online .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(117,225,183,.1); }
.status.offline .dot { background: var(--danger); }
main { height: calc(100vh - 66px); display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 16px; padding: 16px; }
.card { background: rgba(20,23,28,.94); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.workspace { min-height: 0; display: grid; }
.drop-zone { margin: 18px; border: 1px dashed #46505d; border-radius: 13px; display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 520px; cursor: pointer; transition: .2s ease; background: linear-gradient(145deg, rgba(255,255,255,.018), transparent); }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: rgba(117,225,183,.04); }
.drop-icon { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-size: 36px; font-weight: 200; color: var(--accent); background: rgba(117,225,183,.08); border: 1px solid rgba(117,225,183,.25); }
.drop-zone h1 { margin: 22px 0 4px; font-size: clamp(22px,3vw,34px); letter-spacing: -.04em; }
.drop-zone p { color: var(--muted); margin: 4px 0 24px; }
.drop-zone small { color: #69727e; }
.controls { padding: 23px; overflow-y: auto; }
.controls h2 { margin: 0 0 14px; font-size: 15px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 10px; background: #0e1115; border: 1px solid var(--line); }
.segmented input { display: none; }
.segmented span { display: block; text-align: center; padding: 9px; border-radius: 7px; color: var(--muted); font-size: 13px; cursor: pointer; }
.segmented input:checked + span { background: #292e35; color: var(--text); }
.enhancements { margin-top: 18px; transition: opacity .2s; }
.enhancements.disabled { opacity: .35; pointer-events: none; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #242930; cursor: pointer; }
.toggle-row span { display: flex; flex-direction: column; gap: 3px; }
.toggle-row b { font-size: 13px; font-weight: 550; }
.toggle-row small { font-size: 11px; color: var(--muted); }
.toggle-row input { display: none; }
.toggle-row i { width: 38px; height: 22px; border-radius: 12px; background: #343941; position: relative; transition: .2s; }
.toggle-row i::after { content: ''; width: 16px; height: 16px; border-radius: 50%; position: absolute; top: 3px; left: 3px; background: #9da4ad; transition: .2s; }
.toggle-row input:checked + i { background: var(--accent-2); }
.toggle-row input:checked + i::after { transform: translateX(16px); background: white; }
.export-title { margin-top: 25px !important; }
.field { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 13px 0; }
.field select { width: 100%; padding: 10px; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: #101318; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field output { color: var(--text); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary, .download { width: 100%; border: 0; border-radius: 10px; padding: 13px 16px; font-weight: 750; text-align: center; text-decoration: none; cursor: pointer; color: #07100d; background: linear-gradient(135deg, #9aefd0, #4cc091); }
.primary:disabled { cursor: not-allowed; opacity: .35; filter: grayscale(.4); }
.download { display: block; margin-top: 10px; color: var(--text); background: #272d34; border: 1px solid #3a424c; }
.ghost { color: var(--muted); border: 1px solid var(--line); background: #181c21; padding: 8px 11px; border-radius: 8px; cursor: pointer; }
.preview-panel { display: grid; grid-template-rows: auto minmax(0,1fr); min-height: 0; }
.preview-toolbar { padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.preview-toolbar strong { font-size: 13px; margin-right: 8px; }
.badge { font-size: 10px; color: var(--muted); background: #262b32; border-radius: 12px; padding: 4px 8px; }
.view-modes { display: flex; padding: 3px; gap: 2px; border-radius: 8px; background: #0e1115; border: 1px solid var(--line); }
.view-modes button { color: var(--muted); background: transparent; border: 0; border-radius: 6px; padding: 6px 9px; font-size: 11px; cursor: pointer; }
.view-modes button.active { color: var(--text); background: #30363e; }
.comparison { position: relative; min-height: 420px; background: #080a0c; overflow: hidden; user-select: none; }
.comparison > img, .after-layer img { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; }
.after-layer { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0 0 0 50%); }
.after-layer img { width: 100%; object-position: center; }
.divider { position: absolute; z-index: 4; top: 0; bottom: 0; left: 50%; width: 2px; background: white; pointer-events: none; }
.divider span { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #111; background: white; box-shadow: 0 2px 20px rgba(0,0,0,.5); }
#compareRange { position: absolute; z-index: 5; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; }
.label { z-index: 3; position: absolute; top: 14px; border-radius: 5px; padding: 5px 8px; color: white; font-size: 10px; background: rgba(0,0,0,.55); }
.before-label { left: 14px; }.after-label { right: 14px; }
.processing-overlay { position: absolute; z-index: 8; inset: 0; display: flex; flex-direction: column; gap: 15px; align-items: center; justify-content: center; background: rgba(7,9,11,.68); backdrop-filter: blur(8px); }
.processing-overlay p { color: #dce2e6; font-size: 13px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #374047; border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.error { color: var(--danger); font-size: 12px; line-height: 1.45; }
.sub-settings { margin: 10px 0 4px; padding: 12px; border: 1px solid #303740; border-radius: 10px; background: #101318; }
.sub-settings .field:first-child { margin-top: 0; }
.number-unit { width: 100%; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: #0b0e12; overflow: hidden; }
.number-unit input { min-width: 0; flex: 1; padding: 10px; border: 0; outline: 0; color: var(--text); background: transparent; }
.number-unit span { padding: 0 10px; color: var(--muted); }
.dimension-hint, .section-help { color: #747e89; font-size: 11px; line-height: 1.45; }
.dimension-hint { margin: -2px 0 14px; }
.section-help { margin: -8px 0 14px; }
dialog { width: min(390px,calc(100vw - 32px)); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 100px #000; }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(12px); }
dialog form { display: flex; flex-direction: column; align-items: center; gap: 13px; padding: 18px; }
dialog h2, dialog p { margin: 0; } dialog p { color: var(--muted); font-size: 13px; }
dialog input { width: 100%; color: var(--text); background: #0e1115; border: 1px solid var(--line); border-radius: 9px; padding: 12px; }
@media (max-width: 850px) {
  main { height: auto; grid-template-columns: 1fr; }
  .workspace { min-height: 62vh; }
  .controls { order: 2; }
  .comparison { min-height: 58vh; }
  .preview-toolbar { flex-wrap: wrap; gap: 8px; }
  .view-modes { order: 3; width: 100%; }
  .view-modes button { flex: 1; }
}
