/* בוסבוס — kid-friendly RTL transit dashboard.
   Big touch targets, high contrast, playful. Light + dark aware. */
:root {
  --bg: #eef4ff;
  --card: #ffffff;
  --ink: #16233a;
  --muted: #5c6b85;
  --brand: #1b6ef3;
  --brand-ink: #ffffff;
  --good: #16a34a;
  --warn: #ea8a00;
  --hot: #e23b3b;
  --star: #f5b301;
  --line-badge: #1b6ef3;
  --shadow: 0 6px 20px rgba(20, 40, 90, .12);
  --radius: 22px;
  --tap: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1626; --card: #1a2338; --ink: #eaf1ff; --muted: #9fb0cf;
    --brand: #4d92ff; --shadow: 0 6px 22px rgba(0,0,0,.45); --line-badge: #4d92ff;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Rubik", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 20px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 900px; margin: 0 auto; padding: 14px 14px 90px; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 6px 16px;
}
.topbar .clock { font-size: 2.1rem; font-weight: 800; letter-spacing: 1px; }
.topbar .date { color: var(--muted); font-weight: 600; }
.topbar .spacer { flex: 1; }
/* where the board thinks it is — small, but tappable, because every walk-time
   is measured from it and an indoor fix can be a street off */
.addrline {
  display: block; margin-top: 2px; padding: 2px 8px 2px 0;
  border: none; background: none; font: inherit; color: var(--muted);
  font-size: .8rem; font-weight: 600; cursor: pointer; text-align: start;
  max-width: 42vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-radius: 8px; min-height: 32px;
}
.addrline:hover { background: rgba(120,140,180,.14); color: var(--ink); }
.addrline:active { transform: scale(.97); }
.iconbtn {
  border: none; background: var(--card); color: var(--ink);
  width: var(--tap); height: var(--tap); border-radius: 50%;
  font-size: 1.7rem; box-shadow: var(--shadow); cursor: pointer;
  display: grid; place-items: center;
}
.iconbtn:active { transform: scale(.94); }
/* Five of these plus the clock need 368px of a 360px phone's 332px, and the
   overflow is not survivable: it scrolls the whole document sideways, and in RTL
   a scrolled document drags every position:fixed bottom sheet 22–68px off to the
   left with it, cutting the side the Hebrew starts on. So below a phone's width
   the bar stops being one line — the clock/date/address take the first row and
   the five buttons get the second, at the reduced (but still thumb-sized) 50px.
   Shrinking only the ones in the top bar, and only there, keeps every other
   button in the app at the size a six-year-old can hit. */
@media (max-width: 480px) {
  .topbar { gap: 8px 6px; flex-wrap: wrap; }
  /* the identity block takes a whole row, so the five buttons never split 4+1 */
  .topbar > div:first-child { flex: 1 0 100%; min-width: 0; }
  .topbar .spacer { display: none; }
  .topbar .iconbtn { width: 50px; height: 50px; font-size: 1.4rem; }
  .topbar .clock { font-size: 1.8rem; }
  /* 42vw was sized against a bar that had to share its row; now it owns one */
  .addrline { max-width: 100%; }
}

/* ---- headings ---- */
/* GTFS names are one long token ("...כרמלית/הכרמל-תל אביב יפו<->מסוף") with no
   space to break at, so on a 320px phone a heading that may only wrap has to be
   allowed to break mid-token instead of painting past its box. */
h1.big { font-size: 1.7rem; margin: 6px 4px 14px; overflow-wrap: anywhere; }
h2.sec { font-size: 1.25rem; margin: 22px 4px 10px; color: var(--muted); }

/* ---- cards & buttons ---- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 22px; border-radius: 18px; border: none;
  font-size: 1.15rem; font-weight: 700; cursor: pointer;
  background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow);
}
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.wide { width: 100%; }
.btn:active { transform: scale(.97); }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- kid chooser ---- */
.kidgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.kidcard {
  border: none; cursor: pointer; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 10px; text-align: center; position: relative;
  border: 4px solid transparent;
}
.kidcard .face { font-size: 3.4rem; line-height: 1; }
.kidcard .kname { font-size: 1.25rem; font-weight: 800; margin-top: 8px; }
.kidcard.sel { border-color: var(--brand); }
.kidcard:active { transform: scale(.96); }

/* ---- chores ---- */
.chore {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: var(--tap); padding: 8px 10px; border-radius: 16px;
  border: none; background: transparent; color: var(--ink);
  font-size: 1.2rem; cursor: pointer; text-align: start;
}
.chore + .chore { border-top: 2px dashed rgba(120,140,180,.22); }
.chore .box {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  border: 3px solid var(--brand); display: grid; place-items: center;
  font-size: 1.4rem; color: #fff;
}
.chore.done .box { background: var(--good); border-color: var(--good); }
.chore.done .txt { text-decoration: line-through; color: var(--muted); }
.chore .txt { flex: 1; font-weight: 600; }
.progress { font-weight: 800; color: var(--good); }
.cheer { text-align: center; font-size: 1.3rem; font-weight: 800; color: var(--good); padding: 8px; }

/* ---- alarm board ---- */
.alarm {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  padding: 14px; border-radius: 18px; margin-bottom: 10px;
  background: linear-gradient(180deg, rgba(27,110,243,.10), rgba(27,110,243,.02));
}
.alarm.active { outline: 3px solid var(--brand); }
.alarm.soon { background: linear-gradient(180deg, rgba(226,59,59,.16), rgba(226,59,59,.03)); }
.linebadge {
  min-width: 66px; height: 66px; padding: 0 10px; border-radius: 16px;
  background: var(--line-badge); color: #fff; font-weight: 900; font-size: 1.6rem;
  display: grid; place-items: center; flex: 0 0 auto;
}
.linebadge.dim { background: var(--muted); opacity: .75; }
.alarm .info { flex: 1; min-width: 0; }
.alarm .info .to { color: var(--muted); font-weight: 600; font-size: .95rem; }
.alarm .info .stop { font-weight: 700; }
.eta { text-align: center; flex: 0 0 auto; }
.eta .n { font-size: 2.3rem; font-weight: 900; line-height: 1; }
.eta .u { color: var(--muted); font-weight: 700; font-size: .9rem; }
.eta.hot .n { color: var(--hot); }
.eta.mid .n { color: var(--warn); }
.eta.far .n { color: var(--good); }

/* ---- lists (search / arrivals) ---- */
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: var(--tap); padding: 10px 12px; border: none; background: transparent;
  color: var(--ink); cursor: pointer; text-align: start; border-radius: 14px;
  /* a row is allowed to become two rows rather than crush its own text */
  flex-wrap: wrap; row-gap: 6px;
}
.row + .row { border-top: 1px solid rgba(120,140,180,.16); }
/* controls that hand off to another app are <a>, not <button>: they carry a
   real geo:/https href, so the tap is an ordinary navigation the OS can route
   to its app chooser. Nothing else about them changes. */
a.row, a.chip, .leavebanner a.mutebtn { text-decoration: none; }
a.chip, .leavebanner a.mutebtn { display: inline-block; }
.row:active { background: rgba(27,110,243,.08); }
/* 6rem of basis, not 0: .grow is the only child that can shrink, so with a zero
   basis a row carrying a badge, a clock and two buttons hands it exactly what is
   left over — which on a 360px phone is nothing, and the line's destination
   silently stops being rendered at all. With a floor it keeps its words and the
   trailing actions wrap instead. */
.row .grow { flex: 1 1 6rem; min-width: 0; }
.row .title { font-weight: 700; }
.row .sub { color: var(--muted); font-size: .95rem; }
.row .chev { color: var(--muted); font-size: 1.4rem; }
/* the row's trailing buttons, kept together so they wrap as a pair and never
   split 1-and-1 across two lines; margin-auto parks them at the far end whether
   they end up beside the text or under it */
.rowacts {
  display: flex; align-items: center; gap: 12px;
  flex: 0 0 auto; margin-inline-start: auto;
}
/* A row carrying a clock has to keep it on the first line — it is half the
   sentence ("קו 189, בעוד 4 דקות"). A row without one doesn't, so there the
   text is worth a whole line and the buttons can drop below it. Browsers
   without :has() just keep the 6rem floor, which is the old behaviour. */
@media (max-width: 480px) {
  .row:not(:has(.eta)) .grow { flex-basis: 9rem; }
  /* once they are on a line of their own they are a subordinate row, and at the
     full 60px twelve arrivals become a very long scroll for no extra reach */
  .rowacts .iconbtn { width: 48px; height: 48px; font-size: 1.35rem; }
}
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- search box ---- */
.searchbox { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.searchbox input {
  /* min-width:0 or the placeholder sets a floor the flex item refuses to go
     under, and on a 320px phone the box pushes the whole page sideways */
  flex: 1; min-width: 0;
  min-height: var(--tap); border-radius: 18px; border: 3px solid transparent;
  background: var(--card); color: var(--ink); padding: 0 18px; font-size: 1.2rem;
  box-shadow: var(--shadow); outline: none;
}
.searchbox input:focus { border-color: var(--brand); }

/* ---- misc ---- */
/* 44px, not the glyph's own 35: a star is one of the few things on a stop screen
   a child aims at, and it sits between two other tap targets */
.star {
  background: none; border: none; cursor: pointer; font-size: 1.7rem;
  color: #cbd4e6; flex: 0 0 auto;
  min-width: 44px; min-height: 44px; padding: 0;
}
.star.on { color: var(--star); }
.muted { color: var(--muted); }
.center { text-align: center; }
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; background: rgba(27,110,243,.12); color: var(--brand); font-weight: 700; font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .big { font-size: 3rem; }
.spin { text-align: center; padding: 20px; color: var(--muted); }
.backbtn { margin-bottom: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 2px solid var(--brand); background: transparent; color: var(--brand);
  border-radius: 999px; padding: 8px 16px; font-weight: 700; cursor: pointer; font-size: 1rem;
  /* the day-picker is seven of these in a row and they were landing at 38px */
  min-height: 44px;
}
.chip.on { background: var(--brand); color: #fff; }
.warnbox {
  margin-top: 10px; padding: 12px 14px; border-radius: 14px; font-weight: 700;
  background: rgba(234,138,0,.14); color: var(--ink); border: 2px solid var(--warn);
}
.warnbox .sub { color: var(--muted); font-weight: 600; font-size: .95rem; }
label.fld { display: block; font-weight: 700; margin: 12px 0 6px; }
input.txt, select.txt, textarea.txt {
  width: 100%; min-height: 52px; border-radius: 14px; border: 2px solid rgba(120,140,180,.3);
  background: var(--card); color: var(--ink); padding: 0 14px; font-size: 1.1rem;
}
/* a multi-line box needs the padding a single-line one gets from line-height,
   and must not be draggable sideways out of an RTL sheet */
textarea.area {
  padding: 12px 14px; line-height: 1.5; resize: vertical; font: inherit; font-size: 1.1rem;
}
.time2 { display: flex; gap: 10px; align-items: center; }
.toast {
  position: fixed; inset-block-end: 20px; inset-inline: 20px; margin: auto; max-width: 500px;
  background: var(--ink); color: var(--bg); padding: 14px 18px; border-radius: 16px;
  text-align: center; font-weight: 700; box-shadow: var(--shadow); z-index: 50;
}
/* one kid's buses on the shared board: shared frame + tint, so it's obvious at
   a glance that these all belong to the same child */
.kidgroup {
  border: 3px solid; border-radius: 22px; padding: 10px;
  margin-bottom: 16px;
}
.kidgrouphead {
  display: inline-block; color: #fff; font-weight: 900; font-size: 1.15rem;
  border-radius: 999px; padding: 5px 18px; margin: 2px 4px 10px;
}
/* cards sit ON the group tint, so they read as contained by it */
.kidgroup .alarm { background: var(--card); margin-bottom: 8px; }
.kidgroup .alarm:last-child { margin-bottom: 2px; }

/* The note under the ETA. A tracked bus is the norm — it gets no label at all —
   and the three exceptions are deliberately NOT one shared colour: "לפי לוח
   הזמנים" is ordinary and must read as calm grey-blue, while "אין דיווח" is the
   one that should catch an eye across a kitchen. */
.accnote {
  display: inline-block; font-size: .72rem; font-weight: 800; white-space: nowrap;
  margin-top: 3px; padding: 1px 7px; border-radius: 999px;
}
.acc-aging { background: rgba(120,140,180,.18); color: var(--muted); }
.acc-sched { background: rgba(27,110,243,.14); color: var(--brand); }
.acc-lost { background: rgba(226,59,59,.16); color: var(--hot); }
.acc-unknown { background: rgba(120,140,180,.22); color: var(--muted); }

/* A countdown we can't stand behind still shows — hiding it would leave someone
   wondering where their bus went — but it must not read like a live one. */
.eta.dimmed .n, .eta.dimmed .u { opacity: .55; }
.to.warn { color: var(--hot); font-weight: 700; }

/* Weather, living inside the <h1> greeting where the old clock-driven ☀️ was.
   Deliberately not a card: it should read as the end of the sentence, so it
   inherits the heading's font and only lifts a background on hover/press. One
   tap opens the details sheet; with no location yet it degrades to a ❓ whose
   tap triggers the permission prompt. */
.wxchip {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; color: inherit; font: inherit;
  padding: 2px 8px; margin-inline-start: 6px; border-radius: 14px;
  cursor: pointer; vertical-align: baseline;
}
.wxchip:hover { background: rgba(120,140,180,.14); }
.wxchip:active { transform: scale(.94); }
.wxchip .wxi { font-size: 1.15em; line-height: 1; }
/* a touch smaller than the greeting: the sky is the headline, the number rides along */
.wxchip .wxdeg { font-size: .82em; font-weight: 800; }
.wxchip.ask { color: var(--muted); }
/* the ❓ is an ask, not decoration — breathe so it reads as tappable */
.wxchip.ask .wxi { animation: wxpulse 2.4s ease-in-out infinite; }
@keyframes wxpulse { 50% { opacity: .45; } }

/* weather details sheet */
.wxbig { display: flex; align-items: center; gap: 16px; padding: 4px 6px 14px; }
.wxrow { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.wxrow + .wxrow { border-top: 1px solid rgba(120,140,180,.16); }
.wxrow .grow { flex: 1; min-width: 0; }
.wxrow .wxv { font-weight: 800; font-size: 1.15rem; }

/* "time to leave" beep banner on an alarm card */
.leavebanner {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  background: var(--warn); color: #fff; font-weight: 800; font-size: 1.15rem;
  padding: 10px 14px; border-radius: 14px;
}
.leavebanner.now { background: var(--hot); animation: flash 1s steps(1) infinite; }
.leavebanner span { flex: 1; }
.leavebanner .mutebtn {
  border: none; background: rgba(255,255,255,.25); color: #fff; font-weight: 700;
  border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: .95rem;
  white-space: nowrap;
}
/* muted: reads as "off", and its label now offers the way back */
.leavebanner .mutebtn.muted { background: rgba(0,0,0,.28); }
@keyframes flash { 50% { filter: brightness(1.25); } }

/* an area-level answer is a neighbourhood, not an address — don't let it look settled */
.addrline.vague { color: var(--warn); }

/* on/off switch for a setting (sound alerts) */
.switch {
  border: 2px solid var(--muted); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 10px 22px; font-weight: 800; font-size: 1rem;
  cursor: pointer; min-width: 84px; flex: 0 0 auto;
}
.switch.on { background: var(--good); border-color: var(--good); color: #fff; }
.switch:active { transform: scale(.95); }

/* ---- installable app: the "add to home screen" banner ---- */
.installbar {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
  padding: 12px 14px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(27,110,243,.14), rgba(27,110,243,.06));
  border: 2px solid rgba(27,110,243,.28);
}
.installbar .ico { font-size: 1.8rem; line-height: 1; }
.installbar .grow { flex: 1; min-width: 0; }
.installbar .title { font-weight: 800; }
.installbar .sub { color: var(--muted); font-size: .9rem; }
.installbar .btn { padding: 10px 18px; font-size: 1rem; min-height: 0; }
/* the dismissal is a way out, not an offer — it must not outweigh the install */
.installbar .iconbtn { width: 40px; height: 40px; min-width: 40px; font-size: 1rem; box-shadow: none; background: transparent; color: var(--muted); }

/* ---- privacy / sources / disclaimer ---- */
.infoblock h3 { font-size: 1.05rem; margin: 16px 0 6px; }
.infoblock h3:first-child { margin-top: 2px; }
.bullets { margin: 0; padding-inline-start: 22px; color: var(--muted); }
.bullets li { font-size: .95rem; line-height: 1.45; margin-bottom: 6px; }
.bullets li:last-child { margin-bottom: 0; }

/* the same two sentences, quietly, at the foot of the board */
.footnote {
  margin-top: 26px; padding-top: 14px; text-align: center;
  border-top: 1px solid rgba(120,140,180,.22);
  color: var(--muted); font-size: .82rem; line-height: 1.6;
}
.linkbtn {
  background: none; border: none; cursor: pointer; padding: 10px 4px;
  color: var(--brand); font: inherit; font-size: .82rem; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
  min-height: 40px;
}

/* ---- trip planner (?v=plan) ---- */
/* The two endpoints read as one control: a green dot you leave from, a red one
   you arrive at, and a swap between them. */
.planpoint {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: var(--tap); padding: 10px 14px; border-radius: 16px;
  border: 2px solid rgba(120,140,180,.28); background: transparent;
  color: var(--ink); font: inherit; font-size: 1.15rem; font-weight: 700;
  cursor: pointer; text-align: start;
}
.planpoint:active { transform: scale(.985); }
.planpoint .dot { font-size: 1rem; flex: 0 0 auto; }
.planpoint .grow { flex: 1; min-width: 0; }
.planpoint .star { font-size: 1.5rem; }

/* the summary line: the lines you ride, then the total. RTL reads leftwards, so
   the separator between two lines is ← — the arrow that means "and then". */
.chainline { display: flex; align-items: center; gap: 10px; }
.chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.chainsep { color: var(--muted); font-weight: 900; font-size: 1.2rem; }
.chainwalk { color: var(--muted); font-weight: 700; font-size: .95rem; white-space: nowrap; }
.plantotal { font-size: 1.5rem; font-weight: 900; color: var(--good); white-space: nowrap; flex: 0 0 auto; }
.linebadge.sm { min-width: 0; height: 38px; padding: 0 12px; font-size: 1.05rem; border-radius: 12px; }
.linebadge.rail { background: var(--good); }

.planopt { padding: 0; overflow: hidden; }
.planhead { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.planhead .grow { flex: 1; min-width: 0; }
.planhead .chev { color: var(--muted); font-size: 1.5rem; flex: 0 0 auto; }
.planhead:active { background: rgba(27,110,243,.06); }
.plandetail { border-top: 1px solid rgba(120,140,180,.18); }

.planleg { display: flex; gap: 12px; padding: 12px 16px; align-items: flex-start; }
.planleg + .planleg { border-top: 1px solid rgba(120,140,180,.14); }
.planleg .planicon { font-size: 1.5rem; width: 34px; text-align: center; flex: 0 0 auto; }
.planleg .grow { flex: 1; min-width: 0; }
.planleg .sub { color: var(--muted); font-size: .95rem; }
/* a change is the moment a plan breaks, so it is the row that stands out */
.planleg.change { background: rgba(234,138,0,.10); }
.planleg.change .title { color: var(--warn); }
.planleg.walk, .planleg.more { background: rgba(120,140,180,.07); }

.livechip {
  padding: 3px 10px; border-radius: 999px; font-size: .85rem; font-weight: 800;
  background: rgba(226,59,59,.14); color: var(--hot); white-space: nowrap;
}

/* ---- the full timetable: hour once, its minutes across ---- */
.tt {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
  align-items: start; padding: 4px 10px 12px;
}
.tth {
  font-weight: 900; color: var(--brand); padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.tth::after { content: ':'; opacity: .5; }
.ttm { display: flex; flex-wrap: wrap; gap: 5px 6px; }
.ttm span {
  font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 8px; background: rgba(120,140,180,.14);
}
.ttwrap {
  grid-column: 1 / -1; margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed rgba(120,140,180,.35);
  color: var(--muted); font-size: .8rem; font-weight: 700;
}
