
/* =========================================================
   Racecraft GP CSS-only mobile polish
   Safe version:
   - No extra JavaScript
   - Does not touch CPU
   - Does not touch start button
   - Does not alter game state
   ========================================================= */

:root {
  --rcgp-panel: rgba(6, 12, 24, .96);
  --rcgp-yellow: #ffd84d;
  --rcgp-orange: #ff9f1c;
}

.hands-grid.tutorial-hand-guide {
  position: relative;
}

.play-card.tutorial-muted {
  opacity: .16 !important;
  filter: grayscale(1) brightness(.42) contrast(.82) !important;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

.play-card.tutorial-target {
  z-index: 6;
  border-color: #facc15 !important;
  box-shadow: 0 0 0 5px rgba(250, 204, 21, .26), 0 0 34px rgba(250, 204, 21, .42), 0 16px 36px rgba(15, 23, 42, .24) !important;
  animation: tutorialPulseCard 1.15s ease-in-out infinite alternate;
}

.play-card.tutorial-target.selected {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, .24), 0 0 34px rgba(34, 197, 94, .36), 0 16px 36px rgba(15, 23, 42, .24) !important;
}

.tutorial-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #172033;
  background: #facc15;
  border: 1px solid rgba(120, 53, 15, .28);
  font-size: 12px;
  font-weight: 1000;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .18);
}

.tutorial-next {
  display: block;
  margin-top: 6px;
  color: #0f766e;
}

.run-button.tutorial-target {
  border-color: #facc15 !important;
  box-shadow: 0 0 0 5px rgba(250, 204, 21, .24), 0 0 32px rgba(250, 204, 21, .36), 0 14px 30px rgba(15, 23, 42, .24) !important;
  animation: tutorialPulseCard 1.1s ease-in-out infinite alternate;
}

@keyframes tutorialPulseCard {
  from { transform: translateY(-1px); }
  to { transform: translateY(-5px); }
}

/* Keep overlays visual-only */
.focus-card,
.course-card,
.course-tile,
.track-card {
  position: relative;
  overflow: hidden;
}

.focus-card::after,
.course-card::after,
.course-tile::after,
.track-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.04) 40%, rgba(0,0,0,.58));
  pointer-events: none;
  z-index: 1;
}

.focus-name,
.focus-safe,
.focus-label,
.focus-cars {
  position: relative;
  z-index: 2;
  text-shadow: 0 2px 8px rgba(0,0,0,.85);
}

/* Never cover or disable title screen buttons */
.title-screen,
.title-card,
.title-card button,
.title-card .primary-button,
.title-card .ghost-button,
.start-screen,
.start-screen button {
  pointer-events: auto !important;
  position: relative;
  z-index: 1000;
}

@media (max-width: 720px) {
  html, body {
    width: 100%;
    overflow-x: hidden;
  }

  .game-app {
    max-width: 100%;
    padding: 8px 8px calc(260px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .top-command {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: -8px -8px 8px;
    padding: 8px;
    border-radius: 0 0 18px 18px;
    background: rgba(5, 10, 20, .94);
    backdrop-filter: blur(12px);
  }

  .brand-block .eyebrow,
  .brand-subtitle,
  .turn-guide,
  .coach-panel,
  .course-details,
  .rules-panel,
  .current-player,
  .section-heading,
  .mini-map {
    display: none !important;
  }

  .top-command h1,
  .brand-block h1 {
    font-size: 20px !important;
    line-height: 1.05;
  }

  .race-hud {
    gap: 6px !important;
    flex-wrap: wrap;
  }

  .race-hud .hud-pill:nth-child(n+4) {
    display: none;
  }

  .game-stage {
    display: block !important;
  }

  .side-dash {
    display: none !important;
  }

  .race-board {
    padding: 8px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .alert-bar {
    margin-bottom: 8px !important;
    padding: 8px 10px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
  }

  .alert-bar.empty-state {
    display: none !important;
  }

  .course-focus {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 7px !important;
    overflow: visible !important;
  }

  .focus-card.now,
  .course-focus .focus-card:first-child {
    grid-column: 1 / -1 !important;
    min-height: 335px !important;
    border-radius: 24px !important;
    box-shadow: 0 18px 48px rgba(0,0,0,.40) !important;
    border: 2px solid rgba(255,255,255,.18) !important;
  }

  .course-focus .focus-card:not(:first-child) {
    min-height: 76px !important;
    border-radius: 14px !important;
    opacity: .92;
  }

  .focus-card .course-art {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .focus-card.now .focus-name,
  .course-focus .focus-card:first-child .focus-name {
    font-size: 30px !important;
    line-height: 1.05 !important;
    font-weight: 950 !important;
  }

  .focus-card.now .focus-safe,
  .course-focus .focus-card:first-child .focus-safe {
    display: inline-flex !important;
    margin-top: 6px !important;
    padding: 6px 12px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, var(--rcgp-yellow), var(--rcgp-orange)) !important;
    color: #0b1320 !important;
    text-shadow: none !important;
    font-size: 16px !important;
    font-weight: 950 !important;
  }

  .course-focus .focus-card:not(:first-child) .focus-name {
    font-size: 11px !important;
    line-height: 1.05 !important;
  }

  .course-focus .focus-card:not(:first-child) .focus-safe {
    font-size: 10px !important;
  }

  .course-focus .focus-card:not(:first-child) .focus-label {
    display: none !important;
  }

  .focus-card.now .focus-cars,
  .course-focus .focus-card:first-child .focus-cars {
    position: absolute !important;
    left: 50% !important;
    bottom: 78px !important;
    transform: translateX(-50%) !important;
    z-index: 4 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 4px !important;
    width: 90% !important;
  }

  .focus-card.now .car-img,
  .course-focus .focus-card:first-child .car-img {
    width: 84px !important;
    height: 84px !important;
  }

  .course-focus .focus-card:not(:first-child) .focus-cars {
    display: none !important;
  }

  .command-dock {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    border-radius: 22px 22px 0 0 !important;
    padding: 9px 10px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    background: var(--rcgp-panel) !important;
  }

  .dock-topline h2 {
    font-size: 15px !important;
    margin: 0 !important;
  }

  .dock-kicker {
    font-size: 10px !important;
    margin-bottom: 0 !important;
  }

  .target-area {
    display: none !important;
  }

  .move-preview {
    min-height: 42px !important;
    padding: 8px 10px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    margin-bottom: 6px !important;
  }

  .move-preview .preview-route {
    display: none !important;
  }

  .hands-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    margin-top: 0 !important;
  }

  .hand-block h3 {
    margin: 0 0 5px !important;
    font-size: 11px !important;
  }

  .speed-hand {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  .skill-hand {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  .play-card {
    min-height: 62px !important;
    border-radius: 15px !important;
    padding: 7px !important;
  }

  .speed-orb {
    width: 36px !important;
    height: 36px !important;
    font-size: 24px !important;
  }

  .card-kind,
  .card-text,
  .skill-icon {
    display: none !important;
  }

  .card-title {
    margin-top: 4px !important;
    font-size: 11px !important;
    text-align: center !important;
  }

  .run-button {
    height: 52px !important;
    min-width: 100% !important;
    border-radius: 15px !important;
    font-size: 17px !important;
    letter-spacing: .08em;
  }
}

/* =========================================================
   Phase 10 cockpit UX polish
   - visual only, with route preview hooks from app.js
   - keeps turn rules and CPU logic untouched
   ========================================================= */

.title-screen {
  background: linear-gradient(135deg, rgba(2, 6, 23, .96), rgba(7, 20, 36, .94));
}

.title-card {
  background:
    linear-gradient(135deg, rgba(12, 18, 32, .96), rgba(5, 12, 24, .96)),
    repeating-linear-gradient(45deg, rgba(125, 211, 252, .08) 0 12px, transparent 12px 24px);
  color: #e0f2fe;
  border-color: rgba(125, 211, 252, .28);
  box-shadow: 0 34px 110px rgba(0, 0, 0, .58), 0 0 0 1px rgba(255, 255, 255, .06) inset;
}

.title-card h1,
.title-copy {
  color: #ffffff;
}

.title-hint {
  color: #b7cde2;
}

.title-card .ghost-button {
  background: rgba(15, 23, 42, .92);
}

.game-app {
  padding-bottom: 304px;
}

.top-command {
  padding: 12px 16px;
  margin-bottom: 12px;
}

.top-command .brand-block h1 {
  font-size: clamp(28px, 3vw, 40px);
}

.brand-subtitle {
  font-size: 13px;
}

.game-stage {
  gap: 14px;
}

.race-board,
.side-dash {
  padding: 14px;
}

.current-player.empty-state {
  padding: 0;
  border: 0;
  background: transparent;
}

.current-player-card {
  grid-template-columns: 64px 1fr;
  padding: 10px;
  border-radius: 18px;
}

.current-car-img {
  width: 60px;
  height: 60px;
}

.current-player-info {
  min-width: 0;
}

.current-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 5px;
}

.current-title-row strong {
  font-size: 18px;
}

.current-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: #b7cde2;
  font-size: 13px;
  font-weight: 800;
}

.condition-row {
  margin-top: 5px;
}

.course-focus {
  grid-template-columns: minmax(170px, 1.15fr) repeat(4, minmax(112px, .8fr));
  gap: 8px;
}

.focus-card {
  min-height: 146px;
  padding: 10px;
  border-radius: 17px;
}

.focus-card.now {
  min-height: 166px;
}

.focus-card.preview-ok {
  border-color: rgba(74, 222, 128, .72);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .12), 0 12px 26px rgba(0, 0, 0, .34);
}

.focus-card.preview-out {
  border-color: rgba(248, 113, 113, .78);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, .16), 0 0 28px rgba(239, 68, 68, .18);
}

.focus-card.preview-chance {
  border-color: rgba(234, 179, 8, .78);
  box-shadow: 0 0 0 2px rgba(234, 179, 8, .18), 0 12px 26px rgba(42, 54, 71, .16);
}

.focus-card.preview-final {
  outline: 2px solid rgba(250, 204, 21, .74);
  outline-offset: -5px;
}

.focus-arrival {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  padding: 4px 7px;
  border-radius: 7px;
  color: #ffffff;
  background: #2563eb;
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: 0 6px 14px rgba(37,99,235,.28);
  font-size: 10px;
  font-weight: 1000;
}

.course-art {
  height: 68px;
  margin: 7px 0 6px;
}

.focus-name {
  font-size: 15px;
  line-height: 1.15;
}

.focus-safe {
  font-size: 12px;
}

.focus-risk {
  position: relative;
  z-index: 3;
  display: inline-grid;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .05em;
  text-shadow: none;
}

.focus-risk.ok {
  background: rgba(187, 247, 208, .94);
  color: #14532d;
}

.focus-risk.out {
  background: rgba(254, 202, 202, .96);
  color: #7f1d1d;
}

.focus-risk.chance {
  background: rgba(254, 240, 138, .97);
  color: #713f12;
}

.move-preview.safe strong::before,
.move-preview.danger strong::before {
  content: none !important;
}

.command-dock {
  padding: 12px;
  border-radius: 22px;
  max-height: 44vh;
  overflow: auto;
}

.dock-topline {
  margin-bottom: 6px;
}

.coach-panel {
  min-height: 38px;
  padding: 8px 12px;
  margin-bottom: 6px;
}

.move-preview {
  min-height: 44px;
  padding: 9px 12px;
  line-height: 1.35;
}

.preview-route {
  margin-top: 6px;
  max-height: 35px;
  overflow: hidden;
}

.hands-grid {
  grid-template-columns: minmax(340px, 1.18fr) minmax(260px, .82fr) 150px;
  gap: 10px;
}

.speed-hand {
  grid-template-columns: repeat(4, minmax(80px, 1fr));
}

.skill-hand {
  grid-template-columns: repeat(2, minmax(124px, 1fr));
}

.play-card {
  min-height: 86px;
  padding: 9px;
  border-radius: 16px;
}

.play-card[role="button"]:focus-visible {
  outline: 3px solid rgba(250, 204, 21, .82);
  outline-offset: 2px;
}

.speed-card-face {
  margin: 2px 0 6px;
}

.speed-orb {
  width: 42px;
  height: 42px;
  font-size: 26px;
}

.skill-icon {
  width: 34px;
  height: 34px;
}

.card-title {
  font-size: 14px;
  line-height: 1.15;
}

.card-text {
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.run-button {
  height: 58px;
  align-self: end;
}

.primary-button:disabled {
  opacity: .66;
}

@media (max-width: 1040px) {
  .game-app {
    padding-bottom: 330px;
  }

  .command-dock {
    max-height: 52vh;
  }

  .hands-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .game-app {
    padding: 8px 8px calc(248px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .top-command {
    gap: 8px !important;
  }

  .top-actions {
    display: grid !important;
    grid-template-columns: 52px 52px 1fr;
    gap: 8px !important;
    width: 100%;
  }

  .top-actions > * {
    min-height: 44px !important;
    width: auto !important;
    flex: unset !important;
  }

  .alert-bar {
    margin-bottom: 7px !important;
  }

  .course-focus {
    gap: 6px !important;
  }

  .focus-card.now,
  .course-focus .focus-card:first-child {
    min-height: 190px !important;
    height: 190px !important;
    border-radius: 22px !important;
  }

  .course-focus .focus-card:not(:first-child) {
    min-height: 52px !important;
    height: 52px !important;
  }

  .focus-card.now .course-art,
  .course-focus .focus-card:first-child .course-art {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: inherit !important;
  }

  .course-focus .focus-card:not(:first-child) .course-art {
    display: none !important;
  }

  .focus-card.now .focus-name,
  .course-focus .focus-card:first-child .focus-name {
    font-size: 20px !important;
  }

  .focus-card.now .focus-safe,
  .course-focus .focus-card:first-child .focus-safe {
    padding: 5px 10px !important;
    font-size: 13px !important;
  }

  .focus-card.now .focus-cars,
  .course-focus .focus-card:first-child .focus-cars {
    bottom: 42px !important;
  }

  .focus-card.now .car-img,
  .course-focus .focus-card:first-child .car-img {
    width: 50px !important;
    height: 50px !important;
  }

  .focus-risk {
    padding: 3px 6px !important;
    font-size: 9px !important;
  }

  .command-dock {
    max-height: 40vh !important;
    overflow: auto !important;
    padding: 8px 10px calc(9px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .dock-topline {
    align-items: center !important;
    margin-bottom: 5px !important;
  }

  .target-area:not(.hidden) {
    display: block !important;
    min-width: 130px !important;
  }

  .target-area label {
    gap: 3px !important;
    font-size: 10px !important;
  }

  .target-area select {
    min-height: 34px !important;
    padding: 6px 8px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
  }

  .move-preview {
    min-height: 38px !important;
    padding: 7px 9px !important;
    font-size: 11px !important;
  }

  .play-card {
    min-height: 56px !important;
    padding: 6px !important;
  }

  .speed-card-face {
    justify-content: center;
    margin: 0 0 4px !important;
  }

  .speed-lines {
    display: none;
  }

  .skill-hand .play-card {
    min-height: 50px !important;
  }

  .run-button {
    height: 50px !important;
  }
}

/* Phase 10.1: keep the race readout above the fixed hand dock. */
.title-screen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 80 !important;
}

.title-card {
  position: relative !important;
  z-index: 81 !important;
}

.race-board {
  display: flex;
  flex-direction: column;
}

#courseFocus {
  order: 2;
}

#currentPlayer {
  order: 3;
}

#alertBar {
  order: 4;
}

#miniMap {
  order: 5;
}

.course-details {
  order: 7;
}

.command-dock {
  max-height: 240px !important;
}

@media (max-width: 1040px) {
  .command-dock {
    max-height: 330px !important;
  }
}

@media (max-width: 720px) {
  #alertBar {
    order: 3;
  }

  #courseFocus {
    order: 2;
  }

  #miniMap {
    order: 1;
  }

  .command-dock {
    max-height: 40vh !important;
  }
}

/* Phase 11: full-race position tracker. */
.track-overview {
  order: 1 !important;
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px;
  overflow: visible;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(8, 47, 73, .62), rgba(2, 6, 23, .76)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 52px);
  border: 1px solid rgba(125, 211, 252, .22);
  box-shadow: 0 0 28px rgba(14, 165, 233, .12) inset;
}

.track-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #dff7ff;
  font-weight: 1000;
}
.focus-risk strong { font-size: 10px; }
.focus-risk span {
  font-size: 9px;
  line-height: 1.2;
}

.track-overview-head span {
  color: #67e8f9;
  font-size: 12px;
  letter-spacing: .14em;
}

.track-overview-head strong {
  color: #fef3c7;
  font-size: 12px;
}

.track-lane {
  display: grid;
  grid-template-columns: repeat(var(--track-count), minmax(46px, 1fr));
  gap: 6px;
}

.track-cell {
  position: relative;
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 54px;
  padding: 6px;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .94), rgba(2, 6, 23, .9));
  border: 1px solid rgba(125, 211, 252, .15);
}

.track-cell.start {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, .92), rgba(2, 6, 23, .92)),
    repeating-linear-gradient(45deg, #fff 0 5px, #111827 5px 10px);
}

.track-cell.corner {
  border-color: rgba(250, 204, 21, .22);
}

.track-cell.current {
  border-color: rgba(34, 211, 238, .76);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, .16), 0 0 24px rgba(34, 211, 238, .18);
}

.track-cell.has-car {
  background: linear-gradient(180deg, rgba(8, 47, 73, .9), rgba(15, 23, 42, .9));
}

.track-cell-top {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  align-items: center;
}

.track-num,
.track-safe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 1000;
}

.track-num {
  background: rgba(125, 211, 252, .16);
  color: #e0f2fe;
}

.track-safe {
  background: rgba(250, 204, 21, .16);
  color: #fef3c7;
}

.track-name {
  min-height: 1.2em;
  overflow: hidden;
  color: #b7cde2;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-cars {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1px;
  min-height: 26px;
}

.track-car {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 25px;
}

.track-car img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.55));
}

.track-car.active img {
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, .72)) drop-shadow(0 4px 4px rgba(0,0,0,.55));
}

.track-car em {
  position: absolute;
  top: -4px;
  right: -3px;
  min-width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #facc15;
  color: #111827;
  font-size: 9px;
  font-style: normal;
  font-weight: 1000;
  line-height: 13px;
  text-align: center;
}

.track-progress-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.track-progress-row {
  display: grid;
  grid-template-columns: 28px minmax(46px, .7fr) minmax(60px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .7);
  color: #dbeafe;
  border: 1px solid rgba(125, 211, 252, .12);
}

.track-progress-row.active {
  border-color: rgba(34, 211, 238, .48);
  box-shadow: 0 0 16px rgba(34, 211, 238, .12);
}

.track-progress-row img {
  width: 30px;
  height: 28px;
  object-fit: contain;
}

.track-progress-row span {
  overflow: hidden;
  font-size: 11px;
  font-weight: 1000;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-progress-row strong {
  color: #fef3c7;
  font-size: 11px;
}

.track-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, .22);
}

.track-progress-bar i {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #facc15);
}

@media (max-width: 720px) {
  #miniMap.track-overview {
    display: grid !important;
    margin-bottom: 7px !important;
    padding: 7px !important;
    gap: 5px !important;
    border-radius: 16px !important;
  }

  .track-overview-head span {
    font-size: 10px;
  }

  .track-overview-head strong {
    font-size: 10px;
  }

  .track-lane {
    grid-template-columns: repeat(var(--track-count), minmax(36px, 1fr));
    gap: 4px;
  }

  .track-cell {
    min-height: 42px;
    padding: 4px;
    border-radius: 10px;
  }

  .track-name {
    display: none;
  }

  .track-num,
  .track-safe {
    min-width: 17px;
    height: 16px;
    padding: 0 3px;
    font-size: 8px;
  }

  .track-cars {
    min-height: 18px;
  }

  .track-car {
    width: 18px;
    height: 18px;
  }

  .track-car img {
    width: 21px;
    height: 21px;
  }

  .track-car em {
    min-width: 11px;
    height: 11px;
    font-size: 8px;
    line-height: 11px;
  }

  .track-progress-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .track-progress-row {
    grid-template-columns: 22px minmax(40px, .7fr) minmax(34px, 1fr) auto;
    gap: 4px;
    padding: 3px 5px;
  }

  .track-progress-row img {
    width: 22px;
    height: 20px;
  }

  .track-progress-row span,
  .track-progress-row strong {
    font-size: 10px;
  }

  .track-progress-bar {
    height: 5px;
  }
}

/* Phase 11.1: compact cockpit for narrow tablet / in-app browser widths. */
@media (min-width: 721px) and (max-width: 820px) {
  .game-app {
    padding: 10px 10px calc(270px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .top-command {
    margin-bottom: 10px !important;
    padding: 12px 14px !important;
  }

  .race-board {
    padding: 12px !important;
  }

  #miniMap.track-overview {
    margin-bottom: 8px !important;
    padding: 8px !important;
    gap: 5px !important;
  }

  .track-lane {
    grid-template-columns: repeat(var(--track-count), minmax(38px, 1fr));
    gap: 4px;
  }

  .track-cell {
    min-height: 44px;
    padding: 4px;
    border-radius: 10px;
  }

  .track-name {
    display: none;
  }

  .track-num,
  .track-safe {
    min-width: 18px;
    height: 16px;
    padding: 0 3px;
    font-size: 8px;
  }

  .track-cars {
    min-height: 18px;
  }

  .track-car {
    width: 19px;
    height: 19px;
  }

  .track-car img {
    width: 22px;
    height: 22px;
  }

  .track-progress-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .track-progress-row {
    grid-template-columns: 22px minmax(42px, .7fr) minmax(40px, 1fr) auto;
    gap: 4px;
    padding: 3px 5px;
  }

  .track-progress-row img {
    width: 22px;
    height: 20px;
  }

  .track-progress-row span,
  .track-progress-row strong {
    font-size: 10px;
  }

  .track-progress-bar {
    height: 5px;
  }

  .course-focus {
    align-items: start;
    grid-template-columns: minmax(168px, 1.15fr) repeat(4, minmax(104px, .85fr)) !important;
    gap: 6px !important;
    overflow-x: auto;
  }

  .focus-card {
    min-height: 142px !important;
    height: 142px !important;
    padding: 8px !important;
    border-radius: 14px !important;
  }

  .focus-card.now,
  .course-focus .focus-card:first-child {
    min-height: 188px !important;
    height: 188px !important;
    border-radius: 18px !important;
  }

  .course-art {
    height: 50px !important;
    margin: 5px 0 !important;
  }

  .focus-card.now .course-art,
  .course-focus .focus-card:first-child .course-art {
    height: 62px !important;
  }

  .focus-name {
    font-size: 13px !important;
    line-height: 1.16 !important;
  }

  .focus-card.now .focus-name,
  .course-focus .focus-card:first-child .focus-name {
    font-size: 15px !important;
  }

  .focus-safe {
    font-size: 11px !important;
  }

  .focus-cars {
    gap: 3px !important;
    bottom: 6px !important;
  }

  .car-token {
    gap: 3px !important;
    padding: 2px 6px 2px 2px !important;
    font-size: 10px !important;
  }

  .car-img {
    width: 30px !important;
    height: 30px !important;
  }

  .command-dock {
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    max-height: 250px !important;
    padding: 10px !important;
    border-radius: 20px !important;
    overflow: auto !important;
  }

  .move-preview {
    min-height: 40px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }

  .coach-panel {
    min-height: 36px !important;
    padding: 8px 10px !important;
  }
}

/* Phase 12: printable tabletop card-game direction. */
:root {
  --tabletop: #e8f6ef;
  --tabletop-2: #f8fbff;
  --paper: #ffffff;
  --paper-soft: #f3f8ff;
  --print-ink: #172033;
  --print-muted: #5c6b7a;
  --print-line: #cfd9e6;
  --speed-blue: #2563eb;
  --speed-green: #16a34a;
  --speed-orange: #f97316;
  --speed-violet: #7c3aed;
  --skill-red: #dc2626;
  --skill-blue: #0284c7;
  --skill-green: #059669;
  --skill-gold: #ca8a04;
  --card-shadow: 0 10px 26px rgba(42, 54, 71, .16);
}

body {
  color: var(--print-ink);
  background:
    linear-gradient(rgba(23, 32, 51, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, .035) 1px, transparent 1px),
    linear-gradient(135deg, var(--tabletop), var(--tabletop-2) 54%, #eef7ff);
  background-size: 32px 32px, 32px 32px, auto;
}

body.is-fcy::before,
body.is-rain::after,
.top-command::before,
.command-dock::before,
.focus-card.now::after,
.focus-card::after,
.course-card::after,
.course-tile::after,
.track-card::after {
  display: none !important;
}

h1,
h2,
h3,
.title-card h1 {
  color: var(--print-ink);
  text-shadow: none;
}

.eyebrow,
.dock-kicker,
.brand-subtitle,
.title-copy,
.title-subcopy,
label,
.safe-speed,
.focus-safe,
.standing-meta,
.card-text,
.empty-state {
  color: var(--print-muted);
  text-shadow: none;
}

.top-command,
.panel,
.race-board,
.side-dash,
.command-dock,
.modal-card {
  color: var(--print-ink);
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(114, 135, 160, .28);
  box-shadow: 0 16px 40px rgba(42, 54, 71, .13);
}

.top-command {
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(242,248,255,.94)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(37, 99, 235, .035) 18px 20px);
}

.hud-pill,
.status-pill,
.condition-pill,
.panel .ghost-button,
.ghost-button,
.icon-button {
  color: var(--print-ink);
  background: #ffffff;
  border-color: rgba(114, 135, 160, .32);
  box-shadow: 0 4px 12px rgba(42, 54, 71, .08);
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #0284c7);
  box-shadow: 0 10px 20px rgba(37, 99, 235, .22);
  text-shadow: none;
}

.run-button {
  color: #ffffff;
  background: linear-gradient(135deg, #f97316, #dc2626);
  box-shadow: 0 10px 24px rgba(220, 38, 38, .22);
}

input,
select {
  color: var(--print-ink);
  background: #ffffff;
  border-color: var(--print-line);
}

.track-overview {
  color: var(--print-ink);
  background:
    linear-gradient(180deg, #ffffff, #f3f8ff),
    repeating-linear-gradient(90deg, rgba(37,99,235,.06) 0 1px, transparent 1px 48px);
  border-color: rgba(37, 99, 235, .18);
  box-shadow: var(--card-shadow);
}

.track-overview-head,
.track-overview-head span,
.track-overview-head strong {
  color: var(--print-ink);
}

.track-cell {
  background: #ffffff;
  border-color: #d8e2ef;
  box-shadow: inset 0 -3px 0 rgba(37, 99, 235, .06);
}

.track-cell.start {
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(246,250,255,.9)),
    repeating-linear-gradient(45deg, #ffffff 0 5px, #1f2937 5px 10px);
}

.track-cell.corner {
  border-color: rgba(249, 115, 22, .28);
}

.track-cell.current {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14), inset 0 -3px 0 rgba(37, 99, 235, .12);
}

.track-cell.has-car {
  background: #f7fbff;
}

.track-name,
.track-progress-row span,
.track-progress-row strong {
  color: var(--print-ink);
}

.track-num,
.track-safe {
  color: var(--print-ink);
  background: #edf4ff;
}

.track-progress-row {
  color: var(--print-ink);
  background: #ffffff;
  border-color: rgba(114, 135, 160, .22);
}

.track-progress-bar {
  background: #dce6f2;
}

.track-progress-bar i {
  background: linear-gradient(90deg, #2563eb, #f97316);
}

.focus-card,
.course-card,
.standing-card,
.latest-log,
.log-entry,
.current-player-card,
.alert-bar,
.move-preview,
.coach-panel {
  color: var(--print-ink);
  background: #ffffff;
  border-color: var(--print-line);
  box-shadow: var(--card-shadow);
}

.focus-card {
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(247,250,255,.96)),
    repeating-linear-gradient(0deg, transparent 0 16px, rgba(37, 99, 235, .035) 16px 17px);
}

.focus-card.now {
  outline: 3px solid rgba(37, 99, 235, .38);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, .24), var(--card-shadow);
}

.focus-card.danger-zone {
  background: #fff7f7;
  border-color: rgba(220, 38, 38, .24);
}

.focus-label {
  color: #ffffff;
  background: #2563eb;
  border-color: transparent;
}

.focus-name {
  color: var(--print-ink);
  text-shadow: none;
}

.course-art,
.course-thumb {
  border-color: #d8e2ef;
  box-shadow: 0 5px 12px rgba(42, 54, 71, .13);
}

.car-token {
  color: var(--print-ink);
  background: #ffffff;
  border-color: #d8e2ef;
  box-shadow: 0 4px 12px rgba(42, 54, 71, .12);
}

.current-player-card.has-status,
.standing-card.has-status,
.latest-log.warn {
  color: var(--print-ink);
  background: #fff7ed;
  border-color: #fed7aa;
}

.alert-bar {
  color: #155e75;
  background: #ecfeff;
  border-color: #a5f3fc;
}

.alert-bar.warn {
  color: #92400e;
  background: #fff7ed;
  border-color: #fed7aa;
}

.alert-bar.danger {
  color: #7f1d1d;
  background: #fef2f2;
  border-color: #fecaca;
}

.current-meta-grid,
.condition-label,
.coach-panel span,
.move-preview,
.card-text {
  color: #314155;
}

.latest-log.ok,
.move-preview.safe {
  color: #14532d;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.move-preview.chance,
.coach-panel.chance {
  color: #713f12;
  background: #fefce8;
  border-color: #fde68a;
}

.latest-log.danger,
.move-preview.danger {
  color: #7f1d1d;
  background: #fef2f2;
  border-color: #fecaca;
  animation: none;
}

.command-dock {
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(244,248,255,.98)),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(37, 99, 235, .035) 26px 28px);
  border-color: rgba(37, 99, 235, .2);
  box-shadow: 0 -12px 34px rgba(42, 54, 71, .16);
}

.hands-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .9fr) 142px;
  gap: 12px;
}

.speed-hand {
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  gap: 10px;
}

.skill-hand {
  grid-template-columns: repeat(2, minmax(132px, 1fr));
  gap: 10px;
}

.play-card.speed-card,
.play-card.skill-card {
  --card-accent: #2563eb;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 188px;
  aspect-ratio: 5 / 7;
  padding: 16px 13px 14px;
  overflow: hidden;
  isolation: isolate;
  color: var(--print-ink);
  background:
    linear-gradient(180deg, #ffffff, #fbfdff),
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(23, 32, 51, .035) 14px 15px);
  border: 2px solid #263244;
  border-radius: 13px;
  box-shadow: var(--card-shadow);
}

.play-card.speed-card::before,
.play-card.skill-card::before {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: 0;
  opacity: 1;
  border: 1px solid color-mix(in srgb, var(--card-accent) 42%, transparent);
  border-radius: 9px;
  background: transparent !important;
}

.play-card.speed-card::after,
.play-card.skill-card::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  top: 38px;
  z-index: 0;
  height: 4px;
  border-radius: 999px;
  background: var(--card-accent);
  opacity: .92;
}

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

.speed-1 { --card-accent: var(--speed-blue); }
.speed-2 { --card-accent: var(--speed-green); }
.speed-3 { --card-accent: var(--speed-orange); }
.speed-4 { --card-accent: var(--speed-violet); }
.skill-target { --card-accent: var(--skill-red); }
.skill-global { --card-accent: var(--skill-blue); }
.skill-defense { --card-accent: var(--skill-green); }
.skill-assist,
.skill-normal { --card-accent: var(--skill-gold); }

.play-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(42, 54, 71, .2);
}

.play-card.selected {
  color: var(--print-ink);
  background: #ffffff;
  border-color: var(--card-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--card-accent) 18%, transparent), 0 16px 34px rgba(42, 54, 71, .22);
}

.play-card.unusable {
  opacity: .55;
  filter: saturate(.75);
}

.playing-corner {
  position: absolute;
  left: 10px;
  top: 8px;
  display: grid;
  justify-items: center;
  width: 34px;
  color: var(--card-accent);
  line-height: 1;
}

.playing-corner span {
  font-size: 23px;
  font-weight: 1000;
}

.playing-corner small {
  margin-top: 2px;
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: .06em;
}

.playing-corner.bottom {
  top: auto;
  right: 10px;
  bottom: 8px;
  left: auto;
  transform: rotate(180deg);
}

.playing-corner.skill-rank small {
  font-size: 7px;
}

.card-kind {
  align-self: center;
  min-height: 18px;
  color: var(--card-accent);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .14em;
  text-align: center;
}

.speed-card-face {
  display: grid;
  place-items: center;
  gap: 7px;
  flex: 1;
  margin: 18px 0 8px;
}

.speed-orb {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: #ffffff;
  background: var(--card-accent);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--card-accent), 0 9px 18px rgba(42, 54, 71, .18);
  font-size: 42px;
  font-weight: 1000;
}

.speed-pips {
  display: grid;
  grid-template-columns: repeat(var(--pip-count), 10px);
  justify-content: center;
  gap: 6px;
  min-height: 13px;
}

.speed-pips span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--card-accent);
}

.speed-lines {
  display: none;
}

.skill-illustration {
  display: grid;
  place-items: center;
  width: min(86px, 58%);
  aspect-ratio: 1;
  margin: 22px auto 8px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 24%, #d8e2ef);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--card-accent) 10%, #f6f9ff));
}

.skill-icon {
  float: none;
  width: 66px;
  height: 66px;
  margin: 0;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(42, 54, 71, .16));
}

.card-title {
  margin: 2px 16px 6px;
  color: var(--print-ink);
  font-size: 15px;
  font-weight: 1000;
  line-height: 1.18;
  text-align: center;
}

.card-text {
  display: block;
  flex: none;
  min-height: 43px;
  max-height: 58px;
  margin: auto 2px 0;
  padding: 7px 8px;
  overflow: hidden;
  color: #314155;
  background: #f5f8fc;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.28;
}

.skill-card .card-title {
  min-height: 2.2em;
}

.play-card[role="button"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--card-accent) 50%, #ffffff);
  outline-offset: 3px;
}

@media (min-width: 721px) and (max-width: 820px) {
  .command-dock {
    max-height: 330px !important;
  }

  .hands-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .speed-hand {
    grid-template-columns: repeat(4, minmax(116px, 160px));
    justify-content: start;
  }

  .skill-hand {
    grid-template-columns: repeat(2, minmax(146px, 170px));
    justify-content: start;
  }

  .play-card.speed-card,
  .play-card.skill-card {
    min-height: 176px !important;
    padding: 14px 11px 12px !important;
  }

  .play-card.skill-card {
    min-height: 204px !important;
  }

  .speed-orb {
    width: 60px !important;
    height: 60px !important;
    font-size: 34px !important;
  }

  .skill-illustration {
    width: 70px;
    margin-top: 18px;
  }

  .skill-icon {
    width: 54px;
    height: 54px;
  }

  .card-title {
    font-size: 13px !important;
  }

  .card-text {
    min-height: 38px;
    max-height: 44px;
    padding: 6px 7px;
    font-size: 9px;
  }
}

@media (max-width: 720px) {
  .command-dock {
    max-height: 58vh !important;
  }

  .hands-grid {
    grid-template-columns: 1fr;
  }

  .speed-hand {
    grid-template-columns: repeat(2, minmax(128px, 1fr));
  }

  .skill-hand {
    grid-template-columns: repeat(2, minmax(128px, 1fr));
  }

  .play-card.speed-card,
  .play-card.skill-card {
    min-height: 164px !important;
    padding: 14px 10px 12px !important;
  }

  .speed-orb {
    width: 58px !important;
    height: 58px !important;
    font-size: 32px !important;
  }

  .skill-illustration {
    width: 68px;
    margin-top: 18px;
  }

  .skill-icon {
    width: 52px;
    height: 52px;
  }

  .card-text {
    display: block !important;
    min-height: 36px;
    max-height: 42px;
    font-size: 9px;
  }
}

/* Phase 13: F1-inspired simple race tracker. */
#miniMap.race-trackbar {
  order: 1 !important;
  display: grid !important;
  gap: 10px;
  margin: 0 0 12px;
  padding: 13px 16px 12px;
  overflow: visible;
  color: var(--print-ink);
  background:
    linear-gradient(180deg, #ffffff, #f6faff),
    repeating-linear-gradient(90deg, transparent 0 28px, rgba(37, 99, 235, .035) 28px 30px);
  border: 1px solid rgba(114, 135, 160, .26);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.trackbar-head,
.trackbar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.trackbar-head span {
  color: #2563eb;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: .12em;
}

.trackbar-head strong,
.trackbar-foot span {
  color: var(--print-ink);
  font-size: 12px;
  font-weight: 1000;
}

.trackbar-foot {
  flex-wrap: wrap;
  padding-top: 2px;
}

.trackbar-foot span {
  padding: 3px 8px;
  border: 1px solid #d8e2ef;
  border-radius: 999px;
  background: rgba(255, 255, 255, .84);
}

.trackbar-stage {
  position: relative;
  min-height: 88px;
  padding: 29px 46px 24px;
}

.trackbar-line {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #2563eb 0 2%, #dbe7f4 2% 98%, #f97316 98% 100%);
  box-shadow: inset 0 0 0 1px rgba(23, 32, 51, .12), 0 5px 12px rgba(42, 54, 71, .12);
}

.trackbar-line::before {
  content: "";
  position: absolute;
  inset: -9px 0;
  border-top: 1px solid rgba(114, 135, 160, .16);
  border-bottom: 1px solid rgba(114, 135, 160, .16);
  pointer-events: none;
}

.trackbar-gate {
  position: absolute;
  top: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: .08em;
}

.trackbar-gate.start {
  left: 0;
  background: #2563eb;
}

.trackbar-gate.finish {
  right: 0;
  background: #f97316;
}

.trackbar-tick {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 36px;
  border-radius: 999px;
  background: #cbd5e1;
  transform: translate(-50%, -50%);
}

.trackbar-tick.start {
  width: 3px;
  background: #2563eb;
}

.trackbar-tick.corner {
  width: 3px;
  background: #f97316;
}

.trackbar-tick.current {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}

.trackbar-tick b,
.trackbar-tick em {
  position: absolute;
  left: 50%;
  min-width: 18px;
  text-align: center;
  transform: translateX(-50%);
}

.trackbar-tick b {
  top: -20px;
  color: var(--print-ink);
  font-size: 9px;
  font-weight: 1000;
}

.trackbar-tick em {
  bottom: -20px;
  color: var(--print-muted);
  font-size: 8px;
  font-style: normal;
  font-weight: 1000;
}

.trackbar-driver {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 42px;
  height: 34px;
  border: 2px solid var(--driver-color);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(42, 54, 71, .22);
  transform: translate(calc(-50% + var(--fan-x, 0px)), calc(-50% + var(--fan-y, 0px)));
  transition: left .24s ease, transform .24s ease, box-shadow .18s ease;
}

.trackbar-driver.clustered {
  box-shadow: 0 0 0 3px rgba(255,255,255,.92), 0 8px 16px rgba(42, 54, 71, .24);
}

.trackbar-driver img {
  width: 40px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(42, 54, 71, .22));
}

.trackbar-driver strong {
  position: absolute;
  top: -8px;
  left: -7px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--driver-color);
  border: 1px solid #ffffff;
  font-size: 10px;
  font-weight: 1000;
}

.trackbar-driver small {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  max-width: 70px;
  padding: 2px 6px;
  overflow: hidden;
  color: var(--print-ink);
  background: #ffffff;
  border: 1px solid color-mix(in srgb, var(--driver-color) 36%, #d8e2ef);
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(42, 54, 71, .12);
  font-size: 10px;
  font-weight: 1000;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
}

.trackbar-driver.active {
  z-index: 7;
  width: 48px;
  height: 38px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--driver-color) 18%, transparent), 0 10px 18px rgba(42, 54, 71, .22);
}

body.movement-in-progress .trackbar-driver.active {
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--driver-color) 26%, transparent), 0 0 24px color-mix(in srgb, var(--driver-color) 30%, transparent), 0 10px 20px rgba(42, 54, 71, .24);
}

.trackbar-preview {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 3px;
  height: 58px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.trackbar-preview.safe {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .13);
}

.trackbar-preview.chance {
  background: #eab308;
  box-shadow: 0 0 0 4px rgba(234, 179, 8, .16);
}

.trackbar-preview.danger {
  background: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, .13);
}

.trackbar-preview b {
  position: absolute;
  right: 50%;
  bottom: -25px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #ffffff;
  background: inherit;
  font-size: 9px;
  font-weight: 1000;
  transform: translateX(50%);
  white-space: nowrap;
}

@media (min-width: 721px) and (max-width: 820px) {
  #miniMap.race-trackbar {
    margin-bottom: 8px !important;
    padding: 10px 12px 9px !important;
    gap: 8px !important;
  }

  .trackbar-stage {
    min-height: 78px;
    padding: 27px 40px 20px;
  }

  .trackbar-driver {
    width: 36px;
    height: 30px;
  }

  .trackbar-driver.active {
    width: 42px;
    height: 34px;
  }

  .trackbar-driver img {
    width: 35px;
    height: 30px;
  }

  .trackbar-foot span {
    font-size: 10px;
  }
}

@media (max-width: 720px) {
  #miniMap.race-trackbar {
    display: grid !important;
    margin-bottom: 7px !important;
    padding: 9px 10px !important;
    gap: 7px !important;
    border-radius: 16px !important;
  }

  .trackbar-head span,
  .trackbar-head strong {
    font-size: 10px;
  }

  .trackbar-stage {
    min-height: 76px;
    padding: 26px 34px 19px;
  }

  .trackbar-gate {
    top: 20px;
    padding: 2px 5px;
    font-size: 8px;
  }

  .trackbar-tick {
    height: 30px;
  }

  .trackbar-tick b {
    top: -17px;
    font-size: 8px;
  }

  .trackbar-tick em {
    display: none;
  }

  .trackbar-driver {
    width: 34px;
    height: 28px;
    transform: translate(calc(-50% + (var(--fan-x, 0px) * .76)), calc(-50% + (var(--fan-y, 0px) * .78)));
  }

  .trackbar-driver.active {
    width: 39px;
    height: 31px;
  }

  .trackbar-driver img {
    width: 32px;
    height: 28px;
  }

  .trackbar-driver small {
    top: calc(100% + 2px);
    max-width: 58px;
    font-size: 9px;
  }

  .trackbar-foot {
    gap: 4px;
  }

  .trackbar-foot span {
    padding: 2px 6px;
    font-size: 9px;
  }
}

/* Phase 14: brighter title and hand-first command dock. */
.title-screen {
  background:
    linear-gradient(rgba(23, 32, 51, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, .035) 1px, transparent 1px),
    linear-gradient(135deg, #edf8f1, #fbfdff 58%, #eef7ff) !important;
  background-size: 32px 32px, 32px 32px, auto !important;
  backdrop-filter: none !important;
}

.title-card {
  color: var(--print-ink) !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,250,255,.97)),
    repeating-linear-gradient(45deg, transparent 0 18px, rgba(37,99,235,.045) 18px 20px) !important;
  border: 1px solid rgba(114, 135, 160, .28) !important;
  box-shadow: 0 22px 60px rgba(42, 54, 71, .18) !important;
}

.title-card::before {
  opacity: .55;
}

.title-card h1,
.title-copy,
.title-subcopy,
.title-hint {
  color: var(--print-ink) !important;
  text-shadow: none !important;
}

.title-hint,
.title-subcopy {
  color: var(--print-muted) !important;
}

.title-card .ghost-button {
  color: var(--print-ink) !important;
  background: #ffffff !important;
  border-color: rgba(114, 135, 160, .32) !important;
}

.command-dock {
  display: grid;
  gap: 10px;
  max-height: min(66vh, 760px) !important;
}

.dock-topline {
  margin-bottom: 0 !important;
}

.command-feedback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  order: 3;
}

.command-feedback .tutorial-coach,
.command-feedback .coach-panel,
.command-feedback .move-preview {
  margin: 0 !important;
}

.command-feedback .move-preview {
  min-height: 42px !important;
}

.hands-grid {
  order: 2;
  margin-top: 0 !important;
}

@media (min-width: 721px) and (max-width: 820px) {
  .command-dock {
    max-height: min(62vh, 620px) !important;
  }

  .hands-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .hand-block h3 {
    margin-bottom: 5px;
    font-size: 11px;
  }

  .speed-hand {
    grid-template-columns: repeat(4, minmax(86px, 1fr)) !important;
    gap: 8px !important;
  }

  .skill-hand {
    grid-template-columns: repeat(2, minmax(112px, 150px)) !important;
    gap: 8px !important;
  }

  .play-card.speed-card,
  .play-card.skill-card {
    min-height: 146px !important;
    padding: 12px 9px 10px !important;
  }

  .playing-corner {
    left: 8px;
    top: 7px;
    width: 26px;
  }

  .playing-corner.bottom {
    right: 8px;
    bottom: 7px;
  }

  .playing-corner span {
    font-size: 18px;
  }

  .playing-corner small {
    font-size: 6px;
  }

  .card-kind {
    font-size: 8px;
    min-height: 14px;
  }

  .speed-card-face {
    margin: 13px 0 5px;
    gap: 5px;
  }

  .speed-orb {
    width: 50px !important;
    height: 50px !important;
    font-size: 28px !important;
  }

  .skill-illustration {
    width: 56px !important;
    margin-top: 13px !important;
    margin-bottom: 5px !important;
  }

  .skill-icon {
    width: 44px !important;
    height: 44px !important;
  }

  .card-title {
    margin: 1px 12px 4px !important;
    font-size: 11px !important;
  }

  .card-text {
    min-height: 30px !important;
    max-height: 34px !important;
    padding: 4px 5px !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
  }

  .run-button {
    height: 46px !important;
    min-width: 100% !important;
  }

  .command-feedback {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .command-feedback .coach-panel,
  .command-feedback .move-preview {
    min-height: 34px !important;
    padding: 7px 9px !important;
    font-size: 11px !important;
  }
}

@media (max-width: 720px) {
  .title-screen {
    padding: 14px !important;
  }

  .title-card {
    border-radius: 22px !important;
  }

  .command-dock {
    max-height: min(64vh, 620px) !important;
  }

  .speed-hand {
    grid-template-columns: repeat(4, minmax(72px, 1fr)) !important;
    gap: 7px !important;
  }

  .skill-hand {
    grid-template-columns: repeat(2, minmax(104px, 1fr)) !important;
    gap: 7px !important;
  }

  .play-card.speed-card,
  .play-card.skill-card {
    min-height: 140px !important;
  }

  .command-feedback {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 520px) {
  .speed-hand {
    grid-template-columns: repeat(2, minmax(118px, 1fr)) !important;
  }
}

/* Phase 15: printed speed-card art and four-skill hand. */
.hands-grid {
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.45fr) 142px;
}

.speed-hand {
  grid-template-columns: repeat(4, minmax(86px, 1fr));
}

.skill-hand {
  grid-template-columns: repeat(4, minmax(104px, 1fr));
}

.play-card.speed-card {
  min-height: 0 !important;
  padding: 0 !important;
  aspect-ratio: 1102 / 1650;
  overflow: visible;
  color: transparent;
  background: transparent !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

.play-card.speed-card::before,
.play-card.speed-card::after {
  display: none !important;
}

.speed-card-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  pointer-events: none;
  user-select: none;
  box-shadow: 0 9px 18px rgba(42, 54, 71, .2);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease, opacity .16s ease;
}

.play-card.speed-card:hover .speed-card-art,
.play-card.speed-card:focus-visible .speed-card-art {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(42, 54, 71, .24);
}

.play-card.speed-card.selected .speed-card-art {
  transform: translateY(-5px);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .26), 0 16px 28px rgba(42, 54, 71, .28);
}

.play-card.speed-card.unusable .speed-card-art {
  opacity: .5;
  filter: grayscale(.35);
}

.target-area.no-targets select {
  color: #7f1d1d;
  background: #fff1f2;
  border-color: #fecdd3;
}

@media (max-width: 980px) {
  .hands-grid {
    grid-template-columns: 1fr !important;
  }

  .speed-hand {
    grid-template-columns: repeat(4, minmax(86px, 128px)) !important;
    justify-content: center !important;
  }

  .skill-hand {
    grid-template-columns: repeat(4, minmax(104px, 132px)) !important;
    justify-content: center !important;
  }

  .run-button {
    min-width: 100% !important;
  }
}

@media (max-width: 720px) {
  .speed-hand {
    grid-template-columns: repeat(4, minmax(72px, 116px)) !important;
    justify-content: center !important;
  }

  .skill-hand {
    grid-template-columns: repeat(2, minmax(104px, 1fr)) !important;
  }

  .play-card.speed-card {
    min-height: 0 !important;
  }
}

@media (max-width: 520px) {
  .speed-hand {
    grid-template-columns: repeat(4, minmax(66px, 82px)) !important;
    justify-content: center !important;
  }

  .skill-hand {
    grid-template-columns: repeat(2, minmax(124px, 150px)) !important;
    justify-content: center !important;
  }
}

/* Phase 16: mobile hand balance. */
@media (max-width: 520px) {
  .command-dock {
    gap: 6px !important;
    padding: 8px !important;
    max-height: min(62vh, 540px) !important;
  }

  .dock-topline {
    align-items: center !important;
    gap: 6px !important;
  }

  .dock-kicker {
    display: none !important;
  }

  .dock-topline h2 {
    font-size: 15px !important;
    line-height: 1.1 !important;
  }

  .hands-grid {
    gap: 7px !important;
  }

  .hand-block h3 {
    margin-bottom: 4px !important;
    font-size: 10px !important;
  }

  .speed-hand,
  .skill-hand {
    grid-template-columns: repeat(4, minmax(62px, 76px)) !important;
    justify-content: center !important;
    gap: 6px !important;
  }

  .speed-card-art {
    border-radius: 9px !important;
    box-shadow: 0 6px 12px rgba(42, 54, 71, .2);
  }

  .play-card.skill-card {
    min-height: 0 !important;
    aspect-ratio: 1102 / 1650 !important;
    padding: 6px 4px 5px !important;
    border-width: 1.5px !important;
    border-radius: 9px !important;
  }

  .play-card.skill-card::before {
    inset: 4px !important;
    border-radius: 6px !important;
  }

  .play-card.skill-card::after {
    left: 6px !important;
    right: 6px !important;
    top: 22px !important;
    height: 2px !important;
  }

  .playing-corner {
    left: 4px !important;
    top: 4px !important;
    width: 18px !important;
  }

  .playing-corner.bottom {
    right: 4px !important;
    bottom: 4px !important;
  }

  .playing-corner span {
    font-size: 12px !important;
  }

  .playing-corner small {
    display: none !important;
  }

  .card-kind {
    min-height: 8px !important;
    font-size: 6px !important;
    letter-spacing: .08em !important;
  }

  .skill-illustration {
    width: 34px !important;
    height: 34px !important;
    margin: 10px auto 4px !important;
  }

  .skill-icon {
    width: 28px !important;
    height: 28px !important;
  }

  .skill-card .card-title {
    display: -webkit-box !important;
    min-height: 20px !important;
    margin: 0 8px 2px !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    font-size: 8.5px !important;
    line-height: 1.15 !important;
  }

  .skill-card .card-text {
    display: none !important;
  }

  .run-button {
    height: 42px !important;
    min-height: 42px !important;
    font-size: 14px !important;
  }

  .command-feedback {
    gap: 5px !important;
  }

  .command-feedback .coach-panel,
  .command-feedback .move-preview {
    min-height: 30px !important;
    padding: 6px 8px !important;
    font-size: 10px !important;
  }

  .preview-route {
    gap: 4px !important;
    margin-top: 5px !important;
  }

  .route-chip {
    padding: 3px 6px !important;
    font-size: 9px !important;
  }
}

/* Phase 17: compact mobile race chrome. */
.mobile-race-menu-toggle {
  display: none;
}

@media (max-width: 520px) {
  body.race-started .game-app {
    padding-top: 6px !important;
  }

  body.race-started .top-command {
    position: sticky !important;
    top: max(6px, env(safe-area-inset-top)) !important;
    z-index: 42 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 38px !important;
    gap: 8px !important;
    align-items: center !important;
    min-height: 48px !important;
    margin: 0 0 8px !important;
    padding: 6px 8px !important;
    border-radius: 18px !important;
    background:
      linear-gradient(180deg, rgba(255,255,255,.98), rgba(242,248,255,.97)),
      repeating-linear-gradient(90deg, transparent 0 18px, rgba(37,99,235,.04) 18px 20px) !important;
    border: 1px solid rgba(114, 135, 160, .28) !important;
    box-shadow: 0 10px 24px rgba(42, 54, 71, .14) !important;
    overflow: visible !important;
  }

  body.race-started .top-command .brand-block {
    display: none !important;
  }

  body.race-started .race-hud {
    display: flex !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
  }

  body.race-started .race-hud .hud-pill {
    min-height: 34px !important;
    max-width: 48vw !important;
    padding: 6px 9px !important;
    overflow: hidden !important;
    color: var(--print-ink) !important;
    background: #ffffff !important;
    border-color: rgba(114, 135, 160, .32) !important;
    box-shadow: 0 4px 10px rgba(42, 54, 71, .08) !important;
    font-size: 11px !important;
    line-height: 1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body.race-started .mobile-race-menu-toggle {
    display: grid !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    place-items: center !important;
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--print-ink) !important;
    background: #ffffff !important;
    border: 1px solid rgba(114, 135, 160, .34) !important;
    border-radius: 999px !important;
    box-shadow: 0 4px 12px rgba(42, 54, 71, .1) !important;
    font-size: 24px !important;
    font-weight: 1000 !important;
    line-height: 1 !important;
  }

  body.race-started .mobile-race-menu-toggle[aria-expanded="true"] {
    color: #ffffff !important;
    background: #2563eb !important;
    border-color: #2563eb !important;
  }

  body.race-started .top-command .top-actions {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    right: 8px !important;
    z-index: 50 !important;
    display: none !important;
    grid-template-columns: 42px 42px 42px minmax(104px, auto) !important;
    gap: 8px !important;
    align-items: center !important;
    padding: 8px !important;
    background: rgba(255,255,255,.98) !important;
    border: 1px solid rgba(114, 135, 160, .28) !important;
    border-radius: 18px !important;
    box-shadow: 0 16px 34px rgba(42, 54, 71, .22) !important;
  }

  body.race-started .top-command.mobile-menu-open .top-actions {
    display: grid !important;
  }

  body.race-started .top-actions .icon-button {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    padding: 0 !important;
    border-radius: 14px !important;
  }

  body.race-started .top-actions .obs-button {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    border-radius: 14px !important;
    font-size: 11px !important;
    letter-spacing: .04em !important;
  }

  body.race-started .top-actions .ghost-button {
    height: 42px !important;
    min-width: 104px !important;
    padding: 0 14px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }
}

/* Phase 18: printed skill-card art. */
.play-card.skill-card {
  min-height: 0 !important;
  padding: 0 !important;
  aspect-ratio: 1024 / 1536 !important;
  overflow: visible !important;
  color: transparent;
  background: transparent !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

.play-card.skill-card::before,
.play-card.skill-card::after {
  display: none !important;
}

.skill-card-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  pointer-events: none;
  user-select: none;
  box-shadow: 0 9px 18px rgba(42, 54, 71, .2);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease, opacity .16s ease;
}

.play-card.skill-card:hover .skill-card-art,
.play-card.skill-card:focus-visible .skill-card-art {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(42, 54, 71, .24);
}

.play-card.skill-card.selected .skill-card-art {
  transform: translateY(-5px);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .26), 0 16px 28px rgba(42, 54, 71, .28);
}

.play-card.skill-card.interference-card::before {
  content: "";
  display: block !important;
  position: absolute;
  inset: -4px;
  z-index: 2;
  pointer-events: none;
  border-radius: 15px;
  padding: 4px;
  background: repeating-linear-gradient(135deg, #facc15 0 8px, #111827 8px 16px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .18);
}

.play-card.skill-card.interference-card::after {
  content: "";
  display: block !important;
  position: absolute;
  inset: 5px;
  z-index: 2;
  pointer-events: none;
  border-radius: 10px;
  border: 1px solid rgba(17, 24, 39, .28);
  background: transparent !important;
}

.play-card.skill-card.interference-card.selected::before {
  box-shadow: 0 0 0 4px rgba(250, 204, 21, .28), 0 16px 28px rgba(42, 54, 71, .28);
}

.interference-card-detail .skill-detail-art {
  box-shadow:
    0 0 0 5px #facc15,
    0 0 0 10px #111827,
    0 18px 36px rgba(15, 23, 42, .24);
}

.play-card.skill-card.unusable .skill-card-art {
  opacity: .5;
  filter: grayscale(.35);
}

@media (max-width: 520px) {
  .skill-card-art {
    border-radius: 9px !important;
    box-shadow: 0 6px 12px rgba(42, 54, 71, .2);
  }

  .play-card.skill-card.interference-card::before {
    inset: -3px;
    border-radius: 12px;
    padding: 3px;
    background: repeating-linear-gradient(135deg, #facc15 0 6px, #111827 6px 12px);
  }

  .play-card.skill-card.interference-card::after {
    inset: 4px;
    border-radius: 8px;
  }
}

/* Phase 19: keep printed skill cards the same visual size as speed cards. */
.skill-hand {
  grid-template-columns: repeat(4, minmax(86px, 1fr)) !important;
}

@media (max-width: 980px) {
  .skill-hand {
    grid-template-columns: repeat(4, minmax(86px, 128px)) !important;
    justify-content: center !important;
  }
}

@media (max-width: 720px) {
  .skill-hand {
    grid-template-columns: repeat(4, minmax(72px, 116px)) !important;
    justify-content: center !important;
  }
}

@media (max-width: 520px) {
  .skill-hand {
    grid-template-columns: repeat(4, minmax(66px, 82px)) !important;
    justify-content: center !important;
  }
}

/* Phase 20: public-release polish. */
body:not(.race-started) .game-app {
  display: none !important;
}

body:not(.race-started) {
  background:
    linear-gradient(rgba(23, 32, 51, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, .035) 1px, transparent 1px),
    linear-gradient(135deg, #edf8f1, #fbfdff 58%, #eef7ff) !important;
  background-size: 32px 32px, 32px 32px, auto !important;
}

.title-screen {
  z-index: 100 !important;
  min-height: 100dvh !important;
}

body.race-started .command-dock {
  --printed-card-width: 110px;
  color: #f8fafc !important;
  background:
    linear-gradient(180deg, rgba(12, 18, 32, .98), rgba(6, 10, 19, .98)),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(147, 197, 253, .07) 26px 28px) !important;
  border-color: rgba(147, 197, 253, .22) !important;
}

body.race-started .command-dock h2,
body.race-started .command-dock h3 {
  color: #f8fafc !important;
}

body.race-started .command-dock h3 span,
body.race-started .dock-kicker {
  color: #bfdbfe !important;
}

body.race-started .hands-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 152px !important;
  align-items: end !important;
  gap: 12px !important;
}

body.race-started .speed-hand,
body.race-started .skill-hand {
  grid-template-columns: repeat(4, var(--printed-card-width)) !important;
  justify-content: center !important;
  gap: 9px !important;
}

body.race-started .play-card.speed-card,
body.race-started .play-card.skill-card {
  width: var(--printed-card-width) !important;
  min-height: 0 !important;
  aspect-ratio: 2 / 3 !important;
  padding: 0 !important;
}

body.race-started .speed-card-art,
body.race-started .skill-card-art {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

body.race-started .command-feedback .tutorial-coach,
body.race-started .command-feedback .coach-panel,
body.race-started .command-feedback .move-preview {
  background: rgba(255, 255, 255, .96) !important;
  border-color: rgba(203, 213, 225, .95) !important;
  color: #172033 !important;
}

.result-card {
  color: #172033 !important;
}

.result-row span:last-child {
  color: #475569;
  font-weight: 900;
}

@media (max-width: 980px) {
  body.race-started .command-dock {
    --printed-card-width: 104px;
  }

  body.race-started .hands-grid {
    grid-template-columns: 1fr !important;
  }

  body.race-started .run-button {
    width: 100% !important;
  }
}

@media (max-width: 720px) {
  body.race-started .command-dock {
    --printed-card-width: clamp(86px, calc((100vw - 76px) / 4), 104px);
  }
}

@media (max-width: 520px) {
  body.race-started .game-app {
    padding-bottom: calc(342px + env(safe-area-inset-bottom)) !important;
  }

  body.race-started .command-dock {
    --printed-card-width: clamp(70px, calc((100vw - 46px) / 4), 82px);
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    gap: 6px !important;
    max-height: min(39dvh, 334px) !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
    border-width: 1px 0 0 !important;
    border-radius: 22px 22px 0 0 !important;
    box-shadow: 0 -12px 34px rgba(2, 6, 23, .34) !important;
  }

  body.race-started .dock-topline {
    min-height: 18px !important;
  }

  body.race-started .dock-kicker {
    display: none !important;
  }

  body.race-started .dock-topline h2 {
    font-size: 13px !important;
  }

  body.race-started .hands-grid {
    gap: 6px !important;
  }

  body.race-started .hand-block h3 {
    margin-bottom: 3px !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }

  body.race-started .speed-hand,
  body.race-started .skill-hand {
    gap: 6px !important;
  }

  body.race-started .run-button {
    height: 38px !important;
    min-height: 38px !important;
    font-size: 13px !important;
  }

  body.race-started .command-feedback {
    display: block !important;
  }

  body.race-started .command-feedback .coach-panel {
    display: none !important;
  }

  body.race-started .command-feedback .move-preview {
    min-height: 32px !important;
    max-height: 44px !important;
    overflow: hidden !important;
    padding: 7px 9px !important;
    font-size: 10px !important;
    line-height: 1.28 !important;
  }

  body.race-started .preview-route {
    display: none !important;
  }
}

/* Phase 21: forced speed and dice-roll feedback. */
body.race-started .play-card.speed-card {
  position: relative !important;
}

body.race-started .play-card.speed-card.forced-speed .speed-card-art {
  filter: saturate(.9) brightness(.82);
}

.speed-limit-overlay {
  position: absolute;
  inset: 9% 10%;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, .8), rgba(2, 6, 23, .72)),
    repeating-linear-gradient(135deg, rgba(255,255,255,.16) 0 8px, transparent 8px 16px);
  border: 2px solid rgba(255, 255, 255, .86);
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(2, 6, 23, .42), inset 0 0 0 2px rgba(248, 250, 252, .12);
  text-align: center;
  text-shadow: 0 2px 8px rgba(2, 6, 23, .7);
  transform: rotate(-6deg);
  pointer-events: none;
}

.speed-limit-overlay span {
  font-size: clamp(8px, 1vw, 11px);
  font-weight: 1000;
  letter-spacing: .1em;
}

.speed-limit-overlay strong {
  color: #ffffff;
  font-size: clamp(38px, 4.8vw, 64px);
  font-weight: 1000;
  line-height: .86;
}

.speed-limit-overlay em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 17px;
  padding: 1px 6px;
  color: #172033;
  background: #fef3c7;
  border-radius: 999px;
  font-size: clamp(8px, .9vw, 10px);
  font-style: normal;
  font-weight: 1000;
  text-shadow: none;
}

body.turn-in-progress .run-button {
  pointer-events: none;
}

.effect-layer.dice {
  z-index: 180;
}

.effect-layer.dice .dice-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: min(440px, 86vw);
  padding: 26px 30px 28px;
  animation: none;
  color: #f8fafc;
  background:
    radial-gradient(circle at 50% 20%, rgba(250, 204, 21, .25), transparent 42%),
    linear-gradient(145deg, rgba(17, 24, 39, .98), rgba(2, 6, 23, .96));
  border-color: rgba(250, 204, 21, .72);
  box-shadow: 0 0 0 999px rgba(2, 6, 23, .18), 0 24px 80px rgba(2, 6, 23, .55), 0 0 54px rgba(250, 204, 21, .24);
}

.dice-label {
  padding: 4px 12px;
  border-radius: 999px;
  color: #172033;
  background: #facc15;
  font-size: clamp(13px, 2.6vw, 18px);
  font-weight: 1000;
  letter-spacing: .12em;
  text-shadow: none;
}

.dice-cube {
  display: grid;
  place-items: center;
  width: clamp(112px, 22vw, 174px);
  aspect-ratio: 1;
  color: #172033;
  background:
    radial-gradient(circle at 30% 25%, #ffffff, #f8fafc 48%, #e5e7eb);
  border: 6px solid #ffffff;
  border-radius: 28px;
  box-shadow: inset 0 -10px 18px rgba(15, 23, 42, .13), 0 18px 36px rgba(2, 6, 23, .42);
  font-size: clamp(68px, 14vw, 124px);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: none;
}

.effect-layer.dice.rolling .dice-cube {
  animation: diceTumble .18s linear infinite;
}

.effect-layer.dice.result .dice-card {
  animation: diceCardFinal .74s cubic-bezier(.2, 1.35, .28, 1) both;
}

.effect-layer.dice.success .dice-card {
  background:
    radial-gradient(circle at 50% 18%, rgba(250, 204, 21, .36), transparent 38%),
    linear-gradient(145deg, rgba(20, 83, 45, .98), rgba(21, 128, 61, .94));
  border-color: rgba(187, 247, 208, .9);
  box-shadow: 0 0 0 999px rgba(22, 163, 74, .18), 0 24px 90px rgba(2, 6, 23, .55), 0 0 66px rgba(250, 204, 21, .34);
}

.effect-layer.dice.success .dice-label {
  color: #14532d;
  background: linear-gradient(135deg, #fef08a, #facc15);
}

.dice-burst {
  position: absolute;
  inset: 8%;
  pointer-events: none;
}

.dice-burst span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 30px;
  border-radius: 999px;
  background: #facc15;
  transform-origin: 50% 120px;
  animation: diceBurst .92s ease-out both;
}

.dice-burst span:nth-child(1) { transform: rotate(0deg) translateY(-112px); }
.dice-burst span:nth-child(2) { transform: rotate(60deg) translateY(-112px); background: #bbf7d0; }
.dice-burst span:nth-child(3) { transform: rotate(120deg) translateY(-112px); background: #ffffff; }
.dice-burst span:nth-child(4) { transform: rotate(180deg) translateY(-112px); }
.dice-burst span:nth-child(5) { transform: rotate(240deg) translateY(-112px); background: #bbf7d0; }
.dice-burst span:nth-child(6) { transform: rotate(300deg) translateY(-112px); background: #ffffff; }

.effect-layer.dice.result .dice-cube {
  animation: diceFinal .68s cubic-bezier(.2, 1.45, .24, 1) both;
}

.effect-layer.dice.success .dice-cube {
  color: #166534;
  box-shadow: inset 0 -10px 18px rgba(15, 23, 42, .13), 0 0 0 8px rgba(34, 197, 94, .24), 0 18px 36px rgba(2, 6, 23, .42);
}

.effect-layer.dice.failed .dice-cube {
  color: #991b1b;
  box-shadow: inset 0 -10px 18px rgba(15, 23, 42, .13), 0 0 0 8px rgba(239, 68, 68, .24), 0 18px 36px rgba(2, 6, 23, .42);
}

.dice-caption {
  color: #e0f2fe;
  font-size: clamp(13px, 2.8vw, 18px);
  font-weight: 1000;
  letter-spacing: .03em;
}

@keyframes diceTumble {
  0% { transform: translateX(-14px) rotate(-18deg) scale(.94); }
  50% { transform: translateX(14px) rotate(18deg) scale(1.04); }
  100% { transform: translateX(-14px) rotate(342deg) scale(.94); }
}

@keyframes diceFinal {
  0% { transform: translateY(-26px) rotate(-24deg) scale(.82); filter: blur(2px); }
  62% { transform: translateY(0) rotate(4deg) scale(1.22); filter: blur(0); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}

@keyframes diceCardFinal {
  0% { transform: scale(.94); }
  58% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes diceBurst {
  0% { opacity: 0; scale: .2; }
  24% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: 1.35; }
}

@media (max-width: 520px) {
  .speed-limit-overlay {
    inset: 8% 9%;
    border-radius: 10px;
    border-width: 1.5px;
  }

  .speed-limit-overlay span {
    font-size: 7px;
  }

  .speed-limit-overlay strong {
    font-size: 34px;
  }

  .speed-limit-overlay em {
    min-width: 24px;
    min-height: 14px;
    padding: 0 4px;
    font-size: 7px;
  }

  .effect-layer.dice .dice-card {
    gap: 9px;
    min-width: min(330px, 88vw);
    padding: 20px 18px 22px;
  }

  .dice-cube {
    width: 118px;
    border-radius: 22px;
    font-size: 82px;
  }
}

/* Phase 22: online room lobby foundation. */
.modal-layer {
  z-index: 1200 !important;
}

.room-card {
  width: min(960px, 96vw) !important;
}

.room-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}

.room-form,
.room-live {
  display: grid;
  gap: 12px;
}

.room-form {
  padding: 14px;
  border: 1px solid rgba(114, 135, 160, .18);
  border-radius: 18px;
  background: #f8fafc;
}

.room-form-actions,
.room-ready-row,
.room-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.room-form-actions > *,
.room-ready-row > * {
  flex: 1;
}

.room-code-box {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 18px;
  color: #f8fafc;
  background:
    linear-gradient(135deg, #172033, #0f172a),
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(255,255,255,.06) 24px 26px);
  border: 1px solid rgba(56, 189, 248, .28);
}

.room-code-box span {
  color: #bae6fd;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .12em;
}

.room-code-box strong {
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1;
  letter-spacing: .08em;
}

.room-status {
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 14px;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-weight: 900;
  line-height: 1.45;
}

.room-status.ok {
  color: #166534;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.room-status.warn {
  color: #92400e;
  background: #fff7ed;
  border-color: #fed7aa;
}

.room-status.danger {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.room-identity-notice {
  display: grid;
  gap: 5px;
  padding: 9px 11px;
  border-radius: 14px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #dbe2ef;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
}

.room-identity-notice:empty {
  display: none;
}

.room-identity-notice strong {
  color: #9a3412;
  font-weight: 1000;
}

.room-identity-notice.warn {
  color: #7c2d12;
  background: #fff7ed;
  border-color: #fed7aa;
}

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

.room-seat {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-areas:
    "num name"
    "num meta";
  gap: 2px 9px;
  align-items: center;
  min-height: 74px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid #dbe2ef;
  background: #ffffff;
  color: #172033;
  text-align: left;
  cursor: pointer;
}

.room-seat span {
  grid-area: num;
  display: grid;
  place-items: center;
  width: 34px;
  aspect-ratio: 1;
  border-radius: 11px;
  color: #ffffff;
  background: #2563eb;
  font-weight: 1000;
}

.room-seat strong {
  grid-area: name;
  overflow: hidden;
  font-size: 16px;
  font-weight: 1000;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-seat em {
  grid-area: meta;
  color: #64748b;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.room-seat.empty {
  background: #f8fafc;
  border-style: dashed;
}

.room-seat.occupied.connected {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #ffffff, #eff6ff);
}

.room-seat.you {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}

.room-seat.offline {
  opacity: .62;
}

.room-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .title-actions {
    gap: 8px !important;
  }

  .title-actions .ghost-button,
  .title-actions .primary-button {
    width: 100%;
  }

  .room-grid {
    grid-template-columns: 1fr;
  }

  .room-form-actions,
  .room-ready-row,
  .room-link-row {
    align-items: stretch;
    flex-direction: column;
  }

  .room-seats {
    grid-template-columns: 1fr;
  }
}

/* Phase 23: skill detail sheet keeps hand cards clean and readable. */
.skill-card-badge,
.skill-card-summary {
  display: none !important;
}

.skill-detail-layer {
  align-items: end !important;
  justify-items: center !important;
  padding: 0 !important;
}

.skill-detail-card {
  width: min(860px, 100vw) !important;
  border-radius: 28px 28px 0 0 !important;
  border-bottom: 0 !important;
}

@media (max-width: 720px) {
  .skill-detail-card {
    max-height: 86dvh !important;
    padding: 14px !important;
  }

  .skill-detail-head {
    align-items: center !important;
    margin-bottom: 10px !important;
  }

  .skill-detail-head h2 {
    font-size: 22px !important;
    line-height: 1.05 !important;
  }

  .skill-detail-layout {
    grid-template-columns: minmax(132px, 39vw) minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .skill-detail-art {
    width: 100% !important;
    border-radius: 14px !important;
  }

  .skill-detail-state {
    min-height: 24px !important;
    padding: 5px 9px !important;
    font-size: 10px !important;
  }

  .skill-detail-tags {
    gap: 4px !important;
  }

  .skill-detail-tags span {
    min-height: 21px !important;
    padding: 4px 7px !important;
    font-size: 10px !important;
  }

  .skill-detail-copy {
    gap: 7px !important;
  }

  .skill-detail-copy h3 {
    font-size: 21px !important;
  }

  .skill-detail-copy p {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }

  .skill-detail-list {
    gap: 6px !important;
  }

  .skill-detail-list div {
    grid-template-columns: 58px 1fr !important;
    gap: 7px !important;
    padding: 7px 8px !important;
    border-radius: 12px !important;
  }

  .skill-detail-list dt,
  .skill-detail-list dd,
  .skill-detail-target small {
    font-size: 11px !important;
  }

  .skill-detail-target {
    padding: 8px !important;
    border-radius: 13px !important;
  }

  .skill-detail-target select {
    min-height: 40px !important;
    font-size: 13px !important;
  }

  .skill-detail-actions {
    position: sticky;
    bottom: -14px;
    grid-template-columns: .72fr 1fr !important;
    margin: 10px -14px -14px !important;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    background: rgba(248, 250, 252, .96);
    border-top: 1px solid #e2e8f0;
  }

  .skill-detail-actions button {
    min-height: 48px !important;
    font-size: 14px !important;
  }
}

@media (max-width: 420px) {
  .skill-detail-layout {
    grid-template-columns: 126px minmax(0, 1fr) !important;
  }

  .skill-detail-list div {
    grid-template-columns: 1fr !important;
  }
}

/* Phase 24: quieter race shell with one clear decision path. */
body.race-started {
  color: #172033 !important;
  background: #f3f6fa !important;
}

body.race-started .condition-pill.super {
  color: #7c2d12 !important;
  background: #fff1b8 !important;
  border: 1px solid #f4c84b !important;
  box-shadow: 0 0 0 2px rgba(244, 200, 75, .16) !important;
}

body.race-started .game-app {
  width: min(100%, 1600px) !important;
  max-width: 1600px !important;
  padding: 0 16px 24px !important;
}

body.race-started .top-command {
  min-height: 58px !important;
  margin: 0 -16px 14px !important;
  padding: 8px 18px !important;
  color: #172033 !important;
  background: #ffffff !important;
  border-bottom: 1px solid #dbe3ec !important;
  box-shadow: none !important;
}

body.race-started .top-command .eyebrow,
body.race-started .top-command .brand-subtitle {
  display: none !important;
}

body.race-started .top-command h1 {
  color: #172033 !important;
  font-size: 22px !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

body.race-started .race-hud {
  gap: 0 !important;
  color: #172033 !important;
}

body.race-started .race-hud .hud-pill {
  min-height: 34px !important;
  padding: 0 16px !important;
  color: #172033 !important;
  background: transparent !important;
  border: 0 !important;
  border-left: 1px solid #dbe3ec !important;
  border-radius: 0 !important;
  font-size: 13px !important;
}

body.race-started .top-actions .icon-button,
body.race-started .top-actions .ghost-button {
  color: #172033 !important;
  background: #ffffff !important;
  border: 1px solid #cbd6e3 !important;
  box-shadow: none !important;
}

body.race-started .game-stage {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px) !important;
  grid-template-areas: "board side" !important;
  gap: 12px !important;
  align-items: start !important;
}

body.race-started .panel {
  color: #172033 !important;
  background: #ffffff !important;
  border: 1px solid #dbe3ec !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body.race-started .race-board {
  grid-area: board !important;
  min-width: 0 !important;
  padding: 12px !important;
}

body.race-started .race-board-heading {
  margin-bottom: 8px !important;
}

body.race-started .race-board-heading h2,
body.race-started .standings-details > summary,
body.race-started .dock-topline h2 {
  color: #172033 !important;
  font-size: 15px !important;
  font-weight: 950 !important;
  letter-spacing: 0 !important;
}

body.race-started .race-context-strip {
  display: grid !important;
  grid-template-columns: minmax(230px, auto) minmax(0, 1fr) !important;
  gap: 8px !important;
  align-items: stretch !important;
  margin-bottom: 10px !important;
}

body.race-started #currentPlayer,
body.race-started #alertBar {
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.race-started .current-player-card {
  display: grid !important;
  grid-template-columns: 52px minmax(0, 1fr) !important;
  gap: 8px !important;
  align-items: center !important;
  min-height: 58px !important;
  padding: 5px 10px 5px 6px !important;
  color: #172033 !important;
  background: #f7f9fc !important;
  border: 1px solid #dbe3ec !important;
  border-left: 4px solid var(--driver-color, #2563eb) !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

body.race-started .current-car-img {
  width: 48px !important;
  height: 48px !important;
}

body.race-started .current-title-row {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
}

body.race-started .current-title-row strong {
  color: #172033 !important;
  font-size: 15px !important;
}

body.race-started .current-title-row span {
  color: #64748b !important;
  font-size: 10px !important;
  font-weight: 900 !important;
}

body.race-started .current-meta-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 3px 10px !important;
  margin-top: 3px !important;
  color: #64748b !important;
  font-size: 10px !important;
  font-weight: 850 !important;
}

body.race-started #alertBar {
  display: flex !important;
  align-items: center !important;
  min-height: 58px !important;
  padding: 8px 11px !important;
  color: #4b6178 !important;
  background: #f7f9fc !important;
  border: 1px solid #dbe3ec !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
}

body.race-started #alertBar.warn {
  color: #854d0e !important;
  background: #fffbea !important;
  border-color: #f3d56b !important;
}

body.race-started #alertBar.danger {
  color: #991b1b !important;
  background: #fff4f4 !important;
  border-color: #f6b5b5 !important;
}

body.race-started .course-focus {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(118px, 1fr)) !important;
  gap: 8px !important;
  align-items: start !important;
  padding: 0 0 3px !important;
  overflow-x: auto !important;
}

body.race-started .focus-card,
body.race-started .focus-card.now,
body.race-started .course-focus .focus-card:first-child,
body.race-started .course-focus .focus-card:not(:first-child) {
  grid-column: auto !important;
  min-height: 252px !important;
  padding: 9px !important;
  color: #172033 !important;
  background: #ffffff !important;
  border: 1px solid #cfd9e5 !important;
  border-radius: 6px !important;
  outline: 0 !important;
  box-shadow: 0 2px 7px rgba(23, 32, 51, .08) !important;
  opacity: 1 !important;
}

body.race-started .focus-card.now,
body.race-started .course-focus .focus-card:first-child {
  border-color: #4c83d4 !important;
  box-shadow: inset 0 0 0 2px rgba(76, 131, 212, .16) !important;
}

body.race-started .focus-card.preview-final {
  border-color: #f05b50 !important;
  box-shadow: inset 0 0 0 2px rgba(240, 91, 80, .17) !important;
}

body.race-started .focus-card::after {
  display: none !important;
}

body.race-started .focus-card .course-art {
  width: 100% !important;
  height: 122px !important;
  margin: 7px 0 6px !important;
  border: 0 !important;
  border-radius: 4px !important;
  box-shadow: none !important;
}

body.race-started .focus-label {
  padding: 3px 6px !important;
  color: #ffffff !important;
  background: #274b74 !important;
  border: 0 !important;
  border-radius: 4px !important;
  font-size: 9px !important;
}

body.race-started .focus-name,
body.race-started .course-focus .focus-card:not(:first-child) .focus-name {
  margin-top: 3px !important;
  color: #172033 !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  text-shadow: none !important;
}

body.race-started .focus-safe,
body.race-started .course-focus .focus-card:not(:first-child) .focus-safe {
  display: block !important;
  margin-top: 3px !important;
  padding: 0 !important;
  color: #52657a !important;
  background: transparent !important;
  font-size: 10px !important;
}

body.race-started .focus-arrival {
  border-radius: 4px !important;
  background: #ef5b50 !important;
}

body.race-started .focus-risk {
  left: 7px !important;
  right: 7px !important;
  bottom: 7px !important;
  padding: 5px 6px !important;
  border-radius: 4px !important;
  font-size: 9px !important;
}

body.race-started .focus-cars,
body.race-started .focus-card.now .focus-cars,
body.race-started .course-focus .focus-card:first-child .focus-cars {
  position: absolute !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  left: 7px !important;
  right: 7px !important;
  bottom: 7px !important;
  width: auto !important;
  transform: none !important;
}

body.race-started .focus-cars .car-token {
  width: 38px !important;
  min-width: 38px !important;
  height: 34px !important;
  margin-left: -7px !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 999px !important;
}

body.race-started .focus-cars .car-token:first-child {
  margin-left: 0 !important;
}

body.race-started .focus-cars .car-label {
  display: none !important;
}

body.race-started .focus-card.now .car-img,
body.race-started .course-focus .focus-card:first-child .car-img {
  width: 42px !important;
  height: 42px !important;
}

body.race-started .course-details,
body.race-started .race-history,
body.race-started .decision-help {
  margin-top: 8px !important;
  color: #52657a !important;
  font-size: 11px !important;
}

body.race-started .course-details > summary,
body.race-started .race-history > summary,
body.race-started .decision-help > summary {
  cursor: pointer !important;
  color: #52657a !important;
  font-size: 11px !important;
  font-weight: 900 !important;
}

body.race-started .side-dash {
  grid-area: side !important;
  position: static !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  min-width: 0 !important;
  padding: 12px !important;
}

body.race-started .standings-details > summary {
  display: block !important;
  margin-bottom: 8px !important;
  cursor: default !important;
  list-style: none !important;
}

body.race-started .standings-details > summary::-webkit-details-marker {
  display: none !important;
}

body.race-started .standings-details > #playerStandings {
  display: grid !important;
}

body.race-started .standings-list {
  gap: 5px !important;
}

body.race-started .standing-card {
  display: grid !important;
  grid-template-columns: 26px 42px minmax(0, 1fr) !important;
  gap: 6px !important;
  align-items: center !important;
  min-height: 54px !important;
  padding: 5px 7px !important;
  color: #172033 !important;
  background: #ffffff !important;
  border: 1px solid #dbe3ec !important;
  border-left: 4px solid var(--driver-color, #2563eb) !important;
  border-radius: 5px !important;
  box-shadow: none !important;
}

body.race-started .standing-card.active {
  background: #f4f8fe !important;
  border-color: var(--driver-color, #2563eb) !important;
  box-shadow: none !important;
}

body.race-started .standing-rank {
  color: var(--driver-color, #2563eb) !important;
  font-size: 19px !important;
  text-align: center !important;
}

body.race-started .standing-car {
  width: 40px !important;
  height: 40px !important;
}

body.race-started .standing-name {
  color: #172033 !important;
  font-size: 12px !important;
}

body.race-started .standing-name small {
  margin-left: 5px !important;
  color: #718096 !important;
  font-size: 8px !important;
}

body.race-started .standing-meta {
  margin-top: 1px !important;
  color: #64748b !important;
  font-size: 9px !important;
}

body.race-started .standing-card .condition-row:empty {
  display: none !important;
}

body.race-started .standing-card .condition-pill {
  padding: 2px 5px !important;
  font-size: 8px !important;
}

body.race-started #miniMap.race-trackbar {
  order: 2 !important;
  display: grid !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 10px 8px !important;
  color: #172033 !important;
  background: #f7f9fc !important;
  border: 1px solid #dbe3ec !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

body.race-started .trackbar-head span {
  color: #172033 !important;
  letter-spacing: 0 !important;
}

body.race-started .trackbar-foot {
  display: none !important;
}

body.race-started .trackbar-stage {
  min-height: 76px !important;
  padding: 28px 30px 22px !important;
}

body.race-started .race-history {
  order: 3 !important;
  padding-top: 8px !important;
  border-top: 1px solid #e3e9f0 !important;
}

body.race-started .race-history-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin: 8px 0 5px !important;
}

body.race-started .latest-log,
body.race-started .race-log .log-entry {
  color: #41546a !important;
  background: #f7f9fc !important;
  border-color: #dbe3ec !important;
  border-radius: 5px !important;
  box-shadow: none !important;
  font-size: 10px !important;
}

body.race-started .command-dock {
  position: relative !important;
  inset: auto !important;
  display: grid !important;
  gap: 8px !important;
  max-height: none !important;
  margin-top: 12px !important;
  padding: 12px !important;
  overflow: visible !important;
  color: #172033 !important;
  background: #ffffff !important;
  border: 1px solid #dbe3ec !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

body.race-started .command-dock::before {
  display: none !important;
}

body.race-started .dock-topline {
  min-height: auto !important;
  margin: 0 !important;
}

body.race-started .hands-grid {
  display: grid !important;
  order: 1 !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 16px !important;
  align-items: start !important;
  margin: 0 !important;
}

body.race-started .hand-block {
  min-width: 0 !important;
}

body.race-started .hand-block + .hand-block {
  padding-left: 16px !important;
  border-left: 1px solid #e3e9f0 !important;
}

body.race-started .hand-block h3 {
  margin: 0 0 6px !important;
  color: #315a8c !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
}

body.race-started .hand-block h3 span {
  color: #718096 !important;
  font-size: 9px !important;
}

body.race-started .speed-hand,
body.race-started .skill-hand {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 116px)) !important;
  gap: 8px !important;
  justify-content: center !important;
}

body.race-started .play-card.speed-card,
body.race-started .play-card.skill-card {
  width: 100% !important;
  max-width: 116px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  aspect-ratio: 2 / 3 !important;
  padding: 0 !important;
  background: #ffffff !important;
  border: 2px solid transparent !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 7px rgba(23, 32, 51, .1) !important;
}

body.race-started .play-card.speed-card.selected,
body.race-started .play-card.skill-card.selected {
  border-color: #ef5b50 !important;
  box-shadow: 0 0 0 3px rgba(239, 91, 80, .16) !important;
  transform: translateY(-3px) !important;
}

body.race-started .speed-card-art,
body.race-started .skill-card-art {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 4px !important;
}

body.race-started .decision-strip {
  display: grid !important;
  order: 2 !important;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(190px, 220px) !important;
  gap: 8px !important;
  align-items: stretch !important;
  padding-top: 10px !important;
  border-top: 1px solid #dbe3ec !important;
}

body.race-started .decision-strip > .tutorial-coach {
  grid-column: 1 / -1 !important;
}

body.race-started .decision-strip > .target-area {
  grid-column: 1 !important;
  min-width: 0 !important;
  padding: 8px !important;
  background: #f7f9fc !important;
  border: 1px solid #dbe3ec !important;
  border-radius: 6px !important;
}

body.race-started .decision-strip > .move-preview {
  grid-column: 2 !important;
}

body.race-started .decision-strip > .target-area.hidden + .move-preview {
  grid-column: 1 / 3 !important;
}

body.race-started .move-preview {
  min-height: 64px !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 9px 11px !important;
  overflow: visible !important;
  color: #314155 !important;
  background: #f7f9fc !important;
  border: 1px solid #dbe3ec !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  font-size: 11px !important;
  line-height: 1.35 !important;
}

body.race-started .move-preview.safe {
  color: #166534 !important;
  background: #f1fbf5 !important;
  border-color: #9bd8b0 !important;
}

body.race-started .move-preview.chance {
  color: #854d0e !important;
  background: #fffbea !important;
  border-color: #f3d56b !important;
}

body.race-started .move-preview.danger {
  color: #991b1b !important;
  background: #fff4f4 !important;
  border-color: #f6b5b5 !important;
}

body.race-started .preview-destination,
body.race-started .preview-change {
  border-radius: 4px !important;
}

body.race-started .run-button {
  grid-column: 3 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 64px !important;
  align-self: stretch !important;
  color: #ffffff !important;
  background: #ef5b50 !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  font-size: 15px !important;
  letter-spacing: 0 !important;
}

body.race-started .run-button:disabled {
  color: #7b8795 !important;
  background: #e5eaf0 !important;
}

body.race-started .decision-help {
  grid-column: 1 / -1 !important;
  margin: 0 !important;
}

body.race-started .decision-help .coach-panel {
  margin-top: 7px !important;
  padding: 9px 11px !important;
  color: #41546a !important;
  background: #f7f9fc !important;
  border: 1px solid #dbe3ec !important;
  border-radius: 5px !important;
  box-shadow: none !important;
  font-size: 11px !important;
}

  body.race-started .rules-panel {
  margin-top: 10px !important;
  padding: 9px 12px !important;
  background: transparent !important;
  border-color: #dbe3ec !important;
}

@media (max-width: 980px) {
  body.race-started .game-stage {
    grid-template-columns: minmax(0, 1fr) 250px !important;
  }

  body.race-started .focus-card,
  body.race-started .focus-card.now,
  body.race-started .course-focus .focus-card:first-child,
  body.race-started .course-focus .focus-card:not(:first-child) {
    min-width: 136px !important;
  }

  body.race-started .hands-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  body.race-started .hand-block + .hand-block {
    padding-top: 10px !important;
    padding-left: 0 !important;
    border-top: 1px solid #e3e9f0 !important;
    border-left: 0 !important;
  }
}

@media (max-width: 720px) {
  body.race-started .game-app {
    padding: 0 8px 16px !important;
  }

  body.race-started .top-command {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    min-height: 52px !important;
    margin: 0 -8px 8px !important;
    padding: 6px 8px !important;
  }

  body.race-started .top-command h1 {
    font-size: 17px !important;
  }

  body.race-started .race-hud .hud-pill {
    min-height: 30px !important;
    padding: 0 7px !important;
    font-size: 10px !important;
  }

  body.race-started .mobile-race-menu-toggle {
    display: grid !important;
    width: 34px !important;
    height: 34px !important;
    color: #172033 !important;
    background: #ffffff !important;
    border: 1px solid #cbd6e3 !important;
    border-radius: 6px !important;
  }

  body.race-started .game-stage {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
  }

  body.race-started .race-board {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px !important;
    overflow: hidden !important;
  }

  body.race-started .race-board-heading {
    display: none !important;
  }

  body.race-started .race-context-strip {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: minmax(0, 1.2fr) minmax(110px, .8fr) !important;
    gap: 5px !important;
    margin-bottom: 7px !important;
  }

  body.race-started .current-player-card {
    grid-template-columns: 40px minmax(0, 1fr) !important;
    min-height: 48px !important;
    padding: 4px 6px 4px 3px !important;
  }

  body.race-started #currentPlayer {
    display: block !important;
  }

  body.race-started .current-car-img {
    width: 38px !important;
    height: 38px !important;
  }

  body.race-started .current-title-row strong {
    font-size: 12px !important;
  }

  body.race-started .current-meta-grid {
    gap: 1px 6px !important;
    font-size: 8px !important;
  }

  body.race-started #alertBar {
    min-height: 48px !important;
    padding: 6px 7px !important;
    font-size: 9px !important;
  }

  body.race-started .course-focus {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(132px, 42vw) !important;
    gap: 7px !important;
    scroll-snap-type: x mandatory !important;
  }

  body.race-started .focus-card,
  body.race-started .focus-card.now,
  body.race-started .course-focus .focus-card:first-child,
  body.race-started .course-focus .focus-card:not(:first-child) {
    min-width: 0 !important;
    min-height: 202px !important;
    padding: 7px !important;
    scroll-snap-align: start !important;
  }

  body.race-started .focus-card .course-art {
    height: 94px !important;
  }

  body.race-started .focus-name,
  body.race-started .course-focus .focus-card:not(:first-child) .focus-name {
    font-size: 11px !important;
  }

  body.race-started .focus-safe,
  body.race-started .course-focus .focus-card:not(:first-child) .focus-safe {
    font-size: 9px !important;
  }

  body.race-started .course-focus .focus-card:not(:first-child) .focus-label,
  body.race-started .course-focus .focus-card:not(:first-child) .focus-cars {
    display: flex !important;
  }

  body.race-started .side-dash {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 6px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
  }

  body.race-started .standings-details {
    order: 2 !important;
    padding: 8px !important;
    background: #ffffff !important;
    border: 1px solid #dbe3ec !important;
    border-radius: 6px !important;
  }

  body.race-started .standings-details > summary {
    display: list-item !important;
    margin: 0 !important;
    cursor: pointer !important;
    list-style: revert !important;
    font-size: 12px !important;
  }

  body.race-started .standings-details:not([open]) > #playerStandings {
    display: none !important;
  }

  body.race-started .standings-details[open] > #playerStandings {
    display: grid !important;
    margin-top: 8px !important;
  }

  body.race-started #miniMap.race-trackbar {
    order: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  body.race-started .race-history {
    order: 3 !important;
    margin: 0 !important;
    padding: 8px !important;
    background: #ffffff !important;
    border: 1px solid #dbe3ec !important;
    border-radius: 6px !important;
  }

  body.race-started .command-dock {
    position: relative !important;
    inset: auto !important;
    margin-top: 8px !important;
    padding: 8px !important;
    border-width: 1px !important;
    border-radius: 8px !important;
  }

  body.race-started .dock-topline h2 {
    font-size: 13px !important;
  }

  body.race-started .hands-grid {
    gap: 8px !important;
  }

  body.race-started .hand-block + .hand-block {
    padding-top: 8px !important;
  }

  body.race-started .speed-hand,
  body.race-started .skill-hand {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  body.race-started .play-card.speed-card,
  body.race-started .play-card.skill-card {
    width: 100% !important;
    max-width: none !important;
    border-radius: 5px !important;
  }

  body.race-started .decision-strip {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding-top: 8px !important;
  }

  body.race-started .decision-strip > .tutorial-coach,
  body.race-started .decision-strip > .target-area,
  body.race-started .decision-strip > .move-preview,
  body.race-started .decision-strip > .target-area.hidden + .move-preview,
  body.race-started .run-button,
  body.race-started .decision-help {
    grid-column: 1 !important;
  }

  body.race-started .move-preview {
    min-height: 52px !important;
    max-height: none !important;
    padding: 7px 8px !important;
    font-size: 10px !important;
  }

  body.race-started .preview-route {
    display: none !important;
  }

  body.race-started .run-button {
    min-height: 46px !important;
    height: 46px !important;
    font-size: 14px !important;
  }

body.race-started .rules-panel {
    margin-top: 8px !important;
  }
}

/* Phase 28: title menu hierarchy. */
.title-screen {
  overflow-y: auto !important;
}

.title-card {
  width: min(680px, 96vw) !important;
  max-height: calc(100dvh - 28px) !important;
  padding: clamp(24px, 4vw, 42px) !important;
  overflow-y: auto !important;
}

.title-card h1 {
  margin-bottom: 6px !important;
}

.title-copy {
  margin: 8px 0 6px !important;
}

.title-actions {
  display: grid !important;
  gap: 12px !important;
  margin: 22px 0 16px !important;
}

.title-play-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.title-play-actions .title-start,
.title-play-actions .title-online-start {
  width: 100%;
  min-height: 58px;
  padding: 12px 18px !important;
  border-radius: 8px !important;
  font-size: 17px;
  font-weight: 1000;
}

.title-play-actions .title-online-start {
  color: #0f4c5c !important;
  background: #eaf8f6 !important;
  border-color: #8fd5cc !important;
}

.title-tutorial-button {
  justify-self: center;
  padding: 5px 8px;
  color: #2563eb;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, .35);
  text-underline-offset: 4px;
}

.title-tutorial-button:hover {
  color: #1d4ed8;
  text-decoration-color: currentColor;
}

.title-more-menu {
  padding-top: 11px;
  border-top: 1px solid rgba(114, 135, 160, .22);
}

.title-more-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.title-more-menu > summary::-webkit-details-marker {
  display: none;
}

.title-more-menu > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .18s ease;
}

.title-more-menu[open] > summary::after {
  transform: translateY(2px) rotate(225deg);
}

.title-more-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.title-more-actions .ghost-button {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px !important;
  border-radius: 7px !important;
  font-size: 12px;
}

@media (max-width: 720px) {
  .title-card {
    width: min(560px, calc(100vw - 20px)) !important;
    max-height: calc(100dvh - 20px) !important;
    padding: 22px 16px !important;
    border-radius: 14px !important;
  }

  .title-card h1 {
    font-size: clamp(38px, 13vw, 58px) !important;
  }

  .title-subcopy {
    font-size: 13px;
  }

  .title-play-actions {
    grid-template-columns: 1fr;
  }

  .title-play-actions .title-start,
  .title-play-actions .title-online-start {
    min-height: 52px;
  }

  .title-more-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plan-strip {
    grid-template-columns: auto minmax(0, 1fr) !important;
    gap: 7px !important;
    padding: 8px 10px !important;
    text-align: left !important;
  }

  .plan-strip #toggleHostPass {
    grid-column: 1 / -1;
    width: 100%;
  }

  .title-ad {
    padding: 9px 10px !important;
  }
}

@media (max-width: 420px) {
  .title-hint,
  .title-ad em,
  .plan-strip #planSummary {
    display: none !important;
  }

  .plan-strip {
    grid-template-columns: 1fr 1fr !important;
  }

  .plan-strip .plan-badge,
  .plan-strip #toggleHostPass {
    grid-column: auto;
  }

  .title-actions {
    margin-top: 16px !important;
  }
}
