:root {
  --bg: #0b0f14; --panel: #131a22; --panel2: #1a232e; --line: #26323f; --text: #e8eef5; --muted: #8696a8;
  --strong: #2fd27a; --medium: #b7d433; --weak: #f2a93b; --conflict: #ff5468; --manual: #4aa8ff; --disputed: #c78bff;
  --raise: #1f9d57; --fold: #c2333f; --neutral: #2b3744;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.35 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overscroll-behavior: none; }
body { display: flex; flex-direction: column; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--neutral); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-weight: 600; }
button:active { transform: translateY(1px); filter: brightness(1.15); }
button.primary { background: #2563eb; border-color: #2f6df0; }
button.danger { background: #5a1f27; border-color: #7a2a35; }
button.toggle.on { background: #14532d; border-color: var(--strong); color: #d8ffe9; }
button.icon { background: none; border: 0; font-size: 20px; padding: 4px 8px; }
.muted { color: var(--muted); } .warn { color: var(--weak); }

#bar { display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--sat)) 12px 6px; background: #080b0f; border-bottom: 1px solid var(--line); font-size: 13px; }
#status { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#meta { color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--strong); } .dot.busy { background: var(--manual); animation: pulse 0.9s infinite; } .dot.err { background: var(--conflict); }
@keyframes pulse { 50% { opacity: 0.35; } }

main { flex: 1; overflow-y: auto; padding: 8px; display: grid; gap: 8px; grid-template-columns: 1fr; align-content: start; }
#stage { position: relative; background: #000; border-radius: 12px; overflow: hidden; height: 34vh; min-height: 190px; border: 1px solid var(--line); }
#video, #still, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#still { display: none; } #stage.image #still { display: block; } #stage.image #video { display: none; }
#overlay { pointer-events: none; }
#cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; background: radial-gradient(ellipse at 50% 30%, #16202c, #080b0f); }
#cover h1 { margin: 0; font-size: 22px; letter-spacing: 0.5px; } #cover p { margin: 0; color: var(--muted); max-width: 34ch; font-size: 13px; }
#cover .ghost { color: var(--manual); font-size: 13px; text-decoration: underline; padding: 6px; }
#stage.live #cover { display: none; }
#locked { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px; text-align: center; background: rgba(8, 11, 15, 0.94); }
#locked[hidden] { display: none; }
#locked h2 { margin: 0; font-size: 18px; color: var(--weak); } #locked p { margin: 0; font-size: 13px; color: var(--muted); max-width: 40ch; } #locked code { color: var(--text); }
#locked .row { margin-top: 4px; width: 100%; max-width: 340px; } #locked input { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 11px; color: var(--text); }
#scanline { position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, #4aa8ff, transparent); top: 0; opacity: 0; }
#stage.scanning #scanline { opacity: 1; animation: sweep 1.4s linear infinite; }
@keyframes sweep { from { top: 0; } to { top: 100%; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.panel-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; } .panel-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); flex: 1; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); } .chip:empty { display: none; }

.advice { border-width: 2px; transition: background 0.2s, border-color 0.2s; }
.advice.raise { background: #0f2a1c; border-color: var(--raise); } .advice.fold { background: #2a1015; border-color: var(--fold); } .advice.call { background: #10243a; border-color: var(--manual); }
.advice.unsure { border-style: dashed; }
.advice-main { display: flex; align-items: center; gap: 10px; } #advice-action { font-size: 30px; font-weight: 800; letter-spacing: 0.5px; flex: 1; line-height: 1.1; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.6px; } .tag:empty { display: none; }
.tag.ok { background: #14532d; color: #c9ffe0; } .tag.wait { background: #5a3d0c; color: #ffe2ae; } .tag.bad { background: #5a1f27; color: #ffd0d6; }
.advice-sub { color: var(--text); opacity: 0.9; margin-top: 2px; font-variant-numeric: tabular-nums; } .advice-detail { color: var(--muted); font-size: 12.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.eqbar { position: relative; height: 8px; border-radius: 4px; background: #0b0f14; margin-top: 8px; overflow: hidden; } .eqbar i { position: absolute; inset: 0 auto 0 0; background: var(--strong); border-radius: 4px; } .eqbar b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; }

.group { padding: 8px 0; border-top: 1px solid var(--line); } .group:first-child { border-top: 0; padding-top: 2px; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } .group-head h3 { margin: 0; font-size: 14px; flex: 1; }
.st { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.st.confirmed { background: #14532d; color: #c9ffe0; } .st.provisional { background: #5a3d0c; color: #ffe2ae; } .st.partial { background: #26323f; color: #c6d2e0; } .st.conflict { background: #5a1f27; color: #ffd0d6; } .st.disputed { background: #3a2458; color: #ead9ff; } .st.empty { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.seen { display: block; max-height: 150px; max-width: 100%; border-radius: 6px; border: 1px solid var(--line); margin-bottom: 6px; object-fit: contain; background: #000; }
.cards { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding-bottom: 14px; }
.pc { position: relative; width: 46px; height: 64px; border-radius: 7px; background: #fbfbf8; color: #15181c; border: 3px solid var(--weak); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; line-height: 1; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); padding: 0; }
.pc .r { font-size: 22px; } .pc .s { font-size: 20px; margin-top: 1px; }
.pc.s-h { color: #d3202c; } .pc.s-d { color: #1b62d6; } .pc.s-c { color: #168a3a; } .pc.s-s { color: #15181c; }
.pc.lv-disputed { border-color: var(--disputed); border-style: dashed; } .pc .alt { position: absolute; left: 0; right: 0; bottom: -17px; font-size: 11px; font-weight: 700; color: var(--disputed); white-space: nowrap; }
.pc.lv-strong { border-color: var(--strong); } .pc.lv-medium { border-color: var(--medium); } .pc.lv-weak { border-color: var(--weak); } .pc.lv-manual { border-color: var(--manual); } .pc.lv-conflict { border-color: var(--conflict); }
.pc .votes { position: absolute; right: -6px; top: -7px; min-width: 16px; height: 16px; border-radius: 8px; background: #0b0f14; color: var(--text); font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 1px solid var(--line); padding: 0 3px; }
.pc.back { background: repeating-linear-gradient(45deg, #7c1d25 0 5px, #a32a33 5px 10px); border-color: #3b4654; color: transparent; }
.pc.slot { background: transparent; border: 2px dashed var(--line); color: var(--muted); box-shadow: none; font-size: 20px; }
.pc.extra { opacity: 0.75; transform: scale(0.86); transform-origin: bottom left; }
.vs { color: var(--muted); font-size: 12px; align-self: center; padding: 0 2px; }
.check-line { font-size: 12.5px; margin-top: 6px; color: var(--muted); } .check-line .ok { color: var(--strong); } .check-line .bad { color: var(--conflict); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 8px; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; } .numbers:empty { display: none; }
.num { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--weak); border-radius: 8px; padding: 5px 8px; } .num.lv-strong { border-left-color: var(--strong); } .num.lv-medium { border-left-color: var(--medium); } .num.lv-none { border-left-color: var(--line); }
.num small { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; } .num b { font-variant-numeric: tabular-nums; font-size: 15px; }
.problems { margin-top: 8px; font-size: 12.5px; color: #ffd0d6; } .problems:empty { display: none; } .problems div { padding: 2px 0; }

#log { max-height: 160px; overflow-y: auto; font: 11.5px/1.45 ui-monospace, Menlo, Consolas, monospace; color: var(--muted); margin-top: 6px; } #log .err { color: var(--conflict); } #log .warn { color: var(--weak); }
summary { color: var(--muted); font-size: 13px; }

#actions { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 6px; padding: 8px 8px calc(8px + var(--sab)); background: #080b0f; border-top: 1px solid var(--line); } #actions button { padding: 12px 4px; font-size: 14px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 14px; width: min(94vw, 420px); } dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog h3 { margin: 0 0 10px; } dialog label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; color: var(--muted); } dialog label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
dialog select, dialog input[type=number] { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px; color: var(--text); }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
#picker-grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; } #picker-grid button { padding: 7px 0; font-size: 12px; border-radius: 6px; background: #fbfbf8; color: #15181c; border: 1px solid #aab; font-weight: 800; }
#picker-grid button.s-h { color: #d3202c; } #picker-grid button.s-d { color: #1b62d6; } #picker-grid button.s-c { color: #168a3a; } #picker-grid button:disabled { opacity: 0.22; }

@media (orientation: landscape) and (min-width: 700px) {
  main { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  #stage { grid-row: 1 / span 3; height: auto; min-height: 60vh; }
}

/* Modo simples (padrão): uma frase do que está sendo visto, as cartas e a jogada. Tempos, votos, recortes, EV e registro só em "Detalhes". */
body.simples #meta, body.simples #logbox, body.simples .legend, body.simples .seen, body.simples .pc .votes, body.simples .check-line,
body.simples .advice-detail, body.simples #btn-recal, body.simples #btn-newhand { display: none; }
body.simples #actions { grid-template-columns: 1.4fr 1fr 1fr; }
body.simples #bar { font-size: 15px; } body.simples #status { font-weight: 600; }
body.simples .pc { border-color: #8e99a6; } body.simples .pc.lv-strong { border-color: var(--strong); } body.simples .pc.lv-manual { border-color: var(--manual); } body.simples .pc.lv-disputed { border-color: var(--disputed); }
body.simples .st.provisional, body.simples .st.partial, body.simples .st.disputed { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
body.simples #advice-action { font-size: 36px; } body.simples .advice-sub { font-size: 16px; }
