:root {
  color-scheme: dark;
  --bg: #070b16;
  --surface: rgba(17, 24, 43, 0.84);
  --surface-solid: #11182b;
  --surface-raised: #151e34;
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.32);
  --text: #f8fafc;
  --muted: #9aa8be;
  --subtle: #738199;
  --primary: #8b5cf6;
  --primary-bright: #a78bfa;
  --primary-dark: #6d3be7;
  --cyan: #22d3ee;
  --success: #34d399;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --focus: 0 0 0 4px rgba(139, 92, 246, 0.25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -5%, rgba(124, 58, 237, 0.28), transparent 34rem),
    radial-gradient(circle at 92% 20%, rgba(34, 211, 238, 0.12), transparent 26rem),
    var(--bg);
}

button, input, select { font: inherit; }
button { color: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--primary-bright), var(--primary-dark));
  box-shadow: 0 10px 26px rgba(109, 59, 231, 0.33);
}

.brand-mark svg { width: 25px; height: 25px; }
.brand-mark rect { fill: none; stroke: white; stroke-width: 2; }
.brand-mark path { fill: white; }

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: 999px;
  color: #b9f6dc;
  background: rgba(52, 211, 153, 0.07);
  font-size: 0.82rem;
  font-weight: 650;
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.8);
}

main { padding: 76px 0 42px; }

.hero { max-width: 840px; }

.eyebrow {
  margin: 0 0 14px;
  color: var(--primary-bright);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.hero h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(2.55rem, 6vw, 5.15rem);
  line-height: 0.98;
  letter-spacing: -0.058em;
  text-wrap: balance;
}

.hero-copy {
  max-width: 690px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1.02rem, 2vw, 1.2rem);
  line-height: 1.7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
  margin-top: 52px;
}

.workspace-main,
.info-card,
.result-panel,
.how-it-works {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(21, 30, 52, 0.88), rgba(10, 15, 29, 0.9));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace-main {
  min-height: 390px;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.drop-zone {
  min-height: 354px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
  text-align: center;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.10), transparent 18rem),
    rgba(4, 8, 19, 0.42);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--primary-bright);
  background:
    radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.18), transparent 18rem),
    rgba(4, 8, 19, 0.52);
}

.drop-zone.is-dragging { transform: scale(1.006); }

.upload-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 19px;
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
}

.upload-icon svg { width: 34px; height: 34px; }
.upload-icon path { fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }

.drop-zone h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.025em; }
.drop-zone p { margin: 8px 0 0; color: var(--muted); }
.drop-zone .drop-help { margin-top: 22px; max-width: 430px; color: var(--subtle); font-size: 0.82rem; line-height: 1.5; }
.text-link { color: #c4b5fd; font-weight: 700; }

.file-panel { padding: 4px; }
.video-wrap { overflow: hidden; border-radius: var(--radius-md); background: #02040a; aspect-ratio: 16 / 9; }
.video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; }

.file-details {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 6px 18px;
  border-bottom: 1px solid var(--border);
}

.field-label {
  display: block;
  margin: 0 0 8px;
  color: var(--subtle);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.file-name { max-width: 610px; margin: 0; font-weight: 720; overflow-wrap: anywhere; }
.file-meta { margin: 7px 0 0; color: var(--muted); font-size: 0.86rem; }

.settings-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.85fr;
  gap: 16px;
  padding: 22px 6px 10px;
}

.field select,
.field input[type="number"] {
  width: 100%;
  height: 45px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(5, 9, 20, 0.72);
}

.field select { padding: 0 38px 0 13px; }
.field input[type="number"] { padding: 0 50px 0 13px; }

.range-row { min-height: 45px; display: flex; align-items: center; gap: 12px; }
.range-row input { flex: 1; accent-color: var(--primary-bright); }
.range-row output { min-width: 38px; color: var(--muted); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.range-row input:disabled { opacity: 0.4; }

.input-with-unit { position: relative; display: block; }
.input-with-unit > span {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--subtle);
  font-size: 0.82rem;
  pointer-events: none;
}

.settings-note { margin: 4px 6px 0; color: var(--subtle); font-size: 0.8rem; line-height: 1.5; }

.actions { display: flex; gap: 11px; padding: 22px 6px 4px; }

.button {
  min-height: 45px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 760;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.48; }
.button-primary { background: linear-gradient(135deg, var(--primary-bright), var(--primary-dark)); box-shadow: 0 11px 25px rgba(109, 59, 231, 0.25); }
.button-primary:hover:not(:disabled) { background: linear-gradient(135deg, #b8a0ff, #7847ed); }
.button-ghost { border-color: var(--border-strong); background: rgba(148, 163, 184, 0.06); }
.button-ghost:hover:not(:disabled) { border-color: rgba(167, 139, 250, 0.5); background: rgba(139, 92, 246, 0.1); }
.button-small { min-height: 37px; padding: 0 13px; font-size: 0.82rem; }

.spinner { display: none; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.38); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
.button.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.status {
  margin: 14px 4px 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--muted);
  background: rgba(5, 9, 20, 0.66);
  font-size: 0.88rem;
}
.status.is-error { color: #fecdd3; border-color: rgba(251, 113, 133, 0.34); background: rgba(159, 18, 57, 0.12); }
.status.is-success { color: #bbf7d0; border-color: rgba(52, 211, 153, 0.3); background: rgba(6, 95, 70, 0.11); }

.info-card { padding: 28px; border-radius: var(--radius-lg); }
.info-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: #99f6e4; background: rgba(45, 212, 191, 0.1); }
.info-icon svg { width: 25px; height: 25px; }
.info-icon path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.info-card h2 { margin: 20px 0 10px; font-size: 1.15rem; }
.info-card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.65; }
.info-card ul { display: grid; gap: 10px; margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid var(--border); list-style: none; }
.info-card li { position: relative; padding-left: 19px; color: #c8d1df; font-size: 0.86rem; }
.info-card li::before { content: ""; position: absolute; left: 2px; top: 0.45em; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

.result-panel { margin-top: 24px; padding: 28px; border-radius: var(--radius-lg); }
.result-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.result-header h2 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.1rem); letter-spacing: -0.035em; }
.success-eyebrow { color: var(--success); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr) 245px; gap: 22px; }
.frame-stage { min-height: 280px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: #02040a; }
.frame-stage img { display: block; max-width: 100%; max-height: 650px; object-fit: contain; }
.result-meta { margin: 0; display: grid; align-content: start; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.result-meta div { padding: 16px; border-bottom: 1px solid var(--border); }
.result-meta div:last-child { border-bottom: 0; }
.result-meta dt { color: var(--subtle); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.result-meta dd { margin: 6px 0 0; color: #dce4ef; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.how-it-works { display: grid; grid-template-columns: 0.8fr 1.5fr; gap: 48px; margin-top: 24px; padding: 38px; border-radius: var(--radius-lg); }
.how-it-works h2 { margin: 0; max-width: 360px; font-size: clamp(1.5rem, 4vw, 2.25rem); letter-spacing: -0.04em; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 12px; }
.steps li > span { flex: 0 0 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(167, 139, 250, 0.3); border-radius: 9px; color: #c4b5fd; background: rgba(139, 92, 246, 0.1); font-size: 0.78rem; font-weight: 800; }
.steps strong { font-size: 0.91rem; }
.steps p { margin: 6px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.site-footer { display: flex; justify-content: space-between; gap: 24px; padding: 32px 0 40px; border-top: 1px solid var(--border); color: var(--subtle); font-size: 0.78rem; }
.site-footer p { margin: 0; }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 900px) {
  main { padding-top: 56px; }
  .workspace { grid-template-columns: 1fr; }
  .info-card { display: grid; grid-template-columns: auto 1fr; column-gap: 18px; }
  .info-card h2 { margin-top: 2px; }
  .info-card p, .info-card ul { grid-column: 2; }
  .result-grid { grid-template-columns: 1fr; }
  .result-meta { grid-template-columns: repeat(2, 1fr); }
  .result-meta div:nth-child(odd) { border-right: 1px solid var(--border); }
  .result-meta div:nth-last-child(-n+2) { border-bottom: 0; }
  .how-it-works { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 680px) {
  .page-shell { width: min(100% - 24px, 1180px); }
  .site-header { min-height: 72px; }
  .privacy-badge { font-size: 0; padding: 10px; }
  .privacy-badge .privacy-dot { width: 9px; height: 9px; }
  main { padding-top: 42px; }
  .hero h1 { font-size: clamp(2.4rem, 13vw, 4rem); }
  .workspace { margin-top: 36px; }
  .workspace-main { padding: 10px; border-radius: 19px; }
  .drop-zone { min-height: 310px; padding: 28px 18px; }
  .file-details { align-items: center; padding-inline: 4px; }
  .settings-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .button { width: 100%; }
  .result-panel { padding: 19px; }
  .result-header { align-items: flex-start; flex-direction: column; }
  .result-actions { width: 100%; }
  .result-meta { grid-template-columns: 1fr; }
  .result-meta div { border-right: 0 !important; border-bottom: 1px solid var(--border) !important; }
  .result-meta div:last-child { border-bottom: 0 !important; }
  .how-it-works { padding: 28px 22px; }
  .steps { grid-template-columns: 1fr; gap: 20px; }
  .site-footer { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
