/* Formula Racer — rozhraní ve stylu časomíry a volantového displeje.
   Rozvržení: celoobrazovkové plátno, HUD v rozích, menu jako panel vlevo nad ukázkovým závodem. */
:root {
  --ink: #0b0d11;            /* pozadí, noční asfalt */
  --panel: rgba(11, 13, 17, 0.84);
  --panel-solid: #12151b;
  --line: rgba(241, 240, 234, 0.13);
  --fg: #f1f0ea;
  --muted: #9ba1ab;
  --signal: #ffc61a;         /* žlutá vlajka / akcent */
  --purple: #b65cff;         /* nejrychlejší kolo */
  --green: #34d26b;          /* osobní zlepšení */
  --red: #ff3b30;            /* startovní světla */
  --blue: #4fd1ff;           /* ERS */
  --f-display: "Chakra Petch", "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 16px;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

#game, #game3d {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

/* ------------------------------------------------------------ HUD */
.hud { position: fixed; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
.hud.split.top { inset: 0 0 50% 0; }
.hud.split.bottom { inset: 50% 0 0 0; border-top: 2px solid rgba(0, 0, 0, 0.6); }
.hud.split .tower { width: 170px; top: 10px; left: 10px; }
.hud.split .tower li { line-height: 17px; font-size: 13px; }
.hud.split .minimap { width: 120px; height: 120px; top: 10px; right: 10px; }
.hud.split .timing { left: 10px; bottom: 10px; transform: scale(0.85); transform-origin: left bottom; }
.hud.split .dash { right: 10px; bottom: 10px; transform: scale(0.78); transform-origin: right bottom; }
.hud.split .msg { top: 30%; font-size: 18px; }
.hud-name { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-family: var(--f-display); font-weight: 700; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--signal); }
.hud-name:empty { display: none; }
.hud.split .hud-name { top: auto; bottom: 14px; }
.hud.dim > *:not(.msg) { opacity: 0.25; }

.tower {
  position: absolute;
  top: calc(14px + var(--safe-t)); left: calc(14px + var(--safe-l));
  width: 196px;
  background: var(--panel);
  border-top: 3px solid var(--signal);
  font-family: var(--f-display);
}
.hud.tt .tower ol { display: none; }
.tower-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 12px 7px;
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.tower-head b { font-size: 20px; color: var(--fg); letter-spacing: 0.02em; }
.tower ol { list-style: none; margin: 0; padding: 4px 0; }
.tower li {
  display: grid; grid-template-columns: 24px 4px 1fr auto; align-items: center; gap: 8px;
  padding: 2px 12px; font-size: 14px; line-height: 20px;
}
.tower li .p { text-align: right; color: var(--muted); }
.tower li .sw { width: 4px; height: 14px; }
.tower li .c { font-weight: 600; letter-spacing: 0.04em; }
.tower li .g { color: var(--muted); font-size: 12.5px; }
.tower li.me { background: var(--fg); color: var(--ink); }
.tower li.me .p, .tower li.me .g { color: var(--ink); }
.tower li.mate { background: rgba(255, 198, 26, 0.18); }
.tower li.fl .c::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; background: var(--purple); border-radius: 50%; vertical-align: middle; }

.minimap {
  position: absolute;
  top: calc(14px + var(--safe-t)); right: calc(14px + var(--safe-r));
  width: 190px; height: 190px;
  background: var(--panel);
  border-radius: 50%;
}

.timing {
  position: absolute;
  left: calc(14px + var(--safe-l)); bottom: calc(14px + var(--safe-b));
  min-width: 220px;
  background: var(--panel);
  padding: 8px 12px;
  font-family: var(--f-display);
}
.trow { display: flex; justify-content: space-between; gap: 18px; align-items: baseline; line-height: 26px; }
.trow span { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11.5px; color: var(--muted); }
.trow b { font-size: 19px; font-weight: 600; }
.trow:first-child b { font-size: 24px; }
.trow b.purple { color: var(--purple); }
.trow b.green { color: var(--green); }
.trow b.bad { color: var(--red); text-decoration: line-through; text-decoration-thickness: 2px; }
.delta { margin-top: 6px; text-align: center; font-family: var(--f-display); font-size: 22px; font-weight: 700; padding: 2px 0; }
.delta.green { background: rgba(52, 210, 107, 0.18); color: var(--green); }
.delta.red { background: rgba(255, 59, 48, 0.16); color: #ff7a72; }

.dash {
  position: absolute;
  right: calc(14px + var(--safe-r)); bottom: calc(14px + var(--safe-b));
  width: 300px;
  background: var(--panel);
  padding: 10px 14px 12px;
  font-family: var(--f-display);
}
.revs { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; margin-bottom: 8px; }
.revs i { height: 8px; border-radius: 2px; background: rgba(241, 240, 234, 0.1); }
.revs i.g { background: var(--green); box-shadow: 0 0 8px rgba(52, 210, 107, 0.6); }
.revs i.r { background: var(--red); box-shadow: 0 0 8px rgba(255, 59, 48, 0.6); }
.revs i.b { background: var(--purple); box-shadow: 0 0 8px rgba(182, 92, 255, 0.7); }
.dash-main { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 12px; }
.pos { font-size: 30px; font-weight: 700; color: var(--signal); line-height: 1; padding-bottom: 6px; }
.hud.tt .pos { visibility: hidden; }
.speed { text-align: right; line-height: 1; }
.speed b { font-size: 58px; font-weight: 700; letter-spacing: -0.02em; }
.speed span { display: block; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.gear {
  width: 52px; height: 62px; display: grid; place-items: center;
  border: 2px solid var(--fg); font-size: 40px; font-weight: 700; line-height: 1;
}
.ers { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; letter-spacing: 0.14em; color: var(--muted); }
.ers .bar { height: 7px; background: rgba(241, 240, 234, 0.1); overflow: hidden; }
.ers .bar i { display: block; height: 100%; background: var(--blue); transform-origin: left center; }
.ers .bar.active i { background: #9fe8ff; box-shadow: 0 0 12px var(--blue); }
.ers { grid-template-columns: auto 1fr auto auto; }
.ers em { font-style: normal; color: var(--signal); text-transform: uppercase; }
.ers em.drs { color: var(--muted); border: 1px solid var(--line); padding: 0 5px; letter-spacing: 0.08em; }
.ers em.drs.ready { color: var(--green); border-color: var(--green); }
.ers em.drs.open { color: var(--ink); background: var(--green); border-color: var(--green); }
.dash { padding-right: 58px; }
.steer-ind { position: relative; height: 6px; margin-top: 9px; background: rgba(241, 240, 234, 0.1); }
.steer-ind::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: rgba(241, 240, 234, 0.45); }
.steer-ind i { position: absolute; left: calc(50% - 6px); top: -2px; width: 12px; height: 10px; background: var(--signal); }
.dmg { position: absolute; right: 12px; top: 12px; width: 32px; height: 52px; }
.dmg rect { fill: rgba(241, 240, 234, 0.18); }
.dmg rect.warn { fill: var(--signal); }
.dmg rect.bad { fill: var(--red); }

.pause-btn {
  pointer-events: auto;
  position: fixed; z-index: 2;
  top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  width: 40px; height: 40px;
  border: 0; background: var(--panel);
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.pause-btn i { display: block; width: 4px; height: 14px; background: var(--fg); }

.msg {
  position: absolute; left: 50%; top: 26%;
  transform: translate(-50%, -8px);
  padding: 10px 22px;
  background: var(--panel-solid);
  border-left: 4px solid var(--fg);
  font-family: var(--f-display); font-weight: 700; font-size: 22px;
  text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
}
.msg.show { opacity: 1; transform: translate(-50%, 0); }
.msg.purple { border-left-color: var(--purple); }
.msg.green { border-left-color: var(--green); }
.msg.amber { border-left-color: var(--signal); }
.msg.bad { border-left-color: var(--red); }

/* ------------------------------------------------------------ startovní světla */
.lights {
  position: fixed; left: 50%; top: calc(70px + var(--safe-t)); transform: translateX(-50%);
  display: flex; gap: 10px; padding: 10px 14px;
  background: #050608;
  border-radius: 6px;
  pointer-events: none;
}
.pod { display: grid; gap: 6px; padding: 6px; background: #15171c; border-radius: 4px; }
.pod span { width: 30px; height: 30px; border-radius: 50%; background: #2a0d0d; }
.pod.on span:nth-child(n + 3) { background: var(--red); box-shadow: 0 0 18px rgba(255, 59, 48, 0.85), inset 0 -4px 8px rgba(0, 0, 0, 0.3); }

/* ------------------------------------------------------------ dotykové ovládání */
.touch-controls { position: fixed; inset: auto 0 0 0; pointer-events: none; padding: 0 max(16px, var(--safe-r)) calc(16px + var(--safe-b)) max(16px, var(--safe-l)); display: flex; justify-content: space-between; align-items: flex-end; }
.touch-controls button {
  pointer-events: auto; touch-action: none;
  border: 2px solid rgba(241, 240, 234, 0.35);
  background: rgba(11, 13, 17, 0.55);
  color: var(--fg);
  font-family: var(--f-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  border-radius: 14px;
}
.touch-controls button.held { background: rgba(241, 240, 234, 0.85); color: var(--ink); }
.tc-left { display: flex; gap: 12px; }
.tc-left button { width: 84px; height: 84px; font-size: 28px; }
.tc-right { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 12px; align-items: end; }
.tc-ers { grid-column: 1 / 3; justify-self: end; width: 84px; height: 46px; font-size: 14px; border-color: rgba(79, 209, 255, 0.6) !important; }
.tc-brake { width: 84px; height: 84px; font-size: 14px; }
.tc-gas { width: 92px; height: 120px; font-size: 15px; border-color: rgba(52, 210, 107, 0.7) !important; }

body.touch .timing { display: none; }
body.touch .dash { right: 50%; transform: translateX(50%) scale(0.62); transform-origin: bottom center; bottom: calc(8px + var(--safe-b)); }
@media (orientation: portrait) {
  body.touch .dash { bottom: calc(150px + var(--safe-b)); transform: translateX(50%) scale(0.7); }
}
@media (orientation: landscape) and (max-height: 500px) {
  body.touch .tower ol li:not(.me):nth-child(n + 4) { display: none; }
  body.touch .minimap { width: 110px; height: 110px; }
  .tc-left button, .tc-brake { width: 74px; height: 74px; }
  .tc-gas { height: 100px; }
}

/* ------------------------------------------------------------ menu */
.menu {
  position: fixed; inset: 0;
  overflow-y: auto;
  background: linear-gradient(90deg, rgba(11, 13, 17, 0.95) 0, rgba(11, 13, 17, 0.9) 600px, rgba(11, 13, 17, 0.12) 880px);
  padding-left: max(16px, var(--safe-l)); padding-right: max(16px, var(--safe-r));
  padding-block: calc(28px + var(--safe-t)) calc(28px + var(--safe-b));
}
.menu-panel { width: 100%; max-width: 580px; display: grid; gap: 20px; padding-left: 12px; }
.brand h1 {
  margin: 4px 0 6px;
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(44px, 9vw, 68px); line-height: 0.88; letter-spacing: -0.01em; text-transform: uppercase;
  font-style: italic;
}
.brand h1 span { display: block; color: var(--signal); }
.eyebrow { margin: 0; font-family: var(--f-display); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.lede { margin: 8px 0 0; font-size: 17px; color: #c8ccd3; max-width: 40ch; }

.field { display: grid; gap: 8px; }
.label { font-family: var(--f-display); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); width: max-content; max-width: 100%; }
.seg button {
  border: 0; background: transparent; padding: 9px 16px;
  font-family: var(--f-display); font-weight: 600; font-size: 15px;
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--ink); }
.seg button:hover:not([aria-pressed="true"]) { background: rgba(241, 240, 234, 0.08); }

.tracks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-height: 330px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.track-card {
  position: relative;
  display: grid; gap: 3px; padding: 6px 6px 8px; text-align: left;
  background: rgba(241, 240, 234, 0.04); border: 1px solid var(--line);
}
.track-card canvas { width: 100%; height: auto; aspect-ratio: 150 / 92; max-width: 100%; }
.tc-round { position: absolute; top: 5px; left: 7px; font-family: var(--f-display); font-size: 11px; color: var(--muted); }
.track-card[aria-pressed="true"] { border-color: var(--signal); background: rgba(255, 198, 26, 0.08); }
.tc-name { font-family: var(--f-display); font-weight: 600; font-size: 13px; line-height: 1.15; }
.tc-meta { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.blurb { margin: 0; font-size: 15px; color: #c8ccd3; }

.teams { display: flex; flex-wrap: wrap; gap: 8px; }
.team-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 8px; background: transparent; border: 1px solid var(--line);
  font-weight: 600; font-size: 15px;
}
.team-chip[aria-pressed="true"] { border-color: var(--fg); background: rgba(241, 240, 234, 0.1); }
.livery { width: 26px; height: 14px; flex: none; background: linear-gradient(180deg, var(--c1) 0 60%, var(--c2) 60% 100%); }
.livery.big { width: 40px; height: 22px; }
.team-chip { padding: 6px 10px 6px 7px; font-size: 14px; }
.seats { margin-top: 4px; }
.seats button { font-size: 13.5px; padding: 7px 12px; }

/* záložky */
.tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; padding: 10px 13px 9px;
  font-family: var(--f-display); font-weight: 600; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--signal); }
.tabs button:hover { color: var(--fg); }

/* profil, online, kariéra */
.profile { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.profile label { display: grid; gap: 4px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-family: var(--f-display); }
input {
  font: inherit; font-size: 16px; color: var(--fg); background: rgba(241, 240, 234, 0.06);
  border: 1px solid var(--line); padding: 8px 10px; width: 190px; text-transform: none; letter-spacing: 0;
  -webkit-user-select: text; user-select: text;
}
input.short { width: 76px; }
input:focus { outline: 2px solid var(--signal); outline-offset: 0; }
.netbox { display: grid; gap: 12px; }
.join { display: inline-flex; gap: 0; }
.join input { width: 104px; text-transform: uppercase; letter-spacing: 0.2em; font-family: var(--f-display); font-weight: 700; }
.join .ghost { border-left: 0; }
.lobby-code { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.lobby-code b { font-family: var(--f-display); font-size: 40px; letter-spacing: 0.18em; color: var(--signal); line-height: 1; }
.ghost.small { padding: 6px 10px; font-size: 13px; }
.ghost.danger { color: #ff8a82; }
.lobby-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lobby-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(241, 240, 234, 0.05); border-left: 3px solid var(--line); }
.lobby-list li b { font-family: var(--f-display); }
.net-status { margin: 0; min-height: 1.2em; color: var(--muted); font-size: 15px; }
.net-status.bad { color: #ff8a82; }
.career { display: grid; gap: 14px; }
.career-head { display: flex; align-items: center; gap: 12px; font-size: 17px; }
.career-head b { font-family: var(--f-display); font-size: 20px; }
.career-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.career-stats div { background: rgba(241, 240, 234, 0.05); padding: 8px 10px; display: grid; gap: 2px; }
.career-stats span { font-family: var(--f-display); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.career-stats b { font-family: var(--f-display); font-size: 24px; line-height: 1; }
.standings { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; }
table.results.small { font-size: 14px; }
table.results.small td { padding: 4px 6px; }
.credits { font-size: 12px; opacity: 0.8; }

/* načítání */
.loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: rgba(8, 10, 13, 0.72); z-index: 5; font-family: var(--f-display); letter-spacing: 0.08em; text-transform: uppercase; }
.spinner { width: 38px; height: 38px; border: 3px solid rgba(241, 240, 234, 0.2); border-top-color: var(--signal); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.primary {
  border: 0; background: var(--signal); color: var(--ink);
  font-family: var(--f-display); font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 13px 30px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}
.primary:hover { background: #ffd54d; }
.ghost {
  border: 1px solid var(--line); background: transparent; padding: 11px 18px;
  font-family: var(--f-display); font-weight: 600; font-size: 15px;
}
.ghost:hover { background: rgba(241, 240, 234, 0.08); }

.keys { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; font-size: 14px; }
.keys div { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.keys dt { font-family: var(--f-display); font-weight: 600; color: var(--fg); white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }
.fine { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 52ch; }
body.touch .keys { display: none; }

/* ------------------------------------------------------------ pauza, výsledky */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(5, 6, 8, 0.6);
  padding-left: max(16px, var(--safe-l)); padding-right: max(16px, var(--safe-r));
  padding-block: calc(16px + var(--safe-t)) calc(16px + var(--safe-b));
  overflow-y: auto;
}
.card { background: var(--panel-solid); border-top: 3px solid var(--signal); padding: 22px 24px; width: 100%; max-width: 340px; display: grid; gap: 16px; }
.card.wide { max-width: 680px; }
.card h2 { margin: 0; font-family: var(--f-display); font-size: 28px; text-transform: uppercase; letter-spacing: 0.04em; text-wrap: balance; }
.stack { display: grid; gap: 10px; }
.stack button { width: 100%; }
.muted { color: var(--muted); margin: 2px 0 0; }
.res-head { display: flex; align-items: center; gap: 18px; }
.res-pos { font-family: var(--f-display); font-weight: 700; font-style: italic; font-size: 64px; line-height: 1; color: var(--signal); }
.table-wrap { overflow-x: auto; }
table.results { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.results th { text-align: left; font-family: var(--f-display); font-weight: 600; font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.results td { padding: 6px 8px; border-bottom: 1px solid rgba(241, 240, 234, 0.06); white-space: nowrap; }
.results td.p { font-family: var(--f-display); font-weight: 700; width: 34px; }
.results .sw { display: inline-block; width: 4px; height: 14px; margin-right: 8px; vertical-align: -2px; }
.results .num { text-align: right; font-family: var(--f-display); }
.results .team { color: var(--muted); }
.results tr.me td { background: rgba(255, 198, 26, 0.12); }
.results .purple { color: var(--purple); }
.bad-txt { color: #ff8a82; }

/* ------------------------------------------------------------ úzké obrazovky */
@media (max-width: 760px) {
  .menu { background: rgba(11, 13, 17, 0.9); }
  .tracks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .standings { grid-template-columns: 1fr; }
  .tabs button { padding: 9px 9px 8px; font-size: 13.5px; }
  .menu-panel { padding-left: 0; margin: 0 auto; }
  .tower { width: 150px; }
  .tower ol li:not(.me):nth-child(n + 4) { display: none; }
  .dmg { display: none; }
  .minimap { width: 120px; height: 120px; }
  .timing { min-width: 0; }
  .msg { font-size: 17px; top: 22%; }
  .pod span { width: 22px; height: 22px; }
  .lights { top: 30%; }
  .results .team { display: none; }
}
@media (max-width: 420px) {
  .tracks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tc-left button { width: 72px; height: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  .msg { transition: none; }
  .spinner { animation-duration: 2.4s; }
}

/* ------------------------------------------------------------ úvodní obrazovka menu */
body:not(.menu-home) .brand h1 { font-size: clamp(30px, 5vw, 40px); }
.ver { color: var(--signal); }
.home { display: grid; gap: 12px; }
.home-hero {
  position: relative; display: grid; gap: 4px; text-align: left;
  padding: 18px 64px 18px 20px; border: 0; background: var(--signal); color: var(--ink);
  clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
}
.home-hero:hover { background: #ffd54d; }
.home-hero .hero-k { font-family: var(--f-display); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.75; }
.home-hero b { font-family: var(--f-display); font-size: 30px; font-style: italic; text-transform: uppercase; line-height: 1; }
.home-hero .hero-d { font-size: 15px; font-weight: 500; }
.home-hero .hero-arrow { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); font-size: 34px; font-weight: 700; }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.home-tile {
  display: grid; align-content: start; gap: 5px; text-align: left; padding: 14px 14px 16px;
  background: rgba(241, 240, 234, 0.05); border: 1px solid var(--line); min-height: 128px;
}
.home-tile:hover, .home-tile:focus-visible { background: rgba(241, 240, 234, 0.1); border-color: rgba(241, 240, 234, 0.35); }
.home-tile b { font-family: var(--f-display); font-size: 19px; text-transform: uppercase; letter-spacing: 0.03em; }
.home-tile span:last-child { font-size: 14px; color: var(--muted); line-height: 1.3; }
.ico { width: 28px; height: 28px; color: var(--signal); display: block; }
.ico svg { width: 100%; height: 100%; }
.home-help { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; background: transparent; border: 1px dashed var(--line); color: var(--muted); font-size: 15px; }
.home-help b { color: var(--fg); font-family: var(--f-display); text-transform: uppercase; margin-right: 6px; }
.home-help:hover { border-color: rgba(241, 240, 234, 0.35); color: var(--fg); }
.page-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.page-head h2 { margin: 0; font-family: var(--f-display); font-size: 26px; text-transform: uppercase; letter-spacing: 0.03em; }
.page-head p { margin: 4px 0 0; color: #c8ccd3; font-size: 15px; max-width: 46ch; }
.back { flex: none; border: 1px solid var(--line); background: transparent; padding: 8px 12px; font-family: var(--f-display); font-weight: 600; font-size: 14px; }
.back:hover { background: rgba(241, 240, 234, 0.08); }
.main-actions { position: sticky; bottom: calc(-28px - var(--safe-b)); z-index: 2; margin: 0 -12px; padding: 14px 12px calc(14px + var(--safe-b)); background: linear-gradient(180deg, rgba(11, 13, 17, 0) 0, rgba(11, 13, 17, 0.97) 35%); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--signal); font: inherit; text-decoration: underline; }

/* ------------------------------------------------------------ nápověda a uvítání */
.overlay.help { z-index: 6; }
.help-card { max-width: 760px; max-height: calc(100vh - 32px); overflow-y: auto; }
.help-top { display: flex; justify-content: space-between; align-items: center; }
.help-nav { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.help-nav button { border: 0; background: none; padding: 9px 12px; font-family: var(--f-display); font-weight: 600; font-size: 14px; text-transform: uppercase; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.help-nav button[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--signal); }
.help-sec h3 { margin: 18px 0 4px; font-family: var(--f-display); font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; }
.help-sec p { margin: 0; color: #c8ccd3; }
.kb { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.kgroup { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kgroup p { margin: 0 0 0 6px; color: #c8ccd3; }
.key {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 7px;
  border: 1px solid rgba(241, 240, 234, 0.35); border-bottom-width: 3px; border-radius: 5px;
  font-family: var(--f-display); font-weight: 700; font-size: 14px; color: var(--fg); background: rgba(241, 240, 234, 0.06);
}
.key.wide { padding: 0 10px; }
.tips { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 8px; color: #c8ccd3; }
.tips b { color: var(--fg); }
.red, .r { color: #ff6a5f; font-weight: 600; }
.g { color: var(--green); font-weight: 600; }
.y { color: var(--signal); font-weight: 600; }
.hud-help { margin: 6px 0 0; display: grid; gap: 10px; }
.hud-help div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.hud-help dt { font-family: var(--f-display); font-weight: 600; color: var(--fg); }
.hud-help dd { margin: 0; color: #c8ccd3; }
.overlay#intro { z-index: 6; }
.intro-card { max-width: 560px; }
.intro-card .eyebrow { margin-bottom: -10px; }
.intro-mouse {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid rgba(255, 198, 26, 0.35);
  border-left: 4px solid var(--signal);
  background: rgba(255, 198, 26, 0.07);
}
.intro-mouse-copy { display: grid; gap: 2px; flex: 1 1 240px; min-width: 0; }
.intro-mouse-copy b { font-family: var(--f-display); font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--signal); }
.intro-mouse-copy span { color: #c8ccd3; font-size: 14.5px; line-height: 1.35; }
.intro-mouse button {
  flex: 0 0 auto; border: 0; background: var(--signal); color: var(--ink);
  font-family: var(--f-display); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 10px 14px;
}
.intro-mouse button:hover:not([disabled]) { background: #ffd54d; }
.intro-mouse button[disabled] { background: transparent; border: 1px solid rgba(52, 210, 107, 0.5); color: var(--green); cursor: default; }
@media (pointer: coarse) { .intro-mouse { display: none; } }
.intro-steps { margin: 0; padding-left: 22px; display: grid; gap: 12px; font-size: 16.5px; color: #c8ccd3; }
.intro-steps b { color: var(--fg); }
.intro-steps .key { height: 26px; min-width: 26px; font-size: 13px; margin: 0 1px; }

/* ------------------------------------------------------------ načítání */
.boot { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #1a1e26, var(--ink) 70%); transition: opacity 0.4s; }
.boot.out { opacity: 0; pointer-events: none; }
.boot-in { width: min(420px, calc(100% - 32px)); display: grid; gap: 14px; }
.boot h1 { margin: 0; font-family: var(--f-display); font-style: italic; text-transform: uppercase; font-size: clamp(44px, 10vw, 64px); line-height: 0.88; }
.boot h1 span { display: block; color: var(--signal); }
.boot p { margin: 0; color: var(--muted); font-family: var(--f-display); letter-spacing: 0.06em; }
.bar { height: 6px; background: rgba(241, 240, 234, 0.12); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--signal); transition: width 0.3s; }
.loading { background: rgba(8, 10, 13, 0.88); text-transform: none; letter-spacing: 0; }
.load-stamp {
  width: 84px; height: 84px; color: var(--signal);
  transform: rotate(-6deg);
  filter: drop-shadow(0 0 18px rgba(255, 198, 26, 0.22));
}
.load-stamp svg { display: block; width: 100%; height: 100%; }
.load-stamp .ls-line { fill: none; stroke: currentColor; }
.load-stamp .ls-text { fill: currentColor; font: 800 10.5px "Chakra Petch", "Barlow Semi Condensed", Arial, sans-serif; letter-spacing: 0.01em; }
.load-stamp .ls-mono { fill: var(--fg); font: 700 28px "Chakra Petch", "Arial Black", Arial, sans-serif; }
.boot-stamp { width: 68px; height: 68px; justify-self: center; margin: 0 auto 2px; filter: drop-shadow(0 0 14px rgba(255, 198, 26, 0.2)); }
.load-card { display: grid; grid-template-columns: 260px minmax(0, 380px); gap: 26px; align-items: center; padding: 0 16px; }
.load-card canvas { width: 260px; height: 160px; }
.load-card h2 { margin: 2px 0 6px; font-family: var(--f-display); font-size: 34px; text-transform: uppercase; font-style: italic; }
.load-card .bar { margin: 16px 0 14px; }
.load-card .tip { margin: 0; color: #c8ccd3; font-family: var(--f-body); font-size: 15.5px; }
.race-hint {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); z-index: 3;
  padding: 10px 16px; background: var(--panel-solid); border-left: 4px solid var(--signal);
  font-size: 15.5px; color: #dcdfe4; white-space: nowrap; pointer-events: none;
}
.race-hint .key { height: 24px; min-width: 24px; font-size: 12.5px; margin: 0 2px; }
@media (max-width: 760px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-tile { min-height: 0; }
  .kb { grid-template-columns: 1fr; }
  .hud-help div { grid-template-columns: 1fr; gap: 2px; }
  .load-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .load-stamp { width: 66px; height: 66px; }
  .race-hint { display: none; }
}
body.touch .race-hint { display: none; }

/* ------------------------------------------------------------ v1.0.1: pneumatiky, boxy, vlajky, rádio */
.tyre { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.tyre-dot { width: 16px; height: 16px; border-radius: 50%; border: 4px solid #f2c12e; background: #121316; box-shadow: inset 0 0 0 2px #2a2c31; }
.tyre-c { color: var(--fg); font-size: 15px; }
.tyre-w.warn { color: var(--signal); }
.tyre-w.bad { color: var(--red); }
.tyre-rule { margin-left: auto; font-style: normal; color: var(--signal); border: 1px solid rgba(255, 198, 26, 0.5); padding: 0 5px; letter-spacing: 0.06em; }
.bad-txt { color: #ff7a72; }
.trow b.bad-txt { font-size: 17px; }

.flagbar {
  position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%);
  padding: 6px 22px; font-family: var(--f-display); font-weight: 700; font-size: 17px; letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--signal); color: var(--ink); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.flagbar.sc { animation: flagblink 1s steps(2, start) infinite; }
.flagbar.pit { background: #f2f1eb; }
@keyframes flagblink { 50% { background: #ffdf6b; } }
.hud.split .flagbar { top: 10px; font-size: 13px; padding: 4px 14px; }

.radio {
  position: absolute; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translateX(-50%);
  max-width: min(560px, 80vw); padding: 8px 16px 10px; background: var(--panel-solid);
  border-left: 4px solid var(--blue); font-family: var(--f-body); animation: radioIn 0.25s ease-out;
}
.radio-who { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue); }
.radio-who i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); animation: flagblink 0.6s steps(2, start) infinite; }
.radio-txt { margin: 3px 0 0; font-size: 18px; line-height: 1.25; }
@keyframes radioIn { from { opacity: 0; transform: translate(-50%, 8px); } }
.hud.split .radio { bottom: 12px; max-width: 46vw; }
.hud.split .radio-txt { font-size: 15px; }

.pitpanel {
  position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(200px + var(--safe-b));
  width: 300px; background: var(--panel); border-top: 3px solid #f2f1eb; padding: 8px 12px 10px; font-family: var(--f-display);
}
.pp-head { display: flex; justify-content: space-between; align-items: baseline; text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; color: var(--muted); }
.pp-head b { color: var(--fg); font-size: 16px; }
.pp-tyres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.pp-t { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.pp-t b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 4px solid var(--tc); color: var(--fg); font-size: 13px; }
.pp-t kbd { font: inherit; font-size: 10px; color: var(--muted); }
.pp-t.on { border-color: var(--fg); background: rgba(241, 240, 234, 0.1); color: var(--fg); }
.pp-note { margin: 8px 0 0; font-family: var(--f-body); font-size: 14px; color: var(--muted); }
.hud.split .pitpanel { transform: scale(0.8); transform-origin: right bottom; bottom: 150px; }

/* Kariérní přenos: startovní rošt a pozávodní studio. */
.cinema { position:fixed; inset:0; z-index:150; background:#080d16; color:#fff; display:flex; align-items:flex-end; overflow:hidden; border-block:6vh solid #000; }
.cinema[hidden] { display:none; }
.cinema-scene { position:absolute; inset:0; background:radial-gradient(ellipse at 70% 25%,#45617b,transparent 65%),linear-gradient(#101928 55%,#252b32 55%); }
.cinema-road { position:absolute; top:68%; width:200%; height:4px; background:repeating-linear-gradient(90deg,#fff 0 80px,transparent 80px 180px); animation:cinema-road 2s linear infinite; }
.cinema-car { position:absolute; top:48%; left:55%; width:230px; height:55px; background:var(--cine-color,#df2335); border-radius:45% 25% 15% 20%; box-shadow:-80px 14px 0 -4px #090b10,90px 14px 0 -4px #090b10; transform:skewX(-12deg); animation:cinema-car 7s ease-out both; }
.cinema-copy { position:relative; width:100%; padding:clamp(24px,6vw,80px); background:linear-gradient(transparent,#080d16 40%); }
.cinema-copy h1 { font-size:clamp(28px,5vw,64px); margin:12px 0; }
.cinema-copy p { max-width:720px; line-height:1.6; }
.weekend-card { padding:18px; margin:18px 0; border:1px solid #465365; border-radius:12px; background:#141e2b; }
.weekend-card .seg { flex-wrap:wrap; }
@keyframes cinema-road { to { transform:translateX(-180px); } }
@keyframes cinema-car { from { transform:translateX(35vw) skewX(-12deg); } to { transform:translateX(-30px) skewX(-12deg); } }
@media(prefers-reduced-motion:reduce) { .cinema-car,.cinema-road { animation:none; } }

.cinema-car { height:30px; border-radius:12px 70% 12px 8px; box-shadow:none; }
.cinema-car::before { content:""; position:absolute; width:20px; height:56px; left:0; bottom:0; background:var(--cine-color); border-top:7px solid #111; }
.cinema-car::after { content:""; position:absolute; width:50px; height:8px; right:-24px; bottom:0; background:var(--cine-color); }
.cine-wheel { position:absolute; bottom:-12px; width:45px; height:45px; border:10px solid #080a0e; border-radius:50%; background:#59616b; box-shadow:0 0 0 2px #dfb92d; }
.cine-wheel.rear { left:15px; }.cine-wheel.front { right:9px; }
.cine-helmet { position:absolute; top:-20px; left:91px; width:23px; height:23px; border-radius:50%; background:#eee; border-bottom:8px solid #141c29; }
