@font-face { font-family: Anton; src: url(../fonts/anton-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow'; font-weight: 500; src: url(../fonts/barlow-latin-500-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Alfa Slab One'; src: url(../fonts/alfa-slab-one-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; src: url(../fonts/barlow-condensed-latin-500-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); font-display: swap; }

:root {
  --bg: #0e0d14; --panel: #191822; --line: #2c2a3a; --text: #f3f2f8; --muted: #9a98ad;
  --pink: #ff3d7f; --gold: #ffd23f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 500 18px/1.35 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.brand { display: flex; align-items: center; gap: 4px; font: 26px Anton, Impact, sans-serif; letter-spacing: .5px; text-transform: uppercase; }
.brand .plus { color: var(--pink); }
.brand svg { width: 22px; height: 22px; fill: var(--pink); margin-right: 6px; }
.langs { display: flex; gap: 4px; }
.langs button {
  font: inherit; font-weight: 700; text-transform: uppercase; color: var(--muted);
  background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px 9px; min-height: 36px;
}
.langs button[aria-pressed=true] { color: var(--text); border-color: var(--line); background: var(--panel); }

main { max-width: 1040px; margin: 0 auto; }
.stage { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 4px 16px 12px; }
.preview { display: flex; justify-content: center; }
.preview canvas {
  display: block; max-width: 100%; max-height: 46vh; width: auto; height: auto;
  border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.6);
}

.controls { padding: 4px 16px 16px; display: grid; gap: 16px; }
.controls > div[data-show]:not(.field) { display: grid; gap: 16px; }
.tagline { margin: 0; color: var(--muted); }
.field { display: grid; gap: 6px; }
.label { font-weight: 700; font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
input:not([type]), select, textarea {
  font: inherit; font-size: 18px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; min-height: 48px;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-within {
  outline: 2px solid var(--pink); outline-offset: 2px;
}
small { color: var(--muted); font-size: 15px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button {
  font: inherit; font-weight: 700; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; min-height: 48px; padding: 8px 6px;
}
.seg button[aria-pressed=true] { background: var(--pink); border-color: var(--pink); color: #14030a; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.tvrow { align-items: center; justify-content: space-between; }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 16px; }
#scene + #time { margin-top: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 19px; letter-spacing: .5px; text-transform: uppercase;
  min-height: 52px; padding: 10px 20px; border-radius: 12px; border: 1px solid var(--line);
  color: var(--text); background: var(--panel);
}
.btn.primary { background: var(--pink); border-color: var(--pink); color: #14030a; }
.btn:disabled { opacity: .5; }

.switch { display: flex; align-items: center; gap: 12px; font-weight: 700; min-height: 48px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 52px; height: 30px; border-radius: 15px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--pink); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 2px solid var(--pink); outline-offset: 2px; }

.a2hs { margin: 0; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
.a2hs button { font: inherit; font-weight: 700; color: var(--pink); background: none; border: 0; padding: 4px; }
footer { padding-top: 4px; }

.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

[hidden] { display: none !important; }
.roster { display: grid; grid-auto-flow: column; grid-auto-columns: 72px; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.roster button { padding: 0; border: 2px solid transparent; border-radius: 10px; background: none; overflow: hidden; width: 72px; height: 72px; scroll-snap-align: start; position: relative; }
.roster button img { width: 100%; height: 100%; display: block; }
.roster button[aria-selected=true] { border-color: var(--pink); }
.roster button .tag { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; font-weight: 700; background: var(--pink); color: #14030a; text-transform: uppercase; letter-spacing: .5px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); padding: 0; }
.swatches button[aria-pressed=true] { border-color: var(--text); box-shadow: 0 0 0 2px var(--pink); }
.label.sub { font-size: 12px; margin-top: 4px; }

@media (min-width: 860px) {
  body { padding-bottom: 24px; }
  main { display: grid; grid-template-columns: 1fr 400px; gap: 24px; align-items: start; padding: 0 16px; }
  .stage { top: 16px; padding: 0; }
  .preview canvas { max-height: calc(100vh - 110px); }
  .controls { padding: 0 0 100px; }
  .actions { left: auto; right: max(16px, calc((100vw - 1040px) / 2 + 16px)); width: 400px; bottom: 12px; padding: 12px 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
