:root {
  --hud: #f7f2e6;
  --acc: #ffbf4e;
  --mar: #5de5cf;
  --bad: #ff756a;
  --ok: #8fdf8d;
  --panel: rgba(12, 26, 35, .93);
  --tinta: #101d25;
  --linha: #344e5a;
  --titulo: system-ui, "Segoe UI", sans-serif;
}

.simbolos { position: absolute; width: 0; height: 0; }
.icone { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--mar); outline-offset: 2px; }
#menu { background: radial-gradient(ellipse at 85% -50%, #304b43, #10242d 50%, #0b1721); }
#menu::before { opacity: .07; background: repeating-radial-gradient(ellipse at 95% 120%, transparent 0 18px, #6af6ee 19px 20px, transparent 21px 32px); }
#mhead { min-height: 64px; border-color: #35515b; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); background: #0d1c25; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; line-height: 1; }
.brand img { display: block; width: 45px; height: 45px; }
.brand small { display: block; font: 800 9px/1 var(--titulo); letter-spacing: .24em; color: var(--mar); margin-top: 4px; text-transform: uppercase; }
.brand strong { font: italic 900 clamp(19px, 4vw, 28px)/1 var(--titulo); letter-spacing: -.04em; text-transform: uppercase; }
.brand b { color: var(--acc); }
#wallet { background: #182d37; color: #f7f2e6; border: 1px solid var(--linha); font-size: 12px; font-variant-numeric: tabular-nums; }
#menu.landscape #mhead { min-height: 52px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
#menu.landscape .brand img { width: 36px; height: 36px; }
#menu.landscape .brand strong { font-size: 20px; }
#mbody h2 { font: italic 850 clamp(21px, 4vw, 27px)/1.15 var(--titulo); letter-spacing: -.03em; }
#mnav { background: #0e2029; border-color: var(--linha); }
#mnav button { opacity: 1; color: #b7cbd0; min-height: 42px; -webkit-tap-highlight-color: transparent; }
#mnav button .icone { width: 20px; height: 20px; }
#mnav button.on { color: var(--acc); background: #293332; }
.item, button, input.txt, select.txt { background: #172d37; border-color: var(--linha); }
button.on, #play, .go, #resume { background: var(--acc); color: var(--tinta); }
.cta { background: linear-gradient(transparent, #0b1922 22%); }
.cta button { display: flex; align-items: center; justify-content: center; gap: .35em; }

#tracks .tracks { grid-template-columns: repeat(auto-fill, minmax(min(100%, 175px), 1fr)); gap: 10px; }
#mbody #tracks .pista-cartao { display: flex; flex-direction: column; padding: 0; overflow: hidden; border: 1px solid #44606c; border-radius: 8px; background: #122730; color: var(--hud); text-align: left; }
#mbody #tracks .pista-cartao.on { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); background: #243431; }
.pista-arte { display: block; width: 100%; height: clamp(68px, 7vw, 94px); background: var(--pista-cor); }
.pista-info { display: grid; gap: 4px; padding: 9px 10px 10px; width: 100%; }
.pista-info strong { font-size: 14px; line-height: 1.2; }
.pista-info small { color: #b8cdd0; font-size: 11px; font-weight: 550; }
.pista-dados { color: var(--mar); font: 750 11px/1.2 var(--titulo); font-variant-numeric: tabular-nums; }
.pista-cartao.on .pista-dados { color: var(--acc); }
.pista-rota { fill: none; stroke: #fff7d8; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pista-sombra { fill: none; stroke: #122731; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }

#hud .box { border: 1px solid #52707b; background: var(--panel); }
#spd { right: 18px; bottom: 18px; width: 152px; padding: 4px 10px 8px; text-align: center; border-radius: 12px; }
.mostrador { position: relative; }
.mostrador svg { display: block; width: 100%; height: 76px; fill: none; }
.arco-trilha, #arco-vel { stroke-width: 6; }
.arco-trilha { stroke: #3c5862; }
#arco-vel { stroke: var(--mar); }
.arco-tracos { stroke: #bad0d4; opacity: .62; stroke-width: 1.35; }
.vel-leitura { position: absolute; inset: 22px 0 auto; display: grid; justify-items: center; gap: 2px; line-height: 1; }
#kmh { font: italic 900 33px/.96 var(--titulo); font-variant-numeric: tabular-nums; }
.vel-leitura small { font-size: 10px; color: #ccdbdf; }
#tag { display: block; margin: -5px 0 3px; font-size: 9px; line-height: 12px; min-height: 12px; }
.bateria-painel { display: grid; justify-items: center; gap: 4px; }
.bateria-trilho { position: relative; width: 82%; height: 10px; border: 1px solid #8aa8ae; border-radius: 3px; padding: 1px; }
.bateria-trilho::after { content: ""; position: absolute; top: 2px; bottom: 2px; width: 3px; left: 100%; border-radius: 0 2px 2px 0; background: #8aa8ae; }
.bateria-trilho { background: #213944; }
#batb { display: block; width: 100%; height: 100%; clip-path: inset(0 var(--bateria-vazia, 0%) 0 0 round 1px); background: repeating-linear-gradient(to right, var(--bateria-cor, var(--mar)) 0 calc(16.666% - 2px), transparent calc(16.666% - 2px) 16.666%); }
#batl { font-size: 10px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
#spd.turbo { --bateria-cor: var(--acc); }
#spd.carga-baixa { --bateria-cor: var(--bad); }
#spd.turbo #arco-vel { stroke: var(--acc); }
#spd.turbo #batl { color: var(--acc); }
#life .bar { height: 7px; }

body.touch #spd { --margem-hud: max(8px, env(safe-area-inset-top)); top: var(--margem-hud); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: 112px; padding: 3px 5px 5px; }
body.touch .mostrador svg { height: 60px; }
body.touch .vel-leitura { top: 18px; }
body.touch #kmh { font-size: 26px; }
body.touch #map { right: 132px; transform: none; top: max(8px, env(safe-area-inset-top)); }
body.touch #map canvas { width: clamp(86px, 14vw, 126px); height: auto; }
body.touch #life { width: min(200px, 34vw); }
body.touch #mirror { top: 104px; }
body.touch #hud #banner.big { top: max(32%, calc(108px + env(safe-area-inset-top))); }
body.touch #touch .b-pause { right: max(12px, env(safe-area-inset-right)); }
body.touch #touch .b-back { right: calc(72px + env(safe-area-inset-right)); }
body.touch #touch .tb .icone { width: 24px; height: 24px; vertical-align: middle; }
body.touch #touch .b-boost:not(.on) { background: rgba(26, 119, 110, .75); }
body.touch #touch .b-fire:not(.on) { background: rgba(142, 96, 20, .77); }

@media (max-width: 599px) {
  body.touch #map { right: max(12px, env(safe-area-inset-right)); top: 76px; }
  body.touch #map canvas { width: 58px; }
  body.touch #spd { width: 104px; }
  body.touch #hud #life { top: 116px; }
  body.touch #lap { max-width: 26vw; padding-inline: 8px; }
}
@media (max-width: 599px) and (max-height: 400px) {
  body.touch #map { display: none; }
}
@media (max-width: 410px) {
  #mnav button { font-size: 10px; }
  #wallet { padding-inline: 7px; }
  .brand { gap: 5px; }
  .brand img { width: 34px; height: 36px; }
  .brand strong { font-size: 18px; }
  #tracks .tracks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pista-info { padding: 8px; }
  body.touch #spd { left: 43%; }
}

/* online: lobby e sala */
.ohead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ohead h2 { margin-right: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font: 750 12px/1.5 var(--titulo); color: #b7cbd0; background: #172d37; border: 1px solid var(--linha); vertical-align: 1px; }
.pill.on { color: var(--tinta); background: var(--mar); border-color: var(--mar); }
.go2 { background: transparent; color: var(--acc); border: 1.5px solid var(--acc); }
.go2:hover, .go2:active { background: rgba(255, 191, 78, .14); }
.obar { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; margin: 8px 0 2px; }
.obar input.txt { flex: 1 1 150px; width: auto; min-height: 44px; box-sizing: border-box; }
.obar .go { flex: 2 1 220px; width: auto; margin: 0; }
#olist { display: grid; gap: 6px; }
.osala { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #44606c; border-radius: 9px; background: #122730; }
.osala b { display: block; } .osala small { display: block; opacity: .8; font-size: 12px; }
.osala .vagas { font: 750 14px var(--titulo); font-variant-numeric: tabular-nums; color: var(--mar); }
.osala.off { opacity: .55; }
.osala .go2 { min-width: 86px; }
.ovazio { padding: 10px 12px; border: 1px dashed var(--linha); border-radius: 9px; font-size: 14px; color: #cfdde0; margin: 6px 0; }
.ogrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 10px; margin: 14px 0 8px; }
.ogrid .item { display: flex; flex-direction: column; gap: 8px; }
.ogrid .item small { margin: 0; }
.ogrid input.txt, .ogrid select.txt { width: 100%; box-sizing: border-box; }
.ogrid .go2 { margin-top: auto; }
.orow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.orow select.txt { flex: 1 1 120px; width: auto; }
.osalaInfo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.osalaInfo small { display: block; margin: 0; }
.osalaInfo .code { display: block; line-height: 1.1; }
/* sala na rede local: QR code grande (fundo branco para a câmera ler) ao lado do código e das instruções */
.oqr { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.oqr img { background: #fff; border-radius: 10px; image-rendering: pixelated; width: 216px; height: 216px; flex: none; }
.oqr > div { flex: 1 1 180px; min-width: 0; }
.oqr small { display: block; margin: 4px 0; }
.oqr .code { display: block; line-height: 1.1; }
.ogrid .item button, .osalaInfo button { font-size: 15px; padding: 9px 14px; margin: 0; text-align: center; }
/* ranking online */
table.rk td:first-child { width: 3em; text-align: center; }
table.rk td:nth-child(3) { text-align: right; white-space: nowrap; }
#rkpista { display: block; width: 100%; margin: 8px 0; }
#tab-online .rkregra { display: block; margin: 6px 0 10px; }
#tab-online .rkvoce { margin: 8px 0 6px; font-size: 1.05em; }
/* carreira: etapas de cada liga */
.lpistas { margin: 6px 0 4px; padding: 0; list-style: none; font-size: 13px; line-height: 1.5; }
.lpistas li { display: inline; }
.lpistas li + li::before { content: ' · '; opacity: 0.5; }
.lpistas small { display: inline; opacity: 0.65; }
.lpistas li.feita { opacity: 0.5; text-decoration: line-through; }
.lpistas li.agora { color: var(--acc); font-weight: 700; }
.lleg { display: block; margin-bottom: 4px; opacity: 0.8; }

/* cosméticos na garagem: amostras de cor (comprar, usar, guardar) */
.cosm .sw { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.item .swb { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 5px; margin: 0; min-width: 62px; text-align: center; }
.swb i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.55); display: block; }
.swb.on { outline: 2px solid var(--acc); }
.swb.own i { border-color: #fff; }
.swb { position: relative; } .swb .prest { position: absolute; top: 1px; right: 4px; font-size: 11px; color: var(--acc); line-height: 1; }
.item .swb small { font-size: 10px; opacity: 0.85; }

/* árvore de habilidade (aba Piloto) */
.tpts { margin: 4px 0; font-size: 13px; }
.tpts b { color: var(--acc); font-size: 16px; }
.tpas { border: 1px solid var(--linha); border-radius: 8px; padding: 8px 10px; margin: 8px 0; background: #12303a; }
.tpas small { display: block; }
.tramos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0; }
@media (max-width: 720px) { .tramos { grid-template-columns: 1fr; } }
.tramo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tramo h5 { margin: 2px 0; font: 800 15px/1.2 var(--titulo); color: var(--mar); }
.tramo h5 small { color: var(--hud); opacity: .7; font-weight: 600; }
.tno, .tsig { display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 2px; padding: 7px 9px; border-radius: 8px; white-space: normal; }
.tno .tnome { display: flex; align-items: center; gap: 6px; }
.tno .tnome b { flex: 1; min-width: 0; }
.tno .tnome i { font-style: normal; font-size: 10px; padding: 0 5px; border-radius: 6px; background: #22414c; color: var(--mar); }
.tpip { color: var(--acc); letter-spacing: 1px; font-size: 11px; }
.tno small, .tsig small { opacity: .85; overflow-wrap: anywhere; }
.tno .tprox { color: var(--mar); opacity: .8; }
.tno:disabled { opacity: .75; }
.tno.max:disabled { opacity: 1; border-color: #8a7440; }
.tsig.on:disabled { opacity: 1; }
.tsig { border: 1px dashed #6b6040; background: #241f12; }
.tsig b { color: var(--acc); }
.tsig.lib { border-style: solid; }
.tsig.on { border: 2px solid var(--acc); background: #3a2f14; color: var(--hud); }
.tsig.on .tst { color: var(--acc); font-weight: 700; opacity: 1; }

/* modelos de peça na garagem: um encaixe por linha, um botão por modelo (instalado em destaque) */
.grid.mgrid { grid-template-columns: 1fr; margin-top: 8px; }
.item.mods .mrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 4px; }
.item .mbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0; padding: 6px 8px; text-align: left; }
.item .mbtn small { font-size: 11px; opacity: 0.8; }
.item .mbtn small.fx { opacity: 1; }
.item .mbtn em { font-size: 11px; font-style: normal; font-weight: 700; margin-top: 2px; }
.item .mbtn.on { outline: 2px solid var(--acc); }
