body { background: radial-gradient(ellipse at 4% 16%, #dcebe480, transparent 38%), radial-gradient(ellipse at 96% 70%, #f9e5cd70, transparent 38%), #f5f3eb; }
.site-header { position: relative; }
[hidden] { display: none !important; }
.back-to-games { text-decoration: none; font-size: 0.85rem; color: var(--muted); }
.game-page { width: min(1320px, calc(100% - 3rem)); margin: 2.5rem auto; }
.game-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; gap: 1rem; }
.game-heading .eyebrow { margin: 0; font-size: 0.65rem; letter-spacing: 0.2em; }
.game-heading h1 { display: flex; align-items: center; font-size: clamp(1.6rem, 3vw, 2.3rem); max-width: none; margin: 0.3rem 0 0; letter-spacing: -0.06em; font-weight: 950; color: #214740; }
.game-heading h1 span { color: #278473; }
.game-heading h1 i { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; margin-left: 0.7em; border: 1px solid #c2d9ce; border-radius: 50%; font-size: 0.5em; font-style: normal; color: #278473; transform: rotate(-12deg); }
.game-heading > p { margin: 0; font-size: 0.8rem; color: #6a7771; }
.game-shell { overflow: hidden; border: 1px solid #c8d5c9; border-radius: 24px; background: #fffef9; box-shadow: 0 4px 0 #dbe2d5, 0 24px 70px #344e3b16; }
.game-shell, .game-shell * { user-select: none; -webkit-user-select: none; -moz-user-select: none; -webkit-touch-callout: none; }
.game-hud { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0.9rem 1.4rem; background: #203d3b; color: #f9fbef; }
.game-hud::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; opacity: 0.9; background: linear-gradient(90deg, #398eeb 0% 16.66%, #ef8060 16.66% 33.33%, #e8c24d 33.33% 50%, #a18ad8 50% 66.66%, #67b99f 66.66% 83.33%, #d486af 83.33%); }
.hud-status { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; }
.hud-status > span { font-size: 0.65rem; font-weight: 900; letter-spacing: 0.17em; }
.hud-status small { font-size: 0.65rem; color: #b6cdc0; }
.hud-timer { display: flex; flex-direction: column; align-items: center; }
.hud-timer > span { font-size: 2.25rem; font-weight: 850; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.05em; }
.hud-timer small { font-size: 0.5rem; letter-spacing: 0.22em; color: #b6cdc0; }
.hud-lives { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.hud-lives > span { color: #f6d36d; font-size: 1rem; letter-spacing: 0.17em; }
.hud-lives small { font-size: 0.65rem; font-variant-numeric: tabular-nums; }
.hud-timer .time-warning { color: #ffd27e; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; }
.game-stage { position: relative; min-width: 0; height: min(64vw, 640px); min-height: 520px; overflow: hidden; background: #e7e8de; }
#arena { position: relative; z-index: 1; display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -4px; }
.webgl-canvas { position: absolute; z-index: 0; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.stage-tools { position: absolute; z-index: 2; top: 0.9rem; left: 0.9rem; display: flex; flex-wrap: wrap; max-width: calc(100% - 1.8rem); gap: 0.4rem; }
.stage-tools button { min-height: 40px; font: inherit; font-size: 0.72rem; background: #fffefaeb; color: #294b45; border: 1px solid #c2d0c1; border-radius: 12px; padding: 0.4rem 0.7rem; cursor: pointer; box-shadow: 0 2px 6px #30472b10; }
.stage-tools button[aria-pressed="true"] { background: #234840; color: #fff; }
.stage-tools button:not(:disabled):hover { border-color: #6d9d88; box-shadow: 0 3px 12px #203d3b20; }
.game-toast { position: absolute; z-index: 5; bottom: 1.5rem; left: 50%; transform: translateX(-50%); width: max-content; max-width: 88%; margin: 0; padding: 0.6rem 1rem; border-radius: 30px; color: white; background: #203d3bed; font-size: 0.8rem; text-align: center; pointer-events: none; }
.spectator-actions { position: absolute; z-index: 2; bottom: 1rem; left: 1rem; right: 1rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.8rem; width: fit-content; max-width: calc(100% - 2rem); padding: 0.55rem 0.8rem; border: 1px solid #bdcec0; border-radius: 14px; background: #fffef7f2; box-shadow: 0 3px 14px #203d3b18; }
.spectator-actions > span { font-size: 0.65rem; color: #657b70; }
.spectator-actions button, .spectator-actions a { display: inline-flex; align-items: center; min-height: 40px; border: 0; border-radius: 8px; padding: 0.4rem 0.65rem; font: 700 0.75rem system-ui; color: #245b49; background: #e3eee4; cursor: pointer; text-decoration: none; }
.spectator-actions a { background: transparent; }
.game-sidebar { padding: 1.2rem; border-left: 1px solid #d8ded1; background: #fafbf5; min-width: 0; }
.sidebar-caption { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.8rem; }
.sidebar-caption > span { font-size: 0.7rem; font-weight: 900; letter-spacing: 0.15em; }
.sidebar-caption small { font-size: 0.55rem; color: #7c8f80; letter-spacing: 0.08em; overflow-wrap: anywhere; }
#minimap { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 10px; border: 1px solid #d5dccb; }
.leaderboard-heading { display: flex; justify-content: space-between; align-items: center; gap: 0.2rem; margin: 1.4rem 0 0.6rem; }
.leaderboard-heading h2 { font-size: 0.6rem; letter-spacing: 0.08em; margin: 0; }
.leaderboard-heading > span { font-size: 0.55rem; color: #7b8a7d; }
.leaderboard { padding: 0; list-style: none; margin: 0; }
.leaderboard li { display: grid; grid-template-columns: 16px 10px minmax(0, 1fr) auto; align-items: center; gap: 0.4rem; padding: 0.55rem 0; border-bottom: 1px solid #e6eadf; font-size: 0.7rem; }
.leaderboard li.you { font-weight: 850; background: #e7eee2; border-radius: 8px; box-shadow: 5px 0 #e7eee2, -5px 0 #e7eee2; }
.leaderboard .rank-number { color: #899487; font-size: 0.6rem; }
.leaderboard .color-dot { height: 9px; width: 9px; border-radius: 50%; }
.leaderboard .racer-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard .racer-score { font-variant-numeric: tabular-nums; font-weight: 750; }
.sidebar-tip { margin-top: 1.4rem; }
.sidebar-tip > span { font-size: 0.55rem; font-weight: 900; letter-spacing: 0.15em; color: #378c71; }
.sidebar-tip p { font-size: 0.65rem; color: #7c887b; line-height: 1.9; margin: 0.25rem 0; }
.share-button { width: 100%; margin-top: 1.2rem; padding: 0.6rem 0.1rem; font: inherit; font-size: 0.65rem; cursor: pointer; border-radius: 7px; border: 1px solid #cdd7c4; color: #376b55; background: transparent; }
.share-button:disabled { color: #9da89a; cursor: default; }
.share-url { max-width: 100%; font-size: 0.7rem; margin-top: 0.5rem; }
.game-controlbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.9rem; padding: 0.9rem 1.2rem; border: 1px solid #dce1d4; border-radius: 18px; background: #fffef9; }
.difficulty-picker { flex: 1 1 290px; min-width: 0; margin: 0; padding: 0; border: 0; }
.difficulty-picker legend { padding: 0; margin-bottom: 0.35rem; font-size: 0.72rem; font-weight: 800; color: #365f51; }
.difficulty-options { display: flex; gap: 3px; padding: 3px; border: 1px solid #cbd8cd; border-radius: 12px; background: #eff3eb; }
.difficulty-options button { flex: 1; min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: #36554b; font: inherit; font-size: 0.78rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.difficulty-options button small { font-size: 0.65rem; font-weight: 500; }
.difficulty-options button[aria-pressed="true"] { background: #285c4d; color: #fff; box-shadow: 0 1px 4px #214c4020; }
.difficulty-picker:disabled button { cursor: default; }
#difficulty-status { display: block; margin-top: 0.35rem; font-size: 0.65rem; color: #62766b; }
.control-caption { flex: 1 1 130px; }
.difficulty-explanation { margin: 0.6rem 0.4rem 0; font-size: 0.72rem; color: #62766b; }
.game-controlbar > div { display: flex; flex-direction: column; gap: 0.2rem; }
.game-controlbar strong { font-size: 0.65rem; color: #366c5e; letter-spacing: 0.09em; }
.game-controlbar > div > span { font-size: 0.7rem; color: #8a9486; }
#drive-button { display: flex; flex: 1 1 230px; align-items: center; justify-content: center; gap: 0.8rem; min-width: 230px; padding: 0.8rem 1.4rem; border: 0; border-radius: 10px; font: inherit; font-size: 1.1rem; font-weight: 800; color: #fffdf3; background: #237c66; box-shadow: 0 3px 0 #1d5f50; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
#drive-button span { font-size: 0.8rem; }
#drive-button kbd { font-size: 0.6rem; font-family: inherit; padding: 0.1rem 0.4rem; border: 1px solid #82b59b; border-radius: 4px; opacity: 0.8; }
#drive-button.driving { transform: translateY(2px); box-shadow: 0 1px 0 #1d5f50; background: #1b6855; }
.game-overlay { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; background: #e9ede470; backdrop-filter: blur(7px); padding: 1.25rem; overflow-y: auto; }
.welcome-panel, .small-panel { width: min(390px, 100%); background: #fffef9f7; border: 1px solid #fff; border-radius: 24px; padding: 1.5rem 1.8rem; box-shadow: 0 3px 0 #d1ddce, 0 18px 70px #29452a26; text-align: center; margin: auto; }
.game-kicker { font-size: 0.55rem; color: #72917d; font-weight: 800; letter-spacing: 0.13em; margin: 0 0 0.9rem; }
.welcome-panel h2 { max-width: none; white-space: nowrap; font-size: clamp(1.8rem, 4.8vw, 2.85rem); line-height: 1.25; letter-spacing: -0.09em; font-weight: 1000; margin: 0.3rem 0 0.8rem; color: #224440; }
.welcome-panel h2 > span { color: #278473; text-decoration: underline; text-decoration-color: #eac55f; text-decoration-thickness: 5px; text-underline-offset: 7px; }
.color-orbit { position: relative; width: 60px; height: 60px; border: 1px dashed #b2cfc0; border-radius: 50%; margin: 0 auto 0.75rem; transform: rotate(-12deg); }
.color-orbit > span { display: grid; place-items: center; height: 100%; font-size: 2.4rem; line-height: 1; color: #278473; }
.color-orbit i { position: absolute; width: 12px; height: 12px; border: 2px solid #fffef9; border-radius: 50%; background: #398eeb; left: 0; top: 0; }
.color-orbit i:nth-of-type(2) { background: #ef8060; left: auto; right: -4px; top: 25px; }
.color-orbit i:nth-of-type(3) { background: #e8c24d; top: auto; bottom: -4px; left: 15px; }
.welcome-description { font-size: 0.8rem; line-height: 1.8; color: #74816f; }
.welcome-tags { display: flex; justify-content: center; gap: 0.5rem; margin: 1rem 0; }
.welcome-tags span { font-size: 0.62rem; white-space: nowrap; padding: 0.3rem 0.55rem; background: #edf2e6; border-radius: 20px; color: #496950; font-weight: 750; }
.join-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; text-align: left; }
.join-fields label { font-size: 0.62rem; font-weight: 700; color: #73806f; }
.join-fields input { width: 100%; min-width: 0; margin-top: 0.25rem; padding: 0.55rem 0.6rem; border: 1px solid #dce2d4; border-radius: 7px; font: inherit; font-size: 0.75rem; color: #355e4e; background: #fdfdf8; }
.join-message { font-size: 0.6rem; min-height: 1rem; margin: 0.65rem 0; color: #738573; }
.join-message.error { color: #b35143; }
.room-browser { margin: 0.8rem 0; text-align: left; border-top: 1px solid #e0e7d9; padding-top: 0.75rem; }
.room-browser h3 { margin: 0 0 0.4rem; font-size: 0.75rem; color: #355e4e; }
.room-browser h3 span { display: block; margin-top: 0.25rem; font-size: 0.6rem; font-weight: 500; color: #738573; }
#room-list-status { margin: 0.35rem 0; font-size: 0.65rem; color: #738573; }
.room-list { display: grid; gap: 0.35rem; max-height: 150px; overflow-y: auto; }
.room-list button { display: flex; flex-direction: column; gap: 0.2rem; width: 100%; min-height: 48px; padding: 0.55rem 0.7rem; text-align: left; border: 1px solid #cbdccc; border-radius: 9px; background: #eef5eb; color: #285b4a; cursor: pointer; font: inherit; }
.room-list button strong { font-size: 0.75rem; overflow-wrap: anywhere; }
.room-list button span { font-size: 0.6rem; color: #617e6c; }
.room-list button:hover:not(:disabled) { border-color: #398e73; background: #e0efdf; }
.room-list button:disabled { opacity: 0.6; cursor: not-allowed; }
.start-button { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; border-radius: 9px; padding: 0.8rem 1.1rem; color: #fffdf3; background: #237c66; font: inherit; font-size: 0.85rem; font-weight: 800; cursor: pointer; }
.start-button:disabled { opacity: 0.5; cursor: wait; }
.quiet-button { font: inherit; font-size: 0.65rem; color: #7b8e79; border: 0; background: transparent; padding: 0.75rem 0.2rem 0.1rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.welcome-note { font-size: 0.65rem; color: #66765f; margin: 1rem 0 0; line-height: 1.9; }
.welcome-note kbd { font: inherit; font-size: 0.6rem; padding: 0.1rem 0.3rem; border: 1px solid #c7d2c0; border-bottom-width: 2px; border-radius: 4px; }
.game-page button:focus-visible, .game-page input:focus-visible, .game-page summary:focus-visible { outline: 3px solid #398eeb; outline-offset: 3px; }
.game-page button { transition: background-color 140ms, box-shadow 140ms, transform 140ms; }
.start-button { min-height: 48px; box-shadow: 0 3px 0 #195a4c; }
.start-button:not(:disabled):hover { background: #1c6c59; }
.start-button:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 #195a4c; }
.quiet-button { min-height: 36px; color: #527050; }
.join-fields label, .join-message { color: #5d725b; }
.join-fields input { font-size: 16px; }
.game-notes details { border: 1px solid #d8dfd0; border-radius: 14px; padding: 1rem 1.2rem; background: #fffef780; }
.small-panel h2 { font-size: 2.2rem; line-height: 1.2; margin: 0.5rem 0 1rem; letter-spacing: -0.04em; max-width: none; }
.small-panel > p { font-size: 0.8rem; color: #71806e; }
.result-list { padding: 0; list-style: none; margin: 1.2rem 0; }
.result-list li { display: flex; justify-content: space-between; font-size: 0.8rem; padding: 0.5rem; border-bottom: 1px solid #e2e7d9; }
.game-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.8rem 0; font-size: 0.8rem; color: #75816e; }
.game-notes summary { cursor: pointer; color: #42654c; font-weight: 700; }
.game-notes p { line-height: 1.9; }
@media (max-width: 1000px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 190px; }
  .game-sidebar { padding: 0.9rem; }
  .sidebar-tip { display: none; }
}
@media (max-width: 760px) {
  .site-header { grid-template-columns: 1fr auto; gap: 0.45rem; min-height: 0; padding: 0.65rem 1rem; }
  .site-header .site-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .site-header .back-to-games { grid-column: 2; grid-row: 1; }
  .game-page { width: calc(100% - 1rem); margin: 1.3rem auto; }
  .game-heading { padding: 0 0.4rem; }
  .game-heading > p { font-size: 0.6rem; }
  .game-layout { display: block; }
  .game-stage { height: 64svh; min-height: 560px; max-height: 700px; }
  .game-sidebar { display: none; }
  .game-hud { padding: 0.7rem 0.8rem; }
  .hud-status small { max-width: 100px; font-size: 0.55rem; }
  .hud-timer > span { font-size: 1.8rem; }
  .hud-lives > span { font-size: 0.8rem; }
  .game-controlbar { padding: 0.8rem; }
  .game-controlbar > div { display: none; }
  #drive-button { width: 100%; min-width: 0; }
  .game-notes { grid-template-columns: 1fr; padding: 0 0.5rem; gap: 1rem; }
  .welcome-panel, .small-panel { padding: 1.15rem; }
  .color-orbit { width: 46px; height: 46px; margin-bottom: 0.6rem; }
  .color-orbit > span { font-size: 2rem; }
  .welcome-panel .game-kicker { margin-bottom: 0.5rem; }
  .welcome-description { margin: 0.7rem 0; }
  .welcome-tags { gap: 0.3rem; margin: 0.8rem 0; }
  .welcome-panel h2 { font-size: clamp(1.85rem, 8vw, 2.7rem); }
  .back-to-games { font-size: 0.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
