/* Frame dashboard v1. Target: Android WebView 106 at 1920x1080.
   No CSS nesting, no color-mix/oklch, no 4/8-digit hex, no :has(), no dvh. */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: block;
}

:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --panel: #131519;
  --panel-2: #1a1d22;
  --line: rgba(255, 255, 255, 0.07);
  --ink: #f3f1ec;
  --ink-2: #c9c7c1;
  --mute: #8d9098;
  --faint: #5d6068;
  --amber: #ffb547;
  --red: #ff5a4e;
  --green: #6fd39b;
  --mta-brown: #996633;
  --mta-blue: #0039a6;
  --r: 22px;
  --sans: "Inter", "Roboto", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: var(--sans);
  font-feature-settings: "tnum" 1, "cv11" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: default;
}
::selection { background: rgba(255, 181, 71, 0.35); }
ol, ul { list-style: none; }
h2 { font-weight: 600; }

/* The stage is laid out at 1920x1080 and scaled to the window by app.js. */
#stage {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 28px;
  padding: 36px 40px 36px 52px;
}

/* ---------- main column ---------- */
#main {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 500px;
  grid-template-rows: 392px 1fr;
  gap: 28px 40px;
  min-height: 0;
}

#now { align-self: end; padding-bottom: 6px; }
#clock {
  display: flex; align-items: baseline;
  font-weight: 300;
  font-size: 250px; line-height: 0.82;
  letter-spacing: -0.045em;
  font-variation-settings: "opsz" 32;
  margin-left: -14px;
}
#ampm {
  font-size: 64px; font-weight: 500; letter-spacing: 0;
  color: var(--mute); margin-left: 22px;
}
#date {
  margin-top: 30px;
  font-size: 58px; font-weight: 500; letter-spacing: -0.02em;
  color: var(--ink-2);
}

/* weather: compact card (tap for the hourly panel) */
#weather {
  grid-column: 2; grid-row: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 26px 30px 18px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
#weather:active { background: var(--panel-2); }
.wx-top { display: flex; align-items: center; gap: 14px; }
#wx-icon { width: 64px; height: 64px; color: var(--ink); flex: none; }
#wx-temp {
  font-size: 88px; font-weight: 300; letter-spacing: -0.05em; line-height: 1;
  font-variation-settings: "opsz" 32;
}
.wx-meta { margin-left: 2px; min-width: 0; }
#wx-text { font-size: 25px; font-weight: 600; white-space: nowrap; }
#wx-sub { font-size: 20px; margin-top: 4px; white-space: nowrap; line-height: 1.35; }
.wx-more { margin-left: auto; align-self: flex-start; display: flex; align-items: center; gap: 2px; font-size: 18px; font-weight: 600; color: var(--mute); }
.wx-more svg { width: 18px; height: 18px; stroke-width: 2.2; }
#wx-advice { margin-top: 12px; font-size: 24px; font-weight: 600; color: var(--amber); line-height: 1.25; }
#wx-stale { margin-top: 4px; }
#wx-stale:empty { display: none; }
#wx-days {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line); padding-top: 10px;
}
#wx-days li { text-align: center; padding: 4px 0; border-radius: 12px; }
#wx-days li:active { background: rgba(255, 255, 255, 0.06); }
#wx-days .d { font-size: 20px; font-weight: 600; color: var(--ink-2); }
#wx-days svg { width: 42px; height: 42px; margin: 6px auto 6px; display: block; color: var(--ink-2); }
#wx-days .hl { font-size: 24px; font-weight: 650; white-space: nowrap; line-height: 1.15; }
#wx-days .hl span { display: block; font-size: 20px; color: var(--mute); font-weight: 500; }
#wx-days .p { font-size: 17px; color: #7fb4ff; font-weight: 600; height: 22px; margin-top: 2px; }

/* weather: hourly panel over the right column */
#wx-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 500px; z-index: 5;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r);
  padding: 22px 26px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column;
}
#wx-panel[hidden] { display: none; }
.wp-head { display: flex; align-items: center; justify-content: space-between; }
.wp-head h3 { font-size: 28px; font-weight: 650; }
.wp-close { width: 52px; height: 52px; border: 0; border-radius: 26px; background: rgba(255, 255, 255, 0.08); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.wp-close svg, .sheet-close svg { width: 26px; height: 26px; stroke-width: 2.2; }
.wp-tabs { display: flex; gap: 8px; margin: 14px 0 12px; }
.wp-tabs button {
  flex: 1; height: 50px; border: 0; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05); color: var(--ink-2);
  font: 600 19px var(--sans);
}
.wp-tabs button.on { background: var(--ink); color: var(--bg); }
.wp-sum { display: flex; align-items: center; gap: 14px; font-size: 22px; line-height: 1.35; font-weight: 600; color: var(--ink-2); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.wp-sum svg { width: 40px; height: 40px; flex: none; color: var(--ink); }
.wp-sum .rain { color: #7fb4ff; }
.wp-hours { flex: 1; min-height: 0; overflow-y: auto; margin-top: 6px; }
.wp-hours li { display: grid; grid-template-columns: 82px 38px 64px 1fr; align-items: center; gap: 0 12px; height: 42px; font-size: 21px; font-weight: 600; }
.wp-hours .h { color: var(--mute); }
.wp-hours svg { width: 28px; height: 28px; color: var(--ink-2); }
.wp-hours .pr { display: flex; align-items: center; gap: 10px; color: #7fb4ff; font-size: 18px; }
.wp-hours .bar { height: 8px; border-radius: 4px; background: #7fb4ff; opacity: 0.8; }

/* coming up: one joint agenda, scrolls by touch */
#today {
  grid-column: 1 / -1; grid-row: 2;
  min-height: 0;
  display: flex; flex-direction: column;
}
.today-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 16px; }
.today-head h2 { font-size: 34px; letter-spacing: -0.01em; }
#legend { display: flex; align-items: center; gap: 18px; margin-left: auto; font-size: 20px; font-weight: 600; color: var(--ink-2); }
#legend span { display: inline-flex; align-items: center; gap: 8px; }
#legend .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
#legend i, .sheet-cal i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
#agenda-wrap { position: relative; flex: 1; min-height: 0; }
#agenda {
  position: absolute; inset: 0; z-index: 0;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0 30px 18px;
}
#agenda::-webkit-scrollbar { width: 6px; }
#agenda::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
#agenda-hint {
  position: absolute; left: 1px; right: 1px; bottom: 1px; height: 70px; z-index: 2;
  border-radius: 0 0 var(--r) var(--r);
  background: linear-gradient(rgba(19, 21, 25, 0), rgba(19, 21, 25, 0.95));
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 16px; line-height: 1.3;
  font-size: 18px; font-weight: 600; color: var(--mute); pointer-events: none;
}
#agenda-hint[hidden] { display: none; }
.day-h {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: baseline; gap: 14px;
  font-size: 22px; font-weight: 650; color: var(--mute); letter-spacing: 0.01em;
  padding: 16px 0 8px; background: var(--panel);
}
.day-h b { font-size: 26px; color: var(--ink); font-weight: 650; }
.ev {
  display: grid; grid-template-columns: 142px minmax(0, 1fr) auto; align-items: center; gap: 0 18px;
  min-height: 56px; padding: 6px 0;
  border-top: 1px solid var(--line);
}
.ev:active { background: rgba(255, 255, 255, 0.04); }
.day-h + .ev { border-top: 0; }
.ev .when { font-size: 27px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ev .when small { font-size: 18px; font-weight: 600; color: var(--mute); margin-left: 4px; }
.ev .what { font-size: 29px; font-weight: 500; white-space: nowrap; overflow: hidden; display: flex; align-items: center; gap: 8px; }
.ev .what s { flex: none; width: 6px; height: 30px; border-radius: 3px; text-decoration: none; }
.ev .what span { overflow: hidden; text-overflow: ellipsis; margin-left: 8px; }
.ev .where { max-width: 520px; font-size: 21px; font-weight: 500; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .where b { color: var(--ink-2); font-weight: 600; }
.ev.now .when { color: var(--amber); }
.ev.now .what { font-weight: 650; }
.ev.allday .when { font-size: 18px; letter-spacing: 0.08em; color: var(--mute); }
.agenda-note { font-size: 25px; color: var(--mute); padding: 6px 0 4px; }

/* popup sheet (alerts, events) */
#sheet { position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.62); display: flex; align-items: center; justify-content: center; }
#sheet[hidden] { display: none; }
.sheet-card {
  position: relative; width: 940px; max-height: 860px; overflow-y: auto;
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px; padding: 40px 48px 40px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.sheet-close { position: absolute; top: 24px; right: 24px; width: 60px; height: 60px; border: 0; border-radius: 30px; background: rgba(255, 255, 255, 0.08); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.sheet-kicker { display: flex; align-items: center; gap: 14px; font-size: 22px; font-weight: 600; color: var(--mute); margin-bottom: 14px; padding-right: 80px; }
.sheet-card h3 { font-size: 44px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; padding-right: 80px; }
.sheet-card p { font-size: 26px; line-height: 1.45; color: var(--ink-2); margin-top: 16px; white-space: pre-line; }
.sheet-card dl { margin-top: 26px; display: grid; grid-template-columns: 170px 1fr; gap: 16px 24px; font-size: 26px; }
.sheet-card dt { color: var(--mute); font-weight: 600; }
.sheet-card dd { color: var(--ink); font-weight: 500; line-height: 1.35; }
.sheet-card dd small { display: block; font-size: 19px; color: var(--mute); margin-top: 4px; }
.sheet-alert + .sheet-alert { margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--line); }
.sheet-alert h4 { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 650; color: var(--amber); }
.sheet-alert h4 svg { width: 28px; height: 28px; stroke-width: 2.2; }
.sheet-alert.planned h4 { color: #d9a85a; }
.sheet-alert .lead { font-size: 30px; color: var(--ink); font-weight: 600; margin-top: 10px; line-height: 1.3; }
.sheet-alert .meta { font-size: 21px; color: var(--mute); margin-top: 14px; line-height: 1.4; }
.sheet-cal { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- sidebar ---------- */
#side {
  display: flex; flex-direction: column; gap: 28px;
  min-height: 0;
}
.side-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.side-head h2 { font-size: 28px; }
#trains, #list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px 26px 18px;
}
#list { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#list-items { flex: 1; min-height: 0; overflow-y: auto; }
#list-items::-webkit-scrollbar { width: 0; }

.station + .station { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.st-name { display: flex; align-items: baseline; justify-content: space-between; font-size: 19px; color: var(--mute); font-weight: 600; margin-bottom: 6px; }
.row { display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 0 14px; padding: 7px 0; }
.bullet {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.02em;
}
.bullet.J, .bullet.Z { background: var(--mta-brown); }
.bullet.A, .bullet.C { background: var(--mta-blue); }
.row .dir { font-size: 21px; color: var(--ink-2); font-weight: 600; line-height: 1.1; }
.row .next { font-size: 19px; color: var(--mute); font-weight: 500; margin-top: 3px; white-space: nowrap; }
.row .leave { text-align: right; white-space: nowrap; }
.row .leave b { font-size: 46px; font-weight: 650; letter-spacing: -0.03em; }
.row .leave span { font-size: 18px; color: var(--mute); font-weight: 600; margin-left: 4px; }
.row .leave.go b { color: var(--amber); }
.row .alert { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 -4px -6px; padding: 4px 6px; border-radius: 8px; font-size: 18px; font-weight: 650; color: var(--amber); white-space: nowrap; }
.row .alert svg { width: 20px; height: 20px; flex: none; stroke-width: 2.2; }
.row .alert.planned { color: #d9a85a; font-weight: 600; }
.row .alert:active { background: rgba(255, 181, 71, 0.15); }
.row .leave.none { font-size: 22px; color: var(--faint); font-weight: 600; }
.row.dim-row { opacity: 0.55; }

#list-items li {
  display: flex; align-items: center; gap: 16px;
  min-height: 60px; padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 27px; font-weight: 500;
}
#list-items li:first-child { border-top: 0; }
#list-items .box {
  width: 30px; height: 30px; flex: none;
  border: 2.5px solid var(--faint); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
#list-items .box svg { width: 20px; height: 20px; color: var(--bg); display: none; }
#list-items li.done .box { background: var(--green); border-color: var(--green); }
#list-items li.done .box svg { display: block; }
#list-items li.done .txt { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 2px; }
#list-items .who { margin-left: auto; font-size: 19px; color: var(--mute); font-weight: 600; }
#list-items li:active { background: rgba(255, 255, 255, 0.04); }

/* ---------- shared ---------- */
.dim { color: var(--mute); }
.stale { font-size: 19px; color: var(--amber); font-weight: 600; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#offline {
  position: fixed; right: 24px; bottom: 18px;
  font-size: 20px; font-weight: 600; color: var(--amber);
  background: rgba(20, 20, 22, 0.9); padding: 8px 14px; border-radius: 10px;
}

/* Night: a single static veil dims everything; the clock stays readable. */
#night-veil {
  position: fixed; inset: 0; pointer-events: none;
  background: #000; opacity: 0;
  transition: opacity 2s ease-out;
}
body.night #night-veil { opacity: 0.62; }
body.night.awake #night-veil { opacity: 0.15; }
.rb { display: inline-flex; align-items: center; justify-content: center; width: 1.25em; height: 1.25em; border-radius: 50%; font-size: 0.8em; font-weight: 700; color: #fff; background: #808183; vertical-align: 0.08em; margin: 0 0.08em; }
.rb-A, .rb-C, .rb-E { background: var(--mta-blue); }
.rb-J, .rb-Z { background: var(--mta-brown); }
.rb-1, .rb-2, .rb-3 { background: #ee352e; }
.rb-4, .rb-5, .rb-6 { background: #00933c; }
.rb-B, .rb-D, .rb-F, .rb-M { background: #ff6319; }
.rb-G { background: #6cbe45; }
.rb-L { background: #a7a9ac; }
.rb-N, .rb-Q, .rb-R, .rb-W { background: #fccc0a; color: #111; }
.rb-7 { background: #b933ad; }

/* list: add button and add sheet */
#list-add {
  margin-left: 12px; width: 56px; height: 56px; margin-top: -10px; margin-bottom: -10px;
  border: 0; border-radius: 28px; background: rgba(255, 255, 255, 0.08); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
#list-add:active { background: rgba(255, 255, 255, 0.16); }
#list-add svg { width: 30px; height: 30px; stroke-width: 2.4; }
.add-form { display: flex; gap: 14px; margin-top: 22px; }
.add-form input {
  flex: 1; min-width: 0; height: 76px; padding: 0 22px;
  font: 500 32px var(--sans); color: var(--ink); caret-color: var(--amber);
  background: var(--bg); border: 2px solid rgba(255, 255, 255, 0.14); border-radius: 18px; outline: 0;
  -webkit-user-select: text; user-select: text;
}
.add-form input:focus { border-color: var(--amber); }
.add-form input::placeholder { color: var(--faint); }
.add-form button { height: 76px; padding: 0 34px; border: 0; border-radius: 18px; background: var(--ink); color: var(--bg); font: 650 28px var(--sans); }
.add-who { display: flex; gap: 10px; margin-top: 14px; }
.add-who button { height: 54px; padding: 0 24px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, 0.06); color: var(--ink-2); font: 600 22px var(--sans); }
.add-who button.on { background: var(--ink-2); color: var(--bg); }
.add-msg { min-height: 34px; margin-top: 14px; font-size: 22px; font-weight: 600; color: var(--green); }
.add-qr { display: flex; align-items: center; gap: 28px; margin-top: 18px; padding-top: 24px; border-top: 1px solid var(--line); }
.add-qr img { width: 190px; height: 190px; border-radius: 14px; flex: none; }
.add-qr b { display: block; font-size: 26px; font-weight: 650; }
.add-qr span { display: block; font-size: 21px; color: var(--mute); margin-top: 8px; line-height: 1.4; }
/* the add sheet sits at the top, above the on-screen keyboard */
#sheet.top { align-items: flex-start; padding-top: 40px; }

/* departures sheet */
.dep { display: grid; grid-template-columns: 150px 56px 1fr auto; align-items: center; gap: 0 20px; height: 70px; border-top: 1px solid var(--line); font-size: 28px; }
.dep:first-of-type { border-top: 0; }
.dep .t { font-weight: 650; }
.dep .t small { font-size: 18px; color: var(--mute); margin-left: 4px; }
.dep .bullet { width: 46px; height: 46px; font-size: 26px; }
.dep .lb { color: var(--ink-2); font-weight: 500; }
.dep .in { font-weight: 650; text-align: right; }
.dep.go .in { color: var(--amber); }
.dep.late { opacity: 0.45; }
.dep-list { margin-top: 20px; }
.dep-note { margin-top: 18px; font-size: 20px; color: var(--mute); }
.row { cursor: pointer; border-radius: 12px; }
.row:active { background: rgba(255, 255, 255, 0.05); }

/* list deletes: long-press or swipe left shows Delete */
#list-items li { position: relative; touch-action: pan-y; }
#list-items .del {
  display: none; margin-left: auto; height: 46px; padding: 0 20px; border: 0; border-radius: 12px;
  background: var(--red); color: #fff; font: 650 21px var(--sans);
}
#list-items li.armed .del { display: block; }
#list-items li.armed .who { display: none; }
#list-items li.armed { background: rgba(255, 90, 78, 0.08); }
#list .side-head h2, #list-count { white-space: nowrap; }
#list-clear {
  margin-left: auto; height: 44px; padding: 0 14px; border: 0; border-radius: 12px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.06); color: var(--ink-2); font: 600 18px var(--sans);
}
#list-clear[hidden] { display: none; }
#list-clear[hidden] + #list-add { margin-left: auto; }
.rb.wide { width: auto; padding: 0 0.4em; border-radius: 0.65em; }
.ev .where .rb { font-size: 0.85em; }

/* list header: one centred row, title + count pill on the left, actions on the right */
#list .side-head { align-items: center; gap: 12px; height: 56px; margin-bottom: 10px; }
#list-count {
  min-width: 34px; height: 30px; padding: 0 10px; border-radius: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.08); color: var(--ink-2); font-size: 18px; font-weight: 650;
}
#list #list-clear { margin-left: auto; height: 48px; padding: 0 16px; font-size: 19px; }
#list #list-add { margin: 0; width: 52px; height: 52px; flex: none; }
#list #list-clear[hidden] + #list-add { margin-left: auto; }

/* brightness: a faint corner button and its sheet */
#bright-btn {
  position: absolute; left: 6px; top: 4px; z-index: 6;
  width: 56px; height: 56px; border: 0; border-radius: 28px; background: transparent; color: var(--faint);
  display: flex; align-items: center; justify-content: center;
}
#bright-btn:active { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
#bright-btn svg { width: 28px; height: 28px; }
#bright-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 64px; margin-top: 30px; background: transparent;
}
#bright-range::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #2a2d33, #f3f1ec); }
#bright-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 52px; height: 52px; margin-top: -20px; border-radius: 26px;
  background: var(--ink); border: 4px solid var(--panel-2); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.bright-presets { display: flex; gap: 12px; margin-top: 18px; }
.bright-presets button {
  flex: 1; height: 64px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.06);
  color: var(--ink-2); font: 600 24px var(--sans);
}
.bright-presets button.on { background: var(--ink-2); color: var(--bg); }
.bright-mode { margin-top: 12px; font-size: 22px; font-weight: 600; color: var(--mute); }
.bright-mode.auto { color: var(--amber); }
