/* Kart Legend 2: racing HUD (game in the centre, details docked on the sides) and the career screens.
   Same paddock-sticker look as the menus: cream cards, ink outline, hard shadow. */

/* ---------- HUD frame: one zoom for everything (set from JS) ---------- */
.hud2 { position: fixed; inset: 0; pointer-events: none; font-size: 16px; }
.hud2 > *, .hud2 button { pointer-events: auto; }
.hud2 .glass { box-shadow: 0 .5rem 1.4rem rgba(0, 0, 0, .35); border-width: 2.5px; border-radius: .8rem; }
.h2-left { position: absolute; left: 14px; top: 14px; width: 270px; display: grid; gap: 8px; pointer-events: none; }
.h2-left > * { pointer-events: auto; }
.h2-tower { padding: 6px 6px; display: grid; gap: 2px; }
.tw2 { display: grid; grid-template-columns: 24px 10px minmax(0, 1fr) auto auto auto auto; align-items: center; gap: 5px; padding: 2px 5px; border-radius: 6px; font-size: 15.5px; }
.tw2 .p { font-family: var(--disp); text-align: center; }
.tw2 .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.tw2 .g { font-size: 15.5px; color: var(--muted); }
.tw2.me { background: var(--y); }
.tw2.me .g { color: var(--ink); }
.tw2.sep { height: 4px; padding: 0; background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 10px); }
.kl-dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); display: inline-block; }
.ic { font-style: normal; font-family: var(--disp); font-size: 15.5px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.ic.pen { background: var(--kerb); color: #fff; }
.ic.nose { background: #16181d; color: #ff8a1f; box-shadow: inset 0 0 0 2px #ff8a1f; }
.ic.blue { width: 10px; height: 12px; background: #2563c9; padding: 0; }
.ic.tyre { width: 9px; height: 9px; border-radius: 50%; background: #3ccf7a; padding: 0; border: 1px solid var(--line); }
.ic.tyre.cold { background: #5ec8ff; } .ic.tyre.hot { background: #ff6a3d; }
.h2-pen, .h2-warn { padding: 7px 9px; display: grid; gap: 4px; font-size: 15.5px; }
.h2-pen { background: #fff0ec; border-color: var(--kerb); }
.h2-pen > b, .h2-warn > b { font-size: 17px; }
.h2-pen .pr, .h2-warn .pr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.h2-pen .pr span, .h2-warn .pr span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h2-pen .dim, .h2-warn .dim { margin: 0; font-size: 15.5px; }

/* flags */
.fl { display: inline-block; width: 22px; height: 15px; border-radius: 3px; border: 1px solid var(--line); background: var(--fc, #1fa55b); vertical-align: middle; }
.fl-bw { background: linear-gradient(135deg, #111 50%, #fff 50%); }
.fl-nose { background: radial-gradient(circle, #ff8a1f 0 33%, #111 36%); }
.fl-chequered { background: repeating-conic-gradient(#111 0 25%, #fff 0 50%) 0 0 / 7px 7px; }
.fl-double { background: linear-gradient(90deg, var(--flagy) 46%, #111 46% 54%, var(--flagy) 54%); }
.fl-form { background: repeating-linear-gradient(90deg, #fff 0 4px, #1fa55b 4px 8px); }
.fl-lights { background: radial-gradient(circle at 30% 50%, #e5392b 0 22%, transparent 24%), radial-gradient(circle at 70% 50%, #e5392b 0 22%, transparent 24%), #16181d; }

/* top centre: race-control strip, then the stack (lights, messages, prompts, notices, coach) */
.h2-top { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); width: min(430px, 40vw); display: grid; justify-items: center; pointer-events: none; }
.h2-rc { display: flex; align-items: center; gap: 9px; padding: 6px 12px; min-width: 0; width: 100%; max-width: 100%; pointer-events: auto; }
.h2-rc .rc-t { font-family: var(--disp); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; text-align: center; }
.h2-rc .rc-x { font-size: 16px; font-weight: 800; min-width: 2.2em; text-align: right; }
.h2-rc[data-f="yellow"], .h2-rc[data-f="double"] { background: var(--flagy); }
.h2-rc[data-f="blue"] { background: #cfe0ff; }
.h2-rc[data-f="bw"] { background: #f2f2f2; }
.h2-rc[data-f="nose"] { background: #ffe2c6; }
.h2-stack { position: absolute; left: 0; right: 0; top: 52px; display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.h2-stack > * { pointer-events: auto; }
.h2-stack .h-msg { position: static; transform: none; display: grid; gap: 4px; justify-items: center; }
.h2-stack .h-msg .m { font-size: 17px; padding: 4px 14px; max-width: 100%; white-space: normal; text-align: center; }
.h2-stack .h-lights { position: static; transform: none; }
.h2-stack .kl-prompt, .h2-stack .kl-notice { position: static; transform: none; }
.hud2 .h-stamp { top: 34%; }

/* right: MyChron dash */
.h2-dash { position: absolute; right: 14px; top: 64px; width: 230px; pointer-events: none; }
.myc { background: #0f1418; color: #e9f2f6; border-color: var(--ink); padding: 8px 10px 9px; display: grid; gap: 4px; pointer-events: auto; }
.myc-top { display: flex; justify-content: space-between; font-family: var(--disp); font-size: 16px; letter-spacing: .04em; color: #9fb3be; }
.myc-gear { color: #fff; font-size: 22px; line-height: .8; display: none; }
.hud2.gears .myc-gear { display: block; }
.myc-rpm { position: relative; height: 11px; background: #1d2630; border-radius: 4px; overflow: hidden; }
.myc-rpm > i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #2fb36d, var(--y) 80%, #ff4a3a); }
.myc-rpm > i.hot { filter: brightness(1.25); }
.myc .leds { position: absolute; right: 3px; top: 2px; display: none; gap: 3px; }
.hud2.gears .myc .leds { display: flex; }
.myc .leds b { width: 7px; height: 7px; border-radius: 50%; background: #24303a; }
.myc .leds b.g { background: #3ccf7a; } .myc .leds b.y { background: var(--y); } .myc .leds b.r { background: #ff4a3a; box-shadow: 0 0 6px #ff4a3a; }
.myc-big { font-size: 27px; font-weight: 800; text-align: center; letter-spacing: -.02em; }
.myc-delta { text-align: center; font-size: 17px; font-weight: 800; color: #8aa0ad; }
.myc-delta.fast { color: #3ccf7a; } .myc-delta.slow { color: #ff6a5a; }
.myc-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 15.5px; color: #9fb3be; }
.myc-row b { color: #e9f2f6; font-size: 16px; }
.myc-row.spd { justify-content: center; gap: 6px; } .myc-row.spd b { font-size: 22px; }
.myc-sec { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.myc-sec i { font-style: normal; text-align: center; font-family: var(--mono); font-size: 15.5px; padding: 2px 0; border-radius: 4px; background: #1d2630; color: #8aa0ad; }
.myc-sec i.p { background: #8b3cd6; color: #fff; } .myc-sec i.g { background: #1fa55b; color: #fff; } .myc-sec i.y { background: #e6b800; color: #16181d; }
.tt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; background: #3ccf7a; }
.tt.cold { background: #5ec8ff; } .tt.hot { background: #ff6a3d; }
/* onboard camera: the wheel carries the MyChron, the side dash slims down */
.hud2.onboard .h2-dash { width: 150px; }
.hud2.onboard .myc-row:not(.spd), .hud2.onboard .myc-sec { display: none; }

/* bottom corners */
.h2-pos { position: absolute; left: 14px; bottom: 14px; padding: 6px 14px 8px; display: grid; transform: none; background: var(--y); }
.h2-pos b { font-size: 40px; line-height: .9; }
.h2-pos b small { font-size: 18px; }
.h2-pos span { font-size: 15.5px; font-weight: 700; }
.h2-map { position: absolute; right: 14px; bottom: 14px; width: 200px; height: 136px; background: #1d2733; }
.hud2 .h-pause { position: absolute; right: 14px; top: 14px; }
.hud2 .skip { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); }

/* touch (phones in landscape, tablets): controls at the bottom corners; every panel sits above them */
.hud2.is-touch .h2-left { width: 220px; }
.hud2.is-touch .h2-tower .tw2:nth-child(n+6) { display: none; }
.hud2.is-touch .h2-pos { position: relative; left: auto; top: auto; bottom: auto; transform: none; padding: 3px 10px; justify-self: start; }
.hud2.is-touch .h2-pos b { font-size: 26px; }
.hud2.is-touch .h2-dash { top: 14px; right: 74px; width: 158px; }
.hud2.is-touch .myc-row:not(.spd), .hud2.is-touch .myc-sec, .hud2.is-touch .myc-delta { display: none; }
.hud2.is-touch .myc-big { font-size: 22px; }
.hud2.is-touch .h2-map { width: 150px; height: 102px; right: 14px; top: 190px; bottom: auto; }
.hud2.is-touch .h2-top { width: min(400px, 40vw); }
.hud2 .touch { position: absolute; inset: auto 0 0 0; height: 46%; pointer-events: none; }
.hud2 .touch .t-l, .hud2 .touch .t-r, .hud2 .touch .t-m { position: absolute; bottom: 14px; display: flex; gap: 12px; pointer-events: none; }
.hud2 .touch .t-l { left: 14px; } .hud2 .touch .t-r { right: 14px; align-items: flex-end; }
.hud2 .touch .t-m { left: 50%; transform: translateX(-50%); bottom: 14px; gap: 8px; }
.hud2 .touch .tb { pointer-events: auto; width: 96px; height: 96px; border-radius: 50%; background: rgba(20, 26, 34, .82); border: 1px solid var(--line); font-family: var(--disp); font-size: 22px; color: var(--ink); box-shadow: 0 .5rem 1.4rem rgba(0, 0, 0, .35); }
.hud2 .touch .tb.big { width: 118px; height: 118px; background: rgba(255, 210, 63, .9); font-size: 26px; }
.hud2 .touch .tb-brake { position: relative; overflow: hidden; border-radius: 22px; height: 118px; width: 100px; font-size: 18px; }
.hud2 .touch .tb-brake i { position: absolute; left: 0; right: 0; bottom: 0; height: var(--bp, 0%); background: rgba(229, 57, 43, .35); }
.hud2 .touch .tb-cam, .hud2 .touch .tb-back { width: 70px; height: 54px; border-radius: 14px; font-size: 15.5px; line-height: 1; }
.hud2 .touch .tb.on { transform: translateY(.15rem); filter: brightness(.92); }
.hud2.is-touch .skip { bottom: auto; top: 60px; left: 50%; }
.hud2 .kl-prompt b { font-size: 17px; } .hud2 .kl-prompt .btn { font-size: 15.5px; } .hud2 .kl-prompt .key { font-size: 15px; }
.hud2 .kl-notice b { font-size: 20px; } .hud2 .kl-notice span { font-size: 15.5px; }
.hud2 .h-draft b { font-size: 15.5px; }
.hud2 .h-stamp b { font-size: 30px; } .hud2 .h-stamp span { font-size: 15.5px; }
.hud2 .finish b { font-size: 56px; }
.hud2 .skip { font-size: 15.5px; }
.hud2 .gotxt { font-size: 40px; }

/* ---------- career screens ---------- */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; font-weight: 700; font-size: max(.95rem, 12px); }
.k2-hub { position: absolute; left: 1.4rem; right: 1.4rem; top: 5.2rem; bottom: 1.2rem; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: .9rem; }
.k2-next { padding: 1.1rem 1.3rem; display: grid; align-content: start; gap: .45rem; min-height: 0; }
.k2-track { font-size: clamp(1.8rem, 4.2vh, 2.8rem); }
.k2-sub { font-weight: 600; color: var(--muted); font-size: max(.95rem, 12px); }
.k2-goal { display: grid; gap: .35rem; margin-top: .3rem; font-weight: 600; font-size: max(.95rem, 12px); }
.k2-go { display: flex; gap: .7rem; align-items: center; margin-top: .4rem; flex-wrap: wrap; }
.k2-stand { padding: .8rem 1rem; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: .3rem; min-height: 0; overflow: hidden; }
.k2-h { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.k2-h b { font-size: 1.4rem; } .k2-h .dim { margin: 0; }
.k2-rows { display: grid; gap: 2px; align-content: start; overflow: hidden; }
.sr { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .5rem; padding: .16rem .45rem; border-radius: .45rem; font-size: max(.95rem, 12px); }
.sr .p { font-family: var(--disp); } .sr .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.sr.top .p { color: var(--good); } .sr.me { background: var(--y); }
.riv { font-style: normal; font-size: max(.72rem, 12px); color: var(--kerb); font-weight: 700; text-transform: uppercase; }
.k2-tiles { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .7rem; }
.k2-tile { position: relative; display: grid; justify-items: center; gap: .25rem; padding: .6rem .4rem; font-size: max(.95rem, 12px); }
.k2-tile svg { width: 1.8rem; height: 1.8rem; }
.k2-tile.soon { opacity: .62; cursor: default; filter: grayscale(.6); }
.k2-tile.soon em { position: absolute; top: -.55rem; right: -.3rem; background: var(--carbon); color: var(--y); font-style: normal; font-size: max(.72rem, 12px); font-family: var(--disp); padding: .1rem .45rem; border-radius: .4rem; transform: none; }
.seg.small .lockd { padding: .35rem .7rem; opacity: .45; font-weight: 700; }
.k2-quick, .k2-ladder { position: absolute; left: 1.4rem; right: 1.4rem; top: 5.2rem; bottom: 1.2rem; display: grid; place-items: start center; }
.k2-q, .k2-lad { width: min(56rem, 100%); max-height: 100%; padding: 1rem 1.2rem; display: grid; gap: .3rem; overflow: hidden; }
.k2-tracks { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: .35rem; max-height: 30vh; overflow-y: auto; padding-right: .3rem; }
.k2-tracks button { display: flex; justify-content: space-between; gap: .4rem; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--card2); font-weight: 600; font-size: max(.9rem, 12px); text-align: left; }
.k2-tracks button em { font-style: normal; color: var(--muted); font-size: max(.8rem, 12px); }
.k2-tracks button.on { background: var(--y); }
.k2-qrow { display: flex; gap: 1.4rem; align-items: flex-end; flex-wrap: wrap; }
.k2-qgo { margin-left: auto; }
.lad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; }
.lc { display: grid; gap: .3rem; align-content: start; }
.lc .disp { font-size: 1.3rem; } .lc .dim { margin: 0; }
.lv { display: grid; gap: .25rem; }
.lv span { border: 1px solid var(--line); border-radius: .5rem; padding: .25rem .45rem; font-weight: 700; font-size: max(.85rem, 12px); display: flex; justify-content: space-between; background: #efe5cf; opacity: .7; }
.lv span.d { background: #c9f2d9; opacity: 1; } .lv span.c { background: var(--y); opacity: 1; }
.lv em { font-style: normal; font-family: var(--disp); }
.su { display: grid; gap: .25rem; }
.su-r h5 { margin: .35rem 0 .2rem; }
.su-r .dim { display: block; margin: .15rem 0 0; }
.su-warn { color: var(--kerb); font-weight: 700; font-size: max(.9rem, 12px); }
/* results */
.k2-res .res-r { display: grid; gap: .6rem; align-content: start; }
.k2-parc { padding: .7rem 1rem; display: grid; gap: .3rem; position: relative; }
.pc-r { display: grid; grid-template-columns: 6.5rem auto minmax(0, 1fr) auto; gap: .6rem; align-items: baseline; font-weight: 600; font-size: max(.95rem, 12px); }
.pc-r .dim { margin: 0; } .pc-r em { font-style: normal; font-family: var(--disp); } .pc-r em.ok { color: var(--good); } .pc-r em.no { color: var(--kerb); }
.pc-stamp { position: absolute; right: .8rem; top: .5rem; font-family: var(--disp); font-size: 1.15rem; padding: .1rem .6rem; border: 3px solid currentColor; border-radius: .5rem; transform: none; }
.pc-stamp.prov { color: #b07a00; } .pc-stamp.off { color: var(--good); animation: popIn .3s both; }
.k2-pts { padding: .7rem 1rem; display: grid; gap: .35rem; }
.k2-mini { display: grid; gap: 2px; }
.kl-res .res .pen { background: var(--kerb); color: #fff; border-radius: .3rem; padding: 0 .3rem; font-size: max(.8rem, 12px); }
.k2-champ { width: min(34rem, 92vw); padding: 1.2rem 1.4rem; display: grid; gap: .5rem; max-height: calc(100vh - 2rem); overflow: hidden; }
.k2-champ > b { font-size: 2.6rem; } .k2-champ p { margin: 0; font-weight: 600; }
.k2-champ.gold { background: linear-gradient(160deg, #fff3c2, #ffe08a); }
.kl-center { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; }
#coach .pill { position: fixed !important; left: 50% !important; top: auto !important; bottom: 130px !important; transform: translateX(-50%) !important; max-width: min(34rem, 62vw) !important; font-size: max(1rem, 13px) !important; text-align: center; }

/* small frames (800x450 and phones in landscape) */
@media (max-height: 520px) {
  .k2-hub { top: 4.4rem; gap: .6rem; }
  .k2-next { padding: .7rem 1rem; gap: .3rem; }
  .k2-tiles { gap: .45rem; } .k2-tile { padding: .35rem .3rem; } .k2-tile svg { width: 1.4rem; height: 1.4rem; }
  .k2-track { font-size: 1.7rem; }
  .k2-tracks { max-height: 22vh; }
  .k2-quick, .k2-ladder { top: 4.4rem; }
}
.hud2 [hidden] { display: none !important; }
.hud2 .h-pause { left: auto; right: 14px; top: 14px; bottom: auto; transform: none; z-index: 6; }
.hud2.is-touch .h-pause { left: auto; right: 14px; top: 14px; }
.k2-info { display: flex; gap: 1rem; align-items: center; margin-top: .5rem; min-height: 0; overflow: hidden; }
.k2-map { width: min(11rem, 26vh); height: auto; max-height: 24vh; flex: none; }
.k2-facts { display: grid; gap: .25rem; font-weight: 600; font-size: max(.92rem, 12px); }
.k2-facts em { font-style: normal; font-family: var(--disp); color: var(--kerb); text-transform: uppercase; font-size: max(.8rem, 12px); margin-right: .4rem; }
.k2-parc .dim, .k2-res .res-r .dim { text-shadow: none; color: var(--muted); }
@media (max-height: 520px) { .k2-map { max-height: 18vh; } .k2-facts span:nth-child(n+4) { display: none; } }

/* very low frames (phones in landscape): compact cards */
@media (max-height: 430px) {
  #qres .qbox { padding: .45rem .8rem; gap: .2rem; }
  #qres .qbox > b { font-size: 1.3rem; }
  #qres .qlist { grid-template-columns: 1fr 1fr; column-gap: .6rem; }
  #qres .qr { padding: 0 .35rem; font-size: 12px; }
  .k2-pts .kl-bars { display: none; }
  .k2-parc { padding: .35rem .7rem; gap: .1rem; }
  .k2-res .res-h b { font-size: 1.8rem; }
  .k2-res .res-r { gap: .35rem; }
}
.hud2 .h-pause { font-size: 20px; width: 48px; height: 48px; }
.hud2.is-touch .h2-top { width: min(500px, 54vw); }

/* the qualifying card covers the race HUD and tips */
body.qcard #hud, body.qcard #coach { visibility: hidden; }
/* "Skip tips" sits beside the minimap, never on the steering wheel */
.hud2 .skip { left: auto; right: 14px; bottom: 160px; transform: none; }
.hud2.is-touch .skip { top: auto; right: 14px; bottom: auto; left: auto; top: 300px; }
/* frames smaller than the QA sizes: the dash keeps only the essentials */
@media (max-height: 420px) { .hud2:not(.is-touch) .myc-sec, .hud2:not(.is-touch) .myc-row:not(.spd) { display: none; } }
.hud2 .tw2 .fl-nose { width: 16px; height: 12px; }

.h2-rc[data-spd="ok"] .rc-x { color: var(--good); } .h2-rc[data-spd="slow"] .rc-x { color: #b07a00; }
.h2-rc[data-spd="fast"] { background: var(--kerb); color: #fff; } .h2-rc[data-spd="fast"] .rc-x { color: #fff; }
.h2-pen .pr span { white-space: normal; }
.kl-garage .g-left .g-name, .kl-garage .g-left > p { background: rgba(20, 26, 34, .92); color: var(--ink); border: 1px solid var(--line); border-radius: .8rem; padding: .4rem .8rem; box-shadow: var(--sh); justify-self: start; align-self: flex-start; }
.kl-garage .g-left .dim { color: var(--muted); }
