/* Rush scorecards, collectible art and race podium share the original HUD palette. */
#shift-pause, #run-screen, .race-podium, #graphics-status {
  --ink: #0b0d12;
  --panel: #1a1d26;
  --edge: #5a6070;
  --muted: #c8cede;
  --gold: #ffd23f;
  --cash: #7ee07e;
  --danger: #ff6b5a;
  box-sizing: border-box;
  color: #fff;
  font: 400 14px/1.5 Silkscreen, monospace;
  font-variant-numeric: tabular-nums;
}
#run-screen, .race-podium {
  position: fixed;
  inset: 0;
  z-index: 8;
  align-items: safe center;
  justify-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(14px, 3vw, 42px);
  background: rgb(11 13 18 / 82%);
  pointer-events: auto;
}
.race-podium { display: grid; }
#run-screen [hidden], .race-podium[hidden] { display: none; }
.shift-result, .podium-sheet, #shift-pause, #graphics-status {
  box-sizing: border-box;
  background: var(--panel);
  border: 4px solid var(--ink);
  outline: 2px solid var(--edge);
  box-shadow: 6px 6px 0 var(--ink);
}
#shift-pause {
  width: min(390px, calc(100% - 34px));
  padding: 22px;
  border-top: 4px solid var(--gold);
}
#shift-pause::backdrop { background: rgb(11 13 18 / 76%); }
#shift-pause h2, .shift-poster h1, .podium-sheet h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(28px, 3.5vw, 52px);
  line-height: 1.06;
  text-shadow: 3px 3px 0 var(--ink);
}
#shift-pause h2 { font-size: 32px; }
#shift-pause p { margin: 12px 0 20px; color: var(--muted); }
#shift-pause button, #run-screen button, #race .race-podium button {
  min-height: 40px;
  padding: 8px 12px;
  border: 2px solid var(--edge);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ink);
  background: #282d3a;
  color: #fff;
  font: 700 13px/1.3 Silkscreen, monospace;
  cursor: pointer;
}
#shift-pause button { display: block; width: 100%; margin-top: 8px; }
#shift-pause #resume-shift, #run-screen #run-entry button, #run-screen #run-go,
#race .race-podium .race-rematch {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--ink);
}
#shift-pause button:hover, #run-screen button:hover, #race .race-podium button:hover { border-color: #fff; }
#shift-pause button:focus-visible, #run-screen :is(button,input):focus-visible,
#race .race-podium button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#shift-pause button:active, #run-screen button:active, #race .race-podium button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.shift-result {
  display: grid;
  width: min(1100px, 100%);
  grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr);
}
.shift-poster {
  align-self: stretch;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(12px, 2vw, 24px);
  border-right: 4px solid var(--ink);
  background: #12151c;
}
.shift-poster img, .shift-rewards img, .podium-cards img, .tie-art {
  display: block;
  width: 100%;
  height: auto;
}
.shift-poster img { box-sizing: border-box; border: 2px solid var(--edge); }
.shift-poster > div { margin-top: 16px; }
.shift-poster p, .result-label, .podium-sheet header p, .race-award p:first-child, .shift-rewards small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.shift-poster h1 { margin: 4px 0 10px; color: var(--danger); }
.shift-poster .end-caption { color: #fff; font-size: 14px; }
.shift-ledger {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: clamp(14px, 2vw, 26px);
}
.shift-ledger h2 { margin: 5px 0; color: var(--gold); font-size: clamp(21px, 2vw, 30px); line-height: 1.15; }
.shift-ledger p { margin: 6px 0 10px; }
.receipt-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 12px;
  margin-bottom: 13px;
  border-bottom: 2px solid var(--edge);
}
#run-screen .receipt-nav button { flex: 1 1 auto; padding: 5px 6px; font-size: 12px; }
#run-screen .receipt-nav [aria-pressed=true] {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--ink);
  box-shadow: inset 0 -2px 0 var(--gold);
}
.shift-ledger .receipt-total {
  margin: 0;
  color: var(--cash);
  font-size: clamp(30px, 3.8vw, 52px);
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-shadow: 3px 3px 0 var(--ink);
}
.shift-ledger .receipt-total.deficit, .shift-ledger .board tr.psycho .pts { color: var(--danger); }
.shift-ledger .record, .shift-ledger #run-rank { color: var(--gold); }
.shift-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  margin: 14px 0 18px;
}
.shift-stats div { display: flex; justify-content: space-between; gap: 4px; padding: 6px 0; border-top: 2px solid #353b49; }
.shift-stats dt { color: var(--muted); font-size: 12px; }
.shift-stats dd { margin: 0; text-align: right; font-size: 13px; overflow-wrap: anywhere; }
#run-entry label { display: block; margin-bottom: 5px; font-size: 13px; }
#run-entry > div, .shift-ledger footer, .podium-sheet footer { display: flex; flex-wrap: wrap; gap: 8px; }
#run-entry input {
  flex: 1 1 140px;
  min-width: 0;
  width: 100%;
  padding: 7px 9px;
  box-sizing: border-box;
  border: 2px solid var(--gold);
  border-radius: 0;
  color: #fff;
  background: var(--ink);
  font: 16px/1.3 Silkscreen, monospace;
}
#run-entry input::placeholder { color: #a4abba; }
#run-screen #run-entry button:disabled { background: #343a44; border-color: var(--edge); color: var(--muted); cursor: default; }
.shift-ledger footer { padding-top: 18px; margin-top: auto; }
.shift-rewards, .podium-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shift-rewards { margin-top: 12px; }
.shift-rewards figure, .podium-cards article {
  min-width: 0;
  margin: 0;
  border: 2px solid var(--edge);
  color: #fff;
  background: var(--ink);
}
.shift-rewards .earned { border-color: var(--cash); }
.shift-rewards img { aspect-ratio: 1.8; object-fit: cover; }
.shift-rewards .locked img { filter: grayscale(1); opacity: .65; }
.shift-rewards figcaption { padding: 8px; border-top: 2px solid var(--edge); }
.shift-rewards figcaption :is(strong,small) { display: block; }
.shift-rewards figcaption strong { font-size: 14px; line-height: 1.3; }
.shift-rewards small { margin-bottom: 3px; font-size: 11px; }
.shift-rewards .earned small { color: var(--cash); }
.shift-ledger .board { width: 100%; border-collapse: collapse; }
.shift-ledger .board td { padding: 6px 3px; border-bottom: 2px solid #353b49; font-size: 13px; }
.shift-ledger .board td:first-child { color: var(--muted); }
.shift-ledger .board .name { overflow-wrap: anywhere; }
.shift-ledger .board .pts { color: var(--cash); text-align: right; }
.shift-ledger .board .tag { color: var(--danger); font-size: 11px; }
.shift-ledger .board tr.mine { background: #373320; }
.shift-ledger .board tr.mine .name { color: var(--gold); }
.shift-ledger .board tr.gap td { text-align: center; }

.podium-sheet { width: min(850px, 100%); padding: clamp(12px, 2.4vw, 28px); }
.podium-sheet header { margin-bottom: 14px; }
.podium-sheet header p b { color: var(--edge); }
.podium-sheet h2 { margin-top: 4px; }
.podium-cards article { border-top: 4px solid var(--team, var(--gold)); }
.podium-cards img { max-height: 36vh; object-fit: contain; }
.tie-art { max-height: 36vh; margin-bottom: 10px; background: var(--ink); object-fit: contain; }
.race-award { padding: clamp(9px, 1.4vw, 15px); }
.race-award p:first-child { color: var(--team, var(--gold)); }
.race-award h3 { margin: 4px 0; font-size: clamp(16px, 2vw, 26px); line-height: 1.15; }
.race-award p { margin: 0; font-size: 12px; }
.podium-sheet footer { margin-top: 16px; }

#graphics-status {
  position: fixed;
  z-index: 100;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 14px 18px;
  border-top-color: var(--gold);
  color: var(--gold);
  text-align: center;
  pointer-events: none;
}
@media (max-width: 760px) {
  .shift-result { grid-template-columns: minmax(0, 1fr); }
  .shift-poster {
    display: grid;
    grid-template-columns: minmax(100px, .7fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border-right: 0;
    border-bottom: 4px solid var(--ink);
  }
  .shift-poster > div { margin: 0; }
  .shift-poster h1 { font-size: clamp(23px, 4.5vw, 34px); }
}
@media (max-width: 480px) {
  #run-screen, .race-podium { padding: 9px; }
  .shift-ledger, .podium-sheet { padding: 12px; }
  .shift-poster { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .shift-poster img { max-height: 24vh; object-fit: contain; background: var(--ink); }
  .shift-poster h1 { margin: 2px 0 4px; }
  .receipt-nav { gap: 4px; }
  #shift-pause button, #run-screen button, #race .race-podium button { min-height: 44px; }
  #run-screen .receipt-nav button { padding: 6px 4px; font-size: 12px; }
  .shift-stats { grid-template-columns: minmax(0, 1fr); }
  .shift-stats dt, .shift-stats dd { font-size: 13px; }
  .shift-rewards figcaption strong { font-size: 13px; }
  .podium-cards { gap: 6px; }
  .race-award { padding: 7px; }
  .race-award h3 { overflow-wrap: anywhere; }
}

/* The street remains visible beneath the red wash. In split-screen each
   overlay is bounded by the driver's pane, including in the stacked layout. */
.failure-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  container-type: inline-size;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgb(119 12 20 / 44%), rgb(39 2 9 / 87%));
  backdrop-filter: grayscale(1) contrast(1.2);
  animation: verdict-wash 240ms ease-out both;
}
body > .failure-screen { position: fixed; z-index: 7; }
.failure-screen[hidden] { display: none; }
.failure-screen strong {
  display: grid;
  place-items: center;
  width: 100%;
  padding: .16em 0 .22em;
  color: #ff4548;
  background: linear-gradient(90deg, transparent, rgb(16 3 8 / 78%) 25% 75%, transparent);
  font: 700 clamp(32px, 14cqw, 150px)/1 Silkscreen, monospace;
  letter-spacing: -.08em;
  text-indent: -.08em;
  text-shadow: -2px -2px #200407, 2px 2px #200407, 0 5px #200407;
}
body:has(> .failure-screen:not([hidden])) :is(.hud, #hurt, #run-card),
.race-pane:has(.failure-screen:not([hidden])) > :not(.failure-screen) { visibility: hidden; }
@keyframes verdict-wash { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .failure-screen { animation: none; } }
