:root {
  --bg: #050608;
  --panel: #0b0d12;
  --panel-2: #10131a;
  --line: #1c212b;
  --text: #e6edf3;
  --muted: #7d8590;
  --pink: #f472b6;
  --violet: #c678dd;
  --blue: #61afef;
  --green: #98c379;
  --gold: #e5c07b;
  --danger: #ff5370;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: "CascadiaCodeLocal", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(70% 40% at 50% -10%, rgba(244, 114, 182, 0.10), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body { padding: 18px 14px calc(30px + env(safe-area-inset-bottom)); }

.top { max-width: 620px; margin: 0 auto 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 {
  font-size: 19px;
  letter-spacing: 0.14em;
  margin: 0;
  font-weight: 800;
}
.brand h1 span { color: var(--muted); font-weight: 500; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 12px 2px rgba(244, 114, 182, 0.55);
}
.tagline { color: var(--muted); font-size: 13px; margin: 8px 0 0; line-height: 1.45; }

main { max-width: 620px; margin: 0 auto; display: grid; gap: 12px; }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.step { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step b {
  width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: #0b0d12; background: var(--pink);
}
.step span {
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}

.drop {
  width: 100%; border: 1px dashed #2a3140; background: rgba(255, 255, 255, 0.02);
  border-radius: 12px; padding: 18px 12px; color: var(--text);
  display: grid; gap: 4px; cursor: pointer; text-align: center;
  font: inherit; transition: border-color 0.15s, background 0.15s;
}
.drop strong { font-size: 14px; }
.drop span { color: var(--muted); font-size: 12px; }
.drop.over { border-color: var(--pink); background: rgba(244, 114, 182, 0.07); }

.wave {
  width: 100%; height: 45px; display: block; margin-top: 12px;
  border-radius: 8px; background: #07090d;
}

.row { display: flex; gap: 10px; }
.row .field { flex: 1; }

.field { display: grid; gap: 6px; margin-top: 10px; }
.field span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  background: #06080c; color: var(--text);
  border: 1px solid var(--line); font: inherit; font-size: 14px;
}
textarea { margin-top: 10px; resize: vertical; line-height: 1.5; font-family: var(--mono); font-size: 13px; }
.code-editor { min-height: 172px; color: var(--green); background: #05070a; }
.field .code-editor { margin-top: 0; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

button { font: inherit; cursor: pointer; }
.primary {
  width: 100%; margin-top: 12px; padding: 13px;
  border: 0; border-radius: 12px; font-weight: 700; font-size: 15px;
  color: #170a12; background: linear-gradient(180deg, #ff9ecb, var(--pink));
  box-shadow: 0 8px 24px -12px rgba(244, 114, 182, 0.8);
}
.primary:disabled { opacity: 0.38; box-shadow: none; cursor: not-allowed; }
.ghost {
  background: #0a0d13; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; font-size: 13px; white-space: nowrap;
}
.ghost:disabled { opacity: 0.4; }
.ghost.wide { width: 100%; margin-top: 10px; padding: 11px; }

.stage-wrap {
  position: relative; margin-top: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #000;
  overflow: hidden; aspect-ratio: 9 / 16;
  display: grid; place-items: center;
}
.stage-wrap canvas { width: 100%; height: 100%; display: block; }
.stage-empty { position: absolute; color: #3a4150; font-size: 12px; letter-spacing: 0.06em; pointer-events: none; }
.stage-wrap.has-video .stage-empty { display: none; }

.transport { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.scrub { flex: 1; accent-color: var(--pink); }
.time { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.progress { margin-top: 12px; }
.bar { height: 7px; border-radius: 99px; background: #14181f; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--violet), var(--pink)); transition: width 0.2s linear; }
.progress p { margin: 7px 0 0; font-size: 12px; }

.result { display: grid; gap: 8px; margin-top: 12px; }
.result-video { width: 100%; border-radius: 12px; background: #000; border: 1px solid var(--line); }
.muted { color: var(--muted); font-size: 12px; margin: 6px 0 0; line-height: 1.5; }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin: 10px 0 0; }
.hidden { display: none !important; }

.log-card .log {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  max-height: 148px; overflow: auto; color: var(--muted);
  background: #06080c; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
.log-line.ok { color: var(--green); }
.log-line.err { color: var(--danger); }
.log-line.muted { color: #5a6270; }

.foot { max-width: 620px; margin: 16px auto 0; color: #4d5462; font-size: 11px; line-height: 1.6; }

@media (min-width: 720px) {
  body { padding-top: 28px; }
  .brand h1 { font-size: 22px; }
}

.sync-status {
  margin: 8px 0 0; padding: 7px 10px; border-radius: 8px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  background: #06080c; border: 1px solid var(--line);
}
.sync-status.ok { color: var(--green); border-color: rgba(152, 195, 121, 0.35); }
.sync-status.warn { color: var(--gold); border-color: rgba(229, 192, 123, 0.35); }

.check-row {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 12.5px; color: var(--text); cursor: pointer;
}
.check-row input { width: 16px; height: 16px; accent-color: var(--pink); }
.check-row span { color: var(--muted); }

.calib { width: 100%; accent-color: var(--pink); }
.field span b { color: var(--text); font-weight: 600; }
