/* WebOmsi - the start screen as a grid of orange panels (in the manner of a classic bus simulator's
   own menu: dark-orange dividers, outlined buttons, round radio marks, information boxes, and a bar
   of wide buttons at the bottom). */
:root {
  --bg: #f6a21d; --bg2: #f8ae38; --box: #f7a62a; --line: #d9770c; --edge: #c4620a; --ink: #3a2000; --ink2: #6b3a05;
  --mark: #8a2a05; --bar: #e5650f; --bar-hi: #f0710f; --start: #ee5a0a; --white: #fff; --select: #1f4fa3;
  font-family: Verdana, Tahoma, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-size: 12px; line-height: 1.4; overscroll-behavior: none; }
body { position: fixed; inset: 0; overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
label { display: block; font-size: 12px; color: var(--ink); margin: 0 0 4px; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: #000; outline: none; touch-action: none; user-select: none; -webkit-user-select: none; }

/* ---- the window -------------------------------------------------------------------------------- */
#menu { position: fixed; inset: 0; z-index: 2; display: grid; place-items: start center; background: var(--bg); overflow: auto; padding: 10px; }
#menu.gone { display: none; }
.window { width: min(1100px, 100%); min-height: min(720px, 100%); margin: 0 auto; display: grid; background: var(--bg);
  grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(110px, auto) minmax(150px, 1fr) minmax(150px, 190px) auto auto;
  grid-template-areas: "logo map" "driver picture" "bus picture" "infobus infomap" "progress progress" "bar bar"; }
.cell { padding: 16px 20px; border-right: 3px solid var(--line); border-bottom: 3px solid var(--line); min-width: 0; min-height: 0; }
.cell:nth-child(2n) { border-right: 0; }
.c-logo { grid-area: logo; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.c-map { grid-area: map; }
.c-driver { grid-area: driver; display: flex; gap: 16px; align-items: flex-start; }
.c-picture { grid-area: picture; display: flex; flex-direction: column; justify-content: center; border-right: 0; }
.c-bus { grid-area: bus; display: flex; flex-direction: column; }
.c-info-bus { grid-area: infobus; display: flex; flex-direction: column; }
.c-info-map { grid-area: infomap; display: flex; flex-direction: column; border-right: 0; overflow: auto; }
.c-progress { grid-area: progress; border-right: 0; }

/* ---- the mark ------------------------------------------------------------------------------------------ */
.wordmark { display: flex; align-items: flex-end; line-height: .9; font-family: "Arial Black", "Segoe UI Black", Impact, Verdana, sans-serif; font-style: italic; font-weight: 900; color: #2b2a28; user-select: none; }
.wordmark .w { font-size: 34px; margin-right: 3px; transform: skewX(-6deg); letter-spacing: -1px; }
.wordmark .o { font-size: 64px; letter-spacing: -3px; transform: skewX(-6deg); color: transparent; background: repeating-linear-gradient(180deg, #2b2a28 0 5px, #6d3a07 5px 7px); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(3px 3px 0 #b85a07); padding-right: 6px; }
.build { text-align: right; font-size: 11px; color: var(--ink2); line-height: 1.5; }

/* ---- controls ---------------------------------------------------------------------------------------- */
select, input[type=text] { width: 100%; padding: 4px 6px; border: 1px solid #8d8d8d; background: #fff; color: var(--select); font: 12px Verdana, Tahoma, Arial, sans-serif; border-radius: 0; }
input[type=text] { color: #222; }
input:focus, select:focus { outline: 2px solid var(--mark); outline-offset: 0; }
.radios { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.radios.stack { flex-direction: column; flex-wrap: nowrap; }
.radio, .btn { border: 1px solid var(--edge); background: var(--bg2); color: var(--ink); padding: 6px 10px; text-align: left; border-radius: 0; }
.radio { display: flex; align-items: center; gap: 9px; width: 100%; }
.radios:not(.stack) .radio { width: auto; flex: 1 1 auto; justify-content: center; }
.radio::before { content: ''; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--mark); background: transparent; flex: none; }
.radio.on { border-color: #cf4f0a; background: #f59a1a; }
.radio.on::before { background: radial-gradient(circle, var(--mark) 0 45%, transparent 50%); }
.radio:hover, .btn:hover { background: #fbba52; }
.btn { display: block; width: 100%; text-align: center; margin-top: 10px; text-decoration: none; }
.btn.small { display: inline-block; width: auto; padding: 4px 10px; margin: 6px 6px 0 0; }
.driver-fields { flex: 1; min-width: 0; }
label.gap { margin-top: 10px; }
.radios.tight { margin-top: 12px; }
.tfields { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; } .tfields label { display: flex; align-items: center; gap: 6px; margin: 0; }
.tfields input { width: auto; padding: 3px 5px; border: 1px solid #8d8d8d; background: #fff; color: #222; font: 12px Verdana, Tahoma, Arial, sans-serif; }
a.btn { color: var(--ink); }
button.link { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--ink2); }
.muted { margin: 8px 0; color: var(--ink2); font-size: 11.5px; } .muted.small { font-size: 10.5px; }

/* the vehicles: a list box */
.buses { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--edge); background: #fcc063; }
.bus { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 5px 10px; margin: 0; border-bottom: 1px solid #e79b25; cursor: pointer; position: relative; }
.bus:hover { background: #fdcb7a; }
.bus input { position: absolute; opacity: 0; pointer-events: none; }
.bus:has(input:checked) { background: var(--mark); color: #fff; }
.bus .spec { font-size: 11px; white-space: pre; opacity: .85; }
.bus b { display: block; font-size: 13px; } .bus .info { font-size: 11px; opacity: .85; }
.bus .info { display: inline-block; margin-right: 10px; } .tags { display: inline-block; } .tag { font-size: 10.5px; margin-right: 6px; opacity: .9; } .tag.ok { font-weight: 700; }

/* the picture */
.picture { display: block; width: 100%; height: auto; max-height: 100%; object-fit: cover; border: 1px solid var(--edge); background: #fff3da; }
.caption { text-align: center; font-weight: 700; font-size: 15px; margin-top: 8px; color: var(--ink); }
.caption small { display: block; font-weight: 400; font-size: 11px; color: var(--ink2); }

/* the information boxes */
.infobox { flex: 1; min-height: 80px; overflow: auto; border: 1px solid var(--edge); background: var(--box); padding: 6px 8px; font-size: 11.5px; white-space: pre-line; }
.infobox b { display: block; margin-top: 6px; }
.mapbox img { float: right; width: 42%; max-width: 220px; margin: 0 0 6px 10px; border: 1px solid var(--edge); }

/* multiplayer */
.mp { margin-top: 10px; }
.code { font: 700 18px ui-monospace, Menlo, monospace; letter-spacing: .16em; text-transform: uppercase; }
.roombox { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border: 1px solid var(--edge); background: var(--box); padding: 6px 8px; }
.roombox b { margin-right: auto; color: var(--mark); }
label.check { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; cursor: pointer; }
#room-name { margin-top: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chips button { border: 1px solid var(--edge); background: var(--bg2); padding: 2px 8px; }
.lobby { list-style: none; margin: 0; padding: 0; border: 1px solid var(--edge); background: #fcc063; max-height: 180px; overflow: auto; }
.lobby:empty { display: none; }
.lobby li { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; align-items: center; padding: 5px 8px; border-bottom: 1px solid #e79b25; }
.lobby li b { font-size: 12.5px; } .lobby li small { grid-column: 1; color: var(--ink2); font-size: 10.5px; }
.lobby li button { grid-row: 1 / span 2; grid-column: 2; border: 1px solid var(--edge); background: var(--bg2); padding: 4px 12px; font-weight: 700; }
.lobby li button:hover { background: #fbba52; }

/* progress */
.track { height: 16px; background: #c96a0c; border: 1px solid var(--edge); padding: 2px; }
.track i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, #fff3da 0 9px, #f3c77b 9px 11px); transition: width .15s; }
.track.busy i { width: 30% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
#steps { list-style: none; padding: 0; margin: 8px 0 0; display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink2); }
#steps li::before { content: '○ '; } #steps li.now { color: var(--ink); font-weight: 700; } #steps li.now::before { content: '◔ '; }
#steps li.done { color: #1f5d1f; } #steps li.done::before { content: '✓ '; }
.status { margin: 6px 0 0; min-height: 1.4em; white-space: pre-line; word-break: break-all; }
.error { grid-area: progress; margin: 0; padding: 8px 20px; background: #7d1a05; color: #fff; border-bottom: 3px solid var(--line); }

/* the bar of wide buttons */
.menubar { grid-area: bar; display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 3px; background: var(--line); border-top: 3px solid var(--line); }
.menubar button { border: 0; background: var(--bar); color: #fff; font-size: 19px; padding: 11px 6px; border-radius: 0; }
.menubar button:hover { background: var(--bar-hi); }
.menubar .start { background: var(--start); }
.menubar button:disabled { opacity: .6; cursor: default; }
.menubar button.dim { opacity: .55; }

/* ---- in the game --------------------------------------------------------------------------------------------- */
.toolbar { position: fixed; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); z-index: 5; display: flex; gap: 6px; }
.toolbar button { width: 40px; height: 40px; border: 1px solid #ffd9a0; background: #b5530acc; color: #fff; font-size: 17px; padding: 0; border-radius: 0; }
.toolbar button:hover { background: #d9660fee; }
.toolbar .roomchip { width: auto; padding: 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.sheet { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; background: #3a200099; padding: 14px; }
.sheet-card { width: min(100%, 480px); max-height: 100%; overflow: auto; background: var(--bg); border: 3px solid var(--line); padding: 16px 18px; box-shadow: 0 10px 40px #0008; }
.sheet-card.wide { width: min(100%, 640px); }
.sheet-card h2 { margin: 0 0 10px; font-size: 16px; }
#rotate { position: fixed; inset: 0; z-index: 7; display: none; place-items: center; background: #3a2000ee; color: #fff; text-align: center; font-size: 18px; padding: 24px; }
#rotate span { font-size: 54px; display: block; }
@media (orientation: portrait) { body.playing.touch #rotate { display: grid; } }
#rotate[hidden] { display: none !important; }
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 8; background: #3a2000e6; color: #fff; padding: 7px 16px; font-size: 13px; border: 1px solid #ffd9a0; }
body.touch .only-kbd, body:not(.touch) .only-touch { display: none; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 6px 0; }
.keys > span:nth-child(odd) { white-space: nowrap; }
kbd { background: #fbb84a; border: 1px solid var(--edge); border-bottom-width: 2px; padding: 0 6px; font: 11px ui-monospace, monospace; }
.links { margin: 14px 0 0; color: var(--ink2); } .links a { color: var(--ink2); }

/* your own files */
details.own { border: 0; padding: 0; }
.badge { background: var(--mark); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 7px; }
.drop { display: grid; gap: 2px; place-items: center; text-align: center; border: 2px dashed var(--edge); padding: 18px 12px; cursor: pointer; margin: 8px 0 0; background: #f9b449; }
.drop span { color: var(--ink2); font-size: 11px; }
.drop:hover, .drop.over { background: #fbc468; border-color: var(--mark); }
.own-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 5px; }
.own-list li { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; align-items: center; background: #fcc063; border: 1px solid var(--edge); padding: 6px 8px; }
.own-list li b { font-size: 12px; word-break: break-all; } .own-list li small { grid-column: 1; color: var(--ink2); }
.own-list li button { grid-row: 1 / span 2; grid-column: 2; background: #7d1a05; color: #fff; border: 0; width: 26px; height: 26px; }
.guide ol { padding-left: 20px; margin: 6px 0; } .guide li { margin: 4px 0; } .guide h4 { margin: 12px 0 3px; font-size: 13px; } .guide p { margin: 5px 0; }
.guide code { background: #fbb84a; padding: 0 5px; font-size: 11px; }

/* ---- a narrow screen: one column ------------------------------------------------------------------------------- */
@media (max-width: 860px) {
  #menu { align-items: start; padding: 0; }
  .window { min-height: 100%; grid-template-columns: 1fr; grid-template-rows: none;
    grid-template-areas: "logo" "map" "driver" "bus" "picture" "infobus" "infomap" "progress" "bar"; }
  .cell, .cell:nth-child(2n), .c-picture, .c-info-map, .c-progress { border-right: 0; }
  .buses { max-height: 260px; } .infobox { min-height: 90px; max-height: 160px; }
  .wordmark .o { font-size: 48px; } .wordmark .w { font-size: 28px; }
  .menubar { position: sticky; bottom: 0; grid-template-columns: 1fr 1fr 1fr; } .menubar .start { grid-column: 1 / -1; font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .track.busy i { animation: none; } }
