:root {
  --ink: #2a2f36;
  --muted: #69707a;
  --bg: #ece9e1;
  --card: #fbf9f3;
  --line: #d8d2c4;
  --tile: #f5f3ec;
  --green: #1d8a4a;
  --amber: #b9770e;
  --red: #c23b32;
  --blue: #2f6fd0;
  --orange: #d0731c;
  --teal: #1f8f84;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
kbd { display: inline-block; min-width: 1.4em; padding: 0 4px; border: 1px solid #c4bdad; border-bottom-width: 2px; border-radius: 4px;
  background: #fffdf7; font: 600 11px/1.5 ui-monospace, Consolas, monospace; text-align: center; color: var(--ink); }
button { font: 700 13px system-ui, sans-serif; border: 1px solid #bdb6a6; background: #fffdf8; color: var(--ink);
  border-radius: 7px; padding: 5px 11px; cursor: pointer; }
button:hover { background: #fff; border-color: #9d9686; }
button.on { background: #dff3e6; border-color: var(--green); color: var(--green); }
button.primary { background: var(--teal); border-color: var(--teal); color: #fff; padding: 10px 28px; font-size: 16px; }
button.primary:hover { background: #18786f; }

/* header */
#top { height: 50px; display: flex; align-items: center; gap: 18px; padding: 0 14px; background: #e1ddd2; border-bottom: 2px solid #c9c2b2; }
.brand { font-weight: 900; font-size: 20px; color: var(--teal); letter-spacing: .5px; }
.stat { display: flex; flex-direction: column; line-height: 1.1; }
.stat .lbl { font-size: 9px; letter-spacing: 1.5px; color: var(--muted); font-weight: 700; }
.stat b { font: 800 16px ui-monospace, Consolas, monospace; }
.dots { display: flex; gap: 4px; padding-top: 3px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: #d6d0c2; border: 1px solid #bdb5a3; }
.dots i.hit { background: var(--red); border-color: #8f2a23; }
.spacer { flex: 1; }
.speed { display: flex; }
.speed button { border-radius: 0; margin-left: -1px; }
.speed button:first-child { border-radius: 7px 0 0 7px; }
.speed button:last-child { border-radius: 0 7px 7px 0; }

/* layout */
#main { position: fixed; top: 50px; left: 0; right: 0; bottom: 0; display: flex; }
#left { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#mapWrap { flex: 1; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }
#banner { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); background: #fbe3e0; color: var(--red);
  border: 2px solid var(--red); border-radius: 10px; padding: 8px 16px; font-weight: 800; max-width: 80%; text-align: center; box-shadow: 0 6px 20px rgba(120,40,30,.15); }
#cmdBar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--tile); border-top: 1px solid var(--line); min-height: 52px; flex-wrap: wrap; }
#selInfo { font-size: 13px; color: var(--muted); min-width: 260px; }
#selInfo b { color: var(--ink); font-size: 15px; }
#cmdBtns { display: flex; gap: 6px; flex-wrap: wrap; }
.cbtn { display: flex; flex-direction: column; align-items: center; padding: 4px 12px; line-height: 1.15; }
.cbtn small { font-weight: 600; font-size: 10px; color: var(--muted); }
.cbtn.bad { border-color: var(--red); background: #fdf0ee; }
.cbtn.bad small { color: var(--red); }
#comms { height: 118px; overflow: hidden; padding: 6px 12px; background: #f7f5ef; border-top: 1px solid var(--line);
  font: 12.5px/1.45 ui-monospace, Consolas, monospace; display: flex; flex-direction: column; justify-content: flex-end; }
#comms div { flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#comms .twr { color: var(--teal); font-weight: 700; }
#comms .plt { color: #4c535c; }
#comms .incident, #comms .end { color: var(--red); font-weight: 800; }
#comms .wake { color: var(--amber); font-weight: 700; }
#comms .ga { color: var(--amber); }
#comms .score { color: var(--green); }
#comms .t { color: #a39c8c; margin-right: 6px; }

/* strips */
#strips { width: 330px; background: #e6e2d8; border-left: 2px solid #c9c2b2; overflow-y: auto; padding: 6px 8px 20px; }
#strips h4 { margin: 10px 2px 4px; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.bay { display: flex; flex-direction: column; gap: 4px; min-height: 8px; }
.strip { background: #fffdf8; border: 1px solid var(--line); border-left: 6px solid var(--blue); border-radius: 6px; padding: 5px 7px; cursor: pointer; }
.strip.dep { border-left-color: var(--orange); }
.strip.sel { outline: 2px solid var(--teal); background: #eef8f6; }
.strip.alert { background: #fdecea; border-color: var(--red); }
.strip.need .cs::after { content: " ●"; color: var(--amber); }
.strip .r1 { display: flex; align-items: baseline; gap: 6px; }
.strip .cs { font: 800 15px ui-monospace, Consolas, monospace; }
.strip .ty { font-size: 11px; color: var(--muted); }
.strip .st { white-space: nowrap; margin-left: auto; font: 700 10px ui-monospace, Consolas, monospace; padding: 1px 5px; border-radius: 4px; background: #ebe7dc; color: var(--muted); }
.strip .st.go { background: #dff3e6; color: var(--green); }
.strip .st.warn { background: #fdebd2; color: var(--amber); }
.strip .st.bad { background: var(--red); color: #fff; }
.strip .r2 { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.strip .btns { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.strip .btns button { padding: 2px 7px; font-size: 11px; }
.strip .btns button.bad { border-color: var(--red); color: var(--red); background: #fdf0ee; }
.bay.small .strip { padding: 2px 7px; }
.bay.small .strip .cs { font-size: 12px; }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(214, 216, 210, .75); display: flex; align-items: center; justify-content: center;
  z-index: 10; overflow-y: auto; padding: 16px; backdrop-filter: blur(3px); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 28px; width: min(780px, 100%);
  box-shadow: 0 12px 40px rgba(60, 60, 50, .18); max-height: 100%; overflow-y: auto; }
.card.small { width: min(380px, 100%); text-align: center; }
h1 { margin: 0 0 4px; font-size: 38px; letter-spacing: 1px; color: var(--teal); }
h2 { margin: 4px 0 6px; }
h3 { margin: 16px 0 6px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.lead { margin: 4px 0; line-height: 1.45; }
.muted { color: var(--muted); font-size: 13px; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice { text-align: left; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 400; }
.choice b { display: block; font-size: 15px; margin-bottom: 2px; }
.choice span { font-size: 12px; color: var(--muted); line-height: 1.35; display: block; }
.choice em { float: right; font-style: normal; font-weight: 800; color: var(--teal); }
.choice.sel { border-color: var(--teal); background: #e6f4f2; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 14px; }
.opts label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.go { margin-top: 18px; display: flex; gap: 10px; justify-content: center; }
.how { margin-top: 14px; font-size: 14px; }
.how summary { cursor: pointer; font-weight: 700; color: var(--teal); }
.how li { margin: 5px 0; line-height: 1.4; }
.kind { font-size: 12px; letter-spacing: 3px; text-transform: uppercase; font-weight: 800; color: var(--muted); }
.kind.good { color: var(--green); } .kind.bad { color: var(--red); }
.grade { font: 900 54px/1 system-ui, sans-serif; color: var(--teal); margin: 6px 0; }
.grade small { font-size: 20px; color: var(--muted); font-weight: 700; }
#endRows { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
#endRows td { padding: 5px 6px; border-bottom: 1px solid #ebe6da; }
#endRows td.pts { text-align: right; font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
#endInc { margin-top: 8px; }
#endInc div { color: var(--red); }

@media (max-width: 1100px) { #strips { width: 270px; } .stat:nth-of-type(5), .stat:nth-of-type(6) { display: none; } }
@media (max-width: 760px) {
  #main { flex-direction: column; }
  #strips { width: 100%; height: 34%; border-left: 0; border-top: 2px solid #c9c2b2; }
  #top { gap: 10px; overflow-x: auto; }
  .choices, .opts { grid-template-columns: 1fr; }
  #comms { height: 80px; }
}
