:root {
  --bg:          #07101b;
  --panel:       rgba(14, 22, 42, 0.78);
  --panel-edge:  rgba(255, 255, 255, 0.08);
  --line:        rgba(255, 255, 255, 0.09);
  --text:        #eef3ff;
  --muted:       #7a8fb8;
  --accent:      #6ee7ff;
  --accent-2:    #8b5cf6;
  --accent-3:    #ff4fd8;
  --radius:      20px;
  --shadow:      0 24px 80px rgba(0,0,0,0.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: Inter, system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse at 8% 0%,   rgba(110,231,255,0.10) 0%, transparent 40%),
    radial-gradient(ellipse at 92% 10%, rgba(139, 92,246,0.14) 0%, transparent 40%),
    linear-gradient(180deg, #06101a 0%, #080e1c 100%);
}

/* ── Orbs ─────────────────────────────────────────────────────────────────── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
}
.orb-1 { width: 500px; height: 500px; background: #2fe6ff; top: -160px; left: -160px; }
.orb-2 { width: 440px; height: 440px; background: #8b5cf6; bottom: -120px; right: -120px; }

/* ── Wrap ─────────────────────────────────────────────────────────────────── */
.wrap {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 4px;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.badge {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(110,231,255,0.08);
  border: 1px solid rgba(110,231,255,0.22);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  align-items: start;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

/* ── Panel ────────────────────────────────────────────────────────────────── */
.panel { padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 0;
}

/* ── Upload box ───────────────────────────────────────────────────────────── */
.upload-box {
  display: block;
  border: 1.5px dashed rgba(255,255,255,0.13);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: 0.18s ease;
}
.upload-box:hover, .upload-box.drag {
  border-color: rgba(110,231,255,0.4);
  background: rgba(110,231,255,0.05);
}
.upload-box input { display: none; }

.upload-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Preview ──────────────────────────────────────────────────────────────── */
.preview {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #0c1628, #080e1c);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview img { display: block; width: 100%; height: auto; }
.preview img[hidden] { display: none; }
.preview-empty[hidden] { display: none; }

.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.28);
  font-size: 13px;
  padding: 28px 20px;
  text-align: center;
}

/* ── Choices grid ─────────────────────────────────────────────────────────── */
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: 0.15s ease;
  font: inherit;
  min-width: 0;
}
.choice:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(110,231,255,0.25);
}
.choice.active {
  border-color: rgba(110,231,255,0.55);
  background: rgba(110,231,255,0.10);
}
.choice:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.choice .num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  background: rgba(110,231,255,0.10);
}

.choice-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* ── Panel head ───────────────────────────────────────────────────────────── */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-wrap { flex: 1; min-width: 0; }

.status {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  font: inherit;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 9px 16px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: 0.16s ease;
  white-space: nowrap;
}
button:hover:not(:disabled) { background: rgba(255,255,255,0.10); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.primary {
  background: linear-gradient(135deg, var(--accent), #a8f0ff);
  border: none;
  color: #06101a;
  font-weight: 800;
  padding: 9px 22px;
}
button.primary:hover:not(:disabled) { opacity: 0.88; }

/* ── Orientation toggle ───────────────────────────────────────────────────── */
.orient-toggle {
  display: flex;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  overflow: hidden;
}

.orient-btn {
  border: none;
  border-radius: 0;
  padding: 8px 12px;
  font-size: 12px;
  background: transparent;
  color: var(--muted);
  border-right: 1px solid rgba(255,255,255,0.10);
}
.orient-btn:last-child { border-right: none; }
.orient-btn:hover:not(:disabled) { background: rgba(255,255,255,0.06); color: var(--text); }
.orient-btn.active { background: rgba(110,231,255,0.12); color: var(--accent); }
.orient-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Progress ─────────────────────────────────────────────────────────────── */
.progress-shell {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}

.progress-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transition: width 0.35s ease;
}

/* ── Output box ───────────────────────────────────────────────────────────── */
.output-box {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #0a1020, #06090f);
  min-height: 520px;
  display: grid;
  place-items: center;
  position: relative;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.3);
  font-size: 14px;
  padding: 48px;
  text-align: center;
}
.placeholder[hidden] { display: none; }

/* ── Loader ───────────────────────────────────────────────────────────────── */
.loader-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6,9,15,0.65);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
}
.loader-overlay.hidden { display: none; }

.loader-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.10);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

.loader-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* ── Compare ──────────────────────────────────────────────────────────────── */
.compare-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 520px;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}
.compare-wrap.hidden { display: none; }

.compare-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #06090f;
}
.after-img  { z-index: 1; }
.before-clip {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  overflow: hidden;
  z-index: 2;
}
.before-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; }

.compare-divider {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255,255,255,0.85);
  transform: translateX(-1px);
  z-index: 3;
  pointer-events: none;
}
.compare-divider::after {
  content: "↔";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #06101a;
  background: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.compare-slider {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 5;
}

.compare-label {
  position: absolute;
  top: 12px;
  z-index: 4;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.12);
  pointer-events: none;
}
.before-label { left: 12px; }
.after-label  { right: 12px; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 300px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(14,22,42,0.96);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.22s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; transform: scale(0.99); } to { opacity: 1; transform: scale(1); } }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .choices { grid-template-columns: 1fr 1fr; }
  .output-box, .compare-wrap { min-height: 380px; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .toolbar { justify-content: flex-end; }
}

@media (max-width: 480px) {
  .choices { grid-template-columns: 1fr; }
}
