:root { --y: #f5c518; --ink: #14181d; --panel: rgba(16, 22, 28, .86); --line: rgba(255, 255, 255, .14); --red: #d8342a; --grn: #2bd66a; --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1318; color: #f3f1ea; font-family: 'Inter', 'Noto Sans', system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
#loading { position: fixed; inset: 0; background: #0d1318; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 50; }
#loading b { font-size: 44px; color: var(--y); letter-spacing: 1px; } #loading span { opacity: .7; }
#rotate { position: fixed; inset: 0; z-index: 60; background: #0d1318; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.rotate-icon { font-size: 64px; color: var(--y); }
.r-pause { margin-top: 18px; min-height: 44px; padding: 8px 22px; border-radius: 12px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line); font-weight: 700; }
@media (orientation: portrait) and (pointer: coarse) { body.playing #rotate { display: flex; } }

/* ---------- menus: every screen fits the viewport, no page scroll ---------- */
#ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.screen { position: absolute; inset: 0; height: 100dvh; display: flex; align-items: center; justify-content: center; pointer-events: auto; padding: calc(10px + var(--st)) calc(12px + var(--sr)) calc(10px + var(--sb)) calc(12px + var(--sl)); overflow: hidden; background: rgba(6, 10, 14, .45); }
button { touch-action: manipulation; }
.menu button, .sh-f button, .pick button, .tabs button { min-height: 44px; }
.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu button, .sh-f button { background: rgba(255, 255, 255, .08); border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; text-align: left; font-weight: 700; font-size: 15px; }
.menu button small { display: block; font-weight: 400; opacity: .72; font-size: 12px; margin-top: 2px; }
.menu .wide { grid-column: 1 / -1; }
.menu button:hover, .sh-f button:hover { background: rgba(255, 255, 255, .16); }
button.primary { background: var(--y) !important; color: #14181d; border-color: var(--y) !important; }
.disclaimer { font-size: 11px; opacity: .55; margin: 0; } .disclaimer a { color: inherit; }
.challenge:empty { display: none; }

/* title */
#title { justify-content: space-between; align-items: center; background: linear-gradient(90deg, rgba(8, 12, 16, .9) 0, rgba(8, 12, 16, .6) 48%, rgba(8, 12, 16, 0) 74%); gap: 20px; }
.t-top { position: absolute; top: calc(10px + var(--st)); right: calc(12px + var(--sr)); left: calc(12px + var(--sl)); display: flex; justify-content: space-between; align-items: center; gap: 10px; pointer-events: none; z-index: 2; }
.t-top > * { pointer-events: auto; } .t-top .acct { margin-left: auto; }
.t-main { width: min(470px, 100%); display: flex; flex-direction: column; justify-content: center; gap: 12px; padding-left: 2vw; max-height: 100%; }
.t-side { width: 320px; max-height: calc(100% - 50px); margin-top: 44px; display: flex; flex-direction: column; gap: 10px; justify-content: center; min-height: 0; }
.t-side > div:empty { display: none; }
#t-board { overflow: auto; min-height: 0; border-radius: 14px; }
.logo small { color: var(--y); letter-spacing: .5px; font-weight: 600; font-size: 13px; }
.logo h1 { margin: 4px 0 0; font-size: clamp(38px, 6.4vw, 78px); line-height: .9; font-weight: 900; letter-spacing: -1px; }
.logo h1 span { color: var(--y); display: block; }
.story { margin: 0; opacity: .86; line-height: 1.45; font-size: 14.5px; }

/* sheet: header, body that fits, footer with the main action always visible */
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: min(520px, 100%); max-height: 100%; display: flex; flex-direction: column; backdrop-filter: blur(8px); overflow: hidden; }
.sheet.wide { width: min(980px, 100%); height: min(640px, 100%); }
.sheet.narrow { width: min(420px, 100%); }
.sh-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex: none; }
.sh-h h2 { margin: 0; font-size: 21px; white-space: nowrap; }
.sh-h small { color: var(--y); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; font-size: 11.5px; }
.sh-sub { opacity: .62; font-size: 13px; margin-left: auto; text-align: right; }
.back { width: 40px; height: 40px; flex: none; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); font-size: 26px; line-height: 1; padding: 0 0 3px; }
.sh-b { flex: 1 1 auto; min-height: 0; padding: 12px 14px; overflow: auto; overscroll-behavior: contain; }
.sh-f { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px calc(10px); border-top: 1px solid var(--line); flex-wrap: wrap; }
.sh-f > button { flex: 1; text-align: center; }
.sh-f .go { flex: 0 1 220px; margin-left: auto; font-size: 16px; }
.sh-f label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
label.sel { min-width: 0; } .sel select { min-width: 0; max-width: 220px; }
.sheet select, .sheet input[type=range] { padding: 7px; border-radius: 8px; background: #1c242c; color: inherit; border: 1px solid var(--line); font: inherit; font-size: 14px; min-height: 38px; }
.chk input { width: 20px; height: 20px; accent-color: var(--y); }
.best { font-size: 13px; opacity: .8; }

/* pickers */
.pick { display: grid; gap: 6px; }
.pick button { background: rgba(255, 255, 255, .06); border: 2px solid transparent; border-radius: 10px; padding: 6px 10px; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; }
.pick button b { font-size: 13.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pick button small { opacity: .7; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick button em { font-style: normal; color: var(--y); font-size: 11.5px; font-weight: 700; }
.pick button.sel { border-color: var(--y); background: rgba(245, 197, 24, .14); }
.pick button.lock { opacity: .42; }
.pick button.mem { opacity: 1; box-shadow: inset 0 0 0 2px #ffcf4a; } .pick button.mem em { color: #ffcf4a; }
.j-body { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; }
.j-col { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.j-col h3, .m-brief small { margin: 0; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.lines8 { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(48px, 1fr); flex: 1; }
.trains7 { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(44px, 1fr); }
.trains7 button { flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; }
.trains7 .sw { width: 8px; align-self: stretch; border-radius: 4px; flex: none; }
.trains7 span { display: flex; flex-direction: column; min-width: 0; }
.info { margin: 0; font-size: 12.5px; line-height: 1.4; opacity: .8; }
#j-info { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; flex: none; }
.trains7 { flex: 1 1 0; min-height: 0; }
.trains7 b { -webkit-line-clamp: 1 !important; }
.lines8 { min-height: 0; }
.m-body { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; }
.mis16 { grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(52px, 1fr); }
.mis16 button { padding: 5px 8px; }
.mis16 button b { font-size: 12.5px; }
.mis16 .md { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 4px; vertical-align: 1px; background: rgba(255, 255, 255, .2); }
.md.gold { background: #f5c518; } .md.silver { background: #cfd4d9; } .md.bronze { background: #cd8a4a; }
.m-brief { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: auto; }
.m-brief small { opacity: 1; color: var(--y); font-weight: 700; }
.m-brief h3 { margin: 0; font-size: 20px; } .m-brief i { opacity: .7; font-size: 13px; }
.m-brief p { margin: 0; font-size: 13px; line-height: 1.45; }
.medal { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 800; color: #14181d; }
.medal.gold { background: #f5c518; } .medal.silver { background: #cfd4d9; } .medal.bronze { background: #cd8a4a; } .medal.none { background: rgba(255, 255, 255, .15); color: #fff; }
.rule { border-left: 3px solid var(--red); padding-left: 10px; font-weight: 600; }
.medals { display: flex; gap: 6px; flex-wrap: wrap; }

/* help: three columns on a big screen, tabs on a small one */
.help { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 18px; align-content: start; }
.help h3 { margin: 4px 0 2px; color: var(--y); font-size: 15px; } .help p { margin: 0; font-size: 13.5px; line-height: 1.45; opacity: .9; }
.tabs { display: none; gap: 4px; padding: 8px 14px 0; flex: none; overflow-x: auto; }
.tabs button { flex: 1; min-height: 36px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 9px; font-size: 12.5px; font-weight: 700; padding: 4px 8px; white-space: nowrap; }
.tabs button.on { background: var(--y); color: #14181d; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 2px; } .dot.g { background: var(--grn); } .dot.y { background: #ffc81f; } .dot.r { background: #ff2418; }
.set { display: flex; flex-direction: column; gap: 12px; } .set label { display: flex; align-items: center; gap: 10px; } .set select, .set input[type=range] { flex: 1; }
.p-menu { overflow: visible; }

/* leaderboards */
.b-pick { margin-left: auto; } .b-pick select { max-width: 230px; }
.b-body { display: flex; flex-direction: column; gap: 10px; }

/* end */
.e-body { display: grid; grid-template-columns: 1fr 1.1fr; gap: 16px; }
.e-left { display: flex; flex-direction: column; gap: 8px; }
.e-score { display: flex; align-items: baseline; gap: 12px; } .e-score b { font-size: 56px; line-height: 1; color: var(--y); }
.lines { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; font-size: 13.5px; } .lines span:nth-child(even) { text-align: right; font-weight: 700; }
#e-reason { margin: 0; opacity: .85; font-size: 14px; }
.e-board { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.e-board:empty { display: none; }

/* journey picker: lines are a card grid, trains a plain list, each in its own panel. Names wrap, never "..." */
.j-col { background: rgba(255, 255, 255, .025); border: 1px solid var(--line); border-radius: 12px; padding: 8px; overflow: auto; overscroll-behavior: contain; }
.j-col h3 { display: flex; align-items: center; gap: 6px; opacity: .85 !important; }
.j-col h3 i { font-style: normal; width: 16px; height: 16px; border-radius: 50%; background: var(--y); color: #111; display: grid; place-items: center; font-size: 10px; letter-spacing: 0; }
.pick button b { display: block; -webkit-line-clamp: unset; overflow: visible; white-space: normal; }
.lines8 { flex: none; grid-auto-rows: auto; }
.lines8 button { min-height: 46px; }
.trains7 { grid-template-columns: 1fr; grid-auto-rows: auto; flex: none; gap: 3px; }
.trains7 button { min-height: 36px; padding: 4px 10px 4px 6px; border-radius: 8px; background: transparent; gap: 9px; }
.trains7 button:not(.sel) { border-color: transparent; }
.trains7 button + button:not(.sel) { box-shadow: 0 -1px 0 var(--line); }
.trains7 .sw { width: 10px; height: 18px; align-self: center; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.trains7 b { flex: 1; white-space: nowrap; }
.trains7 em { margin-left: auto; white-space: nowrap; }
.j-trn #j-info { margin-top: 4px; }

/* phones in landscape and short windows */
@media (max-height: 520px) {
  .screen { padding: calc(6px + var(--st)) calc(10px + var(--sr)) calc(6px + var(--sb)) calc(10px + var(--sl)); }
  .sheet.wide { height: 100%; }
  .sh-h { padding: 5px 10px; } .sh-h h2 { font-size: 17px; } .back { width: 36px; height: 36px; }
  .sh-b { padding: 8px 10px; } .sh-f { padding: 5px 10px; gap: 8px; } .sh-f button { min-height: 40px; padding: 6px 12px; }
  .lines8 { grid-auto-rows: minmax(40px, 1fr); } .trains7 { grid-auto-rows: minmax(34px, 1fr); }
  .pick button { padding: 4px 8px; } .pick button b { font-size: 12.5px; } .pick button small, .pick button em { font-size: 10.5px; }
  .mis16 { grid-auto-rows: minmax(40px, 1fr); gap: 5px; } .mis16 button b { font-size: 11.5px; -webkit-line-clamp: 2; }
  .m-brief h3 { font-size: 16px; } .m-brief p { font-size: 12px; line-height: 1.35; }
  .info { font-size: 11.5px; }
  .logo h1 { font-size: 36px; } .logo small { font-size: 11.5px; } .story { display: none; } .t-main { gap: 8px; }
  .menu { gap: 6px; } .menu button { padding: 6px 11px; font-size: 14px; min-height: 42px; } .menu button small { font-size: 11px; }
  .t-side { display: none; } .disclaimer { display: none; }
  #j-info { -webkit-line-clamp: 2; }
  .e-score b { font-size: 40px; } .lines { font-size: 12px; } #e-reason { font-size: 12.5px; }
  .help { grid-template-columns: 1fr; } .help > div { display: none; } .help > div.on { display: block; } .tabs { display: flex; padding: 6px 10px 0; }
  .help p { font-size: 14px; }
}
@media (max-height: 520px) {
  .j-body { gap: 8px; } .j-col { padding: 6px; gap: 4px; }
  .lines8 { gap: 4px; } .lines8 button { min-height: 38px; padding: 3px 8px; } .lines8 b { font-size: 11.5px; line-height: 1.15; }
  .trains7 button { min-height: 28px; padding: 2px 8px 2px 4px; } .trains7 b { font-size: 11.5px; } .trains7 .sw { height: 14px; width: 8px; }
  .pick button em { font-size: 10px; }
  #j-info { font-size: 10.5px; line-height: 1.3; }
}
/* portrait phones and tall narrow windows */
@media (orientation: portrait), (max-width: 520px) {
  .t-side { display: none; }
  #title { background: linear-gradient(0deg, rgba(8, 12, 16, .92) 0, rgba(8, 12, 16, .7) 60%, rgba(8, 12, 16, .25) 100%); align-items: flex-end; }
  .t-main { padding: 0 0 6px; width: 100%; }
  .sheet.wide { height: 100%; }
  .sh-sub { display: none; }
  .j-body, .m-body, .e-body { grid-template-columns: 1fr; grid-template-rows: auto auto; align-content: start; }
  .lines8 { grid-auto-rows: minmax(46px, auto); flex: none; }
  .mis16 { grid-auto-rows: minmax(50px, auto); }
  .help { grid-template-columns: 1fr; } .help > div { display: none; } .help > div.on { display: block; } .tabs { display: flex; flex-wrap: wrap; }
  .tabs button { flex: 1 1 30%; }
  .sh-f .go { flex: 1 1 100%; order: 9; }
  .sh-f label.sel { flex: 1; } .sel select { max-width: none; flex: 1; width: 100%; }
  #journey .sh-f { flex-wrap: nowrap; } #journey .sh-f .go { flex: 0 0 auto; order: 0; padding: 6px 16px; }
  .sel-t { display: none; }
  .lines8 { grid-auto-rows: minmax(44px, auto); } .trains7 { grid-auto-rows: 40px; flex: none; } #j-info { -webkit-line-clamp: 3; }
  .j-body { gap: 10px; }
}
@media (orientation: portrait) and (max-height: 700px) { .sh-b { padding: 8px 10px; } .sh-h { padding: 6px 10px; } .lines8 { grid-auto-rows: minmax(40px, auto); } .trains7 { grid-auto-rows: 36px; } .pick button b { font-size: 12.5px; } #j-info { -webkit-line-clamp: 2; } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-variant-numeric: tabular-nums; }
#hud > div { position: absolute; }
#hud button { pointer-events: auto; }
.h-next { top: calc(10px + var(--st)); left: calc(12px + var(--sl)); background: var(--y); color: #14181d; border: 3px solid #14181d; border-radius: 6px; padding: 5px 12px 6px; display: grid; grid-template-columns: auto auto; column-gap: 12px; align-items: baseline; max-width: 46vw; }
.h-next small { grid-column: 1 / 3; font-size: 10px; font-weight: 800; letter-spacing: 1px; opacity: .7; }
.h-next b { font-size: 19px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .h-next i { font-style: normal; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-next span { font-size: 13px; font-weight: 700; } #h-late.late { color: #a3140c; } #h-late.ok { color: #0d5c2a; }
.h-sig { top: calc(10px + var(--st)); left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px 6px 8px; display: flex; gap: 10px; align-items: center; }
.sighead { background: #08090a; border-radius: 9px; padding: 4px; display: flex; flex-direction: column; gap: 3px; } .sighead i { width: 11px; height: 11px; border-radius: 50%; background: #23272b; }
.sighead i.y { background: #ffc81f; box-shadow: 0 0 8px #ffc81f; } .sighead i.g { background: #2dff6a; box-shadow: 0 0 8px #2dff6a; } .sighead i.r { background: #ff2418; box-shadow: 0 0 9px #ff2418; }
.h-sig small { display: block; font-size: 9.5px; letter-spacing: 1px; opacity: .6; } .h-sig b { font-size: 18px; display: block; line-height: 1.1; } .h-sig span { font-size: 12px; opacity: .85; }
.h-top { top: calc(10px + var(--st)); right: calc(12px + var(--sr)); display: flex; gap: 6px; align-items: center; }
.h-top span, .h-top button { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-weight: 800; font-size: 15px; }
#h-score { color: var(--y); } #h-score::before { content: '★ '; } .h-top em { font-style: normal; font-size: 12px; font-weight: 600; }
.h-speed { left: calc(10px + var(--sl)); bottom: calc(34px + var(--sb)); width: 172px; height: 172px; } .h-speed canvas { width: 100%; height: 100%; }
.lim { position: absolute; right: -6px; top: -4px; width: 46px; height: 46px; border-radius: 50%; background: #fff; border: 5px solid #d8342a; color: #111; font-weight: 900; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.kav { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); background: #d8342a; padding: 1px 9px; border-radius: 20px; font-size: 11px; font-weight: 800; letter-spacing: 1px; opacity: 0; } .kav.on { opacity: 1; }
.h-lever { right: calc(14px + var(--sr)); bottom: calc(40px + var(--sb)); width: 64px; height: 216px; pointer-events: auto; touch-action: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lv-track { position: relative; width: 30px; flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; overflow: visible; }
.lv-p, .lv-b { position: absolute; left: 4px; right: 4px; border-radius: 9px; opacity: .5; } .lv-p { top: 6px; height: calc(50% - 10px); background: linear-gradient(#2bd66a, #1c6b3a); } .lv-b { bottom: 6px; height: calc(50% - 10px); background: linear-gradient(#7a1c14, #d8342a); }
.lv-knob { position: absolute; left: -13px; width: 56px; height: 26px; margin-top: -13px; top: 50%; background: #e9e4d4; border: 2px solid #14181d; border-radius: 8px; box-shadow: 0 3px 8px rgba(0, 0, 0, .5); }
.lv-lab { font-weight: 900; font-size: 17px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1px 9px; min-width: 44px; text-align: center; }
.lv-lab.p { color: var(--grn); } .lv-lab.b { color: #ff6a5c; }
.h-btns { right: calc(92px + var(--sr)); bottom: calc(40px + var(--sb)); display: flex; gap: 7px; flex-direction: row-reverse; }
.h-btns button { width: 58px; height: 58px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 22px; line-height: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: none; }
.h-btns button small { font-size: 9.5px; font-weight: 700; opacity: .8; } .h-btns button:active, .h-btns button.down { background: var(--y); color: #14181d; }
.x-steam { display: none !important; } body.steam .x-steam { display: flex !important; }
.h-extra { left: calc(192px + var(--sl)); right: calc(420px + var(--sr)); bottom: calc(40px + var(--sb)); display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap-reverse; }
.gauge { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; width: 74px; } .gauge small { display: block; font-size: 9.5px; letter-spacing: .6px; opacity: .7; } .gauge b { font-size: 14px; }
.gauge i { display: block; height: 7px; background: #23272b; border-radius: 4px; margin-top: 3px; overflow: hidden; } .gauge i u { display: block; height: 100%; background: var(--grn); } .gauge.warn i u { background: #ffc81f; } .gauge.bad i u { background: #ff2418; }
.linebox { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 8px; width: min(46vw, 430px); } .linebox small { font-size: 9.5px; letter-spacing: .6px; opacity: .7; }
.linebox svg { display: block; width: 100%; height: 44px; }
.h-chai { left: calc(192px + var(--sl)); bottom: calc(10px + var(--sb)); display: flex; align-items: center; gap: 6px; font-size: 16px; } .h-chai i { width: 90px; height: 7px; background: rgba(0, 0, 0, .5); border-radius: 4px; overflow: hidden; } .h-chai b { display: block; height: 100%; width: 100%; background: #c98a4a; }
body.touring #h-toast { display: none; }   /* the guided tour's card sits where toasts land */
#h-toast { left: 50%; top: 22%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; width: min(560px, 80vw); }
.toast { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 14px; font-weight: 700; font-size: 15px; text-align: center; animation: tin .25s; } .toast.bad { background: rgba(160, 24, 16, .92); } .toast.good { background: rgba(18, 104, 50, .92); } .toast small { display: block; font-weight: 500; opacity: .85; font-size: 12.5px; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
.mark { top: 32%; right: calc(14px + var(--sr)); width: min(300px, 40vw); background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--y); border-radius: 10px; padding: 9px 12px; display: flex !important; gap: 10px; align-items: flex-start; opacity: 0; transform: translateX(20px); transition: .4s; }
.mark.left { right: auto; left: calc(14px + var(--sl)); border-left: 1px solid var(--line); border-right: 5px solid var(--y); flex-direction: row-reverse; transform: translateX(-20px); } .mark.left .arrow { transform: scaleX(-1); }
.mark.on { opacity: 1; transform: none; } .mark .arrow { color: var(--y); font-size: 24px; line-height: 1; } .mark small { color: var(--y); font-weight: 800; font-size: 10.5px; letter-spacing: 1px; } .mark b { display: block; font-size: 17px; } .mark p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; opacity: .88; }
.arrive { left: 50%; top: 36%; transform: translate(-50%, -50%) scale(.9); background: var(--y); color: #14181d; border: 4px solid #14181d; border-radius: 8px; padding: 10px 22px 12px; text-align: center; opacity: 0; transition: .35s; min-width: 280px; }
.arrive.on { opacity: 1; transform: translate(-50%, -50%); } .arrive h3 { margin: 0; font-size: 26px; } .arrive i { font-style: normal; font-weight: 800; font-size: 20px; display: block; } .arrive p { margin: 6px 0 0; font-size: 13.5px; font-weight: 600; } .arrive em { font-style: normal; font-weight: 900; font-size: 18px; }
#h-route { left: calc(192px + var(--sl)); right: calc(380px + var(--sr)); bottom: calc(14px + var(--sb)); height: 5px; background: rgba(0, 0, 0, .5); border-radius: 3px; margin-left: 110px; } #h-rfill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--y); border-radius: 3px; } #h-rdots i { position: absolute; top: -2px; width: 3px; height: 9px; background: #fff; opacity: .7; border-radius: 2px; }
.keys { left: 50%; top: calc(78px + var(--st)); transform: translateX(-50%); font-size: 12px; opacity: .75; background: rgba(0, 0, 0, .45); padding: 3px 10px; border-radius: 20px; white-space: nowrap; transition: opacity 1s; } body.touch .keys { display: none; }
@media (max-height: 480px) {
  .h-speed { width: 128px; height: 128px; bottom: calc(22px + var(--sb)); } .h-lever { height: 150px; bottom: calc(22px + var(--sb)); } .h-btns { bottom: calc(22px + var(--sb)); right: calc(86px + var(--sr)); } .h-btns button { width: 50px; height: 50px; font-size: 19px; }
  .h-extra { left: calc(146px + var(--sl)); right: calc(380px + var(--sr)); bottom: calc(26px + var(--sb)); gap: 5px; } .h-chai { left: calc(146px + var(--sl)); bottom: calc(4px + var(--sb)); } #h-route { display: none; } .h-next b { font-size: 15px; } .h-next i { font-size: 12px; } .mark { top: 26%; } .mark p { display: none; } #h-toast { top: 20%; }
}
@media (max-width: 760px) { .h-top em { display: none; } }
body.touch .h-top button { min-width: 44px; min-height: 44px; }
#hud button { touch-action: none; }
button { -webkit-touch-callout: none; }

/* loco pilot duties: a second, smaller row of buttons */
.x-extras { display: none !important; } body.extras .x-extras { display: flex !important; }
.h-aux { bottom: calc(106px + var(--sb)); } .h-aux button { width: 48px; height: 44px; font-size: 17px; border-radius: 11px; }
.h-aux button.on { border-color: var(--y); color: var(--y); } .h-aux button.alert { background: #d8342a; animation: vig .5s infinite alternate; } @keyframes vig { to { background: #ffc81f; color: #14181d; } }
@media (max-height: 480px) { .h-aux { bottom: calc(78px + var(--sb)); } .h-aux button { width: 44px; height: 40px; } }

#b-boost.on { background: rgba(245, 197, 24, .45); }
body:not(.fast) #b-boost { display: none; }
/* ---------- compact phone HUD (landscape, short screens): everything scales with the screen height ---------- */
@media (orientation: landscape) and (max-height: 600px) {
  #hud { --u: 1; }
  .h-next { padding: calc(3px * var(--u)) calc(9px * var(--u)); border-width: 0 0 0 4px; border-radius: 8px; column-gap: 8px; max-width: 34vw; top: calc(6px + var(--st)); }
  .h-next small { font-size: calc(9px * var(--u)); } .h-next b { font-size: calc(15px * var(--u)); } .h-next span { font-size: calc(11px * var(--u)); }
  #h-nhi { display: none; }
  .h-sig { top: calc(6px + var(--st)); padding: calc(3px * var(--u)) calc(9px * var(--u)) calc(3px * var(--u)) 5px; gap: 6px; border-radius: 20px; }
  .sighead { flex-direction: row; padding: 3px; } .sighead i { width: calc(9px * var(--u)); height: calc(9px * var(--u)); }
  .h-sig small, #h-sname, #h-swhy { display: none !important; } .h-sig b { font-size: calc(14px * var(--u)); }
  .h-top { top: calc(10px + var(--st)); gap: 14px; } .h-top span, .h-top button { padding: calc(4px * var(--u)) calc(7px * var(--u)); font-size: calc(13px * var(--u)); border-radius: 8px; } .h-top em { display: none; } .h-top button { width: auto !important; height: auto !important; min-width: 0; min-height: 0; }
  /* small to look at, but each top button still takes a 44px tap around it (pause was missed on phones) */
  .h-top button { position: relative; min-width: 32px; min-height: 30px; } .h-top button::after { content: ''; position: absolute; inset: -8px -7px; }
  .h-speed { width: calc(26vh * var(--u) + 20px); height: calc(26vh * var(--u) + 20px); bottom: calc(8px + var(--sb)); left: calc(8px + var(--sl)); }
  .lim { width: calc(30px * var(--u)); height: calc(30px * var(--u)); border-width: 3px; font-size: calc(11px * var(--u)); right: -4px; top: -2px; }
  .h-lever { width: calc(44px * var(--u)); height: calc(44vh); bottom: calc(8px + var(--sb)); right: calc(8px + var(--sr)); }
  .lv-track { width: calc(22px * var(--u)); } .lv-knob { width: calc(42px * var(--u)); height: calc(20px * var(--u)); left: calc(-10px * var(--u)); margin-top: calc(-10px * var(--u)); }
  .lv-lab { font-size: calc(12px * var(--u)); padding: 0 5px; min-width: 0; }
  .h-btns { right: calc(14px + 44px * var(--u) + var(--sr)); bottom: calc(8px + var(--sb)); gap: 5px; flex-direction: column-reverse; align-items: flex-end; }
  .h-btns button { width: calc(44px * var(--u)); height: calc(44px * var(--u)); font-size: calc(17px * var(--u)); border-radius: 12px; }
  #b-horn { width: calc(54px * var(--u)); height: calc(54px * var(--u)); } #b-emg { background: rgba(170, 30, 20, .85); }
  .h-btns button small { display: none; }
  .h-btns.h-aux { right: auto; left: calc(16px + 26vh * var(--u) + 20px + var(--sl)); flex-direction: row; align-items: flex-end; }
  body:not(.fast) #b-boost { display: none; }
  .h-extra, .h-chai { left: calc(16px + 26vh * var(--u) + 20px + var(--sl)); } .h-extra { bottom: calc(16px + 44px * var(--u) + var(--sb)); right: 40vw; } .gauge { width: calc(60px * var(--u)); padding: 3px 6px; } .gauge small { font-size: 8px; } .gauge b { font-size: 11px; }
  .h-chai, #g-v, #g-m { display: none; }
  .mark { padding: 4px 10px !important; top: 18%; width: auto; max-width: 34vw; } .mark p, .mark small { display: none !important; } .mark b { font-size: calc(13px * var(--u)) !important; }
  .linebox { width: 34vw; } .linebox svg { height: 30px; }
  .keys, #h-keys { display: none !important; }
}
@media (orientation: landscape) and (max-height: 430px) { #hud { --u: .86; } }
@media (orientation: landscape) and (max-height: 370px) { #hud { --u: .74; } }
@media (orientation: landscape) and (max-height: 320px) { #hud { --u: .64; } }
/* very short landscape phones (about 260 px tall): the kicker line runs into the bumshi.com back chip */
@media (orientation: landscape) and (max-height: 290px) { .logo small { display: none; } .logo h1 { font-size: 30px; } .t-main { padding-top: 34px; } }

/* brake cue for new drivers */
.cue { position: absolute; left: 50%; bottom: 30%; transform: translate(-50%, 8px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; padding: 9px 16px; border-radius: 10px; font-weight: 800; font-size: 15px; letter-spacing: .4px; white-space: nowrap; background: var(--panel); color: #f3efe4; border: 1px solid var(--line); z-index: 6; }
.cue.on { opacity: 1; transform: translate(-50%, 0); }
.cue.hot { background: var(--y); color: var(--ink); border-color: var(--y); animation: cuePulse .6s ease-in-out infinite alternate; }
@keyframes cuePulse { from { box-shadow: 0 0 0 0 rgba(255, 210, 63, .7); } to { box-shadow: 0 0 0 10px rgba(255, 210, 63, 0); } }
@media (max-height: 500px) { .cue { bottom: 34%; font-size: 13px; padding: 7px 12px; } }

/* the yard: a side panel over the train on the platform (bottom sheet on a tall screen) */
#yard { justify-content: flex-end; align-items: stretch; background: none; }
.y-sheet { width: min(440px, 54vw); height: 100%; }
.y-body { display: flex; flex-direction: column; gap: 8px; }
.y-tabs { display: flex; gap: 6px; flex: none; }
.y-tabs button { flex: 1; min-height: 38px; border-radius: 9px; background: rgba(255, 255, 255, .06); border: 2px solid transparent; font-weight: 700; }
.y-tabs button.sel, .y-grid button.sel, .y-seg button.sel { border-color: var(--y); background: rgba(245, 197, 24, .14); }
.y-pane { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.y-pane h4 { margin: 0; font-size: 12px; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }
.y-grid { display: grid; gap: 6px; grid-template-columns: 1fr 1fr 1fr; }
.y-grid.y-cars { grid-template-columns: 1fr 1fr; }
.y-grid.y-bank { grid-template-columns: repeat(4, 1fr); }
.y-grid.y-liv { grid-template-columns: 1fr 1fr 1fr; }
.y-grid button { background: rgba(255, 255, 255, .06); border: 2px solid transparent; border-radius: 9px; padding: 5px 8px; text-align: left; display: flex; flex-direction: column; min-height: 42px; justify-content: center; min-width: 0; }
.y-grid button b { font-size: 13px; } .y-grid button small { font-size: 10.5px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.y-liv button { flex-direction: row; align-items: center; gap: 7px; } .y-liv .sw { width: 8px; align-self: stretch; border-radius: 4px; flex: none; } .y-liv span { display: flex; flex-direction: column; min-width: 0; }
.y-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(255, 255, 255, .04); border-radius: 9px; padding: 3px 4px 3px 9px; min-height: 42px; font-size: 13px; }
.y-row > span:first-child { min-width: 0; display: flex; flex-direction: column; } .y-row small { opacity: .62; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.y-cars .y-row > span:first-child { flex-direction: row; align-items: baseline; gap: 5px; overflow: hidden; }
.y-step { display: flex; align-items: center; gap: 2px; flex: none; }
.y-step button { width: 36px; height: 36px; border-radius: 8px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line); font-size: 19px; line-height: 1; padding: 0; }
.y-step button:disabled { opacity: .3; }
.y-step b { min-width: 24px; text-align: center; font-size: 15px; }
.y-tot { background: none; padding-left: 2px; opacity: .85; font-size: 12px; }
.y-seg { display: flex; gap: 4px; } .y-seg button { min-height: 34px; padding: 0 10px; border-radius: 8px; background: rgba(255, 255, 255, .06); border: 2px solid transparent; font-size: 12.5px; }
.y-note { margin: 2px 0 0; font-size: 12px; opacity: .7; line-height: 1.4; }
.y-stats { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.y-stats div { display: flex; flex-direction: column; min-width: 0; } .y-stats small { font-size: 10.5px; opacity: .6; white-space: nowrap; } .y-stats b { font-size: 14px; color: var(--y); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.y-warn { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12px; color: #ffb38a; }
.y-open { margin-top: 8px; width: 100%; min-height: 40px; border-radius: 10px; background: rgba(245, 197, 24, .16); border: 1px solid var(--y); font-weight: 700; flex: none; }
body.yarding #title-bg, body.yarding .vignette { opacity: 0; }
@media (max-height: 520px) { .y-sheet .sh-h { padding: 5px 10px; } .y-sheet .sh-h h2 { font-size: 17px; } .y-sheet .sh-b { padding: 6px 10px; } .y-sheet .sh-f { padding: 6px 10px; } .y-row { min-height: 38px; } .y-step button { width: 34px; height: 34px; } .y-grid button { min-height: 38px; padding: 3px 7px; } .y-stats b { font-size: 13px; } .y-sheet .sh-sub { display: none; } }
@media (orientation: portrait) { #yard { align-items: flex-end; justify-content: center; } .y-sheet { width: 100%; height: 62%; } }

#yard .y-hint { position: absolute; height: auto; width: auto; align-self: auto; z-index: 2; left: 16px; bottom: calc(14px + var(--sb)); margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(20, 24, 30, .72); color: #fff; font-size: 13px; pointer-events: none; }
@media (orientation: portrait) { #yard .y-hint { bottom: auto; top: calc(12px + var(--st)); left: 50%; transform: translateX(-50%); } }
#yard { touch-action: pan-y; }
.y-warn .y-fix { display: inline-block; margin: 6px 0 0; padding: 6px 12px; min-height: 32px; border-radius: 8px; background: var(--y); color: #1a1a1a; font-weight: 800; font-size: 12px; }
#h-swhy { display: block; max-width: 220px; margin-top: 3px; font-style: normal; font-size: 11px; line-height: 1.3; opacity: .85; white-space: normal; }
