:root {
  --red: #d7141f;
  --red-dark: #7a0a12;
  --yellow: #ffd400;
  --blue: #38bdf8;
  --green: #4ade80;
  --black: #000;
  --ink: #fff;
  --muted: rgba(255, 255, 255, .62);
  --glass: rgba(0, 0, 0, .55);
  --line: rgba(255, 255, 255, .16);
  --panel: #121212;
  --panel-2: #1e1e1e;
  --panel-3: #2a2a2a;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--black);
  color: var(--ink);
  font: 500 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .35; cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.stage { position: fixed; inset: 0; }

/* ---------- telas ---------- */
.screen { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--black); }
video.screen { object-fit: contain; }
#replay { display: none; overflow: hidden; touch-action: none; }
#replayLayer { position: absolute; inset: 0; will-change: transform; }
#replay video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; opacity: 0; pointer-events: none;
}
#replay video.active { opacity: 1; }
body.zoomed #replay { cursor: grab; }

body[data-mode="replay"] #live { visibility: hidden; }
body[data-mode="replay"] #replay { display: block; }

.live-only, .replay-only { display: none !important; }
body[data-mode="live"] .live-only:not([hidden]) { display: flex !important; }
body[data-mode="replay"] .replay-only:not([hidden]) { display: flex !important; }

/* ---------- barra superior ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 14px calc(12px + var(--safe-l));
  background: linear-gradient(rgba(0,0,0,.75), transparent);
  pointer-events: none;
  z-index: 2;
}
.topbar > * { pointer-events: auto; white-space: nowrap; flex: none; }
.topbar > .spacer { flex: 1; }
body[data-mode="boot"] .topbar, body[data-mode="error"] .topbar { display: none; }

.status {
  align-items: center; gap: 7px;
  height: 34px; padding: 0 10px;
  border-radius: 8px; background: var(--glass);
  font-weight: 800; font-size: 12px; letter-spacing: .08em;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(215,20,31,.7); } 70%, 100% { box-shadow: 0 0 0 8px rgba(215,20,31,0); } }
.buffer-bar { width: 34px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
#bufferFill { display: block; height: 100%; width: 0; background: #fff; transition: width .3s; }
.mic { display: block; width: 4px; height: 16px; border-radius: 2px; background: var(--line); position: relative; overflow: hidden; }
#micFill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--green); }
.mic.hit #micFill { background: var(--yellow); }

.var-badge {
  align-items: center;
  height: 34px; padding: 0 12px;
  border-radius: 6px;
  background: linear-gradient(100deg, var(--red), var(--red-dark));
  border: 2px solid #fff;
  font-style: italic; font-size: 15px; font-weight: 900;
  transform: skewX(-10deg);
}

.scoreboard {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border-radius: 8px;
  background: var(--glass); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.scoreboard strong { font-size: 19px; font-weight: 900; }
.sb-x { color: var(--muted); }
.sb-name { max-width: 10ch; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--muted); }

.jobs {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px;
  border-radius: 8px; background: var(--glass); border: 1px solid var(--line);
  font-size: 13px; font-weight: 700;
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--glass); flex: none;
}
.icon-btn:active { background: rgba(255,255,255,.2); }

.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: 999px; background: #fff; color: #000;
  font-weight: 700; white-space: nowrap;
}
.pill.ghost { background: var(--glass); color: #fff; border: 1px solid var(--line); }
.pill.small { height: 34px; padding: 0 12px; font-size: 13px; }
.pill.big { height: 52px; padding: 0 28px; font-size: 17px; background: var(--red); color: #fff; }
.pill.big.light { background: #fff; color: #000; }
.pill:active { transform: scale(.97); }

/* ---------- ao vivo: VAR + marcar ---------- */
.live-actions {
  position: absolute; left: 0; right: 0;
  bottom: calc(26px + var(--safe-b));
  align-items: center; justify-content: center; gap: 28px;
  pointer-events: none;
}
.live-actions > * { pointer-events: auto; }
.mark-spacer { width: 56px; }
.mark-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--glass); border: 2px solid rgba(255,255,255,.7);
}
.mark-btn:active:not(:disabled) { transform: scale(.92); }
.mark-btn.flash { background: var(--blue); color: #000; }

.var-btn {
  display: flex; align-items: center; justify-content: center;
  width: 112px; height: 112px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff3b45, var(--red) 45%, var(--red-dark));
  border: 5px solid #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.6), inset 0 -6px 12px rgba(0,0,0,.25);
  color: #fff; font-size: 36px; font-weight: 900; font-style: italic;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  transition: transform .08s;
}
.var-btn:active:not(:disabled) { transform: scale(.92); }
.var-btn span { transform: skewX(-8deg); }

@media (orientation: landscape) and (max-height: 520px) {
  .live-actions {
    left: auto; right: calc(20px + var(--safe-r));
    top: 0; bottom: 0; flex-direction: column; gap: 18px;
  }
}

/* ---------- replay ---------- */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  flex-direction: column; gap: 8px;
  padding: 36px calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
  background: linear-gradient(transparent, rgba(0,0,0,.85) 28%);
  z-index: 1;
}
.controls > * { width: 100%; max-width: 760px; margin: 0 auto; }

.scrub-row { display: flex; align-items: center; gap: 8px; }
.scrub-wrap { position: relative; flex: 1; display: flex; }
.time { min-width: 40px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); text-align: center; }
#timeNow { color: #fff; }

.markers { position: absolute; left: 11px; right: 11px; top: -14px; height: 14px; pointer-events: none; }
.markers button {
  position: absolute; top: 0;
  width: 24px; height: 24px; margin-left: -12px; margin-top: -8px;
  pointer-events: auto;
  display: flex; align-items: flex-end; justify-content: center;
}
.markers button::after {
  content: ""; width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 10px solid var(--yellow);
}
.markers button.manual::after { border-top-color: var(--blue); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 32px; background: transparent; touch-action: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--red) var(--p, 0%), var(--line) var(--p, 0%));
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--red); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px;
  border-radius: 50%; background: #fff; border: 3px solid var(--red);
}
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--red); }
.sheet input[type="range"]::-webkit-slider-runnable-track { background: #444; }

.transport { display: flex; align-items: center; justify-content: center; gap: 8px; }
.transport .icon-btn { width: 42px; height: 42px; }
.transport .mk { color: var(--yellow); }
body:not(.has-markers) .transport .mk { opacity: .25; pointer-events: none; }
.icon-btn.play { width: 54px !important; height: 54px !important; background: #fff; color: #000; }
.icon-btn.play .i-pause { display: none; }
body.playing .icon-btn.play .i-pause { display: block; }
body.playing .icon-btn.play .i-play { display: none; }
.rate-btn {
  height: 42px; min-width: 64px; padding: 0 10px;
  border-radius: 999px; background: var(--red);
  font-weight: 800; font-variant-numeric: tabular-nums;
}

/* ---------- teclado de resultado ---------- */
.pad { display: flex; flex-direction: column; gap: 6px; }
.pad-row { display: grid; grid-template-columns: minmax(64px, 110px) repeat(4, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
.pad-name {
  display: flex; flex-direction: column; justify-content: center;
  min-width: 0; padding: 0 4px;
}
.pad-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pad-name small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.fin {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 50px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-weight: 800; font-size: 14px; line-height: 1.1;
}
.fin small { font-size: 12px; font-weight: 800; color: var(--yellow); }
.fin[data-finish="spin"] { border-bottom: 3px solid #9ca3af; }
.fin[data-finish="over"] { border-bottom: 3px solid #fb923c; }
.fin[data-finish="burst"] { border-bottom: 3px solid var(--yellow); }
.fin[data-finish="xtreme"] { background: linear-gradient(120deg, var(--red), var(--red-dark)); border-color: var(--red); }
.fin[data-finish="xtreme"] small { color: #fff; }
.fin:active:not(:disabled) { transform: scale(.95); background: var(--panel-3); }
.pad-row.lead .pad-name strong { color: var(--yellow); }

/* recursos em espera / só no celular */
body:not(.feat-server) .server-only { display: none !important; }
body:not(.is-phone) .phone-only { display: none !important; }
body[data-mode="boot"] .phone-only, body[data-mode="error"] .phone-only { display: none !important; }
.choice.soon { position: relative; opacity: .55; cursor: not-allowed; }
.choice.soon:hover { border-color: var(--line); }
.soon-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--yellow); color: #000; font-size: 11px; font-weight: 800;
}
.screen-row { cursor: default; flex-wrap: wrap; }
.seg-chips.wide button { width: auto; padding: 0 12px; font-size: 13px; }
#btnRotate.locked { background: var(--red); }

/* aviso para virar o celular */
.rotate-hint {
  position: absolute; inset: 0; z-index: 7;
  display: none; align-items: center; justify-content: center;
  padding: 24px; background: rgba(0,0,0,.88);
}
body.want-landscape:not([data-mode="boot"]):not([data-mode="error"]) .rotate-hint:not([hidden]) { display: flex; }
@media (orientation: landscape) { .rotate-hint { display: none !important; } }
.rotate-card { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; max-width: 300px; }
.rotate-card strong { font-size: 22px; font-weight: 900; }
.rotate-card p { margin: 0; color: var(--muted); }
.rotate-ic { animation: tilt 2.2s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

/* sessão */
.session-chip {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px;
  border-radius: 8px; background: rgba(215,20,31,.85); border: 1px solid #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .06em;
}
.session-chip b { font-size: 15px; }
.rec { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
body[data-mode="boot"] .session-chip, body[data-mode="error"] .session-chip { display: none; }

.sess { display: flex; flex-direction: column; gap: 12px; }
.sess p { margin: 0; }
.sess-stats { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; }
.sess-stats .rec { background: var(--red); }
.sess-clips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; max-height: 40vh; overflow: auto; }
.sess-clips li { position: relative; border-radius: 8px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.sess-clips img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sess-clips span { position: absolute; left: 4px; bottom: 3px; font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.sess-clips li.pending { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.sess-actions { display: flex; flex-direction: column; gap: 8px; }
.sess-actions .pill { width: 100%; }
.sess-upload { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; gap: 6px; }
.link-row input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font-size: 13px; user-select: text; -webkit-user-select: text; }
.link-btn.center { align-self: center; }
#tokenInput { text-align: left; padding: 0 12px; }

/* replay em tela cheia: os controles somem e voltam com um toque no vídeo */
.controls, body[data-mode="replay"] .topbar { transition: opacity .25s, transform .25s; }
body.controls-hidden[data-mode="replay"] .controls,
body.controls-hidden[data-mode="replay"] .topbar {
  opacity: 0;
  pointer-events: none !important;
}
body.controls-hidden[data-mode="replay"] .topbar > * { pointer-events: none !important; }
body.controls-hidden[data-mode="replay"] .controls { transform: translateY(12px); }
.tap-hint {
  position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.55);
  font-size: 12px; color: var(--muted); pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
body.controls-hidden[data-mode="replay"] .tap-hint { opacity: 1; animation: hintfade 3s forwards; }
@keyframes hintfade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* placar opcional */
.noscore-bar { display: none; gap: 8px; }
.noscore-bar .pill { flex: 1; height: 52px; padding: 0 12px; font-size: 16px; }
body.no-score .noscore-bar { display: flex; }
body.no-score #replayPad,
body.no-score #btnScore,
body.no-score .score-only,
body.no-score #btnSave { display: none !important; }

@media (orientation: landscape) and (max-height: 520px) {
  .noscore-bar { flex-direction: column; }
  .noscore-bar .pill { flex: none; height: 46px; }
  .controls {
    left: auto; top: 0; width: min(380px, 50vw);
    justify-content: flex-end;
    padding-top: calc(60px + var(--safe-t));
    background: linear-gradient(90deg, transparent, rgba(0,0,0,.72) 22%);
  }
  .pad-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pad-name { grid-column: 1 / -1; flex-direction: row; gap: 8px; align-items: baseline; }
  .fin { height: 40px; }
}

/* ---------- toast e banner ---------- */
.toast {
  position: absolute; left: 50%;
  top: calc(64px + var(--safe-t));
  transform: translate(-50%, -8px);
  display: flex; align-items: center; gap: 12px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 10px 14px; border-radius: 12px;
  background: rgba(20,20,20,.95); border: 1px solid var(--line);
  font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 6;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toastAction { color: var(--yellow); font-weight: 800; padding: 4px 2px; }

.win-banner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.7); z-index: 5;
}
.win-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 32px; border-radius: 18px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border: 3px solid #fff; text-align: center;
  animation: pop .35s cubic-bezier(.2,1.6,.4,1);
}
.win-card small { letter-spacing: .3em; font-weight: 800; opacity: .85; }
.win-card strong { font-size: 40px; font-weight: 900; font-style: italic; line-height: 1.1; }
.win-card span { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.win-card .row { margin-top: 12px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ---------- tela inicial ---------- */
.home {
  position: absolute; inset: 0;
  display: none;
  overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(ellipse at top, #3a0408, #000 60%) fixed;
  user-select: none;
}
body[data-mode="boot"] .home, body[data-mode="error"] .home { display: block; }
.home-inner {
  width: min(560px, 100%);
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: calc(24px + var(--safe-t)) calc(16px + var(--safe-r)) calc(28px + var(--safe-b)) calc(16px + var(--safe-l));
}
.home-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.home-logo { width: min(240px, 62vw); height: auto; }
.home-head h1 { margin: 0; font-size: 32px; font-weight: 900; font-style: italic; letter-spacing: -.01em; }
.home-head h1 em { color: var(--red); }
.home-head p { margin: 0; color: var(--muted); max-width: 340px; }
.home-error {
  margin: 0; padding: 12px 14px; border-radius: 12px;
  background: rgba(215,20,31,.15); border: 1px solid var(--red); color: #fff;
}

/* configuração em passos */
.setup { display: flex; flex-direction: column; gap: 18px; }
.step { display: flex; flex-direction: column; gap: 8px; }
.step-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; font-weight: 800; }
.step-n {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--red); font-size: 14px;
}
.choices { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 14px; border-radius: 16px; text-align: left;
  background: rgba(18,18,18,.92); border: 2px solid var(--line);
  transition: border-color .15s, background .15s;
}
.choice:hover { border-color: rgba(255,255,255,.35); }
.choice[aria-checked="true"] { border-color: var(--red); background: linear-gradient(140deg, rgba(215,20,31,.3), rgba(18,18,18,.92) 70%); }
.ch-ic {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-3);
}
.choice[aria-checked="true"] .ch-ic { background: var(--red); }
.ch-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ch-txt strong { font-size: 16px; }
.ch-txt small { color: var(--muted); font-size: 13px; line-height: 1.35; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px; border-radius: 16px; cursor: pointer;
  background: rgba(18,18,18,.92); border: 2px solid var(--line);
}
.switch {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 52px; height: 30px; border-radius: 999px; margin: 0;
  background: var(--panel-3); position: relative; cursor: pointer; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch:checked { background: var(--red); }
.switch:checked::after { transform: translateX(22px); }
.match-fields { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(18,18,18,.92); border: 1px solid var(--line); }
.match-fields p { margin: 0; }
.go { width: 100%; height: 58px; font-size: 18px; }

.home-card { padding: 14px; border-radius: 16px; background: rgba(18,18,18,.92); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.card-title { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.link-btn { color: var(--muted); font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.vs-x { font-weight: 900; font-style: italic; color: var(--red); font-size: 18px; }
.target-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.seg-chips { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--panel-2); }
.seg-chips button { width: 40px; height: 34px; border-radius: 999px; font-weight: 800; }
.seg-chips button[aria-pressed="true"] { background: var(--red); }

.section-title { margin: 0 0 2px; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.modes { display: flex; flex-direction: column; gap: 8px; }
.mode {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: 16px;
  background: rgba(18,18,18,.92); border: 1px solid var(--line);
  color: #fff; text-decoration: none; text-align: left;
  transition: border-color .15s, transform .08s;
}
.mode:hover { border-color: rgba(255,255,255,.35); }
.mode:active { transform: scale(.985); }
.mode.primary { border-color: var(--red); background: linear-gradient(120deg, rgba(215,20,31,.28), rgba(18,18,18,.92) 60%); }
.mode-ic {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-3);
}
.mode.primary .mode-ic { background: var(--red); }
.mode-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mode-txt strong { font-size: 16px; }
.mode-txt small { color: var(--muted); font-size: 13px; }
.mode-badge {
  position: absolute; top: -8px; right: 12px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--yellow); color: #000; font-size: 11px; font-weight: 800;
}

.check-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.check-list li {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; border-radius: 10px; background: rgba(18,18,18,.92); border: 1px solid var(--line);
  font-size: 13px; line-height: 1.3;
}
.check-list li::before { content: "…"; flex: none; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 900; background: var(--panel-3); }
.check-list li.ok::before { content: "✓"; background: var(--green); color: #000; }
.check-list li.warn::before { content: "!"; background: var(--yellow); color: #000; }
.check-list li.bad::before { content: "✕"; background: var(--red); }
.check-list small { display: block; color: var(--muted); font-size: 12px; }

.home-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.home-links button, .home-links a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; border-radius: 12px;
  background: rgba(18,18,18,.92); border: 1px solid var(--line);
  color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
}
.home-links span { font-size: 20px; }

/* partidas anteriores */
.matches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.match-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--panel-2);
}
.match-item .mres { font-weight: 800; }
.match-item .mres b { color: var(--yellow); }
.match-item small { color: var(--muted); grid-column: 1; }
.match-item .icon-btn { grid-row: 1 / span 2; grid-column: 2; width: 36px; height: 36px; background: var(--panel); }

/* ---------- tutorial ---------- */
.tutorial {
  position: absolute; inset: 0; z-index: 8;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0,0,0,.82);
}
.tut-card {
  position: relative;
  width: min(420px, 100%);
  display: flex; flex-direction: column; gap: 18px;
  padding: 28px 22px 22px;
  border-radius: 20px; background: var(--panel); border: 1px solid var(--line);
}
.tut-skip { position: absolute; top: 12px; right: 14px; color: var(--muted); font-size: 14px; padding: 6px; }
.tut-slides { overflow: hidden; }
.tut-slide { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.tut-art {
  width: 100%; height: 150px; border-radius: 14px;
  background: radial-gradient(ellipse at center, #2b0407, #0b0b0b 70%);
  display: flex; align-items: center; justify-content: center;
}
.tut-step { color: var(--red); font-weight: 800; font-size: 12px; letter-spacing: .14em; }
.tut-slide h3 { margin: 0; font-size: 22px; font-weight: 900; }
.tut-slide p { margin: 0; color: var(--muted); }
.tut-slide .tip { font-size: 13px; color: #fff; background: var(--panel-2); border-radius: 10px; padding: 8px 12px; }
.tut-dots { display: flex; gap: 6px; justify-content: center; }
.tut-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--panel-3); }
.tut-dots span.on { background: var(--red); width: 22px; border-radius: 4px; }
.tut-card .row .pill { flex: 1; }

/* ---------- folhas (dialogs) ---------- */
.sheet {
  width: min(460px, calc(100% - 20px));
  max-height: calc(100% - 20px);
  padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); color: #fff; overflow: auto;
}
.sheet.wide { width: min(640px, calc(100% - 20px)); }
.sheet::backdrop { background: rgba(0,0,0,.65); }
.sheet form { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -16px; background: var(--panel); padding: 4px 0; margin-top: -4px; z-index: 1; }
.sheet-head .icon-btn { width: 36px; height: 36px; background: var(--panel-2); }
.sheet h2 { margin: 0; font-size: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field select {
  height: 44px; padding: 0 10px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.check { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); flex: none; }
.muted { margin: 0; color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.group {
  display: flex; flex-direction: column; gap: 12px;
  margin: 0; padding: 14px; border: 0; border-radius: 14px; background: var(--panel-2);
}
.group legend {
  float: left; width: 100%; padding: 0; margin-bottom: 2px;
  font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--red);
}
.group .field select { background: var(--panel-3); }

.menu { display: flex; flex-direction: column; gap: 6px; }
.menu button {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; border-radius: 12px; background: var(--panel-2); text-align: left;
}
.menu button:active { background: var(--panel-3); }
.menu .mi { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--panel-3); font-size: 18px; }
.menu strong { display: block; }
.menu small { color: var(--muted); }
@media (pointer: coarse) { .desktop-only { display: none !important; } }

.keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.keys th { text-align: left; padding: 12px 0 4px; color: var(--red); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.keys td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.keys td:first-child { white-space: nowrap; padding-right: 12px; }
kbd { display: inline-block; min-width: 24px; padding: 2px 6px; border-radius: 6px; background: var(--panel-3); border-bottom: 2px solid #000; font: 700 12px/1.4 ui-monospace, monospace; text-align: center; }

/* câmera remota */
.gate-remote { min-width: 220px; }
.remote { display: flex; flex-direction: column; gap: 12px; }
.remote p { margin: 0; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.steps code, .remote pre {
  display: inline-block; margin-top: 4px; padding: 6px 10px; border-radius: 8px;
  background: var(--panel-2); font: 600 13px/1.4 ui-monospace, monospace;
  word-break: break-all; user-select: text; -webkit-user-select: text;
}
.remote pre { margin: 0; white-space: pre; }
.room-code {
  align-self: center;
  padding: 10px 24px; border-radius: 16px;
  background: var(--panel-2); border: 2px solid var(--red);
  font-size: 56px; font-weight: 900; letter-spacing: .2em; font-variant-numeric: tabular-nums;
  user-select: text; -webkit-user-select: text;
}
.remote-status { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
.cdot { width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); }
.remote-status.ok .cdot { background: var(--green); }
.remote-status.bad .cdot { background: var(--red); }

/* placar */
.names { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.name-in {
  width: 100%; min-width: 0; height: 42px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  text-align: center; font-weight: 700;
  user-select: text; -webkit-user-select: text;
}
.big-score { display: flex; align-items: baseline; gap: 8px; font-size: 44px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.big-score small { font-size: 20px; color: var(--muted); }
.events { margin: 0; padding: 0 0 0 22px; max-height: 140px; overflow: auto; font-size: 13px; color: var(--muted); }
.events li strong { color: #fff; }

/* histórico */
.viewer { width: 100%; max-height: 50vh; border-radius: 10px; background: #000; }
.clips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.clip {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px; border-radius: 12px; background: var(--panel-2);
}
.clip img, .clip .noimg { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #000; cursor: pointer; }
.clip .meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip .meta small { color: var(--muted); }
.clip .acts { display: flex; gap: 4px; }
.clip .acts .icon-btn { width: 38px; height: 38px; background: var(--panel); }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }

/* ---------- telas estreitas ---------- */
@media (max-width: 480px) {
  .topbar { gap: 6px; padding-left: calc(8px + var(--safe-l)); padding-right: calc(8px + var(--safe-r)); }
  .topbar .icon-btn { width: 38px; height: 38px; }
  .status { padding: 0 8px; }
  .status-txt { display: none; }
  .sb-name { max-width: 7ch; }
  .topbar .pill { height: 36px; padding: 0 12px; }
  .transport { gap: 4px; }
  .transport .icon-btn { width: 38px; height: 38px; }
  .rate-btn { height: 38px; min-width: 56px; }
  .pad-row { grid-template-columns: 64px repeat(4, minmax(0, 1fr)); gap: 5px; }
  .fin { height: 46px; font-size: 13px; }
  .clip { grid-template-columns: 96px minmax(0, 1fr); }
  .clip .acts { grid-column: 1 / -1; justify-content: flex-end; }
  .sheet form { padding: 14px; }
  .big-score { font-size: 36px; }
}
