/* hud.css — HUD de corrida e controles de toque (js/ui/hud.js, notices.js, minimap.js).

   Tudo o que tem texto fica sobre VIDRO ESCURO (.glass-dark): legível sobre céu claro,
   pôr do sol ou grama (contraste AA), e discreto. Mapa da tela:

     ┌ pausa · som ────────── volta · tempo · melhor ─────────── minimapa ┐
     │ COLOCAÇÃO (grande)        [ aviso — um de cada vez ]       olhinhos │
     │ item (slot/roleta)        [ contramão ]                             │
     │ efeitos ativos                                                      │
     │                              kart                                   │
     └ velocidade + mini-turbo ───── [ Lente chegando ] ────────── circuito ┘

   No toque, a faixa de direção fica à esquerda e as ações à direita; a velocidade sobe
   para cima da direção (retrato) ou vai para o centro (paisagem). */

.hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; color: #fff; font-variant-numeric: tabular-nums; animation: fade-in 0.35s ease both; }
.hud small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.09em; color: rgba(255, 255, 255, 0.86); }

/* ---- canto de cima, à esquerda ---- */
.hud-tl {
  position: absolute; top: calc(14px + var(--safe-t)); left: calc(16px + var(--safe-l));
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
}
.hud-btns { display: flex; gap: 8px; }
.hud-place {
  display: flex; align-items: baseline; gap: 7px;
  padding: 6px 16px 8px 14px; border-radius: 20px;
}
.hud-place b {
  display: block; font-size: 52px; font-weight: 800; font-style: italic; letter-spacing: -0.04em; line-height: 1;
  transform-origin: 30% 80%;
}
.hud-place small { font-size: 12px; letter-spacing: 0.06em; }
.hud-place[data-place="1"] b { color: #ffd84a; }
.hud-place[data-place="2"] b { color: #e6ecf4; }
.hud-place[data-place="3"] b { color: #f2b27a; }
.hud-place b.up { animation: place-up 0.55s var(--pop); }
.hud-place b.down { animation: place-down 0.55s ease; }
@keyframes place-up { 0% { color: #7CF29A; transform: scale(1.5); } 60% { color: #7CF29A; } 100% { transform: scale(1); } }
@keyframes place-down { 0% { color: #ff9d8a; transform: scale(0.78); } 60% { color: #ff9d8a; } 100% { transform: scale(1); } }

/* ---- no alto, ao centro ---- */
.hud-center {
  position: absolute; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 22px; padding: 8px 22px 9px; border-radius: 20px; text-align: center; white-space: nowrap;
}
.hud-center b { display: block; margin-top: 1px; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.hud-center .hud-best b { color: #b9e3ff; }
.hud-center .final b { color: #ffd84a; }
.hud-center .hud-best.new b { animation: best-new 1.4s ease; }
@keyframes best-new { 0%, 60% { color: #7CF29A; text-shadow: 0 0 14px rgba(124, 242, 154, 0.8); } }
.hud-ghost {
  position: absolute; top: calc(72px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: baseline; gap: 8px; padding: 5px 14px 6px; border-radius: 980px; white-space: nowrap;
}
.hud-ghost b { font-size: 15px; font-weight: 700; }
.hud-ghost[data-sign="ahead"] b { color: #7CF29A; }
.hud-ghost[data-sign="behind"] b { color: #ffb4a8; }

/* ---- canto de cima, à direita: minimapa e olhinhos ---- */
.hud-tr {
  position: absolute; top: calc(14px + var(--safe-t)); right: calc(16px + var(--safe-r));
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.minimap { width: 148px; height: 148px; border-radius: 26px; overflow: hidden; }
.minimap canvas { width: 100%; height: 100%; display: block; }
.hud-eyes {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 13px 5px 6px; border-radius: 980px;
}
.hud-eyes canvas { width: 26px; height: 26px; }
.hud-eyes b { font-size: 17px; font-weight: 700; min-width: 1.25em; text-align: right; }
.hud-eyes .pips { display: flex; gap: 3px; }
.hud-eyes .pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.28); transition: background 0.3s ease, box-shadow 0.3s ease; }
.hud-eyes[data-level="1"] .pips i:nth-child(-n+1), .hud-eyes[data-level="2"] .pips i:nth-child(-n+2), .hud-eyes[data-level="3"] .pips i { background: #7CF29A; }
.hud-eyes.up { animation: eyes-up 0.3s ease; }
.hud-eyes.down { animation: eyes-down 0.45s ease; }
@keyframes eyes-up { 40% { transform: scale(1.14); } }
@keyframes eyes-down { 30% { transform: translateX(-4px); background: rgba(226, 85, 61, 0.8); } 60% { transform: translateX(4px); } }
.app:not(.has-eyes) .hud-eyes { display: none; }

/* ---- slot do item (teclado e controle; no toque o item é um botão) ---- */
.hud-item {
  position: absolute; left: calc(16px + var(--safe-l)); top: calc(148px + var(--safe-t));
  display: flex; align-items: center; gap: 12px;
}
.slot { position: relative; width: 76px; height: 76px; border-radius: 22px; overflow: hidden; transition: border-color 0.2s ease, box-shadow 0.25s ease; }
.slot canvas { width: 100%; height: 100%; display: block; }
.hud-item kbd {
  position: absolute; right: 5px; bottom: 5px; min-width: 22px; padding: 2px 5px; margin: 0;
  background: #fff; color: #1D1D1F; border: 0; box-shadow: 0 1px 0 rgba(8, 20, 40, 0.35); font-size: 11.5px;
}
.hud-item span {
  padding: 6px 12px; border-radius: 980px; background: var(--hud-glass); border: 1px solid var(--hud-line);
  font-size: 14px; font-weight: 700; white-space: nowrap;
  opacity: 0; transform: translateX(-8px); transition: opacity 0.3s ease, transform 0.3s var(--ease);
}
.hud-item span:empty { display: none; }
.hud-item.named span { opacity: 1; transform: none; }
.hud-item[data-state="vazio"] .slot { border-style: dashed; border-color: rgba(255, 255, 255, 0.34); background: rgba(11, 13, 18, 0.34); box-shadow: none; }
.hud-item[data-state="vazio"] kbd { display: none; }
.hud-item[data-state="roleta"] .slot { border-color: rgba(255, 255, 255, 0.7); }
.hud-item[data-state="cheio"] .slot { border-color: #fff; box-shadow: 0 0 0 3px var(--hud-accent), 0 0 0 6px rgba(77, 178, 255, 0.28); animation: slot-got 0.5s var(--pop); }
.hud-item.used .slot { animation: slot-used 0.35s ease; }
@keyframes slot-got { 0% { transform: scale(0.7); } 55% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes slot-used { 0% { transform: scale(1.18); filter: brightness(2); } 100% { transform: scale(1); filter: none; } }
.app:not(.has-items) .hud-item, .app:not(.has-items) .touch-item, .app.is-touch .hud-item { display: none; }

/* ---- efeitos ativos: escudo, ímã, turbo, vácuo (anel = tempo que resta) ---- */
.hud-fx {
  position: absolute; left: calc(16px + var(--safe-l)); top: calc(236px + var(--safe-t));
  display: flex; flex-direction: column; gap: 8px;
}
.app:not(.has-items) .hud-fx, .app.is-touch .hud-fx { top: calc(148px + var(--safe-t)); }
.fx-badge {
  --p: 1; --c: #4db2ff;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 13px 4px 4px; border-radius: 980px;
  background: var(--hud-glass); border: 1px solid var(--hud-line); box-shadow: var(--hud-shadow);
  font-size: 13px; font-weight: 700; white-space: nowrap;
  animation: fx-in 0.3s var(--pop) both;
}
.fx-badge i {
  position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 360deg), rgba(255, 255, 255, 0.18) 0);
  display: grid; place-items: center;
}
.fx-badge i::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: #12161f; }
.fx-badge canvas { position: relative; width: 22px; height: 22px; }
.fx-badge em { font-style: normal; font-weight: 600; color: rgba(255, 255, 255, 0.86); margin-left: 2px; }
.fx-badge.ending { animation: fx-ending 0.5s ease-in-out infinite; }
@keyframes fx-in { from { opacity: 0; transform: translateX(-10px) scale(0.9); } }
@keyframes fx-ending { 50% { opacity: 0.55; } }

/* ---- embaixo: velocidade + mini-turbo, e o nome do circuito ---- */
.hud-bottom {
  position: absolute; left: calc(16px + var(--safe-l)); right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b));
  display: flex; align-items: flex-end; justify-content: space-between;
}
.speed { position: relative; padding: 7px 16px 12px 14px; border-radius: 20px; min-width: 132px; }
.speed strong { font-size: 38px; font-weight: 800; font-style: italic; letter-spacing: -0.04em; line-height: 1; display: inline-block; min-width: 1.9em; text-align: right; }
.speed span { margin-left: 5px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.86); }
.circuit-tag { padding: 7px 14px; border-radius: 980px; font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }

/* mini-turbo: três gomos (azul, laranja, roxo) + a carga enchendo por baixo */
.turbo { position: relative; display: flex; gap: 3px; margin-top: 7px; height: 6px; opacity: 0.38; transition: opacity 0.15s ease; }
.turbo.on { opacity: 1; }
.turbo i { flex: 1; border-radius: 4px; background: rgba(255, 255, 255, 0.26); transition: background 0.12s ease, box-shadow 0.12s ease; }
.turbo em { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--charge, 0) * 100%); border-radius: 4px; background: rgba(255, 255, 255, 0.5); mix-blend-mode: overlay; pointer-events: none; }
.turbo[data-level="1"] i:nth-child(-n+1) { background: #3fb6ff; box-shadow: 0 0 10px #3fb6ff; }
.turbo[data-level="2"] i:nth-child(-n+2) { background: #ff9b2f; box-shadow: 0 0 10px #ff9b2f; }
.turbo[data-level="3"] i { background: #c46bff; box-shadow: 0 0 12px #c46bff; }
.turbo.boost i { background: #fff; box-shadow: 0 0 12px #fff; }

/* ---- largada: semáforo + número ---- */
.countdown {
  position: absolute; left: 0; right: 0; top: calc(78px + var(--safe-t));
  display: grid; justify-items: center; gap: 10px;
}
.lights { display: flex; gap: 12px; padding: 10px 16px; border-radius: 980px; background: var(--hud-glass-strong); }
.lights i {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06) 60%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.18);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.countdown[data-n="3"] .lights i:nth-child(-n+1), .countdown[data-n="2"] .lights i:nth-child(-n+2), .countdown[data-n="1"] .lights i {
  background: radial-gradient(circle at 35% 30%, #ffd0c4, #ff5a45 55%, #c8281c);
  box-shadow: 0 0 18px rgba(255, 90, 69, 0.85), inset 0 0 0 1.5px rgba(255, 255, 255, 0.4);
}
.countdown.go .lights i {
  background: radial-gradient(circle at 35% 30%, #d9ffe2, #3ddc6d 55%, #129c41);
  box-shadow: 0 0 20px rgba(61, 220, 109, 0.9), inset 0 0 0 1.5px rgba(255, 255, 255, 0.45);
}
.countdown b {
  margin-top: 6px;
  font-size: clamp(88px, 18vh, 150px); font-weight: 800; font-style: italic; letter-spacing: -0.05em; line-height: 0.95;
  color: #fff; -webkit-text-stroke: 3px rgba(11, 13, 18, 0.5); paint-order: stroke fill;
  text-shadow: 0 6px 30px rgba(8, 20, 40, 0.5);
  animation: count-pop 0.6s var(--pop) both;
}
.countdown b:empty { display: none; }
/* a dica vem ANTES das luzes (em cima, sobre o céu): embaixo do número ela cobria o pelotão */
.countdown span { order: -1; padding: 9px 18px; border-radius: 980px; font-size: 14px; font-weight: 600; text-align: center; max-width: 88vw; }
.countdown.go b { color: #7CF29A; animation: count-go 0.8s var(--ease) both; }
@keyframes count-pop { from { transform: scale(1.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes count-go { 0% { transform: scale(0.6); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 70% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }

/* lembrete das teclas nas primeiras largadas (some sozinho) */
.keys-tip {
  position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100vw - 340px);
  padding: 8px 18px; border-radius: 22px; background: var(--hud-glass-strong);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  animation: toast-in 0.4s var(--ease) both;
}
.keys-tip.out { animation: toast-out 0.3s ease both; }
.keys-tip kbd { background: #fff; color: #1D1D1F; border: 0; box-shadow: 0 1.5px 0 rgba(255, 255, 255, 0.35); margin: 0 3px 0 0; }
.keys-tip kbd + kbd { margin-left: -1px; }
.app.is-touch .keys-tip { display: none; }

/* ---- bandeirada: uma faixa quadriculada cruza a tela na chegada ---- */
.flag { position: absolute; left: 0; right: 0; top: 0; height: 100%; overflow: hidden; z-index: -1; }
.flag i {
  position: absolute; left: -30%; top: calc(150px + 4%); width: 160%; height: 44px;
  background:
    conic-gradient(#fff 25%, #14171d 0 50%, #fff 0 75%, #14171d 0) 0 0 / 22px 22px;
  box-shadow: 0 10px 30px rgba(8, 20, 40, 0.35);
  transform: translateX(-110%) rotate(-3deg);
  animation: flag-sweep 1.5s var(--ease) both;
}
@keyframes flag-sweep { 0% { transform: translateX(-110%) rotate(-3deg); } 32%, 66% { transform: translateX(0) rotate(-3deg); } 100% { transform: translateX(110%) rotate(-3deg); } }

/* ---- avisos (um de cada vez) ---- */
.notices { position: absolute; left: 0; right: 0; top: calc(86px + var(--safe-t)); display: grid; justify-items: center; padding: 0 16px; }
.hud:has(.hud-ghost:not([hidden])) .notices { top: calc(112px + var(--safe-t)); }
.toast {
  max-width: min(92vw, 560px); padding: 10px 20px; border-radius: 980px;
  background: var(--hud-glass-strong);
  font-size: 15px; font-weight: 700; text-align: center; letter-spacing: -0.005em;
  animation: toast-in 0.3s var(--ease) both;
}
.toast[data-tone="good"] { box-shadow: 0 0 0 2px rgba(124, 242, 154, 0.75), var(--hud-shadow); }
.toast[data-tone="bad"] { box-shadow: 0 0 0 2px rgba(255, 138, 128, 0.85), var(--hud-shadow); }
.toast[data-tone="item"] { box-shadow: 0 0 0 2px rgba(77, 178, 255, 0.8), var(--hud-shadow); }
.toast.out, .banner.out { animation: toast-out 0.2s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }
.banner {
  padding: 0 8px; text-align: center;
  font-size: clamp(38px, 7.4vw, 68px); font-weight: 800; font-style: italic; letter-spacing: -0.04em; line-height: 1.05;
  color: #fff; -webkit-text-stroke: 2.5px rgba(11, 13, 18, 0.55); paint-order: stroke fill;
  text-shadow: 0 5px 26px rgba(8, 20, 40, 0.55);
  animation: count-pop 0.5s var(--pop) both;
}
.banner[data-kind="final"] { color: #ffd84a; }
.banner[data-kind="chegada"] { color: #7CF29A; }

.warn {
  position: absolute; left: 50%; top: 31%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px;
  padding: 10px 20px 10px 12px; border-radius: 980px;
  background: #c62828; border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 15px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(120, 10, 10, 0.4);
  animation: warn-blink 0.9s ease-in-out infinite;
}
.warn::before { content: '!'; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: #c62828; font-weight: 800; }
@keyframes warn-blink { 50% { opacity: 0.72; } }

/* Lente chegando: seta do lado de onde ela vem + barra de proximidade */
.incoming {
  position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 980px;
  background: #c2410c; border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 26px rgba(120, 40, 0, 0.45);
  font-size: 13.5px; font-weight: 700; white-space: nowrap;
  animation: toast-in 0.2s ease both;
}
.incoming canvas { width: 28px; height: 28px; flex: none; border-radius: 50%; background: #fff; }
.incoming.now { background: #b91c1c; animation: incoming-now 0.24s ease-in-out infinite; }
.incoming.now .arrow { display: none; }
@keyframes incoming-now { 50% { transform: translateX(-50%) scale(1.07); } }
.incoming span { display: grid; gap: 4px; }
.incoming .meter { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.incoming .meter em { display: block; height: 100%; width: calc(var(--near, 0) * 100%); background: #fff; border-radius: inherit; }
.incoming .arrow { width: 22px; height: 22px; opacity: 0.25; }
.incoming[data-side="-1"] .arrow-l, .incoming[data-side="1"] .arrow-r { opacity: 1; animation: arrow-pulse 0.45s ease-in-out infinite; }
.incoming[data-side="0"] .arrow { opacity: 0.6; }
@keyframes arrow-pulse { 50% { transform: scale(1.3); } }

/* ------------------------------------------------------------ controles de toque */
.touch {
  position: absolute; left: 0; right: 0; bottom: calc(22px + var(--safe-b)); z-index: 6;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l));
  pointer-events: none;
}
.steer-pad, .touch button {
  pointer-events: auto;
  background: linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.16));
  border: 1.5px solid rgba(255, 255, 255, 0.62);
  color: #fff;
  box-shadow: 0 2px 0 rgba(8, 20, 40, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  touch-action: none;
  text-shadow: 0 1px 0 rgba(8, 20, 40, 0.45);
  transition: transform 0.12s ease, background 0.12s ease;
}
.steer-pad {
  --steer: 0;
  position: relative;
  width: 196px; height: 96px; border-radius: 48px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
}
.steer-arrow { width: 32px; height: 32px; pointer-events: none; }
.steer-knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.5); border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 0 rgba(8, 20, 40, 0.2);
  /* (o curso é curto de propósito: virado até o fim, o botão para ANTES da seta) */
  transform: translateX(calc(var(--steer) * var(--travel, 28px)));
  pointer-events: none; z-index: 1;
}
.steer-pad.is-down { background: linear-gradient(rgba(0, 113, 227, 0.5), rgba(0, 113, 227, 0.36)); }
.steer-pad.is-down .steer-knob { background: #fff; }
.touch-actions { display: grid; grid-template-columns: auto auto; gap: 10px 12px; align-items: end; justify-items: center; }
.touch button { border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 2px; font-size: 12px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.touch button .ic { width: 28px; height: 28px; }
.touch .touch-drift { width: 96px; height: 96px; grid-column: 2; grid-row: 2; background: linear-gradient(rgba(0, 131, 255, 0.72), rgba(0, 100, 215, 0.62)); font-size: 13px; }
.touch .touch-drift .ic { width: 34px; height: 34px; }
.touch .touch-brake { width: 72px; height: 72px; grid-column: 1; grid-row: 2; align-self: end; }
.touch .touch-gas { width: 72px; height: 72px; grid-column: 2; grid-row: 1; background: linear-gradient(rgba(52, 199, 89, 0.7), rgba(36, 160, 70, 0.6)); }
.touch button.is-down, .touch button:active { transform: scale(0.93); background: rgba(0, 113, 227, 0.86); }
.app.auto-accel .touch-gas { display: none; }
/* item no toque: junto das ações, no alcance do polegar direito (o esquerdo não solta a direção) */
.touch .touch-item { width: 72px; height: 72px; border-radius: 24px; grid-column: 1; grid-row: 1; padding: 0; }
.app.auto-accel .touch .touch-item { grid-column: 2; justify-self: center; }
.touch .touch-item canvas { width: 52px; height: 52px; pointer-events: none; }
.touch .touch-item[data-state="vazio"] { opacity: 0.5; border-style: dashed; box-shadow: none; }
.touch .touch-item[data-state="cheio"] { background: rgba(255, 255, 255, 0.46); border-color: #fff; box-shadow: 0 0 0 3px var(--hud-accent), 0 0 0 6px rgba(77, 178, 255, 0.3); animation: slot-got 0.5s var(--pop); }

/* ------------------------------------------------------------ toque em pé */
.app.is-touch .hud-bottom { bottom: calc(22px + 96px + 14px + var(--safe-b)); }
.app.is-touch .circuit-tag { display: none; }
/* no toque o aviso da Lente fica no ALTO, logo abaixo da fila de avisos — embaixo ele encostava no
   botão do item, no velocímetro ou na faixa de direção, conforme o formato */
.app.is-touch .incoming { bottom: auto; top: calc(262px + var(--safe-t)); font-size: 13px; }
@media (max-width: 640px) and (max-height: 700px) { .app.is-touch .incoming { top: calc(246px + var(--safe-t)); } }
@media (max-height: 520px) and (orientation: landscape) { .app.is-touch .incoming { top: calc(150px + var(--safe-t)); } }
@media (max-height: 520px) and (orientation: landscape) and (max-width: 760px) { .app.is-touch .incoming { top: calc(200px + var(--safe-t)); font-size: 12.5px; } }

/* Celular em pé. De cima para baixo, sem nada por cima de nada:
     10 px   pausa · som | volta · tempo | minimapa
     62 px   COLOCAÇÃO                     olhinhos (sob o minimapa)
    122 px   efeitos ativos (só os ícones, em linha)
    166 px   avisos (um de cada vez) · 214 px contramão
   A pista e o kart ficam livres; embaixo, velocidade sobre a faixa de direção e as ações. */
@media (max-width: 640px) {
  .hud-tl { top: calc(10px + var(--safe-t)); left: calc(12px + var(--safe-l)); gap: 8px; }
  .hud-tr { top: calc(10px + var(--safe-t)); right: calc(12px + var(--safe-r)); gap: 8px; }
  .hud-center { top: calc(10px + var(--safe-t)); gap: 14px; padding: 6px 14px 7px; border-radius: 16px; }
  .hud-center b { font-size: 16px; }
  .hud-center .hud-best { display: none; }
  .hud-place { padding: 5px 13px 6px 11px; border-radius: 18px; }
  .hud-place b { font-size: 40px; }
  .minimap { width: 96px; height: 96px; border-radius: 20px; }
  .hud-eyes b { font-size: 15px; }
  .hud-eyes canvas { width: 22px; height: 22px; }
  .hud-fx { left: calc(12px + var(--safe-l)); top: calc(122px + var(--safe-t)) !important; flex-direction: row; gap: 6px; }
  .fx-badge { padding: 3px; }
  .fx-badge b, .fx-badge em { display: none; }
  .fx-badge i { width: 32px; height: 32px; }
  .fx-badge canvas { width: 20px; height: 20px; }
  .hud-ghost { top: calc(60px + var(--safe-t)); }
  .notices, .hud:has(.hud-ghost:not([hidden])) .notices { top: calc(166px + var(--safe-t)); }
  .toast { font-size: 14px; padding: 9px 16px; }
  .banner { font-size: clamp(32px, 10.5vw, 44px); }
  .warn { top: calc(214px + var(--safe-t)); font-size: 14px; padding: 8px 16px 8px 9px; }
  .countdown { top: calc(168px + var(--safe-t)); gap: 8px; }
  .countdown b { font-size: clamp(84px, 17vh, 150px); }
  .countdown span { font-size: 13px; padding: 8px 14px; }
  .flag i { top: calc(214px + var(--safe-t)); }
  .hud-bottom { left: calc(16px + var(--safe-l)); }
  .speed { padding: 5px 13px 10px 11px; min-width: 0; border-radius: 16px; }
  .speed strong { font-size: 28px; }
  .speed span { font-size: 11px; }
  .steer-pad { width: 184px; height: 92px; --travel: 25px; padding: 0 12px; }
  .touch .touch-drift { width: 92px; height: 92px; }
  .touch .touch-brake, .touch .touch-gas, .touch .touch-item { width: 68px; height: 68px; }
  .app.is-touch .hud-bottom { bottom: calc(22px + 92px + 12px + var(--safe-b)); }
}
/* celular em pé e baixo (até ~700 px úteis): tudo um pouco menor para a pista respirar */
@media (max-width: 640px) and (max-height: 700px) {
  .speed { padding: 4px 10px 8px 9px; }
  .speed strong { font-size: 22px; }
  .turbo { margin-top: 5px; height: 5px; }
  .hud-place b { font-size: 34px; }
  .minimap { width: 84px; height: 84px; border-radius: 18px; }
  .hud-fx { top: calc(116px + var(--safe-t)) !important; }
  .notices, .hud:has(.hud-ghost:not([hidden])) .notices { top: calc(156px + var(--safe-t)); }
  .warn { top: calc(200px + var(--safe-t)); }
  .countdown { top: calc(156px + var(--safe-t)); gap: 6px; }
  .countdown b { font-size: 84px; }
  .lights { padding: 7px 12px; gap: 9px; }
  .lights i { width: 20px; height: 20px; }
  .touch { bottom: calc(14px + var(--safe-b)); }
  .steer-pad { height: 84px; }
  .touch .touch-drift { width: 84px; height: 84px; }
  .touch .touch-brake, .touch .touch-gas, .touch .touch-item { width: 62px; height: 62px; }
  .touch .touch-item canvas { width: 46px; height: 46px; }
  .app.is-touch .hud-bottom { bottom: calc(14px + 84px + 10px + var(--safe-b)); }
}
/* estreito (até 374 px): os controles encolhem um pouco para não se tocarem */
@media (max-width: 374px) {
  .steer-pad { width: 164px; height: 86px; --travel: 20px; padding: 0 10px; }
  .steer-arrow { width: 28px; height: 28px; }
  .steer-knob { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
  .touch .touch-drift { width: 84px; height: 84px; }
  .touch .touch-brake, .touch .touch-gas, .touch .touch-item { width: 62px; height: 62px; }
  .touch-actions { gap: 8px 8px; }
  .touch { padding: 0 calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l)); }
  .minimap { width: 84px; height: 84px; }
}
/* bem estreito (320 px): cabeçalho do HUD no limite — tudo cabe em 300 px */
@media (max-width: 340px) {
  .hud-tl { left: calc(8px + var(--safe-l)); }
  .hud-tr { right: calc(8px + var(--safe-r)); }
  .hud-btns { gap: 6px; }
  .hud-center { gap: 10px; padding: 5px 9px 6px; }
  .hud-center b { font-size: 15px; }
  .minimap { width: 72px; height: 72px; border-radius: 16px; }
  .hud-eyes { padding: 4px 9px 4px 5px; gap: 5px; }
  .hud-eyes .pips { display: none; }
  .hud-fx { left: calc(8px + var(--safe-l)); }
  .steer-pad { width: 146px; height: 80px; --travel: 16px; padding: 0 8px; }
  .steer-arrow { width: 26px; height: 26px; }
  .steer-knob { width: 36px; height: 36px; margin: -18px 0 0 -18px; }
  .touch .touch-drift { width: 78px; height: 78px; }
  .touch .touch-drift .ic { width: 28px; height: 28px; }
  .touch .touch-brake, .touch .touch-gas, .touch .touch-item { width: 58px; height: 58px; }
  .touch button .ic { width: 24px; height: 24px; }
  .touch button { font-size: 11px; }
  .touch-actions { gap: 6px 6px; }
  .touch { padding: 0 calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l)); }
  .hud-bottom { left: calc(8px + var(--safe-l)); }
  .toast { font-size: 13px; padding: 8px 13px; }
  .countdown span { font-size: 12px; }
}

/* ------------------------------------------------------------ paisagem baixa (celular deitado) */
@media (max-height: 520px) and (orientation: landscape) {
  .hud-tl { top: calc(8px + var(--safe-t)); gap: 6px; }
  .hud-tr { top: calc(8px + var(--safe-t)); gap: 6px; flex-direction: row-reverse; align-items: flex-start; }
  .hud-center { top: calc(8px + var(--safe-t)); gap: 16px; padding: 5px 16px 6px; border-radius: 16px; }
  .hud-center b { font-size: 16px; }
  .hud-place { padding: 4px 12px 5px 10px; border-radius: 16px; }
  .hud-place b { font-size: 34px; }
  .minimap { width: 92px; height: 92px; border-radius: 20px; }
  .hud-item { top: calc(112px + var(--safe-t)); }
  .slot { width: 60px; height: 60px; border-radius: 18px; }
  .hud-fx { top: calc(112px + var(--safe-t)) !important; flex-direction: row; gap: 6px; }
  .fx-badge { padding: 3px; }
  .fx-badge b, .fx-badge em { display: none; }
  .fx-badge i { width: 32px; height: 32px; }
  .hud-ghost { top: calc(54px + var(--safe-t)); }
  .notices { top: calc(60px + var(--safe-t)); }
  .hud:has(.hud-ghost:not([hidden])) .notices { top: calc(90px + var(--safe-t)); }
  .toast { font-size: 14px; padding: 8px 16px; max-width: min(56vw, 480px); }
  .banner { font-size: 38px; }
  .warn { top: calc(106px + var(--safe-t)); font-size: 14px; padding: 7px 16px 7px 8px; }
  .countdown { top: calc(58px + var(--safe-t)); gap: 4px; }
  .countdown b { font-size: 76px; margin-top: 0; }
  .countdown span { font-size: 12.5px; padding: 6px 14px; max-width: 54vw; }
  .lights { padding: 6px 11px; gap: 8px; }
  .lights i { width: 18px; height: 18px; }
  .flag i { top: calc(104px + var(--safe-t)); height: 34px; }
  .speed { padding: 4px 12px 9px 10px; border-radius: 16px; min-width: 0; }
  .speed strong { font-size: 26px; }
  .touch { bottom: calc(14px + var(--safe-b)); }
  .steer-pad { width: 184px; height: 84px; --travel: 25px; padding: 0 12px; }
  .touch .touch-drift { width: 86px; height: 86px; }
  .touch .touch-brake, .touch .touch-gas, .touch .touch-item { width: 64px; height: 64px; }
  .touch .touch-item { border-radius: 20px; }
  .touch .touch-item canvas { width: 44px; height: 44px; }
  .touch-actions { gap: 6px 10px; }
  /* deitado os botões ficam sobre a pista: mais opacos, para o que passa por baixo não confundir */
  .steer-pad, .touch .touch-brake, .touch .touch-item { background: linear-gradient(rgba(40, 48, 62, 0.62), rgba(30, 36, 48, 0.56)); }
  /* no toque deitado a velocidade fica ao lado da faixa de direção (o centro é do kart) */
  .app.is-touch .hud-bottom { bottom: calc(14px + var(--safe-b)); left: calc(16px + 184px + 12px + var(--safe-l)); }
}
/* deitado e estreito (até 760 px de largura): não há espaço entre a direção e o kart — a velocidade
   sobe para a coluna da esquerda, sob a colocação, e os efeitos ativos ficam ao lado dela */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 760px) {
  .hud-center .hud-best { display: none; }
  .hud-center { gap: 12px; padding: 5px 12px 6px; }
  .minimap { width: 80px; height: 80px; border-radius: 18px; }
  .hud-place b { font-size: 30px; }
  .app.is-touch .hud-bottom { bottom: auto; top: calc(110px + var(--safe-t)); left: calc(16px + var(--safe-l)); }
  .speed { padding: 3px 10px 7px 8px; border-radius: 14px; }
  .speed strong { font-size: 20px; min-width: 1.7em; }
  .speed span { font-size: 10px; margin-left: 3px; }
  .turbo { margin-top: 4px; height: 4px; }
  .hud-fx { top: calc(110px + var(--safe-t)) !important; left: calc(112px + var(--safe-l)); }
  .warn { top: calc(156px + var(--safe-t)); }
  .steer-pad { width: 168px; height: 78px; --travel: 20px; padding: 0 10px; }
  .steer-arrow { width: 28px; height: 28px; }
  .steer-knob { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
  .touch .touch-drift { width: 80px; height: 80px; }
  .touch .touch-brake, .touch .touch-gas, .touch .touch-item { width: 58px; height: 58px; }
  .touch .touch-item canvas { width: 40px; height: 40px; }
  .touch { bottom: calc(10px + var(--safe-b)); }
  .toast { max-width: 50vw; font-size: 13px; padding: 7px 13px; }
  .banner { font-size: 32px; }
  .countdown b { font-size: 64px; }
}
