@font-face {
  font-family: "Archivo Black";
  src: url("/fonts/ArchivoBlack-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0e1016;
  --bg2: #171a23;
  --bg3: #232734;
  --paper: #f2ede3;
  --dim: #a8a296;
  --muted: #6f6a60;
  --red: #e5482f;
  --blue: #3d6bff;
  --gold: #e9b949;
  --pink: #c96a8a;
  --purple: #8a6bbe;
  --line: rgba(242, 237, 227, 0.14);
  --line-strong: rgba(242, 237, 227, 0.32);
  --display: "Archivo Black", Impact, "Arial Black", sans-serif;
  --body: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
html { background: var(--bg); }
body {
  font-family: var(--body);
  color: var(--paper);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(242, 237, 227, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 237, 227, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Join ---------- */
.screen { height: 100dvh; width: 100%; }
.join-screen {
  display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  gap: 26px; padding: calc(28px + var(--safe-top)) 22px calc(24px + var(--safe-bottom));
  max-width: 620px; margin: 0 auto; overflow-y: auto;
}
.join-brand { position: relative; padding-top: 8px; }
.brand-mark {
  font-family: var(--display); font-size: clamp(64px, 19vw, 110px); line-height: 0.8;
  letter-spacing: -0.06em; color: var(--paper); text-transform: uppercase;
}
.brand-mark::after {
  content: ""; display: block; width: 46%; height: 12px; margin-top: 14px;
  background: var(--red); transform: skewX(-24deg);
}
.brand-claim {
  margin: 16px 0 0; color: var(--dim); font-size: 13px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.join-form {
  border: 1px solid var(--line-strong); background: var(--bg2);
  padding: 22px 20px 20px; border-radius: 10px;
}
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim);
  font-weight: 700;
}
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg); border: 1px solid var(--line-strong);
  padding: 13px 12px; font-size: 22px; font-weight: 600; color: var(--paper);
  outline: none; border-radius: 6px;
}
.field input::placeholder { color: var(--muted); font-weight: 400; }
.field input:focus { border-color: var(--red); }
#room-code { font-family: var(--display); font-size: 42px; letter-spacing: 0.16em; line-height: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 14px 18px; font-family: var(--display);
  font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line-strong); color: var(--paper); background: transparent;
  border-radius: 7px; transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:active { background: #c93a24; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--dim); }
.btn-join { width: 100%; margin-top: 4px; }
.btn[disabled] { opacity: 0.35; pointer-events: none; }
.error { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 13px; font-weight: 600; }
.join-foot { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; letter-spacing: 0.03em; }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; max-width: 820px; margin: 0 auto; width: 100%; }
.app-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: var(--bg2);
  flex: 0 0 auto;
}
.room-badge {
  font-family: var(--display); font-size: 17px; letter-spacing: 0.12em;
  background: var(--red); color: #fff; padding: 6px 9px; border-radius: 5px;
}
.player-chip {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  font-size: 12px; font-weight: 600; color: var(--paper);
  border: 1px solid var(--line); padding: 6px 9px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dot { width: 9px; height: 9px; background: var(--paper); flex: 0 0 auto; border-radius: 50%; }
.connection { display: flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.connection.reconnecting .conn-dot { background: var(--gold); animation: blink 0.9s infinite; }
.connection.offline .conn-dot { background: var(--red); }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; margin-left: auto;
  border: 1px solid var(--line); border-radius: 6px; color: var(--dim);
}
.icon-btn:active { border-color: var(--red); color: var(--paper); }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.timer-wrap { display: flex; align-items: center; gap: 10px; padding: 10px 14px 0; flex: 0 0 auto; }
.timer-track { flex: 1; height: 4px; background: var(--bg3); overflow: hidden; }
.timer-bar { height: 100%; width: 100%; background: var(--red); transform-origin: left; }
.timer-text { font-family: var(--display); font-size: 13px; color: var(--paper); min-width: 42px; text-align: right; }
.main { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px 16px 26px; }

/* ---------- Lobby / players ---------- */
.players-strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px 0; flex: 0 0 auto; }
.players-strip::-webkit-scrollbar { display: none; }
.pchip {
  display: flex; align-items: center; gap: 5px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px;
  font-size: 10px; color: var(--dim); background: var(--bg2);
}
.pchip .pdot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; }
.pchip.you { border-color: var(--red); color: var(--paper); }
.pchip.off { opacity: 0.4; }
.pchip .pscore { font-family: var(--display); font-size: 11px; color: var(--gold); }
.host-bar {
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg2);
  margin: 0 14px 10px; padding: 11px;
}
.host-msg { font-size: 12px; line-height: 1.4; color: var(--dim); margin: 0 0 8px; }
.host-msg.bad { color: var(--red); }
.host-actions { display: flex; gap: 8px; }
.host-actions .btn { flex: 1; min-height: 48px; font-size: 12px; padding: 10px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 40;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--paper); color: var(--bg); border-radius: 6px;
  padding: 10px 14px; font-size: 13px; font-weight: 700; max-width: 88vw;
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Type ---------- */
.kicker { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--red); margin: 0 0 8px; font-weight: 700; }
.big-title {
  font-family: var(--display); font-size: clamp(30px, 8vw, 44px); line-height: 0.98;
  text-transform: uppercase; margin: 0 0 10px; color: var(--paper); letter-spacing: -0.02em;
}
.sub { font-size: 14px; line-height: 1.5; color: var(--dim); margin: 0 0 18px; }
.tiny { font-size: 11px; color: var(--muted); line-height: 1.5; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- Lobby / tutorial ---------- */
.lobby-hero { padding: 4px 0 18px; }
.ready-btn {
  width: 100%; min-height: 74px; border: 1px solid var(--red); border-radius: 8px;
  background: var(--red); color: #fff; font-family: var(--display);
  font-size: 24px; letter-spacing: 0.06em; text-transform: uppercase;
}
.ready-btn.is-ready { background: var(--blue); border-color: var(--blue); }
.ready-btn small { display: block; font-family: var(--body); font-size: 10px; letter-spacing: 0.14em; margin-top: 5px; text-transform: uppercase; opacity: 0.75; }
.tut-dots { display: flex; gap: 5px; margin: 0 0 18px; }
.tut-dots span { height: 4px; flex: 1; background: var(--bg3); }
.tut-dots span.on { background: var(--red); }
.tut-card { border-left: 3px solid var(--red); padding: 2px 0 2px 14px; margin: 0 0 20px; }
.tut-card h2 { font-family: var(--display); font-size: 24px; line-height: 1.02; margin: 0 0 9px; text-transform: uppercase; }
.tut-card p { font-size: 15px; line-height: 1.5; margin: 0; color: var(--dim); }
.player-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 14px; }
.player-card {
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg2);
  padding: 8px 10px; display: flex; gap: 8px; align-items: center; min-width: 0;
}
.player-card .pdot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; }
.player-card .pname { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-card .pstate { font-size: 9px; color: var(--muted); margin-left: auto; text-transform: uppercase; letter-spacing: 0.08em; }
.player-card.ready { border-color: var(--blue); }

/* ---------- Inputs ---------- */
.prompt { padding: 2px 0 14px; }
.prompt .big-title { text-shadow: none; }
.control-label { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin: 0 0 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 8px; }
.choice {
  position: relative; overflow: hidden; text-align: left; min-height: 76px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg2);
  padding: 13px 14px 13px 18px; transition: border-color 120ms ease, background 120ms ease;
}
.choice::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--paper)); }
.choice .clabel { font-family: var(--display); font-size: 18px; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.01em; }
.choice .csub { font-size: 11px; color: var(--dim); margin-top: 5px; line-height: 1.3; }
.choice:active { border-color: var(--paper); }
.choice.sent { border-color: var(--blue); background: #1a2340; }
.choice[disabled] { opacity: 0.35; pointer-events: none; }
.choice .face-svg { width: 100%; height: auto; display: block; }
.face-choice { padding: 6px; min-height: 0; }
.face-choice .clabel { position: absolute; top: 4px; left: 8px; font-size: 12px; opacity: 0.75; }
.face-choice::before { display: none; }
.big-tap {
  width: 100%; min-height: 190px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg2); color: var(--paper); font-family: var(--display);
  font-size: 30px; letter-spacing: 0.04em; text-transform: uppercase;
}
.big-tap:active, .big-tap.holding { background: var(--red); border-color: var(--red); color: #fff; }
.big-tap .tap-hint { display: block; font-family: var(--body); font-size: 11px; letter-spacing: 0.12em; margin-top: 10px; opacity: 0.7; text-transform: uppercase; }
.hold-ring { position: absolute; left: 0; bottom: 0; height: 6px; width: 0%; background: var(--gold); }
.slider-box { border: 1px solid var(--line-strong); border-radius: 10px; padding: 20px 16px 18px; background: var(--bg2); }
.slider-value { font-family: var(--display); font-size: 54px; line-height: 0.9; color: var(--paper); margin: 0 0 4px; }
.slider-value small { font-family: var(--body); font-size: 12px; color: var(--dim); margin-left: 6px; }
.slider-ends { display: flex; justify-content: space-between; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; height: 34px; width: 100%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--bg3); border-radius: 999px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px;
  border-radius: 50%; background: var(--red); border: 3px solid var(--paper);
}
input[type="range"]::-moz-range-track { height: 4px; background: var(--bg3); border-radius: 999px; }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; background: var(--red); border: 3px solid var(--paper); border-radius: 50%; }
.control-image { width: 100%; max-height: 190px; object-fit: cover; display: block; border: 1px solid var(--line-strong); border-radius: 8px; margin: 0 0 12px; }
.audio-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.audio-row .btn { flex: 1; min-height: 44px; font-size: 12px; }
.opt-img { width: 100%; height: 92px; object-fit: cover; display: block; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 8px; }
.product-strip { display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 0 8px; }
.product-chip { flex: 0 0 104px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); padding: 4px; }
.product-chip img, .product-art { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: grid; place-items: center; border-radius: 5px; }
.product-art { font-family: var(--display); font-size: 38px; color: var(--bg); }
.product-chip span { display: block; font-size: 9px; line-height: 1.25; color: var(--dim); margin-top: 4px; max-height: 2.5em; overflow: hidden; }

/* ---------- Map / duel ---------- */
.world-map { position: relative; width: 100%; aspect-ratio: 2 / 1; border: 1px solid var(--line-strong); border-radius: 8px; background: #0a1a2a; overflow: hidden; touch-action: none; cursor: crosshair; }
.world-map img { width: 100%; height: 100%; object-fit: fill; display: block; pointer-events: none; user-select: none; opacity: 0.9; }
.world-pin { position: absolute; width: 16px; height: 16px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--red); border: 2px solid var(--paper); pointer-events: none; }
.map-readout { font-size: 12px; color: var(--dim); margin-top: 8px; font-variant-numeric: tabular-nums; }
.duel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.duel-card { min-height: 190px; border: 1px solid var(--line-strong); border-left: 6px solid var(--c, var(--paper)); border-radius: 8px; background: var(--bg2); padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.duel-letter { font-family: var(--display); font-size: 50px; line-height: 0.8; color: var(--c, var(--paper)); }
.duel-title { font-family: var(--display); font-size: 15px; line-height: 1.1; text-transform: uppercase; }
.duel-sub { font-size: 12px; line-height: 1.3; color: var(--dim); }
.duel-card.picked { border-color: var(--blue); background: #1a2340; }
.duel-card[disabled] { opacity: 0.35; }

/* ---------- Canvas / pad / text / sequence / order ---------- */
.canvas-wrap, .pad-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg2); touch-action: none; overflow: hidden; }
.canvas-wrap canvas, .pad-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.pad-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); pointer-events: none; }
.pad-readout { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-top: 8px; }
.text-box textarea { width: 100%; min-height: 110px; background: var(--bg2); border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px; font-size: 16px; color: var(--paper); resize: vertical; outline: none; }
.text-box textarea:focus { border-color: var(--red); }
.text-meta { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin: 6px 0 12px; }
.seq-chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 42px; padding: 8px; border: 1px dashed var(--line-strong); border-radius: 8px; margin-bottom: 10px; }
.seq-chip { font-size: 12px; padding: 5px 8px; background: var(--bg3); border-left: 3px solid var(--paper); }
.seq-chip.empty { border: 0; color: var(--muted); background: transparent; padding: 5px 2px; }
.seq-actions { display: flex; gap: 8px; margin-top: 12px; }
.seq-actions .btn { flex: 1; }
.order-list { display: flex; flex-direction: column; gap: 6px; }
.order-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--bg2); border-radius: 6px; padding: 8px 8px 8px 12px; }
.order-num { font-family: var(--display); font-size: 19px; color: var(--gold); width: 24px; flex: 0 0 auto; }
.order-label { flex: 1; font-size: 14px; line-height: 1.25; }
.order-btns { display: flex; flex-direction: column; gap: 3px; }
.order-btns button { width: 30px; height: 24px; border: 1px solid var(--line-strong); display: grid; place-items: center; border-radius: 4px; }
.order-btns button:active { background: var(--red); border-color: var(--red); }
.tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }
.tri.up { border-bottom: 7px solid var(--paper); }
.tri.down { border-top: 7px solid var(--paper); }
.pipe-grid { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 3px; touch-action: manipulation; }
.pipe-cell { aspect-ratio: 1 / 1; background: var(--bg2); border: 1px solid var(--line); padding: 0; display: grid; place-items: center; }
.pipe-cell:active { border-color: var(--red); }
.pipe-cell svg { width: 100%; height: 100%; display: block; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }
.legend-swatch { width: 10px; height: 10px; }
.map-cell { aspect-ratio: 1 / 1; border: 1px solid rgba(0,0,0,0.35); position: relative; }
.map-cell:active { outline: 2px solid var(--paper); }
.map-cell .terrain-letter { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 13px; color: rgba(242,237,227,0.8); }

/* ---------- Result ---------- */
.result-hero { border-top: 2px solid var(--red); padding-top: 14px; }
.result-points { font-family: var(--display); font-size: 62px; line-height: 0.9; color: var(--paper); margin: 0 0 4px; }
.result-points small { font-size: 13px; color: var(--dim); font-family: var(--body); margin-left: 6px; }
.podium-mini { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.podium-row { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; }
.podium-row .place { font-family: var(--display); color: var(--gold); width: 22px; }
.podium-row .pscore { margin-left: auto; font-family: var(--display); color: var(--paper); }

/* ---------- Show-Cockpit ---------- */
.wizard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.wizard-step { font-family: var(--display); font-size: 10px; letter-spacing: 0.16em; color: var(--red); text-transform: uppercase; }
.wizard-progress { height: 3px; background: var(--bg3); margin: 0 0 18px; }
.wizard-progress div { height: 100%; background: var(--red); }
.wizard-title { font-family: var(--display); font-size: clamp(27px, 8vw, 40px); line-height: 0.96; text-transform: uppercase; margin: 0 0 8px; }
.wizard-sub { font-size: 13px; color: var(--dim); line-height: 1.45; margin: 0 0 16px; }
.wiz-error { border-left: 3px solid var(--red); color: var(--red); padding: 8px 10px; font-size: 12px; line-height: 1.4; margin: 0 0 14px; background: rgba(229,72,47,0.08); }
.wiz-warn { border-left: 3px solid var(--gold); color: var(--gold); padding: 8px 10px; font-size: 12px; line-height: 1.4; margin: 0 0 14px; background: rgba(233,185,73,0.06); }
.number-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.number-pick button { min-height: 46px; border: 1px solid var(--line-strong); border-radius: 6px; font-family: var(--display); font-size: 20px; }
.number-pick button.on { background: var(--red); border-color: var(--red); color: #fff; }
.preset-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.preset-row button { border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.35; }
.preset-row button .b-main { display: block; font-family: var(--display); font-size: 14px; line-height: 1.05; }
.preset-row button .b-sub { display: block; font-size: 9px; letter-spacing: 0.06em; opacity: .75; margin-top: 4px; }
.preset-row button.on { border-color: var(--red); color: var(--red); }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; }
.stepper .slabel { font-size: 13px; }
.stepper .svalue { font-family: var(--display); font-size: 25px; color: var(--paper); min-width: 40px; text-align: center; }
.stepper button { width: 38px; height: 38px; border: 1px solid var(--line-strong); border-radius: 5px; font-family: var(--display); font-size: 18px; }
.stepper button:active { background: var(--red); border-color: var(--red); }
.summary-line { font-family: var(--display); font-size: 17px; color: var(--paper); margin: 4px 0 0; }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row input { flex: 1; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 12px; color: var(--paper); outline: none; }
.search-row input:focus { border-color: var(--red); }
.tag-row { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; scrollbar-width: none; }
.tag-row::-webkit-scrollbar { display: none; }
.tag-chip { flex: 0 0 auto; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--dim); }
.tag-chip.on { border-color: var(--gold); color: var(--gold); }
.game-list { display: flex; flex-direction: column; gap: 7px; }
.game-card { text-align: left; border: 1px solid var(--line); border-radius: 7px; background: var(--bg2); padding: 11px 12px; position: relative; }
.game-card.sel { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red); }
.game-card.off { opacity: 0.38; }
.game-card .gname { font-family: var(--display); font-size: 15px; text-transform: uppercase; line-height: 1.05; margin: 0; }
.game-card .ghead { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; padding-right: 26px; }
.game-card .game-icon { width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto; }
.game-card .ghook { font-size: 12px; line-height: 1.35; color: var(--dim); margin: 0 0 7px; }
.game-card .gmeta { display: flex; flex-wrap: wrap; gap: 5px; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.game-card .gmeta span { border: 1px solid var(--line); padding: 2px 5px; border-radius: 3px; }
.game-card .gnum { position: absolute; top: 8px; right: 8px; font-family: var(--display); font-size: 17px; color: var(--red); }
.game-card .greason { font-size: 10px; color: var(--red); margin-top: 6px; }
.episode-card { background: var(--bg2); }
.selected-list { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.selected-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; background: var(--bg2); }
.selected-row .snum { font-family: var(--display); color: var(--gold); width: 20px; font-size: 13px; }
.selected-row .sname { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-btns { display: flex; gap: 3px; }
.mini-btns button { width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 4px; display: grid; place-items: center; }
.mini-btns button:active { background: var(--red); border-color: var(--red); }
.tune-card { border: 1px solid var(--line); border-radius: 7px; background: var(--bg2); padding: 12px; margin-bottom: 8px; }
.tune-card h3 { font-family: var(--display); font-size: 14px; text-transform: uppercase; margin: 0 0 8px; }
.tune-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 12px; color: var(--dim); }
.tune-row input[type="range"] { width: 120px; height: 28px; margin: 0; }
.tune-row .tval { font-family: var(--display); color: var(--paper); font-size: 15px; min-width: 42px; text-align: right; }
.toggle { width: 46px; height: 25px; border: 1px solid var(--line-strong); border-radius: 999px; position: relative; background: var(--bg); flex: 0 0 auto; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--muted); transition: left 120ms, background 120ms; }
.toggle.on { border-color: var(--blue); }
.toggle.on::after { left: 23px; background: var(--blue); }
.wiz-nav { display: flex; gap: 8px; margin-top: 16px; }
.wiz-nav .btn { flex: 1; }
.wiz-nav .btn-primary { flex: 2; }
.wiz-summary { border: 1px solid var(--line); border-radius: 7px; padding: 12px; margin-bottom: 12px; background: var(--bg2); }
.wiz-summary .sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 12px; border-bottom: 1px solid var(--line); }
.wiz-summary .sum-row:last-child { border-bottom: 0; }
.wiz-summary .sum-row b { color: var(--paper); font-family: var(--display); font-weight: 400; }
.qr-box { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 12px; margin-bottom: 14px; background: var(--bg2); }
.qr-box img { width: 104px; height: 104px; image-rendering: pixelated; background: var(--paper); padding: 4px; border-radius: 4px; }
.qr-meta { min-width: 0; }
.qr-meta .qcode { font-family: var(--display); font-size: 30px; letter-spacing: 0.12em; color: var(--red); line-height: 1; }
.qr-meta .qhint { font-size: 11px; color: var(--dim); line-height: 1.4; margin-top: 6px; word-break: break-all; }

/* ---------- Party board controller ---------- */
.party-hero { padding: 4px 0 14px; }
.party-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.party-stat { border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg2); padding: 9px 10px; display: flex; flex-direction: column; gap: 2px; }
.party-stat .ps-label { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.party-stat strong { font-family: var(--display); font-size: 28px; line-height: 1; color: var(--paper); }
.party-stat.coins strong { color: var(--gold); }
.party-stat.stars strong { color: var(--red); }
.party-stat.field strong { color: var(--blue); }
.party-dice { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg2); display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; margin-bottom: 10px; }
.party-dice .pd-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.party-dice strong { font-family: var(--display); font-size: 54px; line-height: 0.8; color: var(--red); }
.party-roll { width: 100%; min-height: 64px; font-size: 20px; }
.party-wait { border-left: 3px solid var(--blue); background: rgba(61,107,255,0.06); color: var(--dim); font-size: 13px; line-height: 1.4; padding: 10px 12px; margin-bottom: 12px; }
.party-mini { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin: 0 0 14px; }
.party-cell { position: relative; aspect-ratio: 1 / 1; border-radius: 4px; border: 1px solid rgba(37,33,69,0.25); display: grid; place-items: center; overflow: hidden; }
.party-cell .pnum { font-family: var(--display); font-size: 9px; color: rgba(37,33,69,0.55); }
.party-cell.blue { background: var(--blue); }
.party-cell.red { background: var(--red); }
.party-cell.event { background: var(--gold); }
.party-cell.item { background: var(--pink); }
.party-cell.start { background: var(--paper); }
.party-cell.blue .pnum, .party-cell.red .pnum, .party-cell.item .pnum { color: rgba(255,253,246,0.75); }
.party-cell.start .pnum { color: var(--bg); }
.party-cell .pdot { position: absolute; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--bg2); box-shadow: 0 0 0 1px rgba(37,33,69,0.25); }
.party-cell .pdot:nth-of-type(1) { left: 4px; top: 4px; }
.party-cell .pdot:nth-of-type(2) { right: 4px; top: 4px; }
.party-cell .pdot:nth-of-type(3) { left: 4px; bottom: 4px; }
.party-cell .pdot:nth-of-type(4) { right: 4px; bottom: 4px; }
.party-cell .pdot.current { border: 2px solid var(--paper); box-shadow: 0 0 0 2px var(--red); }
.party-players { display: flex; flex-direction: column; gap: 4px; }
.party-player { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: var(--bg2); font-size: 12px; }
.party-player.current { border-color: var(--red); }
.party-player .pdot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.party-player .pname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-player .pcoins { color: var(--gold); font-weight: 700; }
.party-player .pstars { color: var(--red); font-weight: 700; }

@keyframes blink { 50% { opacity: 0.3; } }

@media (min-width: 720px) {
  .main { padding: 24px 26px 30px; }
  .app-header { padding-left: 20px; padding-right: 20px; }
  .join-screen { padding-top: 40px; padding-bottom: 40px; }
}
@media (max-height: 640px) {
  .brand-mark { font-size: 54px; }
  .join-screen { gap: 16px; }
  .big-tap { min-height: 140px; }
}

/* ============================================================
   RADAU PARTY — bright board-game skin + new start screen
   ============================================================ */
:root {
  --bg: #8ed6ff;
  --bg2: #fff8e8;
  --bg3: #f1dfb8;
  --paper: #2b2440;
  --dim: #6b647e;
  --muted: #9a93a8;
  --red: #f25a45;
  --blue: #3f6df2;
  --gold: #e7a51f;
  --pink: #ef7aa6;
  --purple: #7c5cd6;
  --line: rgba(43, 36, 64, 0.14);
  --line-strong: rgba(43, 36, 64, 0.30);
}
html { background: var(--bg); }
body {
  color: var(--paper);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 48px 48px;
}
.field input, .field textarea, .field select { background: var(--bg2); }
.field input::placeholder { color: var(--muted); }
.app-header { background: var(--bg2); border-bottom-color: var(--line-strong); box-shadow: 0 3px 0 rgba(43,36,64,.08); }
.room-badge { background: var(--red); }
.player-chip { background: var(--bg2); color: var(--paper); }
.connection { color: var(--dim); }
.icon-btn { background: var(--bg2); color: var(--paper); }
.timer-track { background: rgba(43,36,64,.12); border: 1px solid var(--line); }
.timer-text { color: var(--paper); }
.pchip { background: var(--bg2); color: var(--paper); }
.host-bar { background: var(--bg2); border-color: var(--line-strong); }
.host-msg { color: var(--dim); }
.toast { background: var(--paper); color: var(--bg2); }
.big-title { color: var(--paper); text-shadow: none; }
.sub { color: var(--dim); }
.tiny { color: var(--muted); }
.kicker { color: var(--red); }
.ready-btn { background: var(--red); border-color: var(--red); color: #fff; }
.ready-btn.is-ready { background: var(--blue); border-color: var(--blue); }
.tut-card { border-color: var(--red); background: var(--bg2); border-radius: 14px; padding: 14px 16px; }
.tut-card h2 { color: var(--paper); }
.tut-card p { color: var(--dim); }
.player-card { background: var(--bg2); border-color: var(--line); }
.player-card.ready { border-color: var(--blue); background: #e6edff; }
.choice { background: var(--bg2); border-color: var(--line-strong); }
.choice .clabel { color: var(--paper); }
.choice .csub { color: var(--dim); }
.choice.sent { background: #e6edff; border-color: var(--blue); }
.slider-box { background: var(--bg2); border-color: var(--line-strong); }
.slider-value { color: var(--paper); }
.slider-value small { color: var(--dim); }
.slider-ends { color: var(--dim); }
.big-tap { background: var(--bg2); color: var(--paper); border-color: var(--line-strong); }
.big-tap:active, .big-tap.holding { background: var(--red); color: #fff; }
.control-image, .opt-img { border-color: var(--line-strong); }
.product-chip { background: var(--bg2); border-color: var(--line); }
.product-chip span { color: var(--dim); }
.world-map { border-color: var(--line-strong); }
.map-readout { color: var(--dim); }
.duel-card { background: var(--bg2); border-color: var(--line-strong); }
.duel-title { color: var(--paper); }
.duel-sub { color: var(--dim); }
.duel-card.picked { background: #e6edff; }
.canvas-wrap, .pad-wrap { background: var(--bg2); border-color: var(--line-strong); }
.text-box textarea { background: var(--bg2); color: var(--paper); border-color: var(--line-strong); }
.seq-chips { background: var(--bg2); border-color: var(--line-strong); }
.seq-chip { background: var(--bg3); color: var(--paper); }
.order-row { background: var(--bg2); border-color: var(--line); }
.wizard-title { color: var(--paper); text-shadow: none; }
.wizard-sub { color: var(--dim); }
.wizard-step { color: var(--red); }
.wizard-progress { background: rgba(43,36,64,.12); }
.number-pick button { background: var(--bg2); color: var(--paper); border-color: var(--line-strong); }
.number-pick button.on { background: var(--red); color: #fff; }
.preset-row button { background: var(--bg2); color: var(--paper); border-color: var(--line-strong); }
.preset-row button.on { border-color: var(--red); color: var(--red); }
.stepper { background: var(--bg2); border-color: var(--line); }
.stepper button { background: var(--bg2); color: var(--paper); }
.stepper .svalue { color: var(--paper); }
.search-row input { background: var(--bg2); color: var(--paper); }
.tag-chip { background: var(--bg2); color: var(--dim); }
.game-card { background: var(--bg2); border-color: var(--line); }
.game-card .gname { color: var(--paper); }
.game-card .ghook { color: var(--dim); }
.game-card .gmeta span { background: var(--bg3); color: var(--paper); }
.game-card.sel { border-color: var(--red); }
.episode-card { background: var(--bg2); }
.selected-row { background: var(--bg2); }
.selected-row .sname { color: var(--paper); }
.tune-card { background: var(--bg2); border-color: var(--line); }
.tune-card h3 { color: var(--paper); }
.tune-row { color: var(--dim); }
.tune-row .tval { color: var(--paper); }
.toggle { background: var(--bg3); border-color: var(--line-strong); }
.wiz-summary { background: var(--bg2); border-color: var(--line); }
.wiz-summary .sum-row { color: var(--dim); border-bottom-color: var(--line); }
.wiz-summary .sum-row b { color: var(--paper); }
.qr-box { background: var(--bg2); border-color: var(--line); }
.qr-meta .qcode { color: var(--red); }
.qr-meta .qhint { color: var(--dim); }
.wiz-error { background: #ffe3dc; border-color: var(--red); color: #a83222; }
.wiz-warn { background: #fff1c9; border-color: var(--gold); color: #6d5000; }

/* ---------- New start screen ---------- */
.start-screen {
  position: relative; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 18px; padding: calc(18px + var(--safe-top)) 18px calc(22px + var(--safe-bottom));
  max-width: none; overflow: hidden; height: 100dvh;
}
.start-sky { position: absolute; inset: 0; background: var(--bg); overflow: hidden; }
.start-sky::after {
  content: ""; position: absolute; left: -12%; right: -12%; bottom: -8%; height: 56%;
  background: url("/media/party/board-candy.png") center bottom / cover no-repeat;
  opacity: 0.58; border-radius: 50% 50% 0 0;
}
.cloud { position: absolute; display: block; width: 110px; height: 34px; background: #fff; border-radius: 999px; opacity: .72; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 54px; height: 54px; left: 16px; top: -24px; }
.cloud::after { width: 38px; height: 38px; right: 14px; top: -16px; }
.cloud.c1 { left: 8%; top: 12%; transform: scale(.9); }
.cloud.c2 { right: 8%; top: 20%; transform: scale(.65); }
.cloud.c3 { left: 22%; top: 34%; transform: scale(.5); opacity: .5; }
.start-logo { position: relative; z-index: 2; text-align: center; margin-top: auto; }
.start-kicker {
  display: inline-block; background: var(--bg2); color: var(--paper);
  border: 2px solid var(--paper); border-radius: 999px; padding: 6px 12px;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700;
  transform: rotate(-1.5deg);
}
.start-word {
  font-family: var(--display); font-size: clamp(64px, 18vw, 112px); line-height: .78;
  letter-spacing: -.07em; color: var(--paper); text-transform: uppercase; margin: 12px 0 0;
}
.start-word span { display: block; color: var(--red); font-size: .72em; letter-spacing: -.04em; }
.start-ribbon {
  display: inline-block; margin-top: 12px; background: var(--red); color: #fff;
  border: 2px solid var(--paper); border-radius: 6px; padding: 6px 10px;
  font-family: var(--display); font-size: 11px; letter-spacing: .08em;
}
.start-tokens { position: relative; z-index: 2; display: flex; gap: 4px; align-items: flex-end; margin: 2px 0 0; }
.start-tokens img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 5px 0 rgba(43,36,64,.16)); }
.start-tokens img:nth-child(1) { transform: rotate(-7deg); }
.start-tokens img:nth-child(2) { transform: translateY(-8px) rotate(2deg); }
.start-tokens img:nth-child(3) { transform: translateY(-3px) rotate(-2deg); }
.start-tokens img:nth-child(4) { transform: rotate(7deg); }
.start-play {
  position: relative; z-index: 3; width: min(100%, 420px); min-height: 78px;
  border: 3px solid var(--paper); border-radius: 16px; background: var(--red); color: #fff;
  font-family: var(--display); font-size: 26px; letter-spacing: .08em; text-transform: uppercase;
  box-shadow: 0 8px 0 rgba(43,36,64,.22);
}
.start-play:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(43,36,64,.22); }
.start-join {
  position: relative; z-index: 4; width: min(100%, 480px); margin: 0;
  border: 3px solid var(--paper); border-radius: 18px; background: var(--bg2);
  padding: 20px 18px 16px; box-shadow: 0 10px 0 rgba(43,36,64,.18);
}
.start-join.hidden { display: none; }
.join-back {
  display: block; margin: 0 0 10px; padding: 0; background: none; border: 0;
  font-family: var(--display); font-size: 11px; letter-spacing: .12em; color: var(--dim);
}
.start-join .btn-join { background: var(--red); border-color: var(--red); color: #fff; }
.start-float { position: absolute; z-index: 1; object-fit: contain; pointer-events: none; filter: drop-shadow(0 8px 0 rgba(43,36,64,.12)); }
.start-build { position: absolute; right: 14px; bottom: calc(8px + var(--safe-bottom)); z-index: 5; font-family: var(--display); font-size: 8px; letter-spacing: .14em; color: rgba(43,36,64,.45); }
.sf-star { width: 86px; right: 8%; top: 16%; animation: float-a 4s ease-in-out infinite; }
.sf-dice { width: 74px; left: 8%; top: 27%; animation: float-b 5s ease-in-out infinite; }
.sf-coin { width: 58px; right: 18%; top: 38%; animation: float-a 4.6s ease-in-out infinite reverse; }
.sf-confetti { width: 92px; left: 14%; bottom: 22%; animation: float-b 5.4s ease-in-out infinite; opacity: .9; }
@keyframes float-a { 0%,100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-12px) rotate(4deg); } }
@keyframes float-b { 0%,100% { transform: translateY(0) rotate(6deg); } 50% { transform: translateY(-9px) rotate(-4deg); } }

/* ---------- Minimal party controller ---------- */
.party-controller { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.party-topline { display: flex; justify-content: space-between; align-items: center; }
.party-topline .round-pill { font-family: var(--display); font-size: 12px; letter-spacing: .1em; color: var(--paper); background: var(--bg2); border: 2px solid var(--paper); border-radius: 999px; padding: 5px 9px; }
.party-self { display: flex; align-items: center; gap: 12px; background: var(--bg2); border: 2px solid var(--paper); border-radius: 18px; padding: 12px; }
.party-self img { width: 84px; height: 84px; object-fit: contain; }
.party-self .pc-name { font-family: var(--display); font-size: 22px; text-transform: uppercase; line-height: 1; }
.party-self .pc-sub { font-size: 11px; color: var(--dim); margin-top: 4px; }
.party-badges { display: flex; gap: 6px; margin-top: 8px; }
.party-badge { display: flex; align-items: center; gap: 4px; background: var(--bg3); border-radius: 999px; padding: 4px 8px; font-family: var(--display); font-size: 13px; }
.party-badge img { width: 18px; height: 18px; object-fit: contain; }
.party-action-card { background: var(--bg2); border: 3px solid var(--paper); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.party-dice-img { width: 128px; height: 128px; object-fit: contain; filter: drop-shadow(0 7px 0 rgba(43,36,64,.16)); }
.party-big-number { font-family: var(--display); font-size: 72px; line-height: .8; color: var(--red); }
.party-action-card .party-roll { width: 100%; min-height: 64px; font-size: 22px; }
.party-star-img { width: 112px; height: 112px; object-fit: contain; filter: drop-shadow(0 7px 0 rgba(43,36,64,.16)); }
.party-wait-card { background: var(--bg2); border: 2px solid var(--paper); border-radius: 18px; padding: 16px; text-align: center; }
.party-wait-card img { width: 86px; height: 86px; object-fit: contain; }
.party-wait-card strong { display: block; font-family: var(--display); font-size: 20px; text-transform: uppercase; margin-top: 4px; }
.party-wait-card span { display: block; color: var(--dim); font-size: 12px; margin-top: 4px; }
body.party-controller-mode .players-strip,
body.party-controller-mode .host-bar { display: none !important; }
body.party-controller-mode .main { padding: 14px 14px 20px; }

@media (min-width: 720px) {
  .start-screen { justify-content: center; }
  .start-tokens img { width: 84px; height: 84px; }
}

/* ---------- Juice pass ---------- */
.start-kicker { animation: kickerIn .45s .05s both; }
.start-word { animation: wordSlam .7s cubic-bezier(.2,.9,.3,1.3) both; }
.start-word span { animation: wordSlam .7s .1s cubic-bezier(.2,.9,.3,1.3) both; }
.start-ribbon { animation: ribbonPop .5s .32s cubic-bezier(.2,.9,.3,1.4) both; }
.start-tokens img { animation: tokenFade .55s both; }
.start-tokens img:nth-child(1) { animation-delay: .28s; }
.start-tokens img:nth-child(2) { animation-delay: .36s; }
.start-tokens img:nth-child(3) { animation-delay: .44s; }
.start-tokens img:nth-child(4) { animation-delay: .52s; }
.start-play { animation: playPulse 2.4s ease-in-out infinite alternate; }
.start-join { animation: joinUp .35s cubic-bezier(.2,.9,.3,1.2) both; }
.btn { transition: transform .12s ease, box-shadow .12s ease, background .15s ease; }
.btn:active { transform: translateY(3px) scale(.985); }
.game-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.game-card:hover { transform: translateY(-2px); }
.game-card.sel { animation: selPop .35s cubic-bezier(.2,.9,.3,1.3); }
.ready-btn:not(.is-ready) { animation: readyNudge 2.6s ease-in-out infinite; }
.ready-btn.is-ready { animation: readyGlow 1.8s ease-in-out infinite alternate; }
.result-points { animation: pointsSlam .6s cubic-bezier(.2,.9,.3,1.35) both; }
.player-card { animation: cardSlide .35s both; }
.player-card:nth-child(2) { animation-delay: .05s; }
.player-card:nth-child(3) { animation-delay: .1s; }
.player-card:nth-child(4) { animation-delay: .15s; }
.party-self img { animation: tokenFade .5s both; }
.party-action-card .party-roll { animation: playPulse 2.2s ease-in-out infinite alternate; }

@keyframes kickerIn {
  from { opacity: 0; transform: translateY(-8px) rotate(-2deg); }
  to { opacity: 1; transform: translateY(0) rotate(-1.5deg); }
}
@keyframes wordSlam {
  0% { opacity: 0; transform: scale(.6) rotate(-5deg); }
  65% { opacity: 1; transform: scale(1.06) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes ribbonPop {
  0% { opacity: 0; transform: scale(.8) rotate(-2deg); }
  70% { opacity: 1; transform: scale(1.04) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes tokenFade {
  from { opacity: 0; filter: blur(5px) drop-shadow(0 5px 0 rgba(43,36,64,.16)); }
  to { opacity: 1; filter: blur(0) drop-shadow(0 5px 0 rgba(43,36,64,.16)); }
}
@keyframes playPulse {
  from { box-shadow: 0 8px 0 rgba(43,36,64,.22), 0 0 0 rgba(242,90,69,0); }
  to { box-shadow: 0 8px 0 rgba(43,36,64,.22), 0 0 26px rgba(242,90,69,.35); }
}
@keyframes joinUp {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes selPop {
  0% { transform: scale(.98); }
  60% { transform: scale(1.015); }
  100% { transform: scale(1); }
}
@keyframes readyNudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes readyGlow {
  from { box-shadow: 0 0 0 rgba(63,109,242,0); }
  to { box-shadow: 0 0 24px rgba(63,109,242,.35); }
}
@keyframes pointsSlam {
  0% { opacity: 0; transform: scale(.55); }
  65% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes cardSlide {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- Fresh controller skin ---------- */
body {
  background: #8ed6ff;
}

.app {
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 248, 232, .75), transparent 42%),
    linear-gradient(180deg, #8ed6ff 0%, #b9e8ff 38%, #f1dfb8 100%);
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: rgba(255, 248, 232, .95);
  border-bottom: 3px solid var(--paper);
  box-shadow: 0 4px 0 rgba(43, 36, 64, .08);
  backdrop-filter: blur(10px);
}

.brand-mini {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--paper);
}
.brand-mini i {
  color: var(--red);
  font-style: normal;
}

.room-badge {
  background: var(--paper);
  color: var(--bg2);
  border: 2px solid var(--paper);
  border-radius: 999px;
  padding: 5px 9px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .06em;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--gold);
  color: var(--paper);
  border: 2px solid var(--paper);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 700;
  max-width: 34vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.connection {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--dim);
  white-space: nowrap;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--bg2);
  color: var(--paper);
  flex: 0 0 auto;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 14px 120px;
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}

.prompt {
  position: relative;
  background: var(--bg2);
  border: 3px solid var(--paper);
  border-radius: 22px;
  padding: 18px 18px 16px;
  box-shadow: 0 7px 0 rgba(43, 36, 64, .16);
  animation: cardSlide .35s both;
}
.prompt::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 8px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--pink));
}

.prompt .kicker {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 700;
}

.big-title {
  font-family: var(--display);
  font-size: clamp(30px, 8vw, 44px);
  line-height: .95;
  margin: 0;
  color: var(--paper);
  letter-spacing: -.02em;
}

.sub {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--dim);
}

.tiny {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--dim);
}

.control-label {
  margin: 8px 0 4px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
}

.btn {
  min-height: 56px;
  border: 3px solid var(--paper);
  border-radius: 16px;
  padding: 10px 14px;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .04em;
  box-shadow: 0 5px 0 rgba(43, 36, 64, .18);
  background: var(--bg2);
  color: var(--paper);
}
.btn-primary {
  background: var(--red);
  border-color: var(--paper);
  color: #fff;
}
.btn-ghost {
  background: var(--bg3);
  border-color: var(--paper);
  color: var(--paper);
}

.preset-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.preset-row button {
  min-height: 58px;
  border: 2px solid var(--paper);
  border-radius: 14px;
  background: var(--bg2);
  color: var(--paper);
  padding: 8px 10px;
  box-shadow: 0 3px 0 rgba(43, 36, 64, .12);
}
.preset-row button.on {
  background: var(--paper);
  color: var(--bg2);
  border-color: var(--paper);
}

.ready-btn {
  width: 100%;
  min-height: 78px;
  border: 3px solid var(--paper);
  border-radius: 18px;
  background: var(--red);
  color: #fff;
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: .04em;
  box-shadow: 0 6px 0 rgba(43, 36, 64, .2);
}
.ready-btn.is-ready {
  background: var(--blue);
}

.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.player-card {
  background: var(--bg2);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 3px 0 rgba(43, 36, 64, .08);
}
.player-card.ready {
  border-color: var(--blue);
  background: #e6edff;
}

.timer-wrap {
  position: sticky;
  top: calc(58px + var(--safe-top));
  z-index: 25;
  padding: 7px 14px 8px;
  background: rgba(255, 248, 232, .95);
  border-bottom: 2px solid var(--line);
  backdrop-filter: blur(8px);
}
.timer-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg3);
  overflow: hidden;
  border: 1px solid var(--line);
}
.timer-bar {
  height: 100%;
  width: 0%;
  background: var(--red);
  border-radius: 999px;
  transition: width .12s linear;
}
.timer-text {
  display: block;
  margin-top: 4px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--red);
}

.players-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 14px calc(8px + var(--safe-bottom));
  background: rgba(255, 248, 232, .85);
  border-top: 2px solid var(--line);
}
.players-strip .pchip {
  flex: 0 0 auto;
  border: 2px solid var(--paper);
  border-radius: 999px;
  background: var(--bg2);
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 700;
}

.host-bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(255, 248, 232, .97);
  border-top: 3px solid var(--paper);
  box-shadow: 0 -4px 0 rgba(43, 36, 64, .08);
}

.wizard-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--dim);
  text-transform: uppercase;
}
.wizard-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bg3);
  overflow: hidden;
  margin: 6px 0 4px;
}
.wizard-progress div {
  height: 100%;
  background: var(--red);
  border-radius: 999px;
}
.wizard-title {
  font-family: var(--display);
  font-size: 26px;
  line-height: 1;
  margin: 4px 0 0;
}
.wizard-sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--dim);
  margin: 6px 0 0;
}
.wiz-nav {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.game-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.game-card {
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--bg2);
  padding: 12px;
  box-shadow: 0 3px 0 rgba(43, 36, 64, .08);
}
.game-card.sel {
  border-color: var(--red);
  box-shadow: inset 5px 0 0 var(--red), 0 3px 0 rgba(43, 36, 64, .08);
}

.result-hero {
  background: var(--bg2);
  border: 3px solid var(--paper);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 7px 0 rgba(43, 36, 64, .16);
}
.result-points {
  font-size: clamp(52px, 14vw, 78px);
  color: var(--paper);
}

@media (max-width: 380px) {
  .main { padding-left: 10px; padding-right: 10px; }
  .player-grid { grid-template-columns: 1fr; }
}

/* Keep gameplay on one screen, no visible scrollbars */
html, body { height: 100%; overflow: hidden; }
.app { height: 100dvh; overflow: hidden; }
.main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding-bottom: 16px;
}
.main::-webkit-scrollbar { display: none; }
#players-strip { display: none; }
.prompt { padding: 14px 15px; }
.big-title { font-size: clamp(26px, 7.4vw, 38px); }
.btn { min-height: 50px; }
.ready-btn { min-height: 68px; }
.timer-wrap { top: calc(54px + var(--safe-top)); padding: 5px 12px 6px; }
.host-bar { padding: 8px 12px calc(8px + var(--safe-bottom)); }

@media (max-height: 740px) {
  .main { gap: 10px; padding-top: 10px; }
  .prompt { padding: 12px 13px; }
  .big-title { font-size: 26px; }
  .sub { font-size: 13px; margin-top: 5px; }
  .btn { min-height: 46px; }
  .ready-btn { min-height: 60px; font-size: 18px; }
  .control-label { margin-top: 5px; }
}


.skip-intro { width: 100%; margin-top: 12px; }

/* ---------- Host program builder ---------- */
.program-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  margin: 0 0 10px;
  border: 2px solid var(--paper);
  border-radius: 999px;
  background: var(--bg3);
}
.program-mode-btn {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: .08em;
  cursor: pointer;
}
.program-mode-btn.on { background: var(--paper); color: var(--bg2); }

.program-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.program-slot {
  position: relative;
  min-height: 96px;
  padding: 8px 6px 7px;
  border: 2px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--paper);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.program-slot.filled {
  border-style: solid;
  border-color: var(--paper);
  box-shadow: 3px 3px 0 rgba(43, 36, 64, .16);
}
.program-slot.empty { color: var(--dim); }
.program-slot:active { transform: translate(2px, 2px); box-shadow: none; }
.slot-num { font-family: var(--display); font-size: 9px; color: var(--red); }
.slot-icon { width: 28px; height: 28px; object-fit: contain; }
.slot-name {
  overflow: hidden;
  font-family: var(--display);
  font-size: 11px;
  line-height: 1.05;
  text-overflow: ellipsis;
  text-transform: uppercase;
}
.slot-tag { overflow: hidden; color: var(--dim); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.slot-empty { margin: auto 0; font-family: var(--display); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }

.program-summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tag-label {
  margin: 0 0 5px;
  color: var(--dim);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: .14em;
}
.catalog-filters {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 0 10px;
  padding: 9px;
  border: 2px solid var(--paper);
  border-radius: 10px;
  background: var(--bg2);
  box-shadow: 3px 3px 0 rgba(43, 36, 64, .12);
}
.category-block {
  margin: 0;
  padding: 8px;
  border: 2px solid var(--paper);
  border-radius: 9px;
  background: var(--bg2);
  box-shadow: 3px 3px 0 rgba(43, 36, 64, .12);
}
.catalog-filters .category-block {
  margin-top: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.catalog-filters .tag-row { margin-bottom: 0; }
.tag-row { margin-bottom: 10px; padding-bottom: 4px; }
.tag-chip {
  min-height: 28px;
  padding: 4px 9px;
  border: 2px solid var(--paper);
  background: var(--bg3);
  color: var(--paper);
  font-weight: 700;
}
.tag-chip.on {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--bg2);
}
.program-catalog { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.program-catalog .game-card { padding: 9px; }
.program-catalog .game-card .gname { font-size: 12px; }
.program-catalog .game-card .ghook { display: none; }
.program-catalog .game-card .gmeta span:nth-child(n+3) { display: none; }

.host-stage-actions { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 12px; }
.host-stage-actions .btn { flex: 1; min-width: 130px; }
.host-tv-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border: 2px solid var(--paper);
  border-radius: 7px;
  background: var(--gold);
  color: var(--paper);
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: .06em;
  text-decoration: none;
}
.lobby-tv { width: 100%; margin: 0 0 12px; }

@media (max-width: 380px) {
  .program-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .program-catalog { grid-template-columns: 1fr; }
}


