:root {
  --bg: #08111f;
  --bg-soft: #0f1d31;
  --surface: rgba(12, 23, 38, 0.82);
  --surface-strong: rgba(15, 27, 44, 0.94);
  --surface-light: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --muted: #afbdd1;
  --accent: #ff9f43;
  --accent-2: #7dd3fc;
  --success: #34d399;
  --danger: #fb7185;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 32px 80px rgba(2, 8, 23, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Aptos", "Bahnschrift", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(125, 211, 252, 0.22), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(255, 159, 67, 0.18), transparent 24%),
    linear-gradient(160deg, #07101e 0%, #0f172a 52%, #101a30 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 92%);
}

.page-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0 60px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 360px);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.hero-card,
.panel,
.feature-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  padding: 34px;
  border-radius: var(--radius-xl);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero-text {
  max-width: 60ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-badges span {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.92rem;
}

.hero-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: var(--radius-xl);
}

.metric {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.metric strong {
  display: block;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.metric-highlight {
  border: 1px solid rgba(255, 184, 107, 0.2);
  background:
    radial-gradient(circle at top right, rgba(255, 184, 107, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.04);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr) minmax(0, 320px);
  gap: 20px;
}

.panel {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 290px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  border: 1.5px dashed rgba(125, 211, 252, 0.42);
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(125, 211, 252, 0.16), transparent 44%),
    rgba(7, 13, 24, 0.42);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  transform: translateY(-2px);
  border-color: rgba(255, 159, 67, 0.78);
  background:
    radial-gradient(circle at top, rgba(255, 159, 67, 0.18), transparent 44%),
    rgba(7, 13, 24, 0.62);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 159, 67, 0.22), rgba(125, 211, 252, 0.22));
  font-size: 2rem;
  font-weight: 700;
}

.dropzone-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.dropzone-subtitle,
.feature-card p,
.status-pill,
.field span,
.range-field span,
.meta-card span {
  color: var(--muted);
}

.upload-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.meta-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.meta-card strong {
  display: block;
  margin-top: 6px;
  font-size: 0.95rem;
  word-break: break-all;
}

.primary-actions,
.export-actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.secondary-button,
.ghost-button,
.segment,
.swatch {
  border: 0;
  outline: none;
  font: inherit;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 48px;
  border-radius: 16px;
  cursor: pointer;
}

.primary-button {
  color: #1f2937;
  font-weight: 800;
  background: linear-gradient(135deg, #ffb86b, #ffd86b);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.segment:hover,
.swatch:hover {
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--text);
  font-weight: 700;
  background: rgba(125, 211, 252, 0.15);
  border: 1px solid rgba(125, 211, 252, 0.28);
}

.ghost-button,
.segment {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.wide {
  width: 100%;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.inline-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.inline-check:has(input:disabled) {
  opacity: 0.72;
  cursor: not-allowed;
}

.status-pill-inline {
  margin-top: 10px;
}

.status-pill {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  line-height: 1.6;
}

.status-pill[data-tone="success"] {
  color: #d1fae5;
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.12);
}

.status-pill[data-tone="error"] {
  color: #ffe4e6;
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.12);
}

.status-pill[data-tone="working"] {
  color: #e0f2fe;
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(125, 211, 252, 0.12);
}

.preview-stage {
  position: relative;
  min-height: 640px;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%) 0 12px / 24px 24px,
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.05) 75%) 12px -12px / 24px 24px,
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.05) 75%) -12px 0 / 24px 24px,
    #0c1424;
}

.preview-view {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.preview-view.is-hidden,
.empty-state.is-hidden {
  display: none;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 10, 20, 0.72);
  backdrop-filter: blur(10px);
  pointer-events: all;
}

.loading-overlay.is-hidden {
  display: none;
}

.loading-card {
  width: min(100%, 420px);
  padding: 26px 24px;
  border-radius: 24px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  background:
    radial-gradient(circle at top, rgba(125, 211, 252, 0.14), transparent 54%),
    rgba(9, 16, 30, 0.94);
  box-shadow: 0 24px 60px rgba(2, 8, 23, 0.42);
  text-align: center;
}

.loading-card strong {
  display: block;
  margin-top: 14px;
  font-size: 1.08rem;
  color: var(--text);
}

.loading-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.loading-spinner {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 999px;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
}

.compare-shell {
  width: 100%;
  height: 100%;
}

#previewCanvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

#previewCanvas,
#idPhotoCanvas,
.compare-shell {
  position: relative;
  z-index: 1;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 24px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 10px;
  font-size: 1.4rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  gap: 8px;
}

.segment {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  cursor: pointer;
}

.segment.is-active {
  color: #1f2937;
  font-weight: 800;
  background: linear-gradient(135deg, #ffb86b, #ffd86b);
}

.compare-shell {
  position: relative;
  overflow: hidden;
}

.compare-shell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.compare-overlay {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  overflow: hidden;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 12px rgba(255, 255, 255, 0.08);
  transform: translateX(-1px);
}

.compare-range {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(6, 12, 22, 0.72);
  backdrop-filter: blur(12px);
}

.id-photo-shell {
  display: grid;
  gap: 14px;
  justify-items: center;
  width: 100%;
  padding: 28px;
}

#idPhotoCanvas {
  display: block;
  width: min(100%, 360px);
  height: auto;
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(8, 15, 30, 0.36);
  background: #ffffff;
}

.id-photo-meta {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
}

.id-photo-meta strong {
  font-size: 1rem;
}

.id-photo-meta span {
  color: var(--muted);
  font-size: 0.92rem;
}

.controls-panel {
  display: flex;
  flex-direction: column;
}

.control-group {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.studio-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 18px;
  color: var(--accent-2);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.studio-divider::before,
.studio-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.3), transparent);
}

.grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field,
.range-field {
  display: grid;
  gap: 8px;
}

.field span,
.range-field span {
  font-size: 0.92rem;
}

.field select,
.field input[type="file"],
.field input[type="color"],
.field input[type="number"] {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.field select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #dbeafe 50%) calc(100% - 18px) calc(50% - 3px) / 8px 8px no-repeat,
    linear-gradient(135deg, #dbeafe 50%, transparent 50%) calc(100% - 12px) calc(50% - 3px) / 8px 8px no-repeat,
    rgba(255, 255, 255, 0.06);
  padding-right: 34px;
}

.field select option {
  color: #0f172a;
  background: #f8fafc;
}

.field input[type="color"] {
  padding: 6px;
}

.id-photo-note strong {
  font-size: 1rem;
}

.range-field output {
  color: var(--text);
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(125, 211, 252, 0.9), rgba(255, 216, 107, 0.88)),
    rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 6px 16px rgba(7, 14, 26, 0.28);
  cursor: pointer;
  touch-action: pan-x;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 18px;
  border-radius: 999px;
  background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -5px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  background: linear-gradient(180deg, #fff7d6, #ffd86b);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.28),
    0 0 0 3px rgba(255, 216, 107, 0.18);
}

input[type="range"]::-moz-range-track {
  height: 18px;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(125, 211, 252, 0.9), rgba(255, 216, 107, 0.88)),
    rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 6px 16px rgba(7, 14, 26, 0.28);
}

input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7d6, #ffd86b);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.28),
    0 0 0 3px rgba(255, 216, 107, 0.18);
}

input[type="range"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preset-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.swatch {
  min-height: 42px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--swatch);
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.feature-card {
  padding: 22px;
  border-radius: 22px;
}

.feature-card h3 {
  margin: 0 0 10px;
}

.feature-card p {
  margin: 0;
  line-height: 1.7;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .hero,
  .workspace,
  .feature-strip {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 1240px);
    padding: 18px 0 28px;
  }

  .hero-copy,
  .hero-card,
  .panel,
  .feature-card {
    padding: 18px;
    border-radius: 22px;
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .upload-meta,
  .grid-two {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    min-height: 380px;
  }

  .dropzone {
    min-height: 220px;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1;
  }
}
