:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --line: #2a2f3a;
  --text: #eef0f4;
  --muted: #9097a6;
  --accent: #ff7a1a;
  --accent-ink: #1a0d02;
  --ok: #3ccf8e;
  --warn: #ffc24b;
  --bad: #ff5d6c;
  --threads: #e9e9e9;
  --bluesky: #3d8bff;
  --radius: 14px;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--body); }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.screen { max-width: 560px; margin: 0 auto; padding: 12px 16px 40px; }

/* Marca */
.brand { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .02em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.brand em { font-style: normal; color: var(--accent); }
.topbar .brand { font-size: 19px; white-space: nowrap; min-width: 0; }
.topbar .brand em { display: none; }
@media (min-width: 480px) { .topbar .brand em { display: inline; } }
.pill { white-space: nowrap; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
.brand.big { font-size: 32px; justify-content: center; margin-bottom: 24px; }
.ball { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); position: relative; flex: none;
  box-shadow: inset 0 0 0 2px var(--bg); }
.brand.big .ball { width: 28px; height: 28px; }
.ball::after { content: ''; position: absolute; inset: 45% 0 auto; height: 2px; background: var(--bg); }

/* Login */
#login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 10px; }
.login-card label { color: var(--muted); font-size: 14px; }
.login-card input { padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.error { color: var(--bad); min-height: 1.4em; margin: 0; font-size: 14px; }

/* Topo */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0 12px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.accounts { display: flex; gap: 6px; }
.pill { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 10px 6px 22px; font-size: 13px; position: relative; }
.pill::before { content: ''; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; border-radius: 50%; transform: translateY(-50%); background: var(--bad); }
.pill.on::before { background: var(--ok); }

/* Placar */
.board { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.team { display: grid; gap: 6px; justify-items: center; min-width: 0; }
.team-name { width: 100%; text-align: center; background: transparent; border: 0; border-bottom: 1px dashed var(--line); padding: 4px 2px; font-family: var(--display); font-size: 20px; font-weight: 600; text-transform: uppercase; }
.team-name:focus { outline: none; border-bottom-color: var(--accent); }
.score { font-family: var(--display); font-weight: 700; font-size: 52px; line-height: 1; font-variant-numeric: tabular-nums;
  width: 100%; max-width: 120px; text-align: center; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 2px 0;
  -moz-appearance: textfield; appearance: textfield; }
.score::-webkit-outer-spin-button, .score::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score:hover { border-color: var(--line); }
.score:focus { outline: none; border-color: var(--accent); background: var(--panel-2); }
.score-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 100%; }
.score-btns button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 0; font-weight: 600; font-size: 14px; }
.score-btns button:active { background: var(--accent); color: var(--accent-ink); }
.score-btns .minus { color: var(--muted); }
.mid { display: grid; gap: 8px; justify-items: center; padding-top: 6px; }
.mid select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; font-family: var(--display); font-size: 18px; font-weight: 600; }

/* Jogo vinculado à LNB */
.lnb-btn { font-size: 12px; padding: 6px 10px; }
.lnb-btn.on { border-color: var(--accent); color: var(--accent); }
.lnb-status { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.lnb-status #lnb-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lnb-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.lnb-status.live .dot { background: var(--bad); animation: pulse 1.4s infinite; }
.lnb-status.final .dot { background: var(--ok); }
.lnb-status.error { color: var(--warn); }
@keyframes pulse { 50% { opacity: .3; } }
.data-chips button { border-color: var(--accent); }
.game-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.game-list button { width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.game-list .st { color: var(--muted); font-size: 12px; }
.game-list .st.live { color: var(--bad); }
.paste-row { display: flex; gap: 6px; }
.paste-row input { flex: 1; min-width: 0; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 14px; }

/* Atalhos */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 14px; white-space: nowrap; }

/* Fio da cobertura */
.thread-bar { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius); border: 1px dashed var(--line); background: var(--panel); }
.thread-bar.active { border-style: solid; border-color: var(--accent); }
.thread-off, .thread-on { display: flex; align-items: center; gap: 10px; }
.thread-off { justify-content: space-between; }
.thread-info { flex: 1; min-width: 0; display: grid; }
.thread-label { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-off .thread-label { color: var(--muted); font-weight: 500; }
.thread-meta { font-size: 12px; color: var(--muted); }
.thread-meta a { color: var(--accent); }
#thread-title { color: var(--muted); font-weight: 500; }

/* Composição */
.composer { display: grid; gap: 10px; margin-top: 8px; }
textarea { width: 100%; resize: vertical; min-height: 140px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); font-size: 17px; }
textarea:focus, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.tagline { display: flex; align-items: center; gap: 10px; }
.tagline input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; transition: .15s; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { left: 20px; background: var(--accent-ink); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.media-grid:empty { display: none; }
.thumb { position: relative; border-radius: 12px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); }
.thumb img, .thumb video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.thumb .rm { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); font-size: 16px; line-height: 1; }
.thumb .alt { width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--panel); padding: 6px 8px; font-size: 12px; }
.thumb .bar { position: absolute; left: 0; bottom: 31px; height: 4px; background: var(--accent); transition: width .2s; }
.thumb .badge { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.7); border-radius: 6px; padding: 1px 6px; font-size: 11px; }
.thumb.failed { border-color: var(--bad); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.file-btn { white-space: nowrap; }
.count { white-space: nowrap; }
.counters { display: flex; gap: 6px; font-size: 12px; font-variant-numeric: tabular-nums; flex-wrap: wrap; justify-content: flex-end; }
.count { padding: 3px 8px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.count.near { color: var(--warn); }
.count.over { color: var(--bad); border-color: var(--bad); }
.count.thread { color: var(--bluesky); }

.targets { display: flex; gap: 8px; }
.target { flex: 1; }
.target input { position: absolute; opacity: 0; }
.target span { display: block; text-align: center; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-weight: 600; }
.target input:checked + span { color: var(--text); border-color: var(--accent); }
.target input:focus-visible + span { outline: 2px solid var(--accent); }

.warnings { margin: 0; font-size: 13px; color: var(--warn); min-height: 0; }
.warnings:empty { display: none; }

.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius); padding: 14px; font-weight: 700; font-size: 17px; }
.primary:disabled { opacity: .5; }
.actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.copy { font-weight: 700; font-size: 16px; padding: 0 18px; border-radius: var(--radius); }
.copy.done { border-color: var(--ok); color: var(--ok); }
.publish { font-family: var(--display); font-size: 22px; letter-spacing: .04em; text-transform: uppercase; padding: 14px; }
.ghost { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.ghost.small { padding: 7px 10px; font-size: 13px; }
.file-btn { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 4px; }
.small { font-size: 13px; }

.progress { display: grid; gap: 6px; }
.progress:empty { display: none; }
.step { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.step.ok { border-color: var(--ok); }
.step.bad { border-color: var(--bad); }
.step a { color: var(--accent); }

/* Histórico */
.history h2 { font-family: var(--display); font-size: 18px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 28px 0 8px; }
.history ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history li { padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.history li .meta { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.history li a { color: var(--accent); }
.history li:empty { display: none; }

.foot { text-align: center; margin-top: 24px; }

/* Diálogo e aviso */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); max-width: min(92vw, 420px); padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin: 0 0 10px; font-family: var(--display); font-size: 22px; text-transform: uppercase; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
dialog code { word-break: break-all; background: var(--panel-2); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
dialog .row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px; max-width: 90vw; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.4); }

@media (max-width: 380px) {
  .score { font-size: 42px; }
  .score-btns { grid-template-columns: repeat(2, 1fr); }
}
