/* Light Cycles: the field is one full-screen canvas; on top sit a thin HUD (pause, the riders' portraits), the
   connection strip online, the controls and the cards between rounds. The title screen and the sheets are
   shared/mainmenu.js (menu.css, loaded after this); only their colors are set here (--sg-*). */
:root {
  --bg: #05070f; --bg-hi: #0e1a44; --ink: #eaf2ff; --ink-soft: #9db0d8; --line: rgba(160, 200, 255, 0.18);
  --accent: #39e6ff; --accent-ink: #03141c; --panel: #0d1430; --panel-edge: #2a3a6e; --gold: #ffd43a;
  --sheet: #0f1733; --sheet-ink: #eaf2ff; --sheet-soft: #9db0d8;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
* { touch-action: manipulation; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  font-family: "Baloo 2", ui-rounded, system-ui, sans-serif; color: var(--ink);
  overflow: hidden; overscroll-behavior: none;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.app {
  position: fixed; inset: 0; overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---- the HUD ---- */
.hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5;
  padding: var(--sg-corner-top) 8px 0 var(--sg-corner-left); /* the corner's menu button heads the row (shared/menu.css) */
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.hud > * { pointer-events: auto; }
/* the connection strip runs along the top, its words right of the corner; the riders' faces sit under it */
.net:not([hidden]) + .hud .faces { margin-top: max(0px, calc(env(safe-area-inset-top, 0px) + 20px - var(--sg-corner-top))); }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 1px solid var(--panel-edge);
  border-radius: 12px; background: rgba(13, 20, 48, 0.85); cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; fill: none; }
.icon-btn:active { transform: scale(0.94); }
.faces { height: 40px; display: block; }

/* ---- the connection strip (online) ---- */
.net {
  position: absolute; left: 0; right: 0; top: 0; z-index: 6; height: calc(env(safe-area-inset-top, 0px) + 18px);
  padding: env(safe-area-inset-top, 0px) 10px 0 calc(var(--sg-corner-left) + 56px); display: flex; align-items: center; gap: 6px;
  font-size: 12px; line-height: 18px; font-weight: 700; color: var(--ink-soft); background: rgba(5, 7, 15, 0.8);
  font-variant-numeric: tabular-nums;
}
.net .dot { width: 8px; height: 8px; border-radius: 50%; background: #6c7aa0; flex: none; }
.net .dot.good { background: #3dffa0; } .net .dot.ok { background: #ffd43a; } .net .dot.bad { background: #ff5a1f; }

/* ---- controls ---- */
.pad { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; pointer-events: none; padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 14px); display: flex; justify-content: space-between; align-items: flex-end; }
.cluster { display: flex; gap: 10px; pointer-events: auto; }
.cluster.right { flex-direction: column; gap: 8px; }
.key, .half {
  border: 1.5px solid rgba(160, 200, 255, 0.35); background: rgba(13, 20, 48, 0.55); border-radius: 18px; cursor: pointer;
  display: grid; place-items: center; touch-action: none;
}
.key { width: 64px; height: 64px; }
.cluster.right .key { width: 72px; height: 58px; }
.key svg, .half svg { width: 30px; height: 30px; stroke: var(--ink); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.key.on, .half.on { background: rgba(57, 230, 255, 0.35); border-color: var(--accent); }
.turns { position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: 3; display: flex; pointer-events: none; }
.half { flex: 1; border: 0; border-radius: 0; background: transparent; pointer-events: auto; align-items: end; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px); }
.half svg { opacity: 0.45; width: 36px; height: 36px; }
.half.l { justify-items: start; padding-left: 28px; }
.half.r { justify-items: end; padding-right: 28px; }
/* the boost at the bottom right and auto-turn at the bottom left, in every layout (Jay) */
.power {
  position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); z-index: 6;
  width: 72px; height: 72px; border-radius: 50%; border: 2px solid rgba(160, 200, 255, 0.3); background: rgba(13, 20, 48, 0.7);
  display: grid; place-items: center; cursor: pointer; touch-action: none; padding: 0;
}
.power .ic { width: 38px; height: 38px; display: grid; place-items: center; }
.power .ic svg { width: 38px; height: 38px; }
.power b { position: absolute; top: -6px; right: -6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; display: grid; place-items: center; font-size: 16px; line-height: 1; color: #04101f; background: var(--pc, #fff); border: 2px solid #0d1430; }
.power.empty b { background: #3a4668; color: var(--ink-soft); }
.power.full { border-color: var(--pc, #fff); box-shadow: 0 0 14px var(--pc, #fff), inset 0 0 12px rgba(255, 255, 255, 0.12); }
.power.going { border-color: #fff; box-shadow: 0 0 calc(14px + 34px * var(--surge, 0)) calc(2px + 8px * var(--surge, 0)) var(--pc, #fff), inset 0 0 calc(10px + 16px * var(--surge, 0)) rgba(255, 255, 255, 0.35); transform: scale(calc(1 + 0.12 * var(--surge, 0))); transform-origin: 100% 100%; }
.armed { position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); z-index: 6; display: flex; flex-direction: row-reverse; gap: 6px; pointer-events: none; }
.armed span { height: 32px; min-width: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 3px; background: rgba(13, 20, 48, 0.85); border: 1.5px solid var(--pc, #fff); box-shadow: 0 0 8px var(--pc, #fff); }
.armed svg { width: 22px; height: 22px; }
.armed span.ghost { padding: 0 9px 0 5px; }
.armed span.ghost i { font-style: normal; font-weight: 800; font-size: 16px; color: var(--pc, #fff); font-variant-numeric: tabular-nums; min-width: 26px; }
.armed span.ghost.last { border-color: #ff5a7a; box-shadow: 0 0 14px #ff5a7a; animation: ghostlast 0.2s steps(2) infinite; }
.armed span.ghost.last i { color: #fff; }
.armed[hidden] { display: none; }
.power.empty .ic { opacity: 0.25; }
.auto {
  position: absolute; left: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 6; width: 60px; height: 60px; padding: 0;
  border-radius: 18px; border: 1.5px solid rgba(160, 200, 255, 0.3); background: rgba(13, 20, 48, 0.7); color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; touch-action: none;
  font: inherit; font-size: 12px; font-weight: 800; letter-spacing: 0.04em;
}
.auto svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.auto.on { color: #04101f; background: #9fe8ff; border-color: #fff; box-shadow: 0 0 14px rgba(159, 232, 255, 0.8); }
.auto[hidden] { display: none; }
/* arrows: left and right sit above auto-turn on the left; up and down just inside the boost on the right */
.app[data-controls="arrows"] .pad { padding-right: 96px; }
.app[data-controls="arrows"] .cluster.left { margin-bottom: 70px; }
/* turn buttons: the halves fill the screen, so their marks sit above the two corner buttons */
.app[data-controls="turns"] .half { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 104px); }
.skip {
  position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 100px); z-index: 7; min-height: 44px; padding: 0 18px;
  border-radius: 22px; border: 1px solid var(--panel-edge); background: rgba(13, 20, 48, 0.9); font-weight: 800; cursor: pointer;
}

/* ---- spectating once you're out: the rider you watch, between arrows; drag the field to look round ---- */
.spec {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); z-index: 7;
  display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 28px; background: rgba(13, 20, 48, 0.9);
  border: 1px solid var(--panel-edge); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.spec[hidden] { display: none; }
.spec-b { width: 48px; height: 48px; border-radius: 24px; border: 0; background: rgba(255, 255, 255, 0.08); color: #fff; cursor: pointer; display: grid; place-items: center; }
.spec-b:active { background: rgba(255, 255, 255, 0.2); }
.spec-b svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.spec-who { min-width: 132px; max-width: 46vw; text-align: center; line-height: 1.1; padding: 0 6px; }
.spec-who small { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.spec-who b { display: block; font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- the countdown and the banner ---- */
.count {
  position: absolute; left: 0; right: 0; top: 34%; z-index: 8; text-align: center; pointer-events: none;
  font-size: 88px; font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 0 24px var(--accent), 0 0 4px var(--accent);
}
.count small { display: block; font-size: 18px; font-weight: 700; color: var(--ink-soft); text-shadow: none; margin-top: 10px; }
.count.go { animation: pop 0.4s ease-out; }
.banner {
  position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 112px); transform: translateX(-50%); z-index: 8;
  padding: 6px 14px; border-radius: 14px; background: rgba(13, 20, 48, 0.9); border: 1px solid var(--panel-edge);
  font-weight: 700; font-size: 15px; width: max-content; max-width: calc(100vw - 32px); text-align: center; pointer-events: none;
}

/* ---- cards between rounds (intro, results, the control picker) ---- */
.card-layer {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 5, 12, 0.72); overflow-y: auto;
}
/* an online screen has Menu in the corner: the card starts under it */
.card-layer:has(> .sg-corner-slot) { padding-top: calc(var(--sg-corner-top) + 56px); }
.card {
  width: 100%; max-width: 400px; border-radius: 22px; padding: 18px 16px 16px; background: linear-gradient(180deg, #111c42, #0a1128);
  border: 1px solid var(--panel-edge); box-shadow: 0 0 0 1px rgba(57, 230, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: rise 0.25s ease-out;
}
.card.still { animation: none; }
.card .kicker { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink-soft); letter-spacing: 0.04em; text-transform: uppercase; }
.card h2 { margin: 0 0 6px; font-size: 30px; line-height: 1.1; font-weight: 800; color: #fff; }
.card h2.win { color: var(--accent); text-shadow: 0 0 18px rgba(57, 230, 255, 0.5); }
.card p { margin: 6px 0; color: var(--ink-soft); font-size: 16px; line-height: 1.35; }
.card .btns { display: flex; gap: 10px; margin-top: 14px; }
.btn {
  flex: 1; min-height: 50px; border-radius: 16px; border: 1px solid var(--panel-edge); background: rgba(255, 255, 255, 0.06);
  font-weight: 800; font-size: 17px; cursor: pointer; padding: 0 12px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 0 20px rgba(57, 230, 255, 0.35); }
.btn:active { transform: scale(0.97); }
.goals { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 6px; }
.goals li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); min-height: 30px; }
.goals .st { width: 26px; height: 26px; flex: none; }
.goals .st path { fill: rgba(255, 255, 255, 0.12); stroke: rgba(255, 255, 255, 0.3); stroke-width: 1.2; }
.goals li.got .st path { fill: var(--gold); stroke: #fff6c2; }
.goals li.got .st { animation: pop 0.35s ease-out both; }
.rivals { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 2px; }
.rival { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); font-size: 14px; }
.rival .face { width: 34px; height: 34px; border-radius: 9px; overflow: hidden; background: #0b1634; border: 1.5px solid var(--c, #fff); }
.rival .face svg { width: 100%; height: 100%; display: block; }
.rival small { display: block; color: var(--ink-soft); font-size: 12px; line-height: 1; }
.newpower { display: flex; gap: 12px; align-items: center; margin: 10px 0; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--pc, var(--line)); }
.newpower .big { width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #0a1024; border: 2px solid var(--pc, #fff); box-shadow: 0 0 16px var(--pc, #fff); }
.newpower .big svg { width: 34px; height: 34px; }
.newpower b { display: block; font-size: 18px; color: #fff; }
.newpower span { display: block; font-size: 15px; color: var(--ink-soft); line-height: 1.3; }
.score-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 12px 0 4px; }
.score-row .who { display: grid; justify-items: center; gap: 2px; font-size: 13px; color: var(--ink-soft); }
.score-row .who .face { width: 44px; height: 44px; border-radius: 11px; overflow: hidden; border: 2px solid var(--c, #fff); background: #0b1634; }
.score-row .who .face svg { width: 100%; height: 100%; display: block; }
.score-row .who b { font-size: 18px; color: #fff; }
.pips { display: flex; gap: 3px; }
.pips i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); }
.pips i.on { background: var(--gold); }
.newlist { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.newlist li { font-size: 15px; color: var(--gold); font-weight: 700; }
.pick { display: grid; gap: 10px; margin-top: 12px; }
.pick button {
  display: flex; gap: 14px; align-items: center; text-align: left; padding: 14px; border-radius: 18px; min-height: 84px;
  border: 1.5px solid var(--panel-edge); background: rgba(255, 255, 255, 0.05); cursor: pointer;
}
.pick button:active, .pick button.on { border-color: var(--accent); background: rgba(57, 230, 255, 0.12); }
.pick .pic { width: 64px; height: 56px; flex: none; display: grid; place-items: center; }
.pick .pic svg { width: 64px; height: 56px; }
.pick b { display: block; font-size: 19px; color: #fff; }
.pick span { display: block; font-size: 14px; color: var(--ink-soft); line-height: 1.3; }
.small { font-size: 13px !important; text-align: center; }

/* ---- online ---- */
.lc-field { display: grid; gap: 4px; margin: 8px 0; font-size: 14px; color: var(--ink-soft); }
.lc-input {
  font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--panel-edge); border-radius: 14px; min-height: 48px; padding: 0 14px; width: 100%;
  -webkit-user-select: text; user-select: text;
}
.lc-input:focus { outline: none; border-color: var(--accent); }
.lc-input.code { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-size: 22px; }
.lc-join { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.lc-join .btn { flex: none; min-width: 88px; }
.lobby-code { font-size: 48px !important; letter-spacing: 0.18em; color: var(--accent) !important; text-shadow: 0 0 18px rgba(57, 230, 255, 0.5); }
.lobby-list { display: grid; gap: 6px; margin: 10px 0; }
.lobby-list .rival { padding: 6px 10px 6px 6px; }
.btn[disabled] { opacity: 0.55; }
.seg button[disabled] { opacity: 0.6; }

/* ---- sheets: levels, riders, quick race, achievements ---- */
.lc-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.lc-level {
  min-height: 68px; border-radius: 14px; border: 1px solid var(--panel-edge); background: rgba(255, 255, 255, 0.05);
  display: grid; place-items: center; gap: 0; padding: 6px 2px; cursor: pointer;
}
.lc-level b { font-size: 20px; line-height: 1; }
.lc-level .stars { font-size: 13px; letter-spacing: 1px; color: rgba(255, 255, 255, 0.2); }
.lc-level .stars i { font-style: normal; }
.lc-level .stars i.on { color: var(--gold); }
.lc-level.locked { opacity: 0.35; }
.lc-level.next { border-color: var(--accent); box-shadow: 0 0 12px rgba(57, 230, 255, 0.3); }
.lc-levels .lc-chapter { grid-column: 1 / -1; margin: 8px 0 0; font-size: 15px; font-weight: 800; color: var(--sheet-soft); }
.lc-levels .lc-chapter:first-child { margin-top: 0; }
.lc-title-line { margin: 0 0 12px; font-weight: 700; color: var(--gold); }
.lc-riders { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.lc-rider { border-radius: 16px; border: 1.5px solid var(--panel-edge); background: rgba(255, 255, 255, 0.04); padding: 8px 6px; display: grid; justify-items: center; gap: 2px; cursor: pointer; min-height: 120px; }
.lc-rider .face { width: 64px; height: 64px; }
.lc-rider .face svg { width: 100%; height: 100%; display: block; }
.lc-rider b { font-size: 15px; line-height: 1.1; text-align: center; }
.lc-rider small { font-size: 13px; color: var(--ink-soft); }
.lc-rider.on { border-color: var(--accent); background: rgba(57, 230, 255, 0.1); }
.lc-rider.locked .face { filter: grayscale(1) brightness(0.4); }
.lc-rider .cyc { width: 88px; height: 28px; object-fit: contain; margin: -2px 0 2px; filter: drop-shadow(0 0 6px rgba(57, 230, 255, 0.45)); }
.lc-rider.on .cyc { filter: drop-shadow(0 0 8px var(--accent)); }
.lc-rider.locked .cyc { filter: grayscale(1) brightness(0.35); }
.lc-form { display: grid; gap: 14px; }
.lc-form h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink-soft); font-weight: 700; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 0 auto; min-height: 44px; min-width: 44px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--panel-edge); background: rgba(255, 255, 255, 0.05); font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.lc-ach { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lc-ach li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.lc-ach li .medal { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--gold); color: #3a2a00; font-weight: 800; }
.lc-ach li.no .medal { background: rgba(255, 255, 255, 0.1); color: transparent; }
.lc-ach li b { display: block; }
.lc-ach li span { font-size: 14px; color: var(--ink-soft); }
.lc-powers { display: grid; gap: 8px; margin: 8px 0; }
.lc-powers div { display: flex; gap: 10px; align-items: flex-start; }
.lc-powers svg { width: 28px; height: 28px; flex: none; margin-top: 2px; }
.lc-powers b { color: var(--ink); }
.lc-howto p { margin: 0 0 10px; }

/* the crash feed, top right under the portraits */
.feed {
  position: absolute; right: 10px; top: calc(env(safe-area-inset-top, 0px) + 56px); z-index: 7; max-width: calc(100% - 20px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px; pointer-events: none;
}
.net:not([hidden]) ~ .feed { top: calc(env(safe-area-inset-top, 0px) + 74px); }
.feed p {
  margin: 0; padding: 2px 9px; border-radius: 10px; background: rgba(5, 8, 20, 0.78); font-size: 13px; font-weight: 700;
  line-height: 20px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  animation: feedin 0.18s ease-out, feedout 0.5s ease-in 2.1s forwards;
}
.feed p.mine { color: var(--gold); border: 1px solid rgba(255, 212, 58, 0.5); }
@keyframes feedin { from { opacity: 0; transform: translateX(10px); } }
@keyframes feedout { to { opacity: 0; } }

/* the Garage: grids */
.lc-sub { margin: 14px 0 8px; font-size: 15px; color: var(--sheet-soft, var(--ink-soft)); font-weight: 700; }
.lc-grids { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.lc-grid {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 6px; min-height: 44px;
  border-radius: 12px; border: 1px solid var(--panel-edge); background: rgba(13, 20, 48, 0.6); color: inherit; font: inherit; cursor: pointer;
}
.lc-grid .pic svg { display: block; width: 88px; height: auto; border-radius: 6px; }
.lc-grid b { font-size: 14px; line-height: 1.2; }
.lc-grid small { font-size: 13px; color: var(--ink-soft); }
.lc-grid.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.lc-grid.locked .pic { opacity: 0.35; filter: grayscale(0.7); }

.toast {
  position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 60px); z-index: 30; transform: translate(-50%, -8px);
  margin: 0; padding: 8px 14px; border-radius: 14px; background: rgba(13, 20, 48, 0.95); border: 1px solid var(--panel-edge);
  font-weight: 700; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.in-sheet { position: fixed; z-index: 2; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }

/* ---- the title screen's colors (the layout is shared/mainmenu.js) ---- */
#mm {
  --sg-bg: radial-gradient(ellipse 110% 60% at 50% 22%, var(--bg-hi), transparent 75%), var(--bg);
  --sg-ink: var(--ink); --sg-ink-soft: var(--ink-soft);
  --sg-title: #ffffff; --sg-title-shadow: 0 0 18px rgba(57, 230, 255, 0.85), 0 0 3px #39e6ff;
  --sg-accent: var(--accent); --sg-accent-ink: var(--accent-ink);
  --sg-card: #0f1838; --sg-card-ink: var(--ink); --sg-line: rgba(160, 200, 255, 0.22);
}
#mm .lc-title-art { width: 300px; max-width: 86vw; aspect-ratio: 2 / 1; }
#mm .lc-title-art svg { display: block; width: 100%; height: 100%; }
.sg-sheet { --sg-sheet-bg: var(--sheet); --sg-sheet-ink: var(--sheet-ink); --sg-accent: var(--accent); --sg-accent-ink: var(--accent-ink); --sg-ink-soft: var(--sheet-soft); --sg-line: rgba(160, 200, 255, 0.22); }
/* on this dark sheet the shared switch's off track would vanish */
.sg-sheet .sg-switch input:not(:checked) { background: rgba(160, 200, 255, 0.24); }

/* ---- the result card's winner, the new pip, the champion's confetti ---- */
.card { position: relative; overflow: hidden; }
.card:has(.lc-hero) > .kicker { text-align: center; }
.card h2.center { text-align: center; }
.lc-hero { position: relative; display: grid; place-items: center; height: 118px; margin: 2px 0 4px; }
.lc-hero .rays {
  position: absolute; width: 200px; height: 200px; border-radius: 50%; opacity: 0.5;
  background: repeating-conic-gradient(from 0deg, var(--c) 0deg 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 66%); mask: radial-gradient(circle, #000 18%, transparent 66%);
  animation: lc-spin 14s linear infinite;
}
.lc-hero .face {
  position: relative; width: 88px; height: 88px; border-radius: 22px; overflow: hidden; background: #0b1634;
  border: 3px solid var(--c); box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.35), 0 0 28px var(--c);
  animation: lc-heropop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.lc-hero .face svg { width: 100%; height: 100%; display: block; }
.lc-hero { height: 154px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.lc-hero .rays { top: 50%; left: 50%; margin: -100px 0 0 -100px; }
.lc-hero.big .rays { margin: -125px 0 0 -125px; }
/* the winner's cycle on a strip of the grid under their face, riding in with its trail (game.js lookCanvas) */
.lc-stage {
  position: relative; flex: none; width: 256px; max-width: 100%; height: 60px; margin-top: -12px; border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(160, 200, 255, 0.18); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 18px color-mix(in srgb, var(--c) 35%, transparent);
  -webkit-mask: linear-gradient(90deg, transparent, #000 14%, #000 88%, transparent); mask: linear-gradient(90deg, transparent, #000 14%, #000 88%, transparent);
}
.lc-stage::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%, rgba(0, 0, 0, 0.25)); }
.lc-stage canvas { display: block; }
.lc-hero .face { z-index: 1; }
/* the Garage's looks */
.lc-sub.lc-big { font-size: 17px; color: var(--sheet-ink, #fff); margin-top: 18px; }
.lc-mine { border-radius: 12px; overflow: hidden; border: 1px solid var(--panel-edge); margin-bottom: 6px; }
.lc-mine canvas, .lc-lk .pic canvas { display: block; width: 100% !important; height: auto !important; }
.lc-lookrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 8px; }
.lc-lk {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 5px 5px 7px; min-height: 44px; text-align: left;
  border-radius: 12px; border: 1px solid var(--panel-edge); background: rgba(13, 20, 48, 0.6); color: inherit; font: inherit; cursor: pointer;
}
.lc-lk .pic { border-radius: 7px; overflow: hidden; margin-bottom: 3px; }
.lc-lk b { font-size: 14px; line-height: 1.2; padding: 0 3px; }
.lc-lk small { font-size: 12.5px; line-height: 1.25; color: var(--ink-soft); padding: 0 3px; }
.lc-lk.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.lc-lk.locked .pic { opacity: 0.35; filter: grayscale(0.8); }
.lc-hero.big { height: 176px; margin-top: 8px; }
.lc-hero.big .rays { width: 250px; height: 250px; opacity: 0.65; background: repeating-conic-gradient(from 0deg, var(--c) 0deg 6deg, #ffd43a 6deg 8deg, transparent 8deg 20deg); }
.lc-hero.big .face { width: 100px; height: 100px; border-color: #ffd43a; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.35), 0 0 34px #ffd43a, 0 0 60px var(--c); }
.lc-hero .crown { position: absolute; top: -4px; width: 54px; z-index: 1; filter: drop-shadow(0 0 8px rgba(255, 212, 58, 0.8)); animation: lc-crown 0.7s 0.35s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.lc-hero .crown svg { display: block; width: 100%; }
.score-row .who.won .face { box-shadow: 0 0 14px var(--c); }
.pips i.new { animation: lc-pip 0.7s 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.lc-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lc-confetti i {
  position: absolute; top: -12px; left: var(--x); width: 7px; height: 12px; border-radius: 2px; background: var(--c);
  box-shadow: 0 0 6px var(--c); opacity: 0; animation: lc-fall var(--t) var(--d) ease-in infinite;
}
@keyframes lc-spin { to { transform: rotate(360deg); } }
@keyframes lc-heropop { from { transform: scale(0.3) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lc-crown { from { transform: translateY(-30px) scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lc-pip { 0% { transform: scale(0); box-shadow: 0 0 0 transparent; } 60% { transform: scale(2.1); box-shadow: 0 0 14px #ffd43a; } 100% { transform: none; box-shadow: 0 0 6px #ffd43a; } }
@keyframes lc-fall { 0% { transform: translateY(0) rotate(var(--r)); opacity: 1; } 100% { transform: translateY(520px) rotate(calc(var(--r) + 540deg)); opacity: 0; } }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes glowpulse { 0%, 100% { box-shadow: 0 0 10px var(--pc, #fff); } 50% { box-shadow: 0 0 22px var(--pc, #fff); } }
@keyframes ghostlast { 0% { opacity: 1; } 100% { opacity: 0.35; } }
@media (max-height: 680px) {
  .key { width: 58px; height: 56px; }
  .cluster.right .key { width: 60px; height: 50px; }
  .power { width: 64px; height: 64px; }
  .auto { width: 54px; height: 54px; }
  .armed { bottom: calc(env(safe-area-inset-bottom, 0px) + 86px); }
  .app[data-controls="arrows"] .pad { padding-right: 86px; }
  .app[data-controls="arrows"] .cluster.left { margin-bottom: 62px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .count.go, .goals li.got .st, .power.going { transition: none; }
  .lc-hero .rays, .lc-hero .face, .lc-hero .crown, .pips i.new { animation: none; }
  .armed span.ghost.last { animation: none; }
  .toast { transition: none; }
  .feed p { animation: feedout 0.5s ease-in 2.1s forwards; }
}
