/* ==========================================================================
   Heat Solo — Main Stylesheet
   Extracted from index.html inline styles for maintainability and caching.
   ========================================================================== */

/* ---- Custom Properties ---- */
:root {
  --dash-bg: #e8e0d0;
  --panel-bg: #d8d0c0;
  --panel-deep: #cfc7b5;
  --panel-border: #a09078;
  --amber: #e08800;
  --amber-dim: #b87010;
  --amber-glow: rgba(224, 136, 0, 0.35);
  --red-hot: #d03020;
  --red-glow: rgba(208, 48, 32, 0.35);
  --green: #208838;
  --green-bright: #28a048;
  --green-glow: rgba(40, 160, 72, 0.3);
  --chrome: #706858;
  --chrome-dark: #585040;
  --warm-white: #2a2418;
  --warm-dim: #5a5040;
  --warm-muted: #807060;
}

/* ---- Reset & Base ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  background-color: #b8ccaa;
  background-image:
    radial-gradient(ellipse 60px 50px at 15% 20%, rgba(255,248,220,0.35) 0%, transparent 70%),
    radial-gradient(ellipse 80px 70px at 75% 15%, rgba(255,245,200,0.30) 0%, transparent 70%),
    radial-gradient(ellipse 50px 45px at 40% 40%, rgba(255,250,230,0.25) 0%, transparent 70%),
    radial-gradient(ellipse 70px 60px at 85% 55%, rgba(255,248,210,0.28) 0%, transparent 70%),
    radial-gradient(ellipse 90px 80px at 25% 70%, rgba(255,245,200,0.22) 0%, transparent 70%),
    radial-gradient(ellipse 55px 50px at 60% 85%, rgba(255,250,225,0.30) 0%, transparent 70%),
    radial-gradient(ellipse 65px 55px at 10% 90%, rgba(255,248,215,0.20) 0%, transparent 70%),
    radial-gradient(ellipse 45px 40px at 92% 30%, rgba(255,252,235,0.25) 0%, transparent 70%),
    radial-gradient(ellipse 600px 200px at 20% 95%, rgba(120,160,100,0.4) 0%, transparent 70%),
    radial-gradient(ellipse 800px 250px at 80% 100%, rgba(110,150,95,0.35) 0%, transparent 70%),
    radial-gradient(ellipse 500px 180px at 50% 90%, rgba(130,165,110,0.3) 0%, transparent 70%),
    repeating-linear-gradient(175deg, transparent, transparent 3px, rgba(100,140,80,0.06) 3px, rgba(100,140,80,0.06) 4px),
    repeating-linear-gradient(85deg, transparent, transparent 5px, rgba(80,120,60,0.04) 5px, rgba(80,120,60,0.04) 6px),
    linear-gradient(180deg, #d4e4d0 0%, #c8dcc0 15%, #bcd4b0 35%, #b4ccaa 55%, #a8c4a0 75%, #a0bc98 100%);
}
body {
  font-family: 'Courier New', monospace;
  color: var(--warm-white);
  padding: 12px;
  max-width: 1200px;
  margin: 12px auto;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--dash-bg);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
  box-shadow:
    -4px 0 24px rgba(80,100,60,0.20),
    4px 0 24px rgba(80,100,60,0.20),
    0 0 80px rgba(80,100,60,0.15);
}
body::before, body::after {
  content: '';
  position: fixed;
  left: 0; right: 0;
  height: 4px;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(90deg,
    #b8ccaa, #c8b898 20%, #a8c4a0 40%, #d4ccb8 60%, #a8c4a0 80%, #b8ccaa);
  opacity: 0.7;
}
body::before { top: 0; }
body::after { bottom: 0; }

/* ---- Typography ---- */
h1 {
  color: var(--amber);
  margin-bottom: 4px;
  letter-spacing: 3px;
  text-shadow: 0 0 12px var(--amber-glow);
}
h2 {
  color: var(--amber);
  font-size: 1em;
  margin: 8px 0 4px;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(255,140,0,0.3);
}
.subtitle {
  color: var(--warm-muted);
  font-size: 0.8em;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

/* ---- Layout Grid ---- */
#game-area {
  display: grid;
  grid-template-areas:
    "header header"
    "track standings"
    "gauges standings"
    "corner standings"
    "cards standings"
    "actions actions"
    "log log";
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto auto auto auto 1fr auto auto;
  gap: 12px;
  flex: 1;
  min-height: 0;
}
#game-header  { grid-area: header; }
#gauges       { grid-area: gauges; }
#standings    { grid-area: standings; }
#track-line   { grid-area: track; }
#corner-info  { grid-area: corner; }
#hand         { grid-area: cards; }
#actions      { grid-area: actions; }
#log          { grid-area: log; }

/* Dashboard frame — wraps left column components */
#game-header, #gauges, #track-line, #corner-info, #hand, #actions, #log, #standings {
  border: 1px solid rgba(0,0,0,0.08);
}
/* Shared panel seam between track/gauges/corner/cards */
#track-line { border-radius: 6px 0 0 0; border-bottom: none; }
#gauges { border-radius: 0; border-top: none; border-bottom: none; }
#corner-info { border-radius: 0; border-top: none; border-bottom: none; }
#hand { border-radius: 0 0 0 6px; border-top: none; }
#standings {
  border-radius: 6px;
  align-self: start;
  width: 100%;
  max-width: 340px;
  min-width: 280px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 4px;
}

/* ---- Tooltip ---- */
#app-tooltip {
  position: fixed;
  display: none;
  pointer-events: none;
  z-index: 12000;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(18,18,18,0.94);
  color: #fff;
  font-size: 0.9em;
  line-height: 1.25;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  max-width: 360px;
  word-break: break-word;
}

/* Corner SL list under map */
.corner-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 6px;
  padding-left: 2px;
  align-items: center;
}
.corner-item {
  background: rgba(28,20,14,0.78);
  color: #ffe9c8;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.85em;
  white-space: nowrap;
  border: 1px solid rgba(255,214,138,0.12);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* ---- Header with racing stripe ---- */
#game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #e0d8c8 0%, var(--panel-bg) 100%);
  border: 2px solid var(--panel-border) !important;
  border-radius: 6px 6px 0 0 !important;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 -1px 0 rgba(0,0,0,0.06),
    0 2px 4px rgba(0,0,0,0.15);
  margin-bottom: 0;
}
#game-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red-hot), var(--amber), var(--red-hot));
}
.header-title {
  font-size: 1em;
  font-weight: bold;
  color: var(--amber);
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(255,140,0,0.4);
}
.header-info {
  font-size: 0.8em;
  color: var(--warm-dim);
}
.header-buttons { display: flex; gap: 4px; }

/* ---- Gauges (cockpit overlay) ---- */
#gauges {
  position: relative;
  aspect-ratio: 960 / 213;
  background: url('/assets/dashboard/cockpit-bg.webp') left top / 100% 100% no-repeat,
              url('/assets/dashboard/cockpit-bg.png') left top / 100% 100% no-repeat;
  border: none !important;
  padding: 0;
  overflow: visible;
  image-rendering: pixelated;
}
.gauge {
  position: absolute;
  top: 46%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  text-align: center;
  color: #e0d8c0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-value {
  font-size: 1.8em;
  font-weight: bold;
  line-height: 1.1;
}

/* Rivet pseudo-elements disabled — cockpit image has built-in rivets */
#gauges::before, #gauges::after { display: none; }

/* Per-gauge positioning (matches cockpit instrument holes) */
.gauge-gear       { left: 4.0%;  width: 14.6%; }
.gauge-heat       { left: 23.3%; width: 32.3%; aspect-ratio: 284 / 82; padding: 6px 8px; top: 42%; }
.gauge-position   { left: calc(61.9% - 2px); width: 11.4%; top: calc(46% - 4px); }
.gauge-speed      { left: calc(79.3% - 2px); width: 10.7%; top: calc(46% - 4px); }
.gauge-adrenaline { left: calc(92.2% - 2px); width: 5.5%; top: calc(52% + 25px); }

/* Gear — tachometer dial */
.gauge-gear {
  padding: 0;
}
.tach-dial {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  border: 3px solid var(--chrome-dark);
  box-shadow:
    inset 0 0 10px rgba(0,0,0,0.6),
    inset 0 1px 1px rgba(255,255,255,0.1),
    0 0 6px rgba(0,0,0,0.4),
    0 0 12px rgba(255,140,0,0.05);
  background: #181512;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tach-dial::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #181818, #0e0e0e);
  box-shadow: inset 0 0 8px rgba(0,0,0,0.8);
}
.tach-dial .gauge-value {
  position: relative;
  z-index: 1;
  font-size: 2em;
}
.gear-1 .tach-dial .gauge-value,
.gear-2 .tach-dial .gauge-value {
  color: var(--green-bright);
  text-shadow: 0 0 10px var(--green-glow);
}
.gear-3 .tach-dial .gauge-value {
  color: #ffa000;
  text-shadow: 0 0 10px rgba(255,160,0,0.6);
}
.gear-4 .tach-dial .gauge-value {
  color: var(--red-hot);
  text-shadow: 0 0 10px var(--red-glow);
}

.tach-dial.gauge-up,
.dial-ring.gauge-up {
  animation: gauge-up-flash 0.45s ease-out;
}

.tach-dial.gauge-down,
.dial-ring.gauge-down {
  animation: gauge-down-flash 0.45s ease-out;
}

.dial-ring.gauge-pulse {
  animation: gauge-pulse 0.5s ease-out;
}

@keyframes gauge-up-flash {
  0% { transform: scale(0.92); filter: brightness(1.35); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes gauge-down-flash {
  0% { transform: scale(1.06); filter: brightness(0.7); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes gauge-pulse {
  0% { box-shadow: 0 0 0 rgba(255, 200, 0, 0.0); }
  50% { box-shadow: 0 0 14px rgba(255, 200, 0, 0.45); }
  100% { box-shadow: 0 0 0 rgba(255, 200, 0, 0.0); }
}

/* Position / Speed / Adrenaline — circular dials */
.gauge-dial {
  padding: 0;
}
.dial-ring {
  --gauge-fill: 0%;
  --gauge-fill-color: linear-gradient(180deg, #9edbff 0%, #3fa4ef 68%, #1e6fa8 100%);
  --gauge-glow-color: rgba(63, 164, 239, 0.42);
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid var(--chrome-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1a1a1a, #0e0e0e);
  box-shadow:
    inset 0 0 6px rgba(0,0,0,0.6),
    inset 0 1px 1px rgba(255,255,255,0.06),
    0 0 3px rgba(0,0,0,0.3);
}
.liquid-ring {
  background: radial-gradient(circle at 50% 20%, rgba(255,255,255,0.08), transparent 40%), radial-gradient(circle at 50% 40%, #1a1a1a, #0e0e0e);
}
.dial-liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--gauge-fill);
  background: var(--gauge-fill-color);
  box-shadow: 0 0 14px var(--gauge-glow-color);
  opacity: 0.95;
}
.dial-liquid::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 10%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  filter: blur(1px);
}
.dial-ring .gauge-value {
  font-size: 1.65em;
  text-shadow: 0 0 8px currentColor;
  position: relative;
  z-index: 2;
}
.gauge-sub {
  font-size: 0.35em;
  color: var(--chrome-dark);
}
.gauge-position .gauge-value {
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.9),
    1px 0 0 rgba(0, 0, 0, 0.85),
    -1px 0 0 rgba(0, 0, 0, 0.85),
    0 0 10px rgba(0, 0, 0, 0.65);
  -webkit-text-stroke: 0.35px rgba(0, 0, 0, 0.55);
}
.gauge-position .gauge-sub {
  color: #f7ecd4;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.85),
    0 0 6px rgba(0, 0, 0, 0.5);
}
.dial-ring.adrenaline-on {
  border-color: var(--green);
  box-shadow:
    inset 0 0 6px rgba(0,0,0,0.4),
    0 0 10px var(--green-glow),
    0 0 20px rgba(48,192,80,0.15);
}

.tach-dial {
  overflow: hidden;
}

/* Heat bar — segmented LED */
.heat-bar-outer {
  background: #0c0c0c;
  border: 2px solid var(--panel-border);
  border-radius: 3px;
  height: 100%;
  width: 100%;
  margin-top: 0;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}
.heat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f2c14a, #f08a2b);
  transition: width 0.3s;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.08) 8px, rgba(0,0,0,0.35) 8px, rgba(0,0,0,0.35) 10px);
  box-shadow: 0 0 8px rgba(240,138,43,0.35);
}
.heat-bar-fill.heat-rising {
  animation: heat-rise-pop 0.45s ease-out;
}
.heat-bar-fill.heat-dropping {
  animation: heat-drop-pop 0.45s ease-out;
}
.heat-bar-fill.low {
  background: linear-gradient(90deg, #ffd76a, #f4ad3d);
  box-shadow: 0 0 10px rgba(244,173,61,0.35);
}
.heat-bar-fill.mid {
  background: linear-gradient(90deg, #f08a2b, #df4f2b);
  box-shadow: 0 0 10px rgba(223,79,43,0.4);
}
.heat-bar-fill.critical {
  background-color: #e94560;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.08) 8px, rgba(0,0,0,0.35) 8px, rgba(0,0,0,0.35) 10px);
  box-shadow: 0 0 14px rgba(233,69,96,0.6);
  animation: pulse-heat 0.8s infinite alternate;
}
@keyframes pulse-heat {
  from { opacity: 0.6; }
  to { opacity: 1; }
}
@keyframes heat-rise-pop {
  0% { filter: saturate(1.8) brightness(1.25); }
  100% { filter: saturate(1) brightness(1); }
}
@keyframes heat-drop-pop {
  0% { filter: grayscale(0.45) brightness(0.9); }
  100% { filter: grayscale(0) brightness(1); }
}
.heat-bar-text {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.08em;
  letter-spacing: 0.6px;
  font-weight: bold;
  color: #fff5d8;
  text-shadow: 0 1px 2px #000, 0 0 8px rgba(0,0,0,0.9);
}

/* ---- 1D Track Line ---- */
#track-line {
  background: linear-gradient(180deg, #d0c8b8, #d8d0c0);
  padding: 8px 14px;
  position: relative;
}
.track-strip {
  height: 42px;
  background: #b0a890;
  border-radius: 3px;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
  overflow: visible;
}
/* Road surface markings */
.track-strip::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: repeating-linear-gradient(90deg, transparent, transparent 12px, rgba(255,255,255,0.15) 12px, rgba(255,255,255,0.15) 20px);
}
.track-sector-length {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255,255,255,0.08);
  border-left: 1px dashed rgba(255,255,255,0.25);
  border-right: 1px dashed rgba(255,255,255,0.25);
  pointer-events: none;
}
.track-sector-length::after {
  content: attr(data-length);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.65em;
  color: rgba(255,255,255,0.95);
  background: rgba(0,0,0,0.35);
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}
/* Corner markers on track */
.track-corner {
  position: absolute;
  top: 0; bottom: 0;
  width: 4px;
  background: var(--amber);
  opacity: 0.55;
}
.track-corner::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,224,100,0.95);
  box-shadow: 0 0 10px rgba(255,214,110,0.45);
}
.track-corner::after {
  content: attr(data-sl);
  position: absolute;
  top: -8px;
  left: 8px;
  font-size: 0.75em;
  color: var(--amber);
  white-space: nowrap;
  background: rgba(0,0,0,0.45);
  padding: 2px 6px;
  border-radius: 4px;
}
/* Finish line */
.track-finish {
  position: absolute;
  top: 0; bottom: 0;
  width: 4px;
  background: repeating-linear-gradient(180deg, #fff 0px, #fff 4px, #000 4px, #000 8px);
  opacity: 0.6;
}
/* Car dots */
.track-car {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,255,255,0.35);
}
.track-car.is-player {
  width: 14px;
  height: 14px;
  background: var(--amber);
  border: 2px solid #fff;
  box-shadow: 0 0 8px var(--amber-glow);
  z-index: 2;
}
.track-car.is-legend {
  width: 12px;
  height: 12px;
  background: #4090c0;
  border-color: rgba(255,255,255,0.65);
  z-index: 1;
}
.track-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.5em;
  color: var(--chrome-dark);
  margin-top: 2px;
  padding: 0 2px;
}

/* Remove extra spacing when sector label is absent */
.track-label > span:nth-child(2):empty { display: none; }
.track-weather {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.52em;
  padding: 1px 4px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.35);
  color: #1b1712;
  white-space: nowrap;
  z-index: 1;
}
.track-weather-sector {
  top: 6%;
  background: #d6edf8;
}
.track-weather-corner {
  bottom: 8%;
  background: #f7b67a;
}

/* Press Corner camera icon (centred on corner marker) */
.track-press {
  position: absolute;
  transform: translateX(-50%);
  bottom: 8%;
  font-size: 1.05em;
  z-index: 3;
}

/* When rendered inside a corner element, position relative to that corner */
.track-corner .track-press {
  left: 50%;
  transform: translateX(-50%);
  top: -14px;
  bottom: auto;
}

/* Flooded zone overlay */
.track-flooded {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(60, 140, 220, 0.22);
  border-top: 2px solid rgba(60, 140, 220, 0.45);
  border-bottom: 2px solid rgba(60, 140, 220, 0.45);
  pointer-events: none;
  z-index: 0;
}
/* Chicane bracket linking two corners */
.track-chicane {
  position: absolute;
  bottom: -6px;
  height: 5px;
  background: repeating-linear-gradient(90deg, #c83040 0px, #c83040 4px, transparent 4px, transparent 8px);
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
}
/* Chevron indicator near corner */
.track-chevron {
  position: absolute;
  bottom: -4px;
  font-size: 0.6em;
  color: #e85050;
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
}
/* Flooded badge in gear shift info */
.flooded-badge {
  display: inline-block;
  background: rgba(60, 140, 220, 0.35);
  color: #1a4f80;
  border: 1px solid rgba(60, 140, 220, 0.5);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.85em;
  margin-left: 4px;
}

/* ---- Corner Info — warning bulb ---- */
#corner-info {
  background: linear-gradient(180deg, #d0c8b8 0%, #d8d0c0 100%);
  padding: 8px 14px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.05);
}
.warning-bulb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--chrome-dark);
  flex-shrink: 0;
  background: radial-gradient(circle at 35% 35%, #605848, #3a3428);
  box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
}
.warning-bulb.caution {
  background: radial-gradient(circle at 35% 35%, var(--amber), var(--amber-dim));
  box-shadow:
    inset 0 0 3px rgba(0,0,0,0.3),
    0 0 8px var(--amber-glow),
    0 0 16px rgba(255,140,0,0.2);
}
.warning-bulb.danger {
  background: radial-gradient(circle at 35% 35%, #ff4030, #a01808);
  box-shadow:
    inset 0 0 3px rgba(0,0,0,0.3),
    0 0 10px var(--red-glow),
    0 0 20px rgba(224,64,32,0.25);
  animation: bulb-flash 0.6s infinite alternate;
}
@keyframes bulb-flash {
  from { opacity: 0.7; }
  to { opacity: 1; }
}
.corner-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88em;
  background: rgba(28, 20, 14, 0.82);
  border: 1px solid rgba(255, 214, 138, 0.28);
  border-radius: 6px;
  padding: 4px 8px;
  box-shadow: 0 0 8px rgba(0,0,0,0.35);
}
.corner-sl {
  color: #ffe08a;
  font-weight: bold;
  text-shadow: 0 0 7px rgba(255,180,30,0.45);
}
.corner-dist {
  color: #ffd2b3;
  font-weight: bold;
  margin-left: 2px;
  text-shadow: 0 0 6px rgba(255,125,60,0.35);
}
.corner-warning {
  color: var(--red-hot);
  font-weight: bold;
  text-shadow: 0 0 6px var(--red-glow);
}
.corner-weather-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: #d8c7a2;
  color: #463a2a;
  font-size: 0.8em;
}
.corner-weather-tag.sector-tag {
  background: #cde3ec;
}

/* Indicator line under the map: press badges + corner SL list + sector/markers */
.corner-line {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  width: 100%;
}
.press-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}
.press-badge {
  background: linear-gradient(180deg,#ffd89a,#ffb86b);
  color: #3a2a10;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  font-size: 0.85em;
}
.corner-list-wrap { flex: 1; display: flex; justify-content: center; }
.corner-list { justify-content: center; }


/* ---- Standings — timing board ---- */
#standings {
  background:
    repeating-linear-gradient(135deg, transparent, transparent 1px, rgba(0,0,0,0.02) 1px, rgba(0,0,0,0.02) 2px),
    linear-gradient(180deg, #d0c8b8 0%, var(--panel-deep) 100%);
  border: 2px solid var(--panel-border) !important;
  padding: 8px;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.15),
    0 2px 4px rgba(0,0,0,0.1);
}
.standings-title {
  font-size: 0.6em;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-shadow: 0 0 4px rgba(255,140,0,0.3);
  border-bottom: 1px solid rgba(255,140,0,0.15);
  padding-bottom: 4px;
}
.standing-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px;
  font-size: 0.78em;
  margin-bottom: 2px;
  border-radius: 2px;
  background: rgba(0,0,0,0.06);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
  letter-spacing: 1px;
}
.standing-row:last-child { margin-bottom: 0; }
.standing-row.is-player {
  color: var(--amber);
  font-weight: bold;
  background: rgba(224,136,0,0.12);
  border-left: 3px solid var(--amber);
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.08),
    inset 3px 0 6px rgba(224,136,0,0.08);
}
.standing-pos {
  color: var(--chrome);
  width: 24px;
  font-variant-numeric: tabular-nums;
}
.standing-name { flex: 1; margin-left: 4px; }
.standing-info { color: var(--chrome-dark); font-size: 0.85em; }
.legend-portrait {
  width: auto;
  height: 20px;
  max-width: 30px;
  object-fit: contain;
  border-radius: 2px;
  image-rendering: pixelated;
  vertical-align: middle;
  margin-right: 2px;
  transform-origin: left center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: zoom-in;
  position: relative;
  z-index: 0;
}
.legend-portrait:hover {
  transform: scale(4);
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  z-index: 15;
}
.legend-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 0 5px currentColor;
  flex-shrink: 0;
}

/* ---- Cards — instrument panel with image support ---- */
#hand {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: start;
  justify-content: center;
  padding: 12px 14px;
  min-height: 220px;
  background: linear-gradient(180deg, #d0c8b8, #d8d0c0);
}
.card {
  width: 140px;
  height: 190px;
  border: 2px solid var(--panel-border);
  border-radius: 5px;
  background:
    linear-gradient(180deg, #f0e8d8 0%, #e8e0d0 40%, #e0d8c8 100%);
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding-bottom: 0;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    inset 0 -1px 2px rgba(0,0,0,0.1),
    0 2px 4px rgba(0,0,0,0.15);
  overflow: hidden;
}
/* Type strip at top (warning light band) */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 3px 3px 0 0;
}
.card.speed::before {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}
.card.heat::before {
  background: var(--red-hot);
  box-shadow: 0 0 8px var(--red-glow);
}
.card.stress::before {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber-glow);
}
/* Card image area */
.card-img {
  width: 100%;
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2em;
  overflow: hidden;
}
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.card-header {
  height: 22px;
  padding: 2px 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.04);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.card-name {
  display: inline-block;
  width: 100%;
  font-size: 0.6em;
  font-weight: bold;
  letter-spacing: 0.4px;
  color: #4a4032;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 16px;
  padding: 3px 6px;
  border-top: 1px solid rgba(0,0,0,0.08);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.06);
  flex-shrink: 0;
  align-content: flex-start;
}
.card-badge {
  display: inline-block;
  font-size: 0.5em;
  line-height: 1.35;
  padding: 0 4px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.2);
  letter-spacing: 0.3px;
  font-weight: bold;
  white-space: nowrap;
}
.card-badge.optional {
  background: #cde3ec;
  color: #20495d;
}
.card-badge.mandatory {
  background: #f3d0c8;
  color: #6a2217;
}
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 10px;
  background: rgba(0,0,0,0.08);
  border-top: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.card-value {
  font-size: 1.8em;
  font-weight: bold;
  line-height: 1;
}
.card.speed .card-value {
  color: var(--green-bright);
  text-shadow: 0 0 8px var(--green-glow), 0 0 20px rgba(48,192,80,0.15);
}
.card.heat .card-value {
  color: var(--red-hot);
  text-shadow: 0 0 8px var(--red-glow), 0 0 20px rgba(224,64,32,0.15);
}
.card.stress .card-value {
  color: var(--amber);
  text-shadow: 0 0 8px var(--amber-glow), 0 0 20px rgba(255,140,0,0.15);
}
.card-type {
  font-size: 0.65em;
  color: var(--warm-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.card:hover:not(.disabled) {
  transform: translateY(-6px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 6px 12px rgba(0,0,0,0.2),
    0 0 10px rgba(224,136,0,0.12);
}
.card.selected {
  border-color: var(--amber);
  transform: translateY(-10px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 0 14px rgba(224,136,0,0.4),
    0 0 28px rgba(224,136,0,0.12);
  background:
    radial-gradient(ellipse at center 70%, rgba(224,136,0,0.10) 0%, transparent 60%),
    linear-gradient(180deg, #fff8e8 0%, #f8f0e0 40%, #f0e8d8 100%);
}
.card.disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
.hand-hint {
  width: 100%;
  text-align: center;
  font-size: 0.75em;
  color: var(--warm-muted);
  padding: 4px 0;
}
.hand-hint-value {
  color: #6f2b1a;
  font-weight: bold;
  letter-spacing: 0.4px;
}

/* ---- Buttons — dashboard switches ---- */
button {
  background: linear-gradient(180deg, #d04040 0%, #b83030 50%, #a02828 100%);
  color: #fff;
  border: 2px solid var(--chrome-dark);
  border-radius: 4px;
  padding: 8px 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85em;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.15),
    inset 0 -2px 0 rgba(0,0,0,0.3),
    0 2px 4px rgba(0,0,0,0.5);
  transition: all 0.1s;
}
button:hover {
  background: linear-gradient(180deg, #e04848 0%, #c83838 50%, #b03030 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    inset 0 -2px 0 rgba(0,0,0,0.3),
    0 3px 6px rgba(0,0,0,0.6);
}
button:active {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  transform: translateY(1px);
}
button:disabled {
  background: linear-gradient(180deg, #c8c0b0 0%, #b8b0a0 100%);
  border-color: #a09888;
  color: var(--chrome-dark);
  cursor: not-allowed;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}
button.secondary {
  background: linear-gradient(180deg, #d8d0c0 0%, #cfc7b5 50%, #c8c0b0 100%);
  border-color: #a09078;
  color: var(--warm-dim);
}
button.secondary:hover {
  background: linear-gradient(180deg, #e0d8c8 0%, #d8d0c0 50%, #d0c8b8 100%);
  border-color: var(--chrome-dark);
  color: var(--warm-white);
}

/* ---- Actions ---- */
#actions {
  background: linear-gradient(180deg, #d0c8b8 0%, var(--panel-bg) 100%);
  border: 2px solid var(--panel-border) !important;
  border-radius: 0 0 6px 6px !important;
  padding: 10px 14px;
  min-height: 48px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 2px 4px rgba(0,0,0,0.1);
  margin-top: 4px;
}
.phase-label {
  font-size: 0.6em;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-shadow: 0 0 4px rgba(255,140,0,0.3);
}
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.action-info {
  font-size: 0.85em;
  color: var(--warm-dim);
  margin-bottom: 6px;
}
/* Gear shifter strip */
.gear-shifter {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #1a1a20;
  border-radius: 6px;
  border: 2px solid var(--chrome-dark);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  max-width: 360px;
}
.gear-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #505050;
  font-family: 'Courier New', monospace;
  font-size: 1.4em;
  font-weight: bold;
  transition: background 0.15s, color 0.15s;
  position: relative;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.gear-slot:last-child { border-right: none; }
.gear-slot:hover:not(.gear-locked) {
  background: rgba(255,255,255,0.06);
}
.gear-slot.gear-current {
  color: var(--amber);
  background: rgba(224,136,0,0.15);
  text-shadow: 0 0 10px rgba(224,136,0,0.6);
}
.gear-slot.gear-current::after {
  content: '';
  position: absolute;
  bottom: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--amber);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 6px rgba(224,136,0,0.5);
}
.gear-slot.gear-available {
  color: #e0d8c0;
}
.gear-slot.gear-locked {
  color: #333;
  cursor: not-allowed;
}
.gear-slot-label {
  font-size: 0.45em;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
  color: inherit;
  opacity: 0.7;
}
.gear-slot .gear-heat-cost {
  font-size: 0.45em;
  color: var(--red-hot);
  margin-top: 2px;
}

/* ---- Log ---- */
#log {
  background: #2a2820;
  border: 2px solid #48443c !important;
  border-radius: 4px !important;
  padding: 8px;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.7em;
  line-height: 1.5;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  color: #b0a890;
  margin-top: 6px;
}
.log-turn { color: #ffaa20; font-weight: bold; }
.log-action { color: #50b868; }
.log-penalty { color: #e84838; }
.log-info { color: #908878; }
.log-legend { color: #4090c0; }
.log-auto { color: #908878; font-style: italic; }

/* ---- Screens / Modals ---- */
.screen {
  background:
    repeating-linear-gradient(135deg, transparent, transparent 1px, rgba(0,0,0,0.02) 1px, rgba(0,0,0,0.02) 2px),
    linear-gradient(180deg, #e0d8c8 0%, var(--panel-bg) 100%);
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 3px 8px rgba(0,0,0,0.15);
}
.screen label {
  display: block;
  margin: 8px 0 4px;
  color: var(--warm-dim);
  font-size: 0.85em;
}
.screen select {
  background: #f0e8d8;
  color: var(--warm-white);
  border: 2px solid var(--panel-border);
  border-radius: 4px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.9em;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

/* Save entries */
.save-entry {
  background: var(--panel-deep);
  border: 2px solid #b0a890;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

/* Race summary */
.finished-banner {
  background: linear-gradient(90deg, var(--red-hot), var(--amber), var(--red-hot));
  color: #fff;
  padding: 20px;
  border: 2px solid var(--amber);
  border-radius: 4px;
  text-align: center;
  font-size: 1.2em;
  font-weight: bold;
  margin: 16px 0;
  letter-spacing: 3px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow: 0 0 20px rgba(255,140,0,0.25);
}
.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.stat {
  background: var(--panel-deep);
  border: 2px solid #b0a890;
  border-radius: 4px;
  padding: 8px 12px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.stat .label {
  color: var(--warm-dim);
  font-size: 0.65em;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.stat .value {
  color: var(--amber);
  font-size: 1.2em;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(255,140,0,0.3);
}
.position-first .value { color: #c89800 !important; }

/* Auto-resolve spinner */
.auto-resolve {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--warm-muted);
  font-size: 0.85em;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #b0a890;
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Help modal */
.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.72);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.help-panel {
  width: min(760px, 100%);
  max-height: min(84vh, 860px);
  overflow-y: auto;
  background: linear-gradient(180deg, #ece4d4 0%, #ddd4c3 100%);
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.35);
}
.help-panel h2 {
  margin-bottom: 6px;
}
.help-panel h3 {
  margin: 10px 0 6px;
  color: var(--amber-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.78em;
}
.help-panel ul {
  margin: 0 0 8px 20px;
  line-height: 1.35;
  color: #443d32;
  font-size: 0.87em;
}
.help-panel p {
  margin: 0 0 8px;
  color: #443d32;
  font-size: 0.87em;
}
.help-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Deck viewer modal */
.deck-viewer-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.72);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.deck-viewer-panel {
  width: min(760px, 100%);
  max-height: min(84vh, 860px);
  overflow-y: auto;
  background: linear-gradient(180deg, #ece4d4 0%, #ddd4c3 100%);
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.35);
}
.deck-viewer-panel h2 {
  margin-bottom: 6px;
}
.deck-viewer-panel h3 {
  margin: 10px 0 6px;
  color: var(--amber-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.78em;
}
.deck-viewer-panel ul {
  margin: 0 0 8px 20px;
  line-height: 1.35;
  color: #443d32;
  font-size: 0.87em;
}
.deck-viewer-panel p {
  margin: 0 0 8px;
  color: #443d32;
  font-size: 0.87em;
}

/* ==========================================================================
   Media Queries — Responsive
   ========================================================================== */

/* ---- Mobile (<640px) ---- */
@media (max-width: 640px) {
  body { padding: 8px; }
  #game-area {
    grid-template-areas:
      "header"
      "track"
      "gauges"
      "corner"
      "cards"
      "actions"
      "standings"
      "log";
    grid-template-columns: 1fr;
    grid-template-rows: repeat(8, auto);
  }
  #standings { max-height: 160px; overflow-y: auto; margin-left: 0; }
  #gauges, #track-line, #corner-info, #hand, #standings {
    border-radius: 0;
    border: 1px solid rgba(0,0,0,0.08);
  }
  /* Revert cockpit overlay to simple flex on mobile */
  #gauges {
    position: static;
    aspect-ratio: unset;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background-image: none;
    background: linear-gradient(180deg, #c8c0b0 0%, #d0c8b8 50%, #c8c0b0 100%);
    overflow: visible;
    image-rendering: auto;
  }
  .gauge {
    position: static;
    transform: none;
    flex: 1 1 60px;
    min-width: 60px;
    background: rgba(0,0,0,0.08);
    border-radius: 4px;
    padding: 6px;
    left: auto; width: auto;
  }
  .gauge-heat { flex: 2 1 120px; }
  .gauge-gear, .gauge-position, .gauge-speed, .gauge-adrenaline {
    left: auto; width: auto;
  }
  .tach-dial { width: 56px; height: 56px; aspect-ratio: unset; }
  .dial-ring { width: 46px; height: 46px; aspect-ratio: unset; }
  body::before, body::after { height: 3px; }

  .card { width: 100px; height: 136px; }
  .card-value { font-size: 1.4em; }
  .card-name { font-size: 0.5em; }
  .card-badges { padding: 2px 4px; min-height: 12px; }
  .card-badge { font-size: 0.42em; }
  .card-bottom { height: 30px; padding: 0 6px; }
  .card-header { height: 18px; padding: 1px 4px 0; }
}

/* ---- Tablet (641px–1024px) ---- */
@media (min-width: 641px) and (max-width: 1024px) {
  #game-area {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
  #standings {
    max-width: 260px;
    min-width: 220px;
  }
  .card { width: 120px; height: 163px; }
  .card-value { font-size: 1.5em; }
  .card-name { font-size: 0.55em; }
  .card-bottom { height: 34px; }
  .standing-row { font-size: 0.72em; }
  .legend-portrait { height: 16px; max-width: 24px; }
}

/* ---- Large screen (>1400px) ---- */
@media (min-width: 1401px) {
  body {
    max-width: 1440px;
  }
  #game-area {
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 16px;
  }
  #standings {
    max-width: 400px;
  }
  #hand {
    gap: 14px;
  }
  .card { width: 155px; height: 210px; }
  .card-value { font-size: 2em; }
}
