/* Cab look: the driving HUD dressed as a locomotive's control desk.
   Outside the size block at the end this file changes only surfaces (colour, light, depth), never sizes or
   positions, so the compact phone HUD in style.css keeps its layout. Remove its <link> to go back. */
#hud { --mono: 'SF Mono', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace; --desk: linear-gradient(180deg, rgba(46, 52, 59, .95), rgba(15, 18, 22, .95)); --edge: #050608; --hi: inset 0 1px 0 rgba(255, 255, 255, .1); --lift: 0 8px 22px rgba(0, 0, 0, .45); --lcd: #6dffa3; --amber: #ffc531; }

/* a low console shadow so the instruments sit on something */
#hud::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30vh; background: linear-gradient(to top, rgba(4, 6, 8, .6), rgba(4, 6, 8, 0)); pointer-events: none; }

/* ---------- signal: a hooded head with lenses that glow ---------- */
#hud .h-sig { background: var(--desk); border: 1px solid var(--edge); box-shadow: var(--hi), var(--lift); }
#hud .h-sig small { color: #9aa4ac; font-weight: 800; letter-spacing: 1.4px; opacity: 1; }
#hud .h-sig b { font-family: var(--mono); letter-spacing: -.5px; color: #f2f4f5; }
#hud .sighead { background: linear-gradient(90deg, #040506, #1e2226 50%, #040506); border: 1.5px solid #2e3338; box-shadow: inset 0 0 0 1px #000, 0 3px 8px rgba(0, 0, 0, .6); }
#hud .sighead i { position: relative; background: radial-gradient(circle at 38% 32%, #3c4247 0, #121416 55%, #040405 100%); box-shadow: inset 0 0 0 1px #000; transition: background .15s, box-shadow .15s; }
#hud .sighead i::before { content: ''; position: absolute; inset: -2.5px; border-radius: 50%; border: 2px solid #000; border-bottom-color: transparent; border-left-color: transparent; transform: rotate(-45deg); }
#hud .sighead i.y { background: radial-gradient(circle at 40% 35%, #fff8d2 0, #ffd23a 30%, #f0a400 70%, #8a5a00 100%); box-shadow: 0 0 6px 1px rgba(255, 196, 30, .9), 0 0 18px 4px rgba(255, 180, 0, .4); }
#hud .sighead i.g { background: radial-gradient(circle at 40% 35%, #eafff2 0, #5dff9a 30%, #00c86a 70%, #005f33 100%); box-shadow: 0 0 6px 1px rgba(60, 255, 140, .9), 0 0 18px 4px rgba(0, 230, 120, .4); }
#hud .sighead i.r { background: radial-gradient(circle at 40% 35%, #ffe3dc 0, #ff5a44 30%, #e01b0a 70%, #6e0800 100%); box-shadow: 0 0 6px 1px rgba(255, 60, 40, .9), 0 0 18px 4px rgba(255, 30, 10, .45); }

/* ---------- top strip: clock as a backlit display ---------- */
#hud .h-top span, #hud .h-top button { background: var(--desk); border: 1px solid var(--edge); box-shadow: var(--hi), 0 4px 12px rgba(0, 0, 0, .4); }
#hud #h-clock { font-family: var(--mono); color: var(--lcd); background: linear-gradient(180deg, #07140d, #020704); border-color: rgba(109, 255, 163, .2); text-shadow: 0 0 6px rgba(109, 255, 163, .55); }
#hud #h-score { font-family: var(--mono); color: var(--amber); text-shadow: 0 0 6px rgba(255, 190, 40, .45); }

/* ---------- speedometer surround ---------- */
#hud .h-speed canvas { filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .55)); }
#hud .lim { box-shadow: 0 3px 8px rgba(0, 0, 0, .5), inset 0 0 0 1.5px rgba(0, 0, 0, .15); }
#hud .kav { border: 1px solid #000; box-shadow: 0 0 12px rgba(255, 40, 20, .75); }
.h-air { display: none; }
.h-air canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .55)); }

/* ---------- master controller: a notched slot and a steel T-handle ---------- */
#hud .lv-track { background: linear-gradient(90deg, #020303 0%, #1b1f23 30%, #2b3035 50%, #1b1f23 70%, #020303 100%); border: 1px solid #000; border-radius: 8px; box-shadow: inset 0 0 8px rgba(0, 0, 0, .9), 0 0 0 3px #2a2f35, 0 0 0 4px #000, 0 10px 20px rgba(0, 0, 0, .5); }
#hud .lv-p, #hud .lv-b { left: auto; right: -9px; width: 3px; opacity: .85; border-radius: 2px; }
.lv-ticks { position: absolute; inset: 0; pointer-events: none; }
.lv-ticks b { position: absolute; left: -6px; right: -6px; height: 1px; background: rgba(255, 255, 255, .3); }
.lv-ticks b[data-n="N"] { background: rgba(255, 255, 255, .7); height: 2px; margin-top: -.5px; }
.lv-ticks b::after { content: attr(data-n); display: none; position: absolute; right: calc(100% + 3px); top: -5px; font: 700 8px/1 var(--mono, monospace); color: rgba(255, 255, 255, .5); }
#hud .lv-knob { background: linear-gradient(180deg, #fbfaf6 0%, #dcd8cd 38%, #a6a194 58%, #e6e2d8 100%); border: 1px solid #161616; border-radius: 7px; box-shadow: 0 6px 12px rgba(0, 0, 0, .65), inset 0 1px 0 #fff, inset 0 -1px 0 rgba(0, 0, 0, .25); transition: top .08s; }
#hud .lv-knob::after { content: ''; position: absolute; left: 24%; right: 24%; top: 50%; height: 6px; margin-top: -3px; border-radius: 2px; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .3) 0 1px, transparent 1px 4px); }
#hud .lv-lab { font-family: var(--mono); background: linear-gradient(180deg, #07140d, #020704); border: 1px solid rgba(255, 255, 255, .1); color: #c9d2d8; box-shadow: inset 0 1px 4px rgba(0, 0, 0, .8), 0 4px 10px rgba(0, 0, 0, .4); }
#hud .lv-lab.p { color: var(--lcd); text-shadow: 0 0 6px rgba(109, 255, 163, .6); }
#hud .lv-lab.b { color: #ff6a4a; text-shadow: 0 0 6px rgba(255, 90, 60, .6); }

/* ---------- desk keys: raised caps that press in, with an indicator lamp ---------- */
#hud .h-btns button { position: relative; color: #e9edf0; background: linear-gradient(180deg, #454d55 0%, #2b3137 46%, #1b1f24 100%); border: 1px solid var(--edge); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -2px 0 rgba(0, 0, 0, .4), 0 3px 0 var(--edge), 0 8px 14px rgba(0, 0, 0, .45); transition: transform .06s, box-shadow .06s; }
#hud .h-btns button .ico { filter: grayscale(1) brightness(1.4) contrast(1.05); }
#hud .h-btns button small { color: #c3cad0; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; text-shadow: 0 -1px 0 rgba(0, 0, 0, .7); opacity: 1; }
#hud .h-btns button:active, #hud .h-btns button.down { transform: translateY(2px); color: var(--amber); background: linear-gradient(180deg, #2b3137, #1d2227); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .65), 0 1px 0 var(--edge); }
#hud .h-btns button:active .ico, #hud .h-btns button.down .ico { filter: none; }
#hud .h-btns button::before { content: ''; position: absolute; top: 5px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #2b2215; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6); }
#hud .h-btns button.on::before { background: var(--amber); box-shadow: 0 0 6px 1px rgba(255, 190, 30, .9); }
#hud .h-btns button.on { color: var(--amber); border-color: var(--edge); }
#hud .h-aux button.alert { background: #c41a0e; color: #fff; }
#hud .h-aux button.alert::before { background: #ff3b2b; box-shadow: 0 0 8px 2px rgba(255, 50, 30, .9); }
/* emergency: a red mushroom in a yellow collar */
#hud #b-emg { border-radius: 50%; color: #fff; border: 2px solid #111; background: radial-gradient(circle at 38% 30%, #ff8a7c 0, #e3271a 38%, #9b0e05 75%, #5c0602 100%); box-shadow: 0 0 0 4px #f2c200, 0 0 0 5.5px #111, inset 0 -3px 6px rgba(0, 0, 0, .45), 0 8px 16px rgba(0, 0, 0, .5); }
#hud #b-emg::before { display: none; }
#hud #b-emg .ico { filter: grayscale(1) brightness(3); }
#hud #b-emg small { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
#hud #b-emg:active, #hud #b-emg.down { transform: translateY(2px) scale(.97); background: radial-gradient(circle at 50% 45%, #c41a0e, #6e0702); }

/* ---------- mission gauges: backlit values and segmented bars ---------- */
#hud .gauge, #hud .linebox { background: var(--desk); border: 1px solid var(--edge); box-shadow: var(--hi), 0 6px 14px rgba(0, 0, 0, .4); }
#hud .gauge small { color: #a3acb3; font-weight: 800; opacity: 1; }
#hud .gauge b { font-family: var(--mono); color: var(--lcd); text-shadow: 0 0 6px rgba(109, 255, 163, .45); }
#hud .gauge.warn b { color: var(--amber); text-shadow: 0 0 6px rgba(255, 190, 40, .45); } #hud .gauge.bad b { color: #ff5a44; text-shadow: 0 0 6px rgba(255, 70, 50, .5); }
#hud .gauge i { background: #040607; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .9); }
#hud .gauge i u { background: repeating-linear-gradient(90deg, var(--lcd) 0 4px, transparent 4px 6px); }
#hud .gauge.warn i u { background: repeating-linear-gradient(90deg, var(--amber) 0 4px, transparent 4px 6px); }
#hud .gauge.bad i u { background: repeating-linear-gradient(90deg, #ff4a3a 0 4px, transparent 4px 6px); }

/* ---------- full-size screens only: sizes, the station board's keyline and bolts, the brake gauges ---------- */
@media (min-height: 601px) {
  #hud .h-next { background: radial-gradient(circle at 7px 50%, #5b4b00 0 1.6px, transparent 2.3px), radial-gradient(circle at calc(100% - 7px) 50%, #5b4b00 0 1.6px, transparent 2.3px), linear-gradient(180deg, #ffd523, #efb800); box-shadow: inset 0 0 0 2px #f6c400, inset 0 0 0 3.5px #14181d, 0 8px 20px rgba(0, 0, 0, .45); padding: 6px 16px 7px; }
  #hud .sighead { padding: 5px; gap: 6px; border-radius: 10px; }
  #hud .sighead i { width: 14px; height: 14px; }
  #hud .h-btns button .ico { font-size: 19px; }
  #hud #b-emg { margin: 0 5px; }
  .lv-ticks b::after { display: block; }
}
@media (min-height: 601px) and (min-width: 900px) {
  .h-air { display: block; left: calc(186px + var(--sl)); bottom: calc(34px + var(--sb)); width: 92px; height: 172px; }
  .h-extra { left: calc(288px + var(--sl)); }
}

/* ---------- PANTO / ENGINE key: red lamp until raised, amber blinking while it comes up, green when live ---------- */
.x-ready { display: none !important; } body.ready-key .x-ready { display: flex !important; }
#hud #b-panto.need::before { background: #ff3b2b; box-shadow: 0 0 8px 2px rgba(255, 50, 30, .9); animation: lampblink .9s steps(2, start) infinite; }
#hud #b-panto.busy::before { background: var(--amber); box-shadow: 0 0 6px 1px rgba(255, 190, 30, .9); animation: lampblink .4s steps(2, start) infinite; }
#hud #b-panto.on::before { background: #4dff8e; box-shadow: 0 0 6px 1px rgba(60, 255, 140, .9); }
#hud #b-panto.on { color: #c9ffd9; }
@keyframes lampblink { to { visibility: hidden; } }
#hud #b-night.on { color: var(--amber); }
/* credit line on the title screen */
.t-credit { position: absolute; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); margin: 0; text-align: center; font-size: 12px; color: rgba(255, 255, 255, .7); text-shadow: 0 1px 2px rgba(0, 0, 0, .7); pointer-events: auto; }
.t-credit a { color: #ffd23a; font-weight: 700; text-decoration: none; }

/* the AI driver badge (main.js aiDriver) */
#h-auto { display: none; color: #7dffa8; font-weight: 700; letter-spacing: .02em; }
body.ai-drive #h-auto { display: inline-block; animation: lampblink 1.6s infinite; }
