/* Material 3 dark theme, same tokens as the Rock Band helper page so the two
   sites read as a family. Material Symbols is the vendored subset in /fonts. */
@font-face {
  font-family: "Material Symbols Outlined";
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url("fonts/material-symbols-v3.woff2") format("woff2");
}

:root {
  --primary: #d0bcff;
  --on-primary: #381e72;
  --primary-container: #4f378b;
  --on-primary-container: #eaddff;
  --secondary-container: #4a4458;
  --on-secondary-container: #e8def8;
  --surface: #141218;
  --surface-container-low: #1d1b20;
  --surface-container: #211f26;
  --surface-container-high: #2b2930;
  --surface-container-highest: #36343b;
  --on-surface: #e6e0e9;
  --on-surface-variant: #cac4d0;
  --outline: #938f99;
  --outline-variant: #49454f;
  --error: #f2b8b5;
  --ontime: #9fe3bb;
  --late: #ffb77c;

  --elev1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
  --elev2: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15);
  --elev3: 0 4px 8px 3px rgba(0,0,0,.15), 0 1px 3px rgba(0,0,0,.3);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --nav-h: 80px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Roboto", system-ui, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  overscroll-behavior-y: none;
}
button { font-family: inherit; }
::-webkit-scrollbar { width: 0; height: 0; }

.msym {
  font-family: "Material Symbols Outlined";
  font-weight: normal; font-style: normal; line-height: 1;
  letter-spacing: normal; white-space: nowrap; direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  user-select: none;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 24px;
}
.msym.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.msym.big { font-size: 56px; }

.touch { position: relative; overflow: hidden; }
.touch::after {
  content: ""; position: absolute; inset: 0; background: currentColor;
  opacity: 0; transition: opacity .12s var(--ease); pointer-events: none;
}
.touch:active::after { opacity: .12; }
@media (hover: hover) { .touch:hover::after { opacity: .08; } }

/* ---------- top app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  height: 64px; padding: 0 4px 0 16px;
  background: var(--surface); color: var(--on-surface);
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.appbar.scrolled { background: var(--surface-container); box-shadow: var(--elev2); }
.appbar h1 {
  margin: 0; font-size: 22px; font-weight: 400; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar #backBtn { margin-left: -12px; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--on-surface-variant);
  cursor: pointer;
}

/* text button */
.tbtn {
  flex: none; height: 48px; padding: 0 16px; border-radius: 24px;
  border: none; background: transparent; color: var(--primary);
  font-size: 14px; font-weight: 500; cursor: pointer;
}
/* filled button */
.fbtn {
  height: 48px; padding: 0 24px; border-radius: 24px; border: none;
  background: var(--primary); color: var(--on-primary);
  font-size: 14px; font-weight: 500; cursor: pointer;
}

/* ---------- discreet failure banner ---------- */
.warn {
  position: fixed; left: 16px; right: 16px; z-index: 12;
  bottom: calc(88px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 16px;
  background: var(--surface-container-highest); border-radius: 16px;
  border: 1px solid var(--outline-variant); box-shadow: var(--elev3);
  color: var(--on-surface-variant); font-size: 13px;
}
.warn span { flex: 1; min-width: 0; }

main { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
body.warned main { padding-bottom: calc(152px + env(safe-area-inset-bottom)); }
.view { max-width: 560px; margin: 0 auto; }

/* ---------- favourites ---------- */
.cards { display: flex; flex-direction: column; gap: 20px; }
/* The whole card is the tap target, but only the departures sit in the raised
   surface: the station name belongs to the card, not to its first train. */
.card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: none; border-radius: 16px; padding: 0;
  background: transparent; color: inherit; font: inherit;
}
.card-body {
  display: block; border-radius: 16px; padding: 4px 16px 8px;
  background: var(--surface-container-low); box-shadow: var(--elev1);
}
.card-head { padding: 0 4px; margin-bottom: 8px; }
.card-name, .card-sub {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-name { font-size: 18px; font-weight: 500; }
.card-sub { margin-top: 1px; font-size: 12px; color: var(--on-surface-variant); }

/* The card is one big button, which nothing signalled; without this line people
   read the home screen as a dead list. */
.card-more {
  display: block; margin-top: 6px; text-align: right;
  font-size: 13px; font-weight: 500; color: var(--primary);
}

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 72px 24px; color: var(--on-surface-variant); text-align: center;
}
.empty p { margin: 0 0 8px; }

/* ---------- departure rows ---------- */
.list { display: flex; flex-direction: column; gap: 2px; }
.dep {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 0;
}
.list .dep { padding: 8px 16px; border-radius: 16px; background: var(--surface-container-low); }
.dep + .dep { border-top: 1px solid var(--outline-variant); }
.list .dep + .dep { border-top: none; }
/* min-width, not width: "11:30" renders wider than 62px on some phones and
   would then eat the gap before the destination. */
.dep-time {
  flex: none; min-width: 62px; font-size: 24px; font-weight: 400;
  font-variant-numeric: tabular-nums; letter-spacing: -.5px;
}
/* The unit and "agora" ride inside the big slot at reading size, so a countdown never
   grows wider than the "14:35" the slot was built for. */
.dep-time .unit { margin-left: 2px; font-size: 12px; font-weight: 500; letter-spacing: 0; }
.dep-time .soon { font-size: 16px; }
/* A suppressed train never left, so it falls back to its hour, at reading size so the
   destinations of every row still start at the same x. */
.dep-time .past { font-size: 17px; }
.dep-time .gone { display: block; font-size: 15px; line-height: 1.15; letter-spacing: 0; }
.dep-main { flex: 1; min-width: 0; }
/* "vai para" plus a long station name overflows 390px, and the destination is the
   one thing in the row that must not be cut, so it wraps instead of ellipsising. */
.dep-dest { display: block; font-size: 15px; }
.dep-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 2px; font-size: 12px; color: var(--on-surface-variant);
}
.dep-meta.err { color: var(--error); }
.clock { font-variant-numeric: tabular-nums; }
.dep-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.svc {
  padding: 1px 8px; border-radius: 8px;
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-size: 11px; font-weight: 500;
}
/* The bus line number is what the destination hangs off, so it sits inline with it
   rather than down on the meta line like the train service chip. */
.line {
  padding: 1px 8px; border-radius: 8px; margin-right: 2px;
  background: var(--primary-container); color: var(--on-primary-container);
  font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.tag {
  padding: 1px 8px; border-radius: 8px;
  background: var(--surface-container-highest); color: var(--on-surface-variant);
  font-size: 11px; font-weight: 500;
}

.tok { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tok.ontime { color: var(--ontime); }
.tok.late { color: var(--late); }
.tok.sup { color: var(--error); }

.dep.ontime .dep-time, .dep.ontime .dep-dest { color: var(--ontime); }
.dep.late .dep-time, .dep.late .dep-dest { color: var(--late); }
.dep.sup .dep-time, .dep.sup .dep-dest { text-decoration: line-through; color: var(--error); }
.dep.sup .dep-meta { text-decoration: line-through; }

.foot { margin: 16px 4px 0; font-size: 12px; color: var(--on-surface-variant); }

/* ---------- bottom navigation, same shape as the Rock Band site ---------- */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  display: flex; background: var(--surface-container);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--on-surface-variant); padding-top: 12px;
}
.nav-pill {
  width: 64px; height: 32px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s var(--ease);
}
.nav-item.on .nav-pill { background: var(--secondary-container); }
.nav-item.on { color: var(--on-surface); }
.nav-item.on .msym { color: var(--on-secondary-container); }
.nav-label { font-size: 12px; font-weight: 500; }
/* The bar only exists on the favourites screen, so only that screen pays for it. */
#viewHome { padding-bottom: var(--nav-h); }

/* ---------- picker ---------- */
.searchwrap {
  position: sticky; top: 64px; z-index: 9;
  background: var(--surface); padding: 4px 0 8px;
}
.searchbar {
  display: flex; align-items: center; gap: 4px; height: 56px;
  background: var(--surface-container-high); border-radius: 28px; padding: 0 8px 0 16px;
}
.searchbar .msym.lead { color: var(--on-surface-variant); }
.searchbar input {
  flex: 1; min-width: 0; height: 100%; border: none; background: transparent;
  color: var(--on-surface); font-size: 16px; outline: none;
}
.searchbar input::placeholder { color: var(--on-surface-variant); }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.group { margin-top: 16px; }
.group h2 {
  margin: 0 0 4px 4px; font-size: 13px; font-weight: 500; letter-spacing: .5px;
  color: var(--primary); text-transform: uppercase;
}
.group .hint { margin: 0 4px 8px; font-size: 12px; line-height: 1.4; color: var(--on-surface-variant); }
.pick {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 56px; padding: 0 16px; margin-bottom: 2px;
  border: none; border-radius: 16px; cursor: pointer;
  background: var(--surface-container-low); color: var(--on-surface);
  font: inherit; font-size: 15px; text-align: left;
}
.pick span { flex: 1; min-width: 0; }
.pick small { display: block; margin-top: 2px; font-size: 12px; color: var(--on-surface-variant); }
.pick.on small { color: inherit; opacity: .75; }
.pick .msym { font-size: 20px; color: var(--outline); }
.pick.on { background: var(--secondary-container); color: var(--on-secondary-container); }
.pick.on .msym { color: var(--primary); }
.nores { padding: 32px 4px; color: var(--on-surface-variant); }

/* ---------- extended FAB ---------- */
/* In the app bar, where the row is empty anyway: over the list it covered a card and
   needed a word to explain itself, and up here the glyph is the whole label. */
.fab {
  width: 44px; height: 44px; border-radius: 14px; flex: none; margin-right: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  background: var(--primary-container); color: var(--on-primary-container);
}

@media (min-width: 700px) {
  .appbar { padding-left: max(16px, calc((100vw - 560px) / 2)); }
}
