:root {
  --panel: rgba(12, 16, 24, 0.76);
  --card: rgba(13, 17, 26, 0.93);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f6f8;
  --muted: #aeb8c6;
  --accent: #ffd166;
  --red: #e10600;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1018;
  color: var(--text);
  font-family: "Segoe UI", system-ui, Roboto, Arial, sans-serif;
}
body { -webkit-user-select: none; user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
h2, h3 { margin: 0; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 14px 0 8px; }

button, input, select { font: inherit; color: var(--text); }
button {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); border-radius: 9px;
  padding: 8px 14px; font-weight: 600; cursor: pointer;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.17); }
button:disabled { cursor: default; opacity: 0.55; }
button.primary { background: var(--red); border-color: var(--red); }
button.primary:hover:not(:disabled) { background: #ff2a1f; }
button.big { font-size: 18px; padding: 12px 34px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input, select {
  background: #1a2130; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0;
}

/* ================= HUD ================= */
#hud { display: none; }
body.racing #hud { display: block; }
.panel {
  position: fixed; background: var(--panel); border-radius: 12px; padding: 10px 12px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}
.bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.bar > div { height: 100%; width: 0; border-radius: 4px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; margin-bottom: 3px; font-size: 11px; color: var(--muted); }
.bar-label b { color: var(--text); }
.bar-label i { font-style: normal; color: var(--accent); }

#tower { top: 12px; left: 12px; width: 232px; }
#race-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
#pos-row { display: flex; align-items: baseline; gap: 5px; }
#pos { font-size: 36px; font-weight: 800; color: var(--accent); line-height: 1.1; }
#pos-total { color: var(--muted); }
#lap { margin-left: auto; font-size: 19px; font-weight: 700; }
#standings { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; }
#standings li { display: flex; align-items: center; gap: 6px; height: 19px; border-radius: 4px; padding: 0 3px; }
#standings li.me { color: var(--accent); font-weight: 700; }
#standings li.focus { background: rgba(255, 255, 255, 0.13); }
#standings .idx { width: 18px; text-align: right; color: var(--muted); }
#standings .name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#standings .gap { width: 42px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 400; }
#standings .gap.inpit { color: #5ad1ff; font-weight: 700; }
.teambar { width: 4px; height: 13px; border-radius: 2px; flex: none; }
.tyre { width: 15px; height: 15px; border-radius: 50%; border: 2px solid; font-size: 8px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }

#topright { top: 12px; right: 12px; text-align: right; width: 224px; }
#timer { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.split { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.split b { color: var(--text); }
#minimap { display: block; margin: 8px 0 0 auto; width: 200px; height: 143px; border-radius: 8px; background: rgba(0, 0, 0, 0.25); }
#ping { font-size: 10px; color: var(--muted); margin-top: 3px; }

#bottomright { position: fixed; right: 12px; bottom: 12px; display: flex; gap: 10px; align-items: flex-end; }
#bottomright .panel { position: static; }
#carstatus { width: 236px; }
.status-row { display: flex; align-items: center; gap: 10px; }
.status-row .bar-label { margin-top: 0; }
.grow { flex: 1; }
#tyre-letter { width: 36px; height: 36px; border-radius: 50%; border: 4px solid; display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.damage { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.boxrow { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
#next-tyre { display: flex; gap: 5px; }
#next-tyre button { width: 29px; height: 29px; padding: 0; border-radius: 50%; border: 3px solid var(--c); font-size: 11px; opacity: 0.45; }
#next-tyre button.on { opacity: 1; background: rgba(255, 255, 255, 0.2); }
#btn-pit { padding: 5px 12px; font-size: 13px; }
#pit-state { font-size: 12px; font-weight: 700; color: #5ad1ff; margin-top: 5px; min-height: 0; }

#speedo { width: 190px; text-align: right; }
#speed-row { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-bottom: 6px; }
#gear { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--accent); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
#speed { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.unit { font-size: 12px; color: var(--muted); }
#rpm-fill { background: linear-gradient(90deg, #06d6a0 55%, #ffd166 80%, #ef476f); }
#boost-fill { background: #2fa8ff; }
#boost-bar.active { box-shadow: 0 0 10px #5ad1ff; }
#surface-note { margin-top: 5px; font-size: 12px; font-weight: 700; color: var(--accent); }
body.spectating #carstatus { display: none; }

#pitpanel {
  position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); display: none; width: min(420px, 88vw);
  background: var(--card); border: 1px solid #5ad1ff; border-radius: 12px; padding: 12px 16px; text-align: center;
}
#pitpanel.show { display: block; }
#pitpanel .bar { height: 12px; margin: 8px 0; }
#pit-fill { background: #5ad1ff; }
#pit-title { font-weight: 800; }
#pit-detail { font-size: 13px; color: var(--muted); white-space: pre; }

#race-chat { position: fixed; left: 258px; bottom: 12px; width: min(300px, 30vw); font-size: 13px; }
#race-chat-log { max-height: 130px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
#race-chat-log > div { background: var(--panel); border-radius: 6px; padding: 2px 8px; margin-top: 3px; align-self: flex-start; transition: opacity 1s; }
#race-chat-log > div.old { opacity: 0; }
#race-chat.typing #race-chat-log > div.old { opacity: 1; }
#race-chat-form { opacity: 0; pointer-events: none; margin-top: 4px; }
#race-chat.typing #race-chat-form { opacity: 1; pointer-events: auto; }
#race-chat input { width: 100%; }
.sys { color: var(--muted); font-style: italic; }

#center {
  position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%); text-align: center; white-space: nowrap;
  font-weight: 900; font-size: 84px; text-shadow: 0 4px 18px rgba(0, 0, 0, 0.5); pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
#center.show { opacity: 1; }
#center.finish { font-size: 32px; background: var(--panel); padding: 14px 24px; border-radius: 14px; }
#warning {
  position: fixed; left: 50%; top: 16%; transform: translateX(-50%); display: none; white-space: nowrap;
  background: #c1121f; padding: 10px 20px; border-radius: 10px; font-weight: 800;
}
#warning.show { display: block; }
#toast {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%, -8px); opacity: 0; max-width: 92vw; text-align: center;
  background: var(--panel); padding: 9px 18px; border-radius: 10px; font-weight: 700; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.good { color: #d79bff; }
#toast.bad { background: rgba(193, 18, 31, 0.92); }
#sectors { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
#weather { color: #a6e4ff; }
#weather:empty, #radio:empty { display: none; }
#radio {
  position: fixed; left: 50%; bottom: 16%; transform: translateX(-50%);
  width: max-content; max-width: 86vw; padding: 9px 14px;
  background: var(--panel); border-left: 3px solid #59c9ff; border-radius: 8px;
  text-align: center; pointer-events: none;
}

#flag {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%); white-space: nowrap;
  padding: 8px 22px; border-radius: 10px; font-weight: 900; letter-spacing: 0.04em;
  background: #ffd60a; color: #1a1500; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); pointer-events: none;
}
#flag:empty { display: none; }
#flag.sc { background: repeating-linear-gradient(115deg, #ffd60a 0 26px, #ffb000 26px 52px); }
#flag.green { background: #06d6a0; }
#flag.out { background: #c1121f; color: #fff; }
#setup-info:empty { display: none; }
#testpanel { display: none; left: 12px; bottom: 12px; width: 380px; max-width: 40vw; }
body.testing #testpanel { display: block; }
body.testing #race-chat, body.testing #tower { display: none; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.preset-row button { font-size: 13px; padding: 6px 10px; }
.preset-row button.on { background: var(--accent); color: #191300; border-color: var(--accent); }
.sector-table { font-variant-numeric: tabular-nums; }
.sector-table th, .sector-table td { font-size: 12px; padding: 3px 6px; width: auto; }
.sector-table td.fastest { color: #d79bff; font-weight: 800; }
.sector-table tr.current td:first-child { color: var(--accent); font-weight: 700; }
#livery-preview { width: 100%; height: auto; border-radius: 10px; background: #2a303b; display: block; }
.pair.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 10px; }
.pair.parts select { width: 100%; min-width: 0; }
.columns.two { grid-template-columns: 1fr 1fr; }
.field b { color: var(--text); }
input[type="color"] { padding: 2px; height: 36px; width: 100%; cursor: pointer; }

/* Autók fölötti nevek */
#labels { position: fixed; inset: 0; pointer-events: none; }
.label { position: absolute; left: 0; top: 0; padding: 1px 7px; border-radius: 5px; background: rgba(0, 0, 0, 0.55); border-left: 4px solid #fff; font-size: 11px; white-space: nowrap; }
.label.human { font-weight: 800; font-size: 13px; background: rgba(0, 0, 0, 0.75); }

/* ================= Menük ================= */
#menu { position: fixed; inset: 0; display: none; z-index: 10; }
#menu.open { display: block; }
body.in-menu #menu { background: linear-gradient(105deg, rgba(5, 8, 14, 0.86), rgba(5, 8, 14, 0.35)); }
.screen { display: none; position: absolute; inset: 0; overflow: auto; padding: 18px; }
.screen.active { display: flex; }
.card { margin: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5); }
.card.narrow { width: min(400px, 100%); }
.card.medium { width: min(660px, 100%); }
.card.wide { width: min(1080px, 100%); }
.card.full { width: min(1380px, 100%); }
.card header { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.card header span { color: var(--muted); font-size: 14px; }
.card footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.logo { font-size: 44px; font-weight: 900; font-style: italic; letter-spacing: -0.02em; line-height: 1; border-bottom: 5px solid var(--red); padding-bottom: 10px; }
.logo span { display: block; color: var(--accent); }
.lead { color: var(--muted); margin: 10px 0 4px; }
.mainnav { display: flex; flex-direction: column; gap: 9px; }
.mainnav button { text-align: left; font-size: 17px; padding: 12px 16px; }
.columns { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; }
.columns.three { grid-template-columns: minmax(240px, 300px) minmax(250px, 320px) 1fr; }
.columns > div { min-width: 0; }

.track-card canvas { width: 100%; height: auto; background: rgba(255, 255, 255, 0.05); border-radius: 10px; }
.track-name { font-weight: 800; margin-top: 6px; }
.track-tag { color: var(--muted); font-size: 13px; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.settings .field { margin: 0; }
.field input, .field select { font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; }
.note { color: var(--muted); font-size: 13px; line-height: 1.45; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input[type="text"], .inline input:not([type]) { flex: 1; }
.inline .check { margin: 0; }

.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.team { border: 1px solid var(--line); border-top: 4px solid var(--team); border-radius: 10px; padding: 8px 9px; background: rgba(255, 255, 255, 0.035); }
.team-head { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; background: var(--team); border: 3px solid var(--accent2); flex: none; }
.stats { margin: 6px 0; }
.stat { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.stat span:first-child { width: 48px; }
.meter { flex: 1; height: 4px; background: rgba(255, 255, 255, 0.12); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.seats { display: flex; flex-direction: column; gap: 4px; }
.seat { font-size: 12px; padding: 4px 6px; font-weight: 500; }
.seat.selected, .seat.selected:hover { background: var(--team); border-color: var(--accent2); font-weight: 800; text-shadow: 0 0 4px #000, 0 0 2px #000; }
.seat.human { font-style: italic; }

ul, ol { list-style: none; margin: 0; padding: 0; }
#rooms li, #members li { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); margin-bottom: 5px; }
#rooms { max-height: 230px; overflow: auto; }
#rooms .name { flex: 1; display: flex; flex-direction: column; }
#rooms small { color: var(--muted); }
#rooms .empty { color: var(--muted); }
#members { max-height: 220px; overflow: auto; }
#members li { padding: 4px 8px; font-size: 14px; }
#members li.me { outline: 1px solid var(--accent); }
#members .name { flex: 1; }
#members .team-short { color: var(--muted); font-size: 12px; }
#members .flag { font-size: 12px; color: var(--accent); min-width: 76px; text-align: right; }
.chatlog { height: 140px; overflow: auto; background: rgba(0, 0, 0, 0.3); border-radius: 8px; padding: 7px 9px; font-size: 13px; margin-bottom: 7px; user-select: text; }

table { width: 100%; border-collapse: collapse; margin-top: 6px; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--accent); white-space: nowrap; width: 120px; }
.rules { margin-top: 12px; }
.rules li { font-size: 14px; line-height: 1.45; margin-bottom: 6px; color: var(--muted); }
.rules b { color: var(--text); }

#error { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); background: #c1121f; padding: 9px 18px; border-radius: 9px; font-weight: 700; max-width: 92vw; z-index: 20; }
#error:empty { display: none; }

/* ================= Eredmények ================= */
#results {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none; z-index: 9;
  width: min(640px, calc(100vw - 24px)); max-height: 94vh; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}
#results.show { display: flex; }
#results-sub { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
#results-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
#results-tabs button.on { background: var(--accent); color: #191300; border-color: var(--accent); }
#results-body { overflow: auto; min-height: 0; }
.champion { text-align: center; font-size: 22px; font-weight: 800; color: var(--accent); padding: 6px 0 10px; }
.table li { display: flex; align-items: center; gap: 9px; padding: 3px 4px; font-size: 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.table li.me { color: var(--accent); font-weight: 700; }
.table .idx { width: 26px; text-align: right; color: var(--muted); }
.table .name { flex: 1; }
.table .extra { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.table .value { min-width: 104px; text-align: right; font-variant-numeric: tabular-nums; white-space: pre; }
#results-timer { color: var(--muted); font-size: 13px; text-align: center; margin-top: 8px; }
#results footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; }
#results footer .primary { margin-left: auto; }

/* ================= Felvezetés és díjátadó ================= */
#ceremony { position: fixed; inset: 0; display: none; pointer-events: none; z-index: 8; }
#ceremony.show { display: block; }
#ceremony::before, #ceremony::after { content: ""; position: absolute; left: 0; right: 0; height: 6vh; background: #05070b; }
#ceremony::before { top: 0; }
#ceremony::after { bottom: 0; }
#ceremony-head { position: absolute; left: 0; right: 0; bottom: 11vh; text-align: center; padding: 0 16px; }
#ceremony-title { font-weight: 900; font-style: italic; font-size: clamp(30px, 6vw, 62px); text-shadow: 0 4px 20px rgba(0, 0, 0, 0.75); }
#ceremony-sub { font-size: clamp(15px, 2.2vw, 22px); font-weight: 700; color: var(--accent); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); }
#ceremony-cards { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.card-driver {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; text-align: left; min-width: 240px;
  background: var(--card); border-left: 6px solid; border-radius: 10px; padding: 9px 16px;
}
.card-driver b { grid-row: span 2; font-size: 28px; }
.card-driver .name { font-weight: 800; font-size: 18px; }
.card-driver .crew { color: var(--muted); font-size: 13px; }
.card-driver.me .name { color: var(--accent); }
#btn-skip { position: absolute; right: 16px; bottom: calc(6vh + 10px); pointer-events: auto; background: var(--card); }
body.ceremony #hud #tower, body.ceremony #hud #topright, body.ceremony #hud #bottomright, body.ceremony #hud #testpanel,
body.ceremony #hud #toast, body.ceremony #hud #radio, body.ceremony #hud #flag, body.ceremony #hud #warning,
body.ceremony #hud #race-chat, body.ceremony #hud #pitpanel { visibility: hidden; }
body.ceremony-podium #announcer { display: none; }
body.podium-backdrop #hud { visibility: hidden; }
/* Az eredménytábla jobbra húzódik, hogy az ünneplés látsszon mögötte. */
@media (min-width: 1100px) {
  body.podium-backdrop #results { left: auto; right: 16px; transform: translateY(-50%); width: min(520px, 42vw); }
}
#announcer {
  position: fixed; left: 50%; top: 62px; transform: translateX(-50%); z-index: 7; pointer-events: none;
  width: max-content; max-width: 86vw; text-align: center; padding: 7px 16px;
  background: var(--panel); border-bottom: 3px solid var(--red); border-radius: 8px; font-weight: 700;
}
#announcer:empty { display: none; }

/* ================= Főmenü ================= */
body.in-menu #menu:has(.screen.active[data-screen="main"]) {
  background: linear-gradient(90deg, rgba(5, 8, 14, 0.9) 0%, rgba(5, 8, 14, 0.55) 34%, rgba(5, 8, 14, 0) 60%);
}
.home { margin: auto auto auto 3vw; width: min(500px, 100%); }
.home .logo { font-size: 56px; text-shadow: 0 6px 26px rgba(0, 0, 0, 0.6); }
#badge {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 6px 0 12px; padding: 10px 14px; text-align: left;
  background: var(--card); border-radius: 14px;
}
#badge .avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--red); font-size: 20px; font-weight: 900;
}
#badge .who { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#badge small { color: var(--muted); font-weight: 500; }
#badge .meter { flex: none; display: block; }
#badge .count { color: var(--accent); white-space: nowrap; }
.home-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile-btn {
  grid-column: span 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 2px;
  text-align: left; padding: 9px 12px; min-height: 86px; background: var(--card); border-radius: 14px;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.tile-btn:hover:not(:disabled), .tile-btn:focus-visible { transform: translateY(-3px); border-color: var(--accent); background: #1c2437; }
.tile-btn .icon { font-size: 24px; margin-bottom: auto; }
.tile-btn b { font-size: 14px; }
.tile-btn small { font-size: 11px; color: var(--muted); font-weight: 500; line-height: 1.3; }
.tile-btn.hero {
  grid-column: 1 / -1; min-height: 100px; border-color: transparent;
  background: linear-gradient(115deg, #e10600 0%, #a50808 62%, #5c0b16 100%);
}
.tile-btn.hero:hover:not(:disabled), .tile-btn.hero:focus-visible { background: linear-gradient(115deg, #ff2a1f 0%, #c40d0d 62%, #75101e 100%); }
.tile-btn.hero b { font-size: 26px; font-style: italic; }
.tile-btn.hero small { color: #ffe3e0; font-size: 13px; }
.tile-btn.mid { grid-column: span 2; min-height: 86px; }
.tile-btn.mid b { font-size: 18px; }

/* ================= Profil ================= */
.rank-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.rank-line b { font-size: 26px; font-style: italic; color: var(--accent); }
.rank-line span { color: var(--muted); font-size: 13px; }
#profile-body > .meter { display: block; flex: none; height: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 14px; }
.tile { background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 10px 12px; }
.tile b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); }
.trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.trophy-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 12px 10px;
  border: 1px dashed var(--line); border-radius: 12px;
}
.trophy-card .icon { font-size: 34px; filter: grayscale(1); opacity: 0.3; }
.trophy-card small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.trophy-card .when { margin-top: auto; }
.trophy-card.got { border: 1px solid var(--accent); background: linear-gradient(160deg, rgba(255, 209, 102, 0.17), rgba(255, 209, 102, 0.03)); }
.trophy-card.got .icon { filter: none; opacity: 1; }
.history li { display: flex; gap: 10px; align-items: baseline; padding: 5px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.history b { width: 34px; color: var(--accent); }
.history .note { margin: 0 0 0 auto; }
#results-trophies { color: var(--accent); font-weight: 800; font-size: 14px; margin-bottom: 8px; }
#results-trophies:empty { display: none; }

/* ================= Szponzorok ================= */
#badge .money { color: #7ee8a7; white-space: nowrap; }
.offers, .shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.offer, .upgrade {
  display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}
.offer.signed { border-color: var(--accent); background: rgba(255, 209, 102, 0.09); }
.offer.locked { opacity: 0.55; }
.offer small, .upgrade small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.offer .progress, .upgrade .progress { color: var(--accent); }
.offer button, .upgrade button { margin-top: auto; font-size: 13px; }
.brand { align-self: flex-start; padding: 4px 12px; border-radius: 5px; font-weight: 900; font-style: italic; font-size: 15px; }
.pips { display: flex; gap: 4px; }
.pips i { flex: 1; height: 7px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); }
.pips i.on { background: var(--accent); }
.career-foot { display: flex; justify-content: flex-end; }
#goal { font-size: 11px; font-weight: 700; color: #ff9aaa; margin-top: 4px; }
#goal.met { color: #06d6a0; }
#goal:empty { display: none; }
#results-earnings { margin-bottom: 8px; padding: 7px 10px; border-radius: 9px; background: rgba(126, 232, 167, 0.1); }
#results-earnings:empty { display: none; }
#results-earnings .sum { display: flex; justify-content: space-between; font-weight: 800; }
#results-earnings .sum b { color: #7ee8a7; }
#results-earnings .parts { font-size: 12px; color: var(--muted); }

/* ================= Időkülönbség, előzés, kijelzőméret ================= */
#tower, #topright, #bottomright { zoom: var(--hud-scale, 1); }
#gaps:empty { display: none; }
#gaps { margin: 4px 0 2px; padding: 4px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.gap-line { display: flex; align-items: center; gap: 6px; font-size: 13px; height: 20px; }
.gap-line .tag { width: 46px; font-size: 9px; color: var(--muted); }
.gap-line .name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gap-line b { font-variant-numeric: tabular-nums; }
.gap-line i { width: 10px; font-style: normal; font-size: 9px; }
.gap-line.good b, .gap-line.good i { color: #06d6a0; }
.gap-line.bad b, .gap-line.bad i { color: #ff6b81; }
#overtake {
  position: fixed; left: 50%; top: 29%; transform: translate(-50%, 10px) scale(0.94); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 12px; white-space: nowrap; padding: 8px 18px; border-radius: 10px;
  background: var(--card); border-left: 6px solid; transition: opacity 0.2s, transform 0.2s;
}
#overtake b { font-size: 24px; font-style: italic; }
#overtake.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#overtake.good { border-color: #06d6a0; }
#overtake.good b { color: #06d6a0; }
#overtake.bad { border-color: #ff6b81; }
#overtake.bad b { color: #ff6b81; }
body.ceremony #hud #overtake { visibility: hidden; }

/* ================= Kisebb képernyők ================= */
@media (max-width: 1100px) {
  .columns.three { grid-template-columns: 1fr 1fr; }
  .columns.three > div:last-child { grid-column: 1 / -1; }
  #race-chat { display: none; }
}
@media (max-width: 900px) {
  #bottomright { flex-direction: column-reverse; gap: 6px; }
  #topright { width: 170px; }
  #minimap { width: 146px; height: 104px; }
  #tower { width: 196px; }
}
@media (max-width: 720px) {
  .columns, .columns.two, .columns.three { grid-template-columns: 1fr; }
  #center { font-size: 52px; }
  .table .extra { display: none; }
}
@media (max-width: 1000px) {
  .home { margin: auto auto 0; }
  body.in-menu #menu:has(.screen.active[data-screen="main"]) {
    background: linear-gradient(0deg, rgba(5, 8, 14, 0.9) 0%, rgba(5, 8, 14, 0.5) 55%, rgba(5, 8, 14, 0) 75%);
  }
}
@media (max-width: 560px), (max-height: 640px) {
  .home .logo { font-size: 36px; }
  .home .lead { display: none; }
  .tile-btn, .tile-btn.mid { min-height: 76px; }
  .tile-btn.hero { min-height: 82px; }
  .tile-btn small { display: none; }
}
@media (max-width: 560px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .tile-btn.mid { grid-column: span 1; }
}
