:root { --red: #e02828; --gold: #ffd23a; --ink: #0c0e18; --panel: rgba(12, 14, 28, 0.86); --line: rgba(255, 255, 255, 0.14); --muted: #a8b0c8; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05060c; color: #fff; font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif; overflow: hidden; }
#game { position: absolute; inset: 0; margin: auto; width: min(100vw, calc(100vh * 16 / 9)); height: min(100vh, calc(100vw * 9 / 16)); }
#cv { width: 100%; height: 100%; display: block; image-rendering: pixelated; background: #000; }
#ui { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 2.5%; }
#ui.racing { pointer-events: none; }
#ui.overlay { background: linear-gradient(90deg, rgba(5, 6, 14, 0.82), rgba(5, 6, 14, 0.25)); overflow: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 2px solid var(--line); background: rgba(255, 255, 255, 0.06); border-radius: 10px; padding: 8px 14px; }
button:hover { border-color: var(--gold); background: rgba(255, 210, 58, 0.12); }
button.big { font-size: 1.15em; padding: 12px 22px; font-weight: 800; }
button.go { background: var(--red); border-color: #ff7a7a; box-shadow: 0 4px 0 #7a0a0a; }
button.go:hover { background: #ff3a3a; }
.title { margin-right: auto; max-width: 440px; width: 100%; }
.logo { font-family: "Press Start 2P", monospace; font-size: clamp(30px, 5.4vw, 64px); margin: 0; line-height: 1.05; color: #fff; text-shadow: 4px 4px 0 var(--red), 8px 8px 0 #000; letter-spacing: 2px; }
.logo span { display: block; color: var(--gold); text-shadow: 4px 4px 0 #b0400a, 8px 8px 0 #000; }
.sub { margin: 10px 0 18px; color: #ffe8b0; font-weight: 700; letter-spacing: 2px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mode { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; background: var(--panel); }
.mode b { font-size: 1.15em; }
.mode span { color: var(--muted); font-size: 0.85em; }
.panel { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 18px 22px; max-width: 620px; width: 100%; max-height: 100%; overflow: auto; }
.panel.wide { max-width: 1000px; }
.panel.small { max-width: 320px; text-align: center; }
.panel h2 { margin: 0; font-size: 1.4em; }
.head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; }
.grid.tracks { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.riders { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card { text-align: left; display: flex; gap: 12px; align-items: flex-start; background: rgba(255, 255, 255, 0.04); }
.card h3 { margin: 4px 0; font-size: 1.05em; }
.card p { margin: 2px 0; color: var(--muted); font-size: 0.82em; line-height: 1.4; }
.card .rec { color: #7ae0ff; }
.card .map { width: 84px; height: 84px; border-radius: 8px; flex: none; image-rendering: auto; }
.card.cup { flex-direction: column; gap: 4px; }
.tag { display: inline-block; font-size: 0.72em; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.tag.road { background: #2f6fde; }
.tag.dirt { background: #b8603a; }
.stars { color: var(--gold); font-size: 0.8em; }
.stars i { color: #444a60; font-style: normal; }
.rider { flex-direction: column; align-items: center; text-align: center; border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.rider.on { border-color: var(--gold); background: rgba(255, 210, 58, 0.12); box-shadow: 0 0 0 2px var(--gold) inset; }
.rider canvas { height: 150px; width: auto; image-rendering: pixelated; }
.stat { display: grid; grid-template-columns: 6.5em 1fr; gap: 6px; align-items: center; width: 100%; font-size: 0.75em; color: var(--muted); }
.stat i { height: 7px; background: #2a2f44; border-radius: 4px; overflow: hidden; }
.stat b { display: block; height: 100%; background: var(--c); }
.foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-weight: 700; }
.opt { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.opt span { width: 7em; color: var(--muted); }
.opt button.on { border-color: var(--gold); background: rgba(255, 210, 58, 0.2); }
.help { line-height: 1.7; padding-left: 20px; }
.results h2 { margin-bottom: 6px; }
.bigplace { font-family: "Press Start 2P", monospace; font-size: 30px; color: var(--gold); margin: 8px 0 14px; text-shadow: 3px 3px 0 #000; }
.res { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 0.9em; }
.res td, .res th { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.res th { color: var(--muted); font-weight: 600; }
.res tr.me td { color: var(--gold); font-weight: 800; }
.res i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.res small { color: var(--muted); font-weight: 400; }
.results .cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.results h3 { margin: 6px 0 0; font-size: 1em; }
.champ { font-size: 1.5em; font-weight: 900; color: var(--gold); margin: 6px 0; }
/* touch controls */
#touch { display: none; position: absolute; inset: 0; pointer-events: none; }
body.touchy.inrace #touch { display: block; }
.pad { position: absolute; bottom: 4%; display: flex; gap: 10px; pointer-events: auto; }
.pad.left { left: 3%; bottom: 14%; }
.pad.right { right: 3%; bottom: 16%; }
.pad button { width: 68px; height: 68px; border-radius: 50%; font-size: 26px; background: rgba(255, 255, 255, 0.14); border: 2px solid rgba(255, 255, 255, 0.35); touch-action: none; user-select: none; -webkit-user-select: none; }
.pad button.on { background: rgba(255, 210, 58, 0.45); }
.pad .gas { background: rgba(60, 200, 90, 0.3); }
.pad .nitro { background: rgba(60, 140, 255, 0.3); }
#rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: block; position: fixed; left: 0; right: 0; top: 8px; text-align: center; color: var(--gold); font-weight: 800; z-index: 5; } #game { top: 0; bottom: auto; margin-top: 40px; } }
@media (max-width: 700px) { .results .cols { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .pad button { width: 56px; height: 56px; font-size: 22px; } #ui { padding: 10px; font-size: 13px; } .grid.tracks { grid-template-columns: 1fr; } }
