﻿html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: #101522;
      font-family: Arial, sans-serif;
    }

    #game {
      position: fixed;
      inset: 0;
    }

    .hud {
      position: fixed;
      top: 14px;
      left: 14px;
      right: 14px;
      z-index: 30;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      pointer-events: none;
    }

    .hud.hidden {
      display: none;
    }

    .race-info {
      position: fixed;
      top: 14px;
      left: 14px;
      right: 14px;
      z-index: 32;
      display: none;
      grid-template-columns: repeat(4, minmax(120px, 1fr));
      gap: 10px;
      pointer-events: none;
    }

    .race-info.active {
      display: grid;
    }

    .race-stat {
      background:
        linear-gradient(180deg, rgba(255,255,255,0.86), rgba(246,249,255,0.68));
      border: 1px solid rgba(255,255,255,0.72);
      color: #152033;
      padding: 10px 12px;
      border-radius: 12px;
      backdrop-filter: blur(18px) saturate(1.35);
      box-shadow: 0 14px 34px rgba(12,22,36,0.22), inset 0 1px 0 rgba(255,255,255,0.9);
    }

    .race-stat span {
      display: block;
      font-size: 10px;
      text-transform: uppercase;
      opacity: 0.68;
      letter-spacing: 0.08em;
      margin-bottom: 4px;
    }

    .race-stat strong {
      display: block;
      font-size: 15px;
      line-height: 1.15;
    }

    .panel {
      pointer-events: auto;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,250,255,0.82));
      color: #101827;
      padding: 10px 14px;
      border-radius: 16px;
      border: 1px solid rgba(255,255,255,0.76);
      backdrop-filter: blur(18px) saturate(1.35);
      box-shadow: 0 16px 38px rgba(12,22,36,0.24), inset 0 1px 0 rgba(255,255,255,0.95);
    }

    button {
      border: 1px solid rgba(255,255,255,0.78);
      border-radius: 999px;
      padding: 11px 18px;
      font-size: 12px;
      font-weight: 900;
      letter-spacing: 0.04em;
      cursor: pointer;
      background:
        linear-gradient(180deg, #1d66ff, #0d47c7);
      color: #fff;
      box-shadow: 0 12px 28px rgba(29,102,255,0.28), inset 0 1px 0 rgba(255,255,255,0.28);
      transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    }

    button:hover {
      transform: translateY(-1px);
      border-color: rgba(255,255,255,0.92);
      box-shadow: 0 16px 34px rgba(29,102,255,0.34), inset 0 1px 0 rgba(255,255,255,0.35);
    }

    button:active {
      transform: translateY(0);
    }

    .status {
      font-size: 13px;
      opacity: 0.85;
      margin-top: 4px;
    }

    .center-message {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      z-index: 25;
      color: #101827;
      text-align: center;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.9), rgba(244,248,255,0.72));
      padding: 24px 30px;
      border-radius: 24px;
      border: 1px solid rgba(255,255,255,0.72);
      backdrop-filter: blur(20px) saturate(1.35);
      box-shadow: 0 22px 60px rgba(12,22,36,0.28), inset 0 1px 0 rgba(255,255,255,0.95);
      max-width: 88%;
    }

    .center-message.result {
      top: 50%;
      bottom: auto;
      transform: translate(-50%, -50%);
      width: min(580px, 90vw);
      max-width: none;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      border-radius: 16px;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.92), rgba(241,247,255,0.74));
      border: 1px solid rgba(255,255,255,0.76);
      padding: 16px;
      box-shadow: 0 24px 70px rgba(12,22,36,0.34), inset 0 1px 0 rgba(255,255,255,0.96);
    }

    .center-message.result.win {
      box-shadow: 0 24px 70px rgba(12,22,36,0.34), inset 0 0 42px rgba(46,229,157,0.2);
    }

    .center-message.result.loss {
      box-shadow: 0 24px 70px rgba(12,22,36,0.34), inset 0 0 42px rgba(255,101,117,0.2);
    }

    .result-card {
      position: relative;
      overflow: hidden;
      width: 100%;
      text-align: left;
      border-radius: 12px;
      padding: 14px 2px 2px;
    }

    .result-card::before {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      height: 5px;
      background: var(--flag-bg);
    }

    .result-card > * {
      position: relative;
      z-index: 1;
    }

    .result-kicker {
      color: #2f67d8;
      font-size: 11px;
      font-weight: 900;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }

    .result-card h1 {
      font-size: clamp(30px, 5vw, 48px);
      margin: 6px 0;
    }

    .result-card p {
      max-width: 420px;
      font-size: 14px;
      line-height: 1.45;
    }

    .result-badge {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 0 10px;
      margin-bottom: 8px;
      border-radius: 999px;
      background: rgba(47,103,216,0.1);
      border: 1px solid rgba(47,103,216,0.18);
      color: #204a9b;
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }

    .result-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin: 14px 0;
    }

    .result-stats div {
      border: 1px solid rgba(255,255,255,0.72);
      background: rgba(255,255,255,0.52);
      border-radius: 10px;
      padding: 9px;
    }

    .result-stats span {
      display: block;
      font-size: 10px;
      opacity: 0.64;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .result-stats strong {
      display: block;
      margin-top: 3px;
      font-size: 14px;
    }

    .center-message h1 {
      margin: 0 0 8px;
      font-size: clamp(30px, 8vw, 66px);
    }

    .center-message p {
      margin: 0;
      opacity: 0.9;
    }

    .center-message.prep {
      padding: 14px 16px;
      border-radius: 14px;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.92), rgba(243,248,255,0.74));
      border: 1px solid rgba(255,255,255,0.76);
      box-shadow: 0 22px 60px rgba(12,22,36,0.3), inset 0 1px 0 rgba(255,255,255,0.96);
    }

    .center-message.prep h1 {
      font-size: clamp(24px, 4vw, 34px);
      margin-bottom: 2px;
    }

    .prep-kicker {
      color: #2f67d8;
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      margin-bottom: 5px;
    }

    .center-message.prep p {
      font-size: 12px;
      max-width: 420px;
      margin: 0 auto;
    }

    .race-lineup {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 10px;
      min-width: min(360px, 76vw);
      overflow: visible;
    }

    .lineup-head {
      display: grid;
      grid-template-columns: minmax(105px, 1fr) minmax(86px, 0.8fr);
      gap: 0;
      padding: 0 12px;
      color: rgba(16,24,39,0.5);
      font-size: 9px;
      font-weight: 900;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }

    .lineup-runner {
      position: relative;
      display: grid;
      grid-template-columns: minmax(105px, 1fr) minmax(86px, 0.8fr);
      overflow: hidden;
      min-height: 34px;
      border: 1px solid rgba(255,255,255,0.16);
      border-radius: 8px;
      background:
        linear-gradient(90deg, rgba(235,241,252,0.78), rgba(255,255,255,0.74)),
        var(--flag-bg);
      box-shadow: 0 10px 24px rgba(12,22,36,0.18), inset 0 1px 0 rgba(255,255,255,0.92);
    }

    .lineup-runner::before {
      content: "";
      position: absolute;
      inset: 0;
      background:
        linear-gradient(110deg, rgba(255,255,255,0.18) 0 12%, transparent 13% 100%),
        radial-gradient(circle at 88% 24%, rgba(255,255,255,0.15), transparent 24%);
      pointer-events: none;
    }

    .lineup-runner::after {
      content: "";
      position: absolute;
      inset: 0;
      background: rgba(238,244,255,0.42);
      pointer-events: none;
    }

    .lineup-cell {
      position: relative;
      z-index: 1;
      overflow: hidden;
      min-height: 34px;
      padding: 5px 10px;
      text-align: left;
      font-size: 11px;
      display: flex;
      align-items: center;
    }

    .lineup-head span {
      padding: 0 12px 2px;
    }

    .runner-name {
      display: block;
      color: #1457d9;
      font-size: 10px;
      line-height: 1;
      margin-bottom: 0;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .runner-code {
      color: rgba(255,255,255,0.58);
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.06em;
    }

    .runner-country {
      color: #172033;
      font-size: 11px;
      font-weight: 900;
      line-height: 1.15;
    }

    .race-carousel {
      width: min(420px, 78vw);
      display: flex;
      gap: 10px;
      overflow-x: auto;
      overscroll-behavior-x: contain;
      scroll-snap-type: x mandatory;
      padding: 6px 4px 12px;
      margin-top: 8px;
      scrollbar-width: none;
    }

    .race-carousel::-webkit-scrollbar {
      display: none;
    }

    .racer-preview {
      position: relative;
      flex: 0 0 min(230px, 68vw);
      min-height: 118px;
      scroll-snap-align: center;
      overflow: hidden;
      border-radius: 16px;
      border: 1px solid rgba(255,255,255,0.72);
      background:
        linear-gradient(180deg, rgba(255,255,255,0.9), rgba(238,245,255,0.78)),
        var(--flag-bg);
      box-shadow: 0 16px 36px rgba(12,22,36,0.22), inset 0 1px 0 rgba(255,255,255,0.96);
    }

    .racer-preview::before {
      content: "";
      position: absolute;
      inset: 0;
      background:
        linear-gradient(115deg, rgba(255,255,255,0.56) 0 20%, transparent 21% 100%),
        linear-gradient(90deg, rgba(255,255,255,0.78), rgba(255,255,255,0.52));
    }

    .racer-preview::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: 5px;
      background: var(--flag-bg);
    }

    .racer-preview-body {
      position: relative;
      z-index: 1;
      display: grid;
      grid-template-columns: 48px 1fr;
      gap: 12px;
      align-items: center;
      min-height: 118px;
      padding: 14px;
      text-align: left;
    }

    .racer-avatar {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: 15px;
      font-weight: 900;
      background: linear-gradient(180deg, #1d66ff, #0d47c7);
      box-shadow: 0 10px 22px rgba(29,102,255,0.24), inset 0 1px 0 rgba(255,255,255,0.34);
    }

    .racer-preview strong {
      display: block;
      color: #10213a;
      font-size: 13px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .racer-preview span {
      display: flex;
      align-items: center;
      gap: 7px;
      margin-top: 4px;
      color: rgba(16,24,39,0.64);
      font-size: 11px;
      font-weight: 800;
    }

    .preview-flag {
      display: inline-flex;
      width: 22px;
      height: 15px;
      overflow: hidden;
      border-radius: 4px;
      border: 1px solid rgba(255,255,255,0.36);
      box-shadow: 0 5px 12px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.26);
    }

    .racer-preview b {
      display: inline-flex;
      margin-top: 10px;
      padding: 4px 8px;
      border-radius: 999px;
      background: rgba(20,87,217,0.1);
      color: #1457d9;
      font-size: 9px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }

    .swipe-hint {
      margin-top: 2px;
      color: rgba(16,24,39,0.54);
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }


    .prep-status {
      color: #2f67d8;
      font-weight: 900;
      margin-top: 14px;
      min-height: 18px;
    }

    .bet-panel {
      width: min(420px, 86vw);
      text-align: left;
    }

    .bet-panel h1 {
      font-size: clamp(22px, 4vw, 30px);
      margin-bottom: 4px;
    }

    .bet-panel p {
      font-size: 12px;
      line-height: 1.4;
      margin-bottom: 12px;
    }

    .bet-options {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }

    .stake-back {
      width: 100%;
      min-height: 34px;
      margin: 10px 0;
      font-size: 9px;
    }

    .bet-option {
      position: relative;
      overflow: hidden;
      display: grid;
      grid-template-columns: 34px 1fr;
      align-items: center;
      text-align: left;
      gap: 9px;
      border: 1px solid rgba(255,255,255,0.78);
      border-radius: 12px;
      min-height: 54px;
      padding: 9px 10px;
      background:
        linear-gradient(180deg, rgba(255,255,255,1), rgba(239,245,255,0.9));
      color: #101827;
      box-shadow: 0 12px 26px rgba(12,22,36,0.18), inset 0 1px 0 rgba(255,255,255,1);
      transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    }

    .bet-option::before {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(115deg, rgba(255,255,255,0.75) 0 18%, transparent 19% 100%);
      opacity: 0.7;
      pointer-events: none;
    }

    .bet-option:hover {
      transform: translateY(-2px);
      border-color: rgba(47,103,216,0.36);
      box-shadow: 0 18px 38px rgba(12,22,36,0.28), 0 0 0 1px rgba(47,103,216,0.1), inset 0 1px 0 rgba(255,255,255,1);
    }

    .bet-option:active {
      transform: translateY(0);
    }

    .bet-option strong {
      position: relative;
      z-index: 1;
      display: block;
      color: #1457d9;
      font-size: 14px;
      letter-spacing: 0;
    }

    .bet-option span {
      position: relative;
      z-index: 1;
      display: block;
      margin-top: 2px;
      color: rgba(16,24,39,0.62);
      font-size: 9px;
      font-weight: 700;
    }

    .stake-icon {
      position: relative;
      z-index: 1;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background:
        radial-gradient(circle at 50% 46%, #07111f 0 16%, transparent 17%),
        linear-gradient(180deg, #ffe27a, #ffb421);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.52), 0 8px 18px rgba(255,180,33,0.2);
    }

    .stake-icon::before,
    .stake-icon::after {
      content: "";
      position: absolute;
      background: #07111f;
    }

    .stake-icon::before {
      left: 9px;
      top: 8px;
      width: 14px;
      height: 4px;
      border-radius: 999px;
    }

    .stake-icon::after {
      left: 14px;
      top: 8px;
      width: 4px;
      height: 16px;
      border-radius: 999px;
    }

    .player-card {
      position: fixed;
      z-index: 20;
      transform: translate(-50%, -100%);
      width: 122px;
      padding: 7px;
      border-radius: 12px;
      color: #101827;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.92), rgba(242,247,255,0.74));
      border: 1px solid rgba(255,255,255,0.72);
      backdrop-filter: blur(18px) saturate(1.35);
      box-shadow: 0 14px 34px rgba(12,22,36,0.24), inset 0 1px 0 rgba(255,255,255,0.94);
      pointer-events: none;
      opacity: 0.66;
      font-size: 10px;
      line-height: 1.35;
      transition: opacity 1.45s ease, transform 1.45s ease;
    }

    .player-card.hidden {
      opacity: 0;
      transform: translate(-50%, -100%) translateY(-10px);
    }

    .player-card strong {
      display: block;
      font-size: 11px;
      margin-bottom: 3px;
      color: #1457d9;
    }

    .player-card.chaser strong {
      color: #d22f45;
    }

    .player-card .row {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      border-top: 1px solid rgba(15,23,42,0.08);
      padding-top: 3px;
      margin-top: 3px;
    }

    @media (max-width: 600px) {
      .hud {
        top: 10px;
        left: 10px;
        right: 10px;
      }

      .race-info {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
        top: 10px;
        left: 10px;
        right: 10px;
      }

      .panel {
        padding: 10px 12px;
      }

      button {
        padding: 11px 16px;
      }

      .player-card {
        width: 124px;
        font-size: 10px;
        padding: 8px;
      }

      .player-card strong {
        font-size: 12px;
      }

      .race-lineup {
        min-width: 0;
      }

      .lineup-head,
      .lineup-runner {
        grid-template-columns: minmax(110px, 1fr) minmax(86px, 0.9fr);
      }

      .result-stats {
        grid-template-columns: 1fr;
      }
    }

    /* Game shell overrides */
    body {
      background:
        radial-gradient(circle at 20% 12%, rgba(46,229,157,0.16), transparent 28%),
        radial-gradient(circle at 82% 18%, rgba(255,212,71,0.16), transparent 26%),
        linear-gradient(180deg, #07111f 0%, #132238 46%, #07111f 100%);
      font-family: Arial, sans-serif;
    }

    body:not(.logged-in) .hud,
    body:not(.logged-in) .center-message,
    body:not(.logged-in) .race-info,
    body:not(.logged-in) .tap-control {
      display: none;
    }

    .login-screen {
      position: fixed;
      inset: 0;
      z-index: 80;
      display: grid;
      place-items: center;
      padding: 24px;
      background:
        linear-gradient(180deg, rgba(7,17,31,0.28), rgba(7,17,31,0.86)),
        radial-gradient(circle at 50% 26%, rgba(46,229,157,0.2), transparent 34%);
      backdrop-filter: blur(8px);
    }

    .login-screen.hidden {
      display: none;
    }

    .login-card {
      width: min(430px, 92vw);
      border-radius: 22px;
      padding: 22px;
      color: #f7fbff;
      border: 1px solid rgba(255,255,255,0.18);
      background:
        linear-gradient(180deg, rgba(18,34,55,0.94), rgba(7,17,31,0.92));
      box-shadow: 0 30px 90px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.18);
    }

    .login-card h1,
    .stadium-top h2 {
      margin: 4px 0 6px;
      letter-spacing: 0;
    }

    .login-card p {
      margin: 0 0 16px;
      color: rgba(247,251,255,0.72);
      font-size: 13px;
      line-height: 1.45;
    }

    .auth-tabs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin: 12px 0 10px;
    }

    .auth-tab {
      min-height: 34px;
      border-radius: 12px;
      color: rgba(247,251,255,0.72);
      background: linear-gradient(180deg, rgba(39,61,97,0.88), rgba(16,31,53,0.88));
      box-shadow: 0 4px 0 #07111f, inset 0 1px 0 rgba(255,255,255,0.12);
      font-size: 10px;
    }

    .auth-tab.active {
      color: #07111f;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
      box-shadow: 0 4px 0 #8c5b00, 0 12px 22px rgba(255,180,33,0.14), inset 0 1px 0 rgba(255,255,255,0.44);
    }

    .login-form {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 9px;
      margin: 12px 0 14px;
    }

    .login-form label {
      display: block;
      min-width: 0;
      text-align: left;
    }

    .login-form label span {
      display: block;
      margin: 0 0 5px;
      color: rgba(247,251,255,0.58);
      font-size: 9px;
      font-weight: 900;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }

    .login-form input {
      width: 100%;
      min-height: 38px;
      border: 1px solid rgba(255,255,255,0.14);
      border-radius: 12px;
      padding: 0 11px;
      color: #f7fbff;
      background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
      outline: none;
      font-size: 12px;
      font-weight: 800;
    }

    .login-form input:focus {
      border-color: rgba(255,212,71,0.44);
      box-shadow: 0 0 0 3px rgba(255,212,71,0.1), inset 0 1px 0 rgba(255,255,255,0.16);
    }

    .auth-status {
      min-height: 16px;
      margin: -4px 0 12px;
      color: rgba(247,251,255,0.62);
      font-size: 10px;
      font-weight: 800;
      line-height: 1.35;
    }

    .game-kicker {
      display: block;
      color: #ffd447;
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }

    .login-profile {
      display: flex;
      gap: 12px;
      align-items: center;
      margin: 14px 0 18px;
      padding: 12px;
      border-radius: 14px;
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.12);
    }

    .flag-strip {
      display: flex;
      gap: 7px;
      margin: -6px 0 14px;
    }

    .flag-chip {
      position: relative;
      display: inline-flex;
      width: 34px;
      height: 24px;
      flex: 0 0 auto;
      overflow: hidden;
      border-radius: 7px;
      border: 1px solid rgba(255,255,255,0.36);
      box-shadow: 0 8px 16px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.35);
      background: #101827;
    }

    .flag-chip::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(115deg, rgba(255,255,255,0.42) 0 20%, transparent 21% 100%);
    }

    .login-profile .flag-chip {
      width: 44px;
      height: 32px;
      border-radius: 9px;
    }

    .flag-chip.nigeria {
      background: linear-gradient(90deg, #008751 0 33%, #ffffff 33% 66%, #008751 66% 100%);
    }

    .flag-chip.south-africa {
      background:
        linear-gradient(135deg, transparent 0 40%, #ffb81c 40% 48%, #007749 48% 56%, #ffb81c 56% 64%, transparent 64% 100%),
        linear-gradient(90deg, #000000 0 28%, transparent 28% 100%),
        linear-gradient(180deg, #de3831 0 50%, #002395 50% 100%);
    }

    .flag-chip.zimbabwe {
      background:
        linear-gradient(90deg, #ffffff 0 24%, transparent 24% 100%),
        linear-gradient(180deg, #009739 0 16%, #ffd100 16% 32%, #de2010 32% 48%, #000000 48% 58%, #de2010 58% 74%, #ffd100 74% 90%, #009739 90% 100%);
    }

    .flag-chip.zambia {
      background:
        linear-gradient(90deg, transparent 0 68%, #ef7d00 68% 78%, #de2010 78% 88%, #000000 88% 100%),
        #198a00;
    }

    .flag-chip.lesotho {
      background: linear-gradient(180deg, #00209f 0 33%, #ffffff 33% 66%, #009543 66% 100%);
    }

    .login-profile small {
      display: block;
      margin-top: 3px;
      color: rgba(247,251,255,0.62);
      font-size: 11px;
      font-weight: 800;
    }

    .mode-select {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin: 14px 0 18px;
    }

    .mode-option {
      min-height: 86px;
      align-items: flex-start;
      justify-content: flex-start;
      flex-direction: column;
      gap: 6px;
      text-align: left;
      color: #f7fbff;
      background: linear-gradient(180deg, #273d61, #132238);
      box-shadow: 0 5px 0 #07111f, 0 14px 28px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.16);
      text-transform: none;
    }

    .mode-option b {
      display: inline-flex;
      min-width: 38px;
      height: 22px;
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      color: #07111f;
      background: linear-gradient(180deg, #f7fbff, #cfd9ea);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
      font-size: 9px;
      letter-spacing: 0.1em;
    }

    .mode-option b::before {
      content: "";
      width: 8px;
      height: 8px;
      margin-right: 5px;
      border-radius: 50%;
      background: #07111f;
      box-shadow: 10px 0 0 rgba(7,17,31,0.52);
    }

    .mode-option strong {
      color: #ffd447;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .mode-option span {
      color: rgba(247,251,255,0.68);
      font-size: 10px;
      line-height: 1.35;
      font-weight: 800;
      letter-spacing: 0;
    }

    .mode-option.active {
      border-color: rgba(255,212,71,0.48);
      background: linear-gradient(180deg, #34527f, #182b49);
      box-shadow: 0 5px 0 #8c5b00, 0 18px 34px rgba(255,180,33,0.16), inset 0 1px 0 rgba(255,255,255,0.2);
    }

    .mode-option.active b {
      background: linear-gradient(180deg, #ffe27a, #ffb421);
    }

    body[data-mode="marathon"] {
      background:
        radial-gradient(circle at 18% 14%, rgba(74,163,255,0.18), transparent 28%),
        radial-gradient(circle at 84% 16%, rgba(255,101,117,0.16), transparent 26%),
        linear-gradient(180deg, #0b1020 0%, #17233b 46%, #070b15 100%);
    }

    body[data-mode="marathon"] .login-screen {
      background:
        linear-gradient(180deg, rgba(9,14,28,0.24), rgba(7,11,21,0.86)),
        radial-gradient(circle at 50% 26%, rgba(74,163,255,0.2), transparent 34%);
    }

    body[data-mode="marathon"] .game-kicker,
    body[data-mode="marathon"] .prep-kicker,
    body[data-mode="marathon"] .prep-status,
    body[data-mode="marathon"] .result-kicker {
      color: #4aa3ff;
    }

    body[data-mode="marathon"] .mode-option.active,
    body[data-mode="marathon"] .game-button,
    body[data-mode="marathon"] button,
    body[data-mode="marathon"] .result-badge {
      background: linear-gradient(180deg, #ff7b8b, #ff3344);
      box-shadow: 0 6px 0 #8f1320, 0 18px 34px rgba(255,51,68,0.2), inset 0 1px 0 rgba(255,255,255,0.34);
      color: #fff;
    }

    .stadium-shell {
      position: fixed;
      inset: 0;
      z-index: 2;
      pointer-events: none;
      background: linear-gradient(180deg, rgba(4,9,18,0.32), transparent 30%);
    }

    body:not(.logged-in) .stadium-shell {
      display: none;
    }

    .stadium-top {
      position: fixed;
      left: 18px;
      right: 18px;
      bottom: 16px;
      display: flex;
      justify-content: space-between;
      align-items: end;
      gap: 12px;
      color: #f7fbff;
      opacity: 0.82;
    }

    .wallet-pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      order: -1;
      min-height: 34px;
      padding: 0 12px;
      border-radius: 999px;
      background: rgba(255,255,255,0.1);
      border: 1px solid rgba(255,255,255,0.16);
      backdrop-filter: blur(14px);
      font-size: 12px;
    }

    .wallet-icon {
      position: relative;
      width: 22px;
      height: 18px;
      border-radius: 6px;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.52), 0 6px 14px rgba(255,180,33,0.16);
    }

    .wallet-icon::before {
      content: "";
      position: absolute;
      left: 3px;
      right: 3px;
      top: -4px;
      height: 8px;
      border-radius: 8px 8px 3px 3px;
      border: 2px solid rgba(255,226,122,0.8);
      border-bottom: 0;
    }

    .wallet-icon::after {
      content: "";
      position: absolute;
      right: 4px;
      top: 7px;
      width: 4px;
      height: 4px;
      border-radius: 50%;
      background: #07111f;
    }

    .command-center {
      width: min(620px, 92vw);
    }

    .command-panel {
      position: relative;
      overflow: hidden;
      width: 100%;
      text-align: left;
      padding: 4px;
    }

    .command-panel::before {
      content: "";
      position: absolute;
      inset: -20% -10% auto;
      height: 130px;
      background:
        radial-gradient(circle at 22% 50%, rgba(255,212,71,0.16), transparent 34%),
        linear-gradient(90deg, rgba(46,229,157,0.1), rgba(74,163,255,0.08));
      pointer-events: none;
    }

    .command-panel h1 {
      position: relative;
      font-size: clamp(24px, 4vw, 34px);
      margin-bottom: 4px;
      letter-spacing: 0;
    }

    .command-topline {
      position: relative;
      z-index: 1;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    .menu-toggle {
      display: none;
      min-height: 28px;
      padding: 0 10px;
      border-radius: 10px;
      color: #07111f;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
      box-shadow: 0 4px 0 #8c5b00, inset 0 1px 0 rgba(255,255,255,0.45);
      font-size: 9px;
    }

    .command-panel h2 {
      margin: 0 0 8px;
      color: #f7fbff;
      font-size: 12px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }

    .command-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin: 14px 0;
    }

    .command-stats.compact {
      grid-template-columns: repeat(2, 1fr);
      margin: 10px 0;
    }

    .command-stats div,
    .record-row,
    .leader-preview,
    .empty-row {
      border: 1px solid rgba(255,255,255,0.14);
      border-radius: 12px;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.045));
      padding: 9px;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
    }

    .command-stats span,
    .record-row span,
    .leader-preview span,
    .profile-line span,
    .mission-card span {
      display: block;
      color: rgba(247,251,255,0.62);
      font-size: 9px;
      font-weight: 900;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .command-stats strong {
      display: block;
      margin-top: 3px;
      color: #ffd447;
      font-size: 15px;
    }

    .command-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
      margin: 12px 0;
    }

    .command-grid.single-grid,
    .command-grid.menu-grid {
      grid-template-columns: 1fr;
    }

    .command-grid section,
    .command-section {
      position: relative;
      overflow: hidden;
      min-width: 0;
      padding: 12px;
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 16px;
      background:
        radial-gradient(circle at 100% 0%, rgba(255,212,71,0.08), transparent 32%),
        linear-gradient(180deg, rgba(22,38,62,0.72), rgba(7,17,31,0.54));
      box-shadow: 0 16px 34px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,0.1);
    }

    .command-section::before {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(115deg, rgba(255,255,255,0.06) 0 16%, transparent 17% 100%);
      pointer-events: none;
    }

    .command-section > * {
      position: relative;
      z-index: 1;
    }

    .command-grid section.highlight {
      border-color: rgba(255,212,71,0.32);
      box-shadow: 0 20px 42px rgba(255,180,33,0.08), inset 0 0 28px rgba(255,212,71,0.08);
    }

    .section-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 10px;
    }

    .section-head h2 {
      margin: 0;
      text-align: right;
    }

    .section-badge {
      display: inline-flex;
      min-height: 24px;
      align-items: center;
      padding: 0 9px;
      border-radius: 999px;
      color: #07111f;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
      font-size: 9px;
      font-weight: 900;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }

    .record-row,
    .leader-preview,
    .profile-line {
      display: grid;
      grid-template-columns: 40px 1fr auto;
      gap: 10px;
      align-items: center;
      margin-top: 6px;
      min-height: 54px;
    }

    .record-row strong {
      display: block;
      color: #f7fbff;
      font-size: 12px;
      text-transform: uppercase;
    }

    .record-row.win .rank-medal {
      background: linear-gradient(180deg, #90ffcf, #2ee59d);
    }

    .record-row.loss .rank-medal {
      color: #fff;
      background: linear-gradient(180deg, #ff8b98, #ff3344);
    }

    .record-row.loss b {
      color: #ff6575;
    }

    .record-row b,
    .leader-preview b,
    .leader-preview strong,
    .profile-line strong {
      color: #f7fbff;
      font-size: 11px;
    }

    .profile-line span {
      align-self: end;
    }

    .profile-line strong {
      justify-self: end;
      font-size: 12px;
      text-align: right;
    }

    .leader-preview.rank-1 {
      border-color: rgba(255,212,71,0.38);
      background: linear-gradient(180deg, rgba(255,212,71,0.16), rgba(255,255,255,0.05));
    }

    .wallet-section .command-stats div {
      min-height: 62px;
      background:
        radial-gradient(circle at 85% 18%, rgba(255,212,71,0.16), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.045));
    }

    .wallet-section .command-stats strong {
      font-size: 18px;
    }

    .profile-section {
      background:
        radial-gradient(circle at 100% 0%, rgba(46,229,157,0.11), transparent 34%),
        linear-gradient(180deg, rgba(22,38,62,0.72), rgba(7,17,31,0.54));
    }

    .records-section {
      background:
        radial-gradient(circle at 100% 0%, rgba(74,163,255,0.12), transparent 34%),
        linear-gradient(180deg, rgba(22,38,62,0.72), rgba(7,17,31,0.54));
    }

    .menu-section {
      background:
        radial-gradient(circle at 100% 0%, rgba(255,212,71,0.13), transparent 34%),
        radial-gradient(circle at 0% 100%, rgba(46,229,157,0.1), transparent 32%),
        linear-gradient(180deg, rgba(22,38,62,0.76), rgba(7,17,31,0.56));
    }

    .menu-tile-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 9px;
    }

    .menu-tile-grid button {
      min-width: 0;
      min-height: 76px;
      align-items: flex-start;
      justify-content: flex-start;
      flex-direction: column;
      gap: 6px;
      padding: 11px;
      color: #f7fbff;
      text-align: left;
      border-radius: 14px;
      background:
        linear-gradient(180deg, rgba(39,61,97,0.94), rgba(16,31,53,0.92));
      box-shadow: 0 5px 0 #07111f, 0 14px 26px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.14);
    }

    .menu-tile-grid button strong {
      color: #ffd447;
      font-size: 12px;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

    .menu-tile-grid button small {
      color: rgba(247,251,255,0.62);
      font-size: 10px;
      font-weight: 800;
      line-height: 1.25;
      text-transform: none;
    }

    .menu-tile-grid .pace-icon {
      width: 24px;
      height: 24px;
    }

    .command-nav {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      margin: 12px 0;
    }

    .command-nav button {
      min-height: 32px;
      padding: 0 10px;
      border-radius: 10px;
      color: rgba(247,251,255,0.76);
      background: linear-gradient(180deg, rgba(39,61,97,0.86), rgba(16,31,53,0.86));
      box-shadow: 0 4px 0 #07111f, inset 0 1px 0 rgba(255,255,255,0.12);
      font-size: 9px;
    }

    .command-nav button.active {
      color: #07111f;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
      box-shadow: 0 4px 0 #8c5b00, 0 12px 24px rgba(255,180,33,0.16), inset 0 1px 0 rgba(255,255,255,0.45);
    }

    .mission-card {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px;
      border-radius: 16px;
      border: 1px solid rgba(255,212,71,0.24);
      background:
        linear-gradient(135deg, rgba(255,212,71,0.13), rgba(46,229,157,0.08)),
        rgba(7,17,31,0.34);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
    }

    .mission-card strong {
      display: block;
      color: #ffd447;
      font-size: 18px;
      line-height: 1.1;
    }

    .mission-card small {
      display: block;
      margin-top: 4px;
      color: rgba(247,251,255,0.62);
      font-size: 11px;
      font-weight: 800;
    }

    .mission-card button {
      flex: 0 0 auto;
    }

    .leaderboard-open {
      width: 100%;
      margin-top: 8px;
    }

    .leaderboard-modal {
      position: fixed;
      inset: 0;
      z-index: 90;
      display: grid;
      place-items: center;
      padding: 18px;
      background: rgba(3,8,16,0.62);
      backdrop-filter: blur(10px);
    }

    .leaderboard-card {
      position: relative;
      overflow: hidden;
      width: min(520px, 92vw);
      max-height: 86vh;
      padding: 18px;
      border-radius: 18px;
      color: #f7fbff;
      border: 1px solid rgba(255,212,71,0.24);
      background:
        linear-gradient(180deg, rgba(22,38,62,0.97), rgba(7,17,31,0.96));
      box-shadow: 0 34px 90px rgba(0,0,0,0.52), inset 0 1px 0 rgba(255,255,255,0.16);
    }

    .leaderboard-card h1 {
      margin: 4px 0;
      font-size: clamp(28px, 5vw, 44px);
    }

    .leaderboard-card p {
      margin: 0 0 12px;
      color: rgba(247,251,255,0.68);
      font-size: 12px;
    }

    .modal-close {
      position: absolute;
      right: 12px;
      top: 12px;
      min-height: 30px;
      padding: 0 10px;
      border-radius: 10px;
      color: #f7fbff;
      background: linear-gradient(180deg, #273d61, #132238);
      box-shadow: 0 4px 0 #07111f;
      font-size: 9px;
    }

    .leaderboard-list {
      display: grid;
      gap: 8px;
      max-height: 58vh;
      overflow-y: auto;
      padding-right: 3px;
    }

    .leaderboard-row {
      display: grid;
      grid-template-columns: 42px 1fr auto;
      gap: 10px;
      align-items: center;
      padding: 10px;
      border-radius: 14px;
      border: 1px solid rgba(255,255,255,0.12);
      background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    }

    .leaderboard-row.rank-1 {
      border-color: rgba(255,212,71,0.42);
      background: linear-gradient(180deg, rgba(255,212,71,0.18), rgba(255,255,255,0.05));
    }

    .rank-medal {
      width: 36px;
      height: 36px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      color: #07111f;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
      font-weight: 900;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.48);
    }

    .leaderboard-row strong {
      display: block;
      color: #f7fbff;
      font-size: 13px;
    }

    .leaderboard-row span {
      color: rgba(247,251,255,0.62);
      font-size: 10px;
      font-weight: 800;
    }

    .leaderboard-row b {
      color: #ffd447;
      font-size: 12px;
    }

    .empty-row {
      color: rgba(247,251,255,0.62);
      font-size: 11px;
    }

    .command-tools {
      display: grid;
      grid-template-columns: 1fr auto 1fr auto;
      gap: 8px;
      margin: 12px 0;
    }

    .command-tools input {
      min-width: 0;
      min-height: 38px;
      border: 1px solid rgba(255,255,255,0.14);
      border-radius: 12px;
      padding: 0 10px;
      color: #f7fbff;
      background: rgba(255,255,255,0.08);
      outline: none;
    }

    .result-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }

    .result-actions button {
      flex: 1;
      min-width: 150px;
    }

    .secondary-command {
      color: #f7fbff;
      background: linear-gradient(180deg, #273d61, #132238);
      box-shadow: 0 6px 0 #07111f, 0 18px 34px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.18);
    }

    .panel,
    .race-stat,
    .center-message,
    .center-message.result {
      color: #f7fbff;
      background:
        linear-gradient(180deg, rgba(22,38,62,0.92), rgba(9,18,32,0.82));
      border-color: rgba(255,255,255,0.16);
      box-shadow: 0 18px 46px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.16);
    }

    .center-message p,
    .race-stat span,
    .status {
      color: rgba(247,251,255,0.72);
      opacity: 1;
    }

    .game-button,
    button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-height: 42px;
      border: 1px solid rgba(255,255,255,0.22);
      border-radius: 12px;
      color: #07111f;
      background:
        linear-gradient(180deg, #ffe27a, #ffb421);
      box-shadow: 0 6px 0 #9e6200, 0 18px 34px rgba(255,180,33,0.24), inset 0 1px 0 rgba(255,255,255,0.55);
      text-transform: uppercase;
    }

    .btn-icon {
      position: relative;
      display: inline-flex;
      width: 20px;
      height: 20px;
      flex: 0 0 auto;
      align-items: center;
      justify-content: center;
      border-radius: 7px;
      background: rgba(7,17,31,0.16);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.24);
    }

    .btn-icon::before,
    .btn-icon::after {
      content: "";
      position: absolute;
      background: currentColor;
    }

    .login-icon::before {
      width: 10px;
      height: 8px;
      border: 2px solid currentColor;
      border-top: 0;
      background: transparent;
      bottom: 4px;
      border-radius: 2px;
    }

    .login-icon::after {
      width: 8px;
      height: 7px;
      border: 2px solid currentColor;
      border-bottom: 0;
      background: transparent;
      top: 3px;
      border-radius: 8px 8px 0 0;
    }

    .register-icon::before {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      top: 3px;
    }

    .register-icon::after {
      width: 14px;
      height: 7px;
      bottom: 3px;
      border-radius: 8px 8px 3px 3px;
    }

    .ticket-icon::before {
      width: 14px;
      height: 10px;
      border: 2px solid currentColor;
      background: transparent;
      border-radius: 3px;
    }

    .ticket-icon::after {
      width: 2px;
      height: 12px;
      background: currentColor;
      opacity: 0.65;
    }

    .reset-icon::before {
      width: 12px;
      height: 12px;
      border: 2px solid currentColor;
      border-left-color: transparent;
      background: transparent;
      border-radius: 50%;
    }

    .reset-icon::after {
      right: 3px;
      top: 3px;
      width: 0;
      height: 0;
      background: transparent;
      border-left: 5px solid currentColor;
      border-top: 4px solid transparent;
      border-bottom: 4px solid transparent;
    }

    .pace-icon {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
    }

    .pace-icon::before {
      width: 9px;
      height: 16px;
      transform: skew(-16deg);
      background: #07111f;
      clip-path: polygon(44% 0, 100% 0, 63% 42%, 100% 42%, 36% 100%, 49% 55%, 0 55%);
    }

    .command-nav button::before,
    .secondary-command::before,
    .command-tools button::before,
    .modal-close::before,
    .menu-toggle::before,
    .leaderboard-open::before,
    .mission-card button::before,
    .result-actions button::before {
      content: "";
      width: 14px;
      height: 14px;
      flex: 0 0 auto;
      border-radius: 4px;
      background:
        linear-gradient(currentColor 0 0) center / 8px 2px no-repeat,
        linear-gradient(currentColor 0 0) center / 2px 8px no-repeat,
        rgba(7,17,31,0.14);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.16);
      opacity: 0.9;
    }

    .game-button.primary {
      width: 100%;
    }

    .game-button.ghost,
    #restartBtn {
      color: #f7fbff;
      background: linear-gradient(180deg, #273d61, #132238);
      box-shadow: 0 6px 0 #07111f, 0 18px 34px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.18);
    }

    button:hover {
      transform: translateY(-2px);
    }

    button:active {
      transform: translateY(3px);
      box-shadow: 0 3px 0 #9e6200, 0 10px 22px rgba(255,180,33,0.18), inset 0 1px 0 rgba(255,255,255,0.42);
    }

    .tap-control {
      position: fixed;
      right: 18px;
      bottom: 72px;
      z-index: 36;
      display: none;
      width: min(190px, 42vw);
      padding: 12px;
      border-radius: 18px;
      border: 1px solid rgba(255,255,255,0.16);
      background: linear-gradient(180deg, rgba(22,38,62,0.92), rgba(9,18,32,0.88));
      box-shadow: 0 20px 48px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.14);
      color: #f7fbff;
    }

    .tap-control.active {
      display: block;
    }

    .tap-button {
      width: 100%;
      min-height: 64px;
      border-radius: 16px;
      flex-direction: column;
      font-size: 11px;
    }

    .tap-button span {
      font-size: 22px;
      line-height: 1;
    }

    .tap-button.hit {
      animation: tapHit 0.24s ease;
    }

    .tap-meter {
      height: 8px;
      margin-top: 10px;
      overflow: hidden;
      border-radius: 999px;
      background: rgba(255,255,255,0.12);
    }

    .tap-meter span {
      display: block;
      width: 0;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, #2ee59d, #ffd447);
      transition: width 0.12s ease;
    }

    .tap-control small {
      display: block;
      margin-top: 7px;
      color: rgba(247,251,255,0.68);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      text-align: center;
    }

    @keyframes tapHit {
      0% { transform: scale(1); }
      50% { transform: scale(0.94); }
      100% { transform: scale(1); }
    }

    html,
    body,
    * {
      box-sizing: border-box;
    }

    html,
    body {
      max-width: 100%;
      overflow-x: hidden;
      touch-action: manipulation;
    }

    #game canvas {
      max-width: 100vw;
    }

    .hud,
    .race-info,
    .center-message,
    .login-card,
    .tap-control,
    .stadium-top {
      max-width: calc(100vw - 20px);
    }

    .bet-panel,
    .race-carousel {
      max-width: 100%;
    }

    .bet-option.locked,
    .bet-option:disabled {
      cursor: not-allowed;
      opacity: 0.42;
      filter: grayscale(0.3);
      transform: none;
    }

    .bet-option.locked strong,
    .bet-option:disabled strong {
      color: rgba(247,251,255,0.64);
      text-shadow: none;
    }

    @media (max-width: 600px) {
      .hud {
        flex-direction: column;
        align-items: stretch;
      }

      .action-panel {
        display: flex;
        gap: 8px;
      }

      .action-panel .game-button,
      .action-panel button {
        flex: 1;
        min-width: 0;
      }

      .center-message {
        width: calc(100vw - 20px);
        padding: 16px;
      }

      .bet-options {
        grid-template-columns: 1fr;
      }

      .race-info {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
      }

      .race-stat {
        min-width: 0;
        padding: 9px;
      }

      .race-stat strong {
        font-size: 13px;
        overflow-wrap: anywhere;
      }

      .login-card {
        padding: 18px;
      }

      .login-form {
        grid-template-columns: 1fr;
      }

      .command-grid,
      .command-stats,
      .command-tools {
        grid-template-columns: 1fr;
      }

      .mode-select {
        grid-template-columns: 1fr;
      }

      .stadium-top {
        left: 12px;
        right: 12px;
        bottom: 10px;
        max-width: calc(100vw - 24px);
      }

      .tap-control {
        right: 10px;
        bottom: 58px;
        width: 150px;
      }

      .tap-button {
        min-height: 58px;
      }
    }

    /* Final dark game skin for older white prototype surfaces */
    .center-message.prep,
    .bet-panel,
    .result-card {
      color: #f7fbff;
    }

    .center-message.prep {
      width: min(460px, 90vw);
      background:
        linear-gradient(180deg, rgba(22,38,62,0.96), rgba(7,17,31,0.9));
      border: 1px solid rgba(255,212,71,0.18);
      box-shadow: 0 26px 78px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.14);
    }

    .center-message.prep h1,
    .result-card h1 {
      color: #f7fbff;
      text-shadow: 0 2px 0 rgba(0,0,0,0.2);
    }

    .center-message.prep p,
    .bet-panel p,
    .result-card p {
      color: rgba(247,251,255,0.72);
      opacity: 1;
    }

    .prep-kicker,
    .prep-status,
    .result-kicker {
      color: #ffd447;
      text-shadow: 0 0 18px rgba(255,212,71,0.18);
    }

    .bet-options {
      gap: 10px;
    }

    .bet-option {
      min-height: 64px;
      border-radius: 14px;
      color: #f7fbff;
      border: 1px solid rgba(255,212,71,0.2);
      background:
        linear-gradient(180deg, rgba(39,61,97,0.98), rgba(16,31,53,0.98));
      box-shadow: 0 7px 0 #07111f, 0 18px 36px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.14);
    }

    .bet-option::before {
      background:
        linear-gradient(115deg, rgba(255,212,71,0.16) 0 18%, transparent 19% 100%),
        radial-gradient(circle at 84% 22%, rgba(46,229,157,0.16), transparent 24%);
      opacity: 1;
    }

    .bet-option strong {
      color: #ffd447;
      font-size: 15px;
      text-shadow: 0 0 18px rgba(255,212,71,0.14);
    }

    .bet-option span {
      color: rgba(247,251,255,0.72);
      font-size: 10px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .bet-option:hover {
      border-color: rgba(255,212,71,0.42);
      box-shadow: 0 8px 0 #07111f, 0 24px 46px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.2);
    }

    .race-carousel {
      width: min(380px, 78vw);
    }

    .racer-preview,
    .lineup-runner {
      color: #f7fbff;
      border-color: rgba(255,255,255,0.14);
      background:
        linear-gradient(90deg, rgba(9,18,32,0.88), rgba(22,38,62,0.76)),
        var(--flag-bg);
      box-shadow: 0 18px 42px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.12);
    }

    .racer-preview::before {
      background:
        linear-gradient(115deg, rgba(255,212,71,0.12) 0 20%, transparent 21% 100%),
        linear-gradient(90deg, rgba(7,17,31,0.34), rgba(7,17,31,0.08));
    }

    .racer-preview strong,
    .runner-name {
      color: #f7fbff;
    }

    .racer-preview span,
    .runner-country,
    .runner-code,
    .swipe-hint {
      color: rgba(247,251,255,0.68);
    }

    .racer-preview b,
    .racer-avatar {
      color: #07111f;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
      border-color: rgba(255,255,255,0.24);
    }

    .player-card {
      color: #f7fbff;
      background:
        linear-gradient(180deg, rgba(22,38,62,0.88), rgba(9,18,32,0.76));
      border-color: rgba(255,255,255,0.14);
      box-shadow: 0 14px 34px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.12);
    }

    .player-card strong {
      color: #ffd447;
    }

    .player-card.chaser strong {
      color: #ff6575;
    }

    .player-card .row {
      border-top-color: rgba(255,255,255,0.1);
    }

    .result-stats div {
      color: #f7fbff;
      border-color: rgba(255,255,255,0.14);
      background: rgba(255,255,255,0.07);
    }

    .result-badge {
      color: #07111f;
      background: linear-gradient(180deg, #ffe27a, #ffb421);
      border-color: rgba(255,212,71,0.3);
    }

    @media (max-width: 720px) {
      .login-screen {
        align-items: start;
        overflow-y: auto;
        padding: 10px;
        -webkit-overflow-scrolling: touch;
      }

      .login-card {
        width: min(390px, calc(100vw - 20px));
        padding: 14px;
        margin: 0 auto 14px;
      }

      .login-card h1 {
        font-size: 26px;
        margin: 2px 0 4px;
      }

      .login-card p {
        margin-bottom: 10px;
        font-size: 11px;
      }

      .login-profile,
      .flag-strip,
      .mode-select {
        margin-top: 8px;
        margin-bottom: 10px;
      }

      .center-message.command-center {
        top: 8px;
        bottom: auto;
        left: 8px;
        right: 8px;
        transform: none;
        width: auto;
        max-width: none;
        max-height: calc(100dvh - 16px);
        padding: 8px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        align-items: stretch;
        justify-content: flex-start;
      }

      .command-panel {
        display: block;
        max-height: none;
        padding: 2px;
        overflow: visible;
      }

      .command-panel .prep-kicker {
        font-size: 8px;
      }

      .menu-toggle {
        display: none;
      }

      .command-panel h1 {
        font-size: 20px;
        margin: 2px 0;
      }

      .command-panel > p {
        display: none;
      }

      .command-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        margin: 8px -2px 8px;
        padding: 0 2px 4px;
        scrollbar-width: none;
      }

      .command-panel.menu-collapsed .command-nav {
        display: none;
      }

      .command-nav::-webkit-scrollbar {
        display: none;
      }

      .command-nav button {
        flex: 0 0 auto;
        min-height: 30px;
        padding: 0 9px;
        font-size: 8px;
      }

      .command-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
        margin: 6px 0;
      }

      .command-stats div {
        min-width: 0;
        padding: 6px;
        border-radius: 10px;
      }

      .command-stats span {
        font-size: 8px;
      }

      .command-stats strong {
        font-size: 12px;
        overflow-wrap: anywhere;
      }

      .mission-card {
        min-height: 48px;
        padding: 8px;
        border-radius: 14px;
      }

      .mission-card strong {
        font-size: 14px;
      }

      .mission-card small {
        display: none;
      }

      .mission-card button {
        min-height: 36px;
        padding: 0 10px;
        font-size: 9px;
      }

      .command-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 8px 0;
        overflow: visible;
        padding-right: 2px;
      }

      .menu-tile-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
      }

      .menu-tile-grid button {
        min-height: 58px;
        padding: 7px;
        gap: 4px;
      }

      .menu-tile-grid button strong {
        font-size: 10px;
      }

      .menu-tile-grid button small {
        display: none;
      }

      .command-section {
        padding: 8px;
        border-radius: 14px;
      }

      .section-head {
        margin-bottom: 7px;
      }

      .section-badge {
        min-height: 20px;
        padding: 0 7px;
        font-size: 8px;
      }

      .section-head h2 {
        font-size: 10px;
      }

      .command-stats.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .record-row,
      .leader-preview,
      .profile-line {
        grid-template-columns: 30px minmax(0, 1fr) auto;
        min-height: 42px;
        gap: 7px;
        padding: 6px;
      }

      .record-row:nth-of-type(n+5) {
        display: none;
      }

      .rank-medal {
        width: 26px;
        height: 26px;
        font-size: 10px;
      }

      .record-row strong,
      .leader-preview strong,
      .profile-line strong {
        font-size: 10px;
        overflow-wrap: anywhere;
      }

      .record-row span,
      .leader-preview span,
      .profile-line span {
        font-size: 8px;
      }

      .record-row b,
      .leader-preview b {
        font-size: 10px;
      }

      .command-tools,
      .command-tools.pin-tools {
        grid-template-columns: 1fr 78px;
        gap: 7px;
      }

      .command-tools input {
        min-height: 34px;
        font-size: 11px;
      }

      .command-tools button {
        min-height: 34px;
        padding: 0 8px;
        font-size: 8px;
      }

      .result-actions {
        display: flex;
        margin-top: 6px;
      }

      .result-actions button {
        min-width: 0;
        min-height: 34px;
        padding: 0 8px;
        font-size: 8px;
      }

      .command-panel > .auth-status {
        margin: 2px 0 0;
        font-size: 8px;
      }

      .leaderboard-card {
        width: calc(100vw - 24px);
        max-height: calc(100dvh - 28px);
        padding: 14px;
      }

      .leaderboard-card h1 {
        font-size: 26px;
      }

      .leaderboard-list {
        max-height: calc(100dvh - 150px);
      }

      .center-message.stake-screen {
        top: 10px;
        bottom: auto;
        left: 8px;
        right: 8px;
        transform: none;
        width: auto;
        max-width: none;
        max-height: calc(100dvh - 20px);
        padding: 10px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
      }

      .bet-panel {
        width: 100%;
      }

      .bet-panel h1 {
        font-size: 22px;
        margin: 2px 0;
      }

      .bet-panel p {
        font-size: 10px;
        margin-bottom: 6px;
      }

      .bet-options {
        grid-template-columns: 1fr;
        gap: 7px;
        max-height: calc(100dvh - 210px);
        overflow-y: auto;
        padding-right: 2px;
      }

      .bet-option {
        grid-template-columns: 28px 1fr;
        min-height: 48px;
        padding: 7px 9px;
        border-radius: 12px;
      }

      .stake-icon {
        width: 26px;
        height: 26px;
      }

      .bet-option strong {
        font-size: 13px;
      }

      .bet-option span {
        font-size: 8px;
      }
    }
