/* VOICE   platform signage: read in one glance between classes
   IDEA    the MTA "Happening now" alert screen, for escalators
   PICTURE the board itself: alerts first, then every working escalator
   COLOUR  black screen in a grey bezel, white type; floor circles, blue for even floors and orange for odd
   TYPE    Helvetica Neue bold, like the subway signs
   LAYOUT  one centred board at every width; type grows on big displays */

:root {
  color-scheme: dark;
  --page: #20242b;
  --bezel: #2c3038;
  --screen: #000;
  --ink: #fff;
  --muted: #a9adb4;
  --rule: #333;
  --even: #0062cf;
  --odd: #ff6319;
  --out: #ee352e;
  --maint: #fccc0a;
  --sans: "Helvetica Neue", Helvetica, Arial, "Nimbus Sans", sans-serif;
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font: 16px/1.4 var(--sans);
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; line-height: 1.05; letter-spacing: -.01em; font-weight: 700; }
ul { list-style: none; margin: 0; padding: 0; }

.wrap {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.bezel { background: var(--bezel); border-radius: 24px; padding: 24px; }
.screen { background: var(--screen); border-radius: 8px; }

/* Everything inside the board is sized in em, so one font-size scales it */
.board { padding: 1.9em 2.1em 2.2em; font-size: 18px; }
.board section + section { margin-top: 2.2em; }

.head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75em;
  padding-bottom: .65em;
  border-bottom: 2px solid var(--ink);
}
.head h1, .head h2 { font-size: 2em; }
.head span { font-size: .9em; color: var(--muted); white-space: nowrap; }

/* Route bullets */
.bullet {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  font-style: normal;
  font-weight: 700;
  color: #fff;
  background: var(--even);
  line-height: 1;
}
.bullet.odd { background: var(--odd); }
.pair { display: inline-flex; align-items: center; gap: .3em; white-space: nowrap; }
.pair .arr { font-weight: 700; color: var(--ink); }

/* Happening now */
.alerts li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: .8em;
  row-gap: .3em;
  padding: 1.05em 0;
  border-bottom: 1px solid var(--rule);
}
.alerts li:last-child { border-bottom: 0; padding-bottom: 0; }
.alerts .pair { grid-row: span 2; align-self: start; font-size: 1.05em; margin-top: -.25em; }
.alerts .t { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3em .55em; font-size: 1.25em; font-weight: 700; line-height: 1.2; }
.alerts .dur {
  display: inline-block;
  padding: .12em .45em;
  border-radius: .3em;
  background: #262626;
  font-size: .9em;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
}
.alerts .dur.long { background: var(--out); color: #fff; }
.alerts .d { margin: 0; font-size: 1.1em; color: var(--muted); line-height: 1.45; }
.alerts .none { display: block; padding: 1.05em 0 0; color: var(--muted); font-size: 1.1em; border: 0; }

/* All others in service */
.ok {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5em, 1fr));
  gap: .9em 1.2em;
  padding-top: 1.2em;
}
.ok li { display: flex; align-items: center; gap: .7em; font-size: 1.05em; }
.ok .up { font-weight: 700; font-size: 1.05em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ok .up.good { color: #3ccf6e; }
.ok .up.bad { color: #ff5b52; }
.ok .none { color: var(--muted); font-weight: 400; }

.foot { margin: 16px 4px 0; color: #70747c; font-size: 14px; line-height: 1.45; }

/* Phones */
@media (max-width: 600px) {
  .wrap { padding-top: max(16px, env(safe-area-inset-top)); }
  .bezel { padding: 10px; border-radius: 16px; }
  .board { font-size: 15px; padding: 1.4em 1.3em 1.6em; }
  .head h1, .head h2 { font-size: 1.75em; }
  .head { flex-wrap: wrap; }
}
/* Public board: the screen fills the whole window; the footer sits just below the fold.
   Type scales with the window, so a hallway TV and a laptop both read well. */
.tv .wrap {
  width: 100%;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.tv .bezel {
  display: flex;
  min-height: calc(100vh - 24px);
  min-height: calc(100svh - 24px);
  padding: clamp(8px, 1.4vw, 24px);
  border-radius: clamp(14px, 1.6vw, 28px);
}
.tv .board { flex: 1; font-size: clamp(15px, min(1.7vw, 3vh), 40px); }
.tv .foot { margin: 16px 8px 0; }

/* ---------- Shared bits ---------- */
.foot a { color: var(--muted); }
.foot a:hover { color: var(--ink); }
.head span.warn { color: var(--maint); }
button { font: inherit; }
:focus-visible { outline: 3px solid #6cb4ff; outline-offset: 2px; }

/* ---------- Admin portal ---------- */
.admin .wrap { width: min(100%, 980px); }
.admin .board { font-size: 16px; }
.loading { color: var(--muted); margin: 0; }
.log-bezel { margin-top: 20px; }

.btn {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
  color: #000;
  background: var(--ink);
}
.btn:disabled { opacity: .5; cursor: progress; }
.btn.out { background: var(--out); color: #fff; }
.btn.maintenance { background: var(--maint); color: #000; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px #555; }
.link { padding: 0; border: 0; background: none; color: var(--ink); text-decoration: underline; cursor: pointer; }
.link.small { margin-top: .35em; font-size: .9em; color: var(--muted); min-height: 32px; }

/* Login */
.login { display: grid; gap: 8px; max-width: 360px; padding-top: 1.2em; }
.login label { font-weight: 700; margin-top: 8px; }
.login input, .note-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #555;
  border-radius: 8px;
  background: #111;
  color: var(--ink);
  font: 16px var(--sans);
}
.login input:focus, .note-input:focus { border-color: #9aa0a8; outline: none; box-shadow: 0 0 0 3px rgba(108, 180, 255, .45); }
.login .btn { margin-top: 12px; justify-self: start; min-width: 140px; }
.error { min-height: 1.4em; margin: 4px 0 0; color: #ff7a70; }

/* Console */
.who { display: inline-flex; flex-wrap: wrap; gap: .3em; align-items: baseline; }
.hint { margin: .9em 0 0; color: var(--muted); }
.controls { margin-top: .4em; }
.ctl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .6em 1em;
  padding: .9em 0;
  border-bottom: 1px solid var(--rule);
}
.ctl:last-child { border-bottom: 0; }
.ctl .pair { font-size: 1.05em; }
.ctl .t { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3em .55em; font-weight: 700; font-size: 1.1em; }
.ctl.running .t { color: var(--muted); font-weight: 400; }
.ctl .d { margin: .25em 0 0; color: var(--muted); font-size: .95em; }
.ctl .dur { padding: .12em .45em; border-radius: .3em; background: #262626; font-size: .85em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctl .dur.long { background: var(--out); color: #fff; }
.ctl.out { box-shadow: inset 4px 0 0 var(--out); padding-left: 12px; }
.ctl.maintenance { box-shadow: inset 4px 0 0 var(--maint); padding-left: 12px; }

.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: #1a1a1a; }
.seg-btn {
  min-width: 76px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.seg-btn:hover { color: var(--ink); background: #262626; }
.seg-btn[aria-pressed=true].running { background: var(--ink); color: #000; }
.seg-btn[aria-pressed=true].out { background: var(--out); color: #fff; }
.seg-btn[aria-pressed=true].maintenance { background: var(--maint); color: #000; }

.editor { grid-column: 1 / -1; display: grid; gap: 6px; padding: .8em; border-radius: 10px; background: #141414; }
.editor label { font-weight: 700; }
.editor .opt { font-weight: 400; color: var(--muted); }
.editor-row { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-row .note-input { flex: 1 1 260px; }

/* Change log */
.log li {
  display: grid;
  grid-template-columns: 9.5em auto minmax(0, 1fr);
  align-items: center;
  gap: .4em 1em;
  padding: .7em 0;
  border-bottom: 1px solid var(--rule);
  font-size: .95em;
}
.log li:last-child { border-bottom: 0; }
.log .when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log .pair { font-size: .85em; }
.log .none { display: block; color: var(--muted); padding-top: 1em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 140%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: #000;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  transition: transform .2s ease, opacity .2s ease, visibility .2s;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.out { background: var(--out); color: #fff; }
.toast.maintenance { background: var(--maint); color: #000; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

@media (max-width: 700px) {
  .ctl { grid-template-columns: auto minmax(0, 1fr); }
  .ctl .seg { grid-column: 1 / -1; display: flex; }
  .ctl .seg-btn { flex: 1; min-width: 0; }
  .log li { grid-template-columns: auto minmax(0, 1fr); }
  .log .when { grid-column: 1 / -1; }
}
