
:root {
  --bg: #0b0d12;
  --panel: #141821;
  --panel-2: #1b2030;
  --line: #262d40;
  --text: #e8ebf2;
  --muted: #8a93a8;
  --accent: #e10600;
  --purple: #b04cff;
  --green: #2bd96b;
  --yellow: #ffd23f;
  --blue: #3fa9ff;
  --orange: #ff8a1f;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'Roboto Mono', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.purple { color: var(--purple); }
.green { color: var(--green); }
.yellow { color: var(--yellow); }
.red { color: #ff4d4d; }
.orange { color: var(--orange); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 600;
}
h2.label { margin: 0; }
.big { font-size: 34px; font-weight: 900; line-height: 1; }

/* ---------- topo ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  border-bottom: 2px solid var(--accent);
  background: linear-gradient(90deg, #160709, var(--bg) 40%);
}
.brand { font-weight: 900; font-size: 20px; letter-spacing: .04em; white-space: nowrap; }
.brand span { color: #ff4d4d; }
.topbar .spacer { flex: 1; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #555; display: inline-block; margin-right: 6px; }
.live-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.topbar a { color: var(--muted); text-decoration: none; font-size: 13px; }
.topbar a:hover { color: var(--text); }

/* ---------- pneus ---------- */
.tyre {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid currentColor; font-weight: 900; font-size: 11px;
  background: #000;
}
.tyre.S { color: #ff3b3b; } .tyre.M { color: #ffd23f; } .tyre.H { color: #f2f2f2; }
.tyre.I { color: #2bd96b; } .tyre.W { color: #3fa9ff; } .tyre.X { color: #666; }

/* ---------- carro / pneus ---------- */
.car-diagram {
  display: grid; grid-template-columns: 1fr 34px 1fr; gap: 10px 8px; align-items: center;
}
.tw { display: flex; align-items: center; gap: 8px; }
.tw.r { flex-direction: row-reverse; text-align: right; }
.tw-block {
  width: 30px; height: 52px; border-radius: 7px; background: #000;
  border: 2px solid var(--c); position: relative; overflow: hidden; flex-shrink: 0;
}
.tw-fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--c); opacity: .85; }
.tw-info { font-size: 13px; line-height: 1.25; }
.tw-wear { font-weight: 700; font-size: 16px; }
.car-body { height: 52px; background: linear-gradient(#2a3145, #1a1f2d); border-radius: 6px; }
.car-body.top { border-radius: 14px 14px 6px 6px; }

.dmg { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 13px; }
.dmg .mono { text-align: right; }

/* ---------- chuva ---------- */
.blue { color: var(--blue); }
.rain-head { font-size: 20px; font-weight: 800; margin: 4px 0 8px; }
.rain-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.rain-row > span:last-child { text-align: right; }
.rain-timeline { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; }
.rain-cell { flex: 1 0 46px; text-align: center; background: var(--panel-2); border-radius: 8px; padding: 6px 2px; border: 1px solid transparent; }
.rain-cell.is-rain { border-color: var(--blue); background: rgba(63,169,255,.12); }
.rain-bar { height: 40px; width: 10px; margin: 4px auto; background: #000; border-radius: 5px; position: relative; overflow: hidden; }
.rain-bar i { position: absolute; bottom: 0; left: 0; right: 0; background: var(--blue); }
.rain-pct { font-weight: 700; font-size: 13px; }
.rain-w { font-size: 16px; }
.rain-lap { font-size: 11px; }
.rain-note { font-size: 12px; margin: 8px 0 0; }

/* ---------- estratégia ---------- */
.strat-goal { font-size: 20px; font-weight: 900; margin: 4px 0 10px; }
.strat { border-left: 4px solid var(--c); background: var(--panel-2); border-radius: 0 10px 10px 0; padding: 10px 14px; margin-top: 8px; }
.strat-tag { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--c); }
.strat-title { font-size: 17px; font-weight: 800; margin: 2px 0; }
.strat ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; color: #c9cfdc; }
.strat li { margin: 2px 0; }

/* ---------- acessibilidade ---------- */
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--yellow); color: #000; padding: 8px 14px; border-radius: 6px; font-weight: 700;
}
.skip:focus { top: 8px; }
a.brand { color: var(--text); text-decoration: none; }
a { color: #8cc8ff; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- rodapé, aviso de cookies, páginas legais ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.site-footer nav { display: flex; gap: 16px; }
.cookie-notice {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; max-width: 620px; margin: 0 auto;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 14px;
}
.cookie-notice p { margin: 0; flex: 1 1 280px; }
.cookie-notice button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 18px; font: inherit; font-weight: 700; cursor: pointer;
}
.doc { max-width: 820px; margin: 0 auto; padding: 24px 16px 40px; line-height: 1.6; }
.doc h1 { font-size: 30px; margin: 0 0 4px; }
.doc h2 { font-size: 19px; margin: 28px 0 8px; }
.doc li { margin: 4px 0; }
.doc code { font-family: var(--mono); font-size: 13px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.table-wrap { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-table th, .doc-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc-table th { background: var(--panel-2); }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login {
  width: 100%; max-width: 360px;
  background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--accent);
  border-radius: 12px; padding: 28px 24px;
}
.login h1 { margin: 0 0 4px; font-size: 26px; font-weight: 900; }
.login h1 span { color: #ff4d4d; }
.login p { margin: 0 0 20px; color: var(--muted); }
.login label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.login input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit;
}
.login input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login button {
  margin-top: 20px; width: 100%; padding: 11px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.login .err { color: #ff6b6b; margin-top: 12px; font-size: 14px; }

.btn-link {
  display: inline-block; padding: 8px 14px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px;
}
.btn-link:hover { border-color: var(--accent); }

.room-chip {
  font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
}
.room-chip b { color: var(--text); }
.room-chip:hover { border-color: var(--accent); }

/* ---------- carrinho (estilo SAG) ---------- */
.cbadges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.cbadge { font-size: 11px; font-weight: 900; letter-spacing: .06em; padding: 2px 7px; border-radius: 4px; }
.cbadge.boost { background: var(--orange); color: #000; animation: pulse 0.8s infinite; }
.cbadge.ready { background: var(--green); color: #000; }
.cbadge.drs { background: var(--green); color: #000; }
.cbadge.pit { background: var(--blue); color: #000; }
.ersmini { display: inline-block; width: 46px; height: 8px; background: #000; border-radius: 4px; overflow: hidden; }
.ersmini i { display: block; height: 100%; }
.cw { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 6px; }
.cw-car { height: var(--car-h, 220px); width: auto; display: block; }
.cw-car .part { stroke: #0b0d12; stroke-width: 2; transition: fill .4s; }
.cw-car .body { fill: #2a3145; }
.cw-col { display: flex; flex-direction: column; justify-content: space-around; font-family: var(--mono); }
.cw-col.r { text-align: right; }
.cw-tyre b { display: block; font-size: 20px; line-height: 1.1; }
.cw-tyre span { font-size: 12px; }
@keyframes pulse { 50% { opacity: .55; } }
.strat-goal.small { font-size: 15px; margin: 2px 0 6px; }
.strat-line { border-left: 3px solid var(--c); padding: 3px 0 3px 8px; margin-top: 4px; font-size: 13px; font-weight: 700; line-height: 1.3; }

.login-logo { display: block; width: 120px; height: 120px; margin: 0 auto 10px; border-radius: 16px; }
.login h1, .login > p { text-align: center; }

/* ---------- barra de cima ---------- */
.topbar { background: linear-gradient(90deg, #1d0709 0%, #120a0d 35%, var(--bg) 70%); box-shadow: 0 2px 18px rgba(225,6,0,.18); gap: 12px; }
a.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.topbar a:not(.brand):not(.room-chip), .tv-top nav a {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.04);
  color: #c9cfdc; font-weight: 600; font-size: 13px; text-decoration: none; transition: border-color .15s, background .15s, color .15s;
}
.topbar a:not(.brand):not(.room-chip):hover, .tv-top nav a:hover { border-color: var(--accent); color: #fff; }
.topbar a[aria-current="page"], .tv-top a[aria-current="page"] { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
.topbar nav { display: flex; gap: 8px; flex-wrap: wrap; }

.cbadge.mode { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.cbadge.mode.m0 { color: var(--muted); }
.cbadge.mode.m2 { border-color: var(--purple); color: #d9b3ff; }
.cbadge.mode.m3 { background: var(--orange); border-color: var(--orange); color: #000; }
.ers-log { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; }
.ers-log li { padding: 2px 0; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- bateria ao lado do nome ---------- */
.bat { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.bat-bar { width: 36px; height: 10px; background: #000; border-radius: 4px; overflow: hidden; border: 1px solid #2a3145; }
.bat-bar i { display: block; height: 100%; }
.bat b { font-family: var(--mono); font-size: 15px; font-weight: 900; min-width: 40px; text-align: right; }
.bat-mode { font-size: 11px; font-weight: 800; letter-spacing: .03em; padding: 1px 5px; border-radius: 3px; min-width: 50px; text-align: center;
            background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.bat-mode.m0 { color: var(--muted); }
.bat-mode.m2 { border-color: var(--purple); color: #d9b3ff; }
.bat-mode.m3 { background: var(--orange); border-color: var(--orange); color: #000; }

[hidden] { display: none !important; }
