/* Preview layouts (/preview/a/, /preview/b/): load shedding first, the map on request. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f2f4f7; --text: #101828; --muted: #667085; --border: #e4e7ec;
  --accent: #fdb022; --off: #d92d20; --shedding: #912018; --overdue: #c11574; --partial: #f79009;
  --scheduled: #2e90fa; --restored: #12b76a; --unknown: #98a2b3; --estimate: #6941c6;
  --line-1: #2a78d6; --line-2: #eb6834; --line-3: #1baf7a; --line-4: #eda100;
  --line-5: #e87ba4; --line-6: #008300; --line-7: #4a3aa7; --line-8: #e34948;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c111d; --surface: #161b26; --surface-2: #1f242f; --text: #f5f5f6; --muted: #94969c; --border: #2a303c;
    --off: #f97066; --shedding: #e04f43; --overdue: #f670c7; --partial: #fdb022; --scheduled: #53b1fd; --restored: #32d583; --unknown: #61646c; --estimate: #b692f6;
    --line-1: #3987e5; --line-2: #d95926; --line-3: #199e70; --line-4: #c98500;
    --line-5: #d55181; --line-6: #008300; --line-7: #9085e9; --line-8: #e66767;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c111d; --surface: #161b26; --surface-2: #1f242f; --text: #f5f5f6; --muted: #94969c; --border: #2a303c;
  --off: #f97066; --shedding: #e04f43; --overdue: #f670c7; --partial: #fdb022; --scheduled: #53b1fd; --restored: #32d583; --unknown: #61646c; --estimate: #b692f6;
  --line-1: #3987e5; --line-2: #d95926; --line-3: #199e70; --line-4: #c98500;
  --line-5: #d55181; --line-6: #008300; --line-7: #9085e9; --line-8: #e66767;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
button { font: inherit; color: inherit; }
time, .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* Header */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.unofficial { margin: 0; padding: 5px 16px; padding-top: max(5px, env(safe-area-inset-top)); text-align: center; font-size: 12px; line-height: 1.35;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; color: inherit; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand-bg { fill: #101828; } .brand-bolt { fill: var(--accent); }
.brand b { font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand span { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.live { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); }
.live.on { color: var(--restored); } .live.on::before { background: var(--restored); }
.live.warn { color: var(--partial); } .live.warn::before { background: var(--partial); }

.wrap { max-width: 640px; margin: 0 auto; padding: 14px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.alerts:empty { display: none; }
.wrap.wide { max-width: 860px; }
.side { display: flex; flex-direction: column; gap: 14px; }

/* What this is: a note on the first visit */
dialog.intro { width: min(400px, calc(100vw - 32px)); }
.intro-in { padding: 24px 22px 20px; text-align: center; }
.intro-in svg { width: 44px; height: 44px; }
.intro-in h2 { margin: 12px 0 12px; font-size: 19px; }
.intro-in p { margin: 0 0 10px; color: var(--muted); }
.intro-in p b { color: var(--text); }
.intro-in .btn { width: 100%; margin-top: 8px; }

/* Your lines */
.mine { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mine-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mine-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--scheduled); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* A line or area named in a slot: a colour mark and a short name */
.ln { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--surface-2);
  font-size: 13px; font-weight: 600; white-space: nowrap; }
.ln i { width: 10px; height: 10px; border-radius: 3px; background: var(--lc, var(--muted)); flex: none; }
.ln.place { font-weight: 500; color: var(--muted); }
.ln > span { white-space: normal; }
.ln small { font-size: inherit; font-weight: 500; color: var(--muted); }
.ln.place i { display: none; }
.ln.dim { opacity: .55; }
.ln.tip { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ln.tip:hover, .ln.tip[aria-expanded="true"] { background: color-mix(in srgb, var(--lc) 16%, var(--surface-2)); }
.ln.tip:focus-visible { outline: 2px solid var(--scheduled); outline-offset: 2px; }

/* The areas on a line, shown when its name is tapped */
.line-pop { position: absolute; z-index: 1100; /* above the map's panes and controls */ padding: 10px 12px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(16, 24, 40, .16); font-size: 13px; }
.line-pop b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.line-pop b i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.line-pop p { margin: 6px 0 0; line-height: 1.45; }
.line-pop small { display: block; margin-top: 6px; color: var(--muted); }

/* The boxes for load shedding now: one per spell */
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

/* The headline: what load shedding means for you right now */
.hero { border-radius: 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.hero .kicker { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.hero .kicker::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.hero .big { margin: 6px 0 2px; font-size: 26px; line-height: 1.1; font-weight: 750; letter-spacing: -.02em; }
.hero .big small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hero .label { margin-top: 6px; font-size: 14px; color: var(--muted); }
.hero .sub { margin-top: 6px; font-size: 14px; color: var(--muted); }
/* The time back and the time to go side by side, the same size, at the top. */
.hero .stats { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.hero .stats b { font-size: 24px; line-height: 1.2; font-weight: 750; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
/* Its lines in even columns, names lined up (an area with no colour mark kept in step) */
.hero .who { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); gap: 6px; margin-top: 12px; }
.hero .who .ln { border-radius: 9px; white-space: normal; min-width: 0; }
.hero .who .ln.place { padding-left: 23px; }
.hero.ok { background: color-mix(in srgb, var(--restored) 8%, var(--surface)); border-color: color-mix(in srgb, var(--restored) 30%, var(--border)); }
.hero.ok .kicker { color: var(--restored); }
.hero.calm .kicker { color: var(--muted); }
.hero.shed { background: color-mix(in srgb, var(--shedding) 9%, var(--surface)); border-color: color-mix(in srgb, var(--shedding) 35%, var(--border)); }
.hero.shed .kicker { color: var(--shedding); }
.hero.over { background: color-mix(in srgb, var(--overdue) 9%, var(--surface)); border-color: color-mix(in srgb, var(--overdue) 35%, var(--border)); }
.hero.over .kicker { color: var(--overdue); }
.progress { height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--shedding) 15%, transparent); margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--shedding); border-radius: inherit; transition: width .6s; }

/* Unplanned trouble: kept small */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--off) 35%, var(--border)); font-size: 14px; }
.alert::before { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--off); flex: none; }
.alert b { font-weight: 650; }
.alert .sub { color: var(--muted); font-size: 13px; }
/* Line faults (src/lineissues.js): a whole line off or unstable, not load shedding. Tap for the details. */
.alert.fault { width: 100%; text-align: start; cursor: pointer; font: inherit; color: inherit; -webkit-tap-highlight-color: transparent;
  border-color: color-mix(in srgb, var(--off) 45%, var(--border)); background: color-mix(in srgb, var(--off) 6%, var(--surface)); }
.alert.fault.unstable { border-color: color-mix(in srgb, var(--partial) 55%, var(--border)); background: color-mix(in srgb, var(--partial) 8%, var(--surface)); }
.alert.fault.unstable::before { background: var(--partial); }
.alert.fault.mixed { border-color: color-mix(in srgb, var(--partial) 55%, var(--border)); background: color-mix(in srgb, var(--partial) 8%, var(--surface)); }
.alert.fault.mixed::before { background: var(--partial); }
.fault-mixed { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--partial) 12%, var(--surface)); }
.alert.fault.back { border-color: color-mix(in srgb, var(--restored) 40%, var(--border)); background: color-mix(in srgb, var(--restored) 7%, var(--surface)); }
.alert.fault.back::before { background: var(--restored); }
.alert.fault > div { flex: 1; min-width: 0; }
.alert.fault .ln { margin: 0 2px; }
.alert.fault .go { flex: none; color: var(--muted); font-size: 20px; line-height: 1; }
.alert.fault:focus-visible { outline: 2px solid var(--scheduled); outline-offset: 2px; }
.fault-lines { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.fault-q { border-inline-start: 3px solid var(--scheduled); padding: 2px 0; padding-inline-start: 10px; margin: 6px 0 10px; font-size: 14px; }
.fault-q time { display: block; font-size: 12px; color: var(--muted); }
.fault-h { margin: 4px 0 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fault-note { font-size: 13px; color: var(--muted); }
/* Estimates (src/estimate.js): the app's own reading of past patterns, never ZECO's. Dashed and in their
   own colour wherever they show, so they can't be taken for what was posted. */
.est-card { padding: 14px 16px; border-radius: 16px; border: 1.5px dashed color-mix(in srgb, var(--estimate) 60%, var(--border));
  background: color-mix(in srgb, var(--estimate) 6%, var(--surface)); }
.est-kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--estimate); }
.est-badge { padding: 2px 8px; border-radius: 999px; background: var(--estimate); color: var(--surface); }
.est-title { margin-top: 8px; font-size: 19px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.est-when { margin-top: 2px; font-size: 15px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.est-card .who { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.est-lead { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.est-why { margin-top: 8px; font-size: 14px; }
.est-why summary { cursor: pointer; font-weight: 600; color: var(--estimate); padding: 4px 0; }
.est-why ul { margin: 4px 0 8px; padding-inline-start: 18px; color: var(--muted); }
.est-why li { margin: 3px 0; }
.est-days { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.est-day { display: flex; flex-direction: column; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; color: var(--muted); }
.est-day b { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.est-day.evening, .est-day.both { border-color: color-mix(in srgb, var(--estimate) 45%, var(--border)); color: var(--text); }
.est-note { margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed color-mix(in srgb, var(--estimate) 35%, var(--border)); font-size: 12.5px; color: var(--muted); }
.est-note .link { font-size: 12.5px; padding: 0; }
.preview-note { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: color-mix(in srgb, var(--estimate) 12%, var(--surface)); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--estimate) 40%, var(--border)); }
.note { font-size: 13px; color: var(--muted); padding: 0 2px; }
.note .link { font-size: 13px; padding: 0; }

/* Slots */
.day + .day { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.day h3 { margin: 0 0 8px; font-size: 16px; display: flex; gap: 8px; align-items: baseline; }
.day h3 span { font-size: 13px; font-weight: 500; color: var(--muted); }
.slots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.slot { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; align-items: center; padding: 10px 12px;
  border-radius: 12px; background: var(--surface-2); border-inline-start: 4px solid var(--scheduled); }
.slot time { font-weight: 700; font-size: 17px; line-height: 1.25; }
.slot time span { font-weight: 500; font-size: 15px; color: var(--muted); }
.slot time.tbc { font-size: 15px; color: var(--muted); }
.slot .who { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.slot .why { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.slot .why.posted { overflow-wrap: anywhere; }
.slot .st { grid-column: 2; grid-row: 1; font-size: 13px; font-weight: 650; color: var(--muted); text-align: end; white-space: nowrap; }
.slot.now { border-inline-start-color: var(--shedding); background: color-mix(in srgb, var(--shedding) 9%, var(--surface)); }
.slot.now .st { color: var(--shedding); }
.slot.overdue { border-inline-start-color: var(--overdue); background: color-mix(in srgb, var(--overdue) 9%, var(--surface)); }
.slot.overdue .st { color: var(--overdue); }
.slot.ended { border-inline-start-color: var(--unknown); opacity: .75; }
.slot.ended time { font-weight: 600; }
.slot.uncertain { border-inline-start-color: var(--unknown); border-inline-start-style: dashed; background: var(--surface-2); }
.slot.uncertain .st { color: var(--muted); }
.slot.plan, .slot.tbc { border-inline-start-style: dashed; }
.slot.est { border: 1.5px dashed color-mix(in srgb, var(--estimate) 60%, var(--border)); background: color-mix(in srgb, var(--estimate) 6%, var(--surface)); }
.slot.est .st { color: var(--estimate); }
.slot.est time { font-weight: 600; }
.empty { margin: 0; color: var(--muted); }
.toggle-all { margin-top: 10px; }

/* Earlier (record) */
details.card > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; font-weight: 650; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; color: var(--muted); transition: transform .2s; }
details.card[open] > summary::after { transform: rotate(180deg); }
details.card > summary .muted { font-weight: 500; font-size: 13px; margin-left: auto; margin-right: 8px; }
details.card[open] > summary { margin-bottom: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 650; cursor: pointer; box-shadow: var(--shadow); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--text); color: var(--bg); border-color: transparent; }

footer.foot { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: 13px; color: var(--muted); padding-top: 6px; }
footer.foot a { color: inherit; }
footer.foot .link { color: inherit; font-weight: 400; font-size: 13px; padding: 0; text-decoration: underline; }
.promo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(90deg, #0e7490, #0369a1); color: #fff; text-decoration: none; font-size: 14px; font-weight: 500; box-shadow: 0 -4px 16px rgba(16, 24, 40, .18);
  /* Its own layer, so phone browsers keep it on the bottom edge while the address bar slides in and out. */
  transform: translateZ(0); -webkit-transform: translateZ(0); will-change: transform; }
.promo[hidden], body:has(> .map-view:not([hidden])) > .promo { display: none; }
body.has-promo .wrap { padding-bottom: 76px; }
.promo-brand { flex: none; padding: 4px 10px; border-radius: 999px; background: #fdb022; color: #101828; font-size: 13px; font-weight: 700; }
.promo-run { flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent); }
.promo-track { display: inline-flex; white-space: nowrap; animation: promo-scroll 24s linear infinite; }
.promo-track i { font-style: normal; color: #fdb022; margin: 0 14px; }
.promo:hover .promo-track { animation-play-state: paused; }
.promo-go { flex: none; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .2); font-size: 13px; font-weight: 700; }
@keyframes promo-scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .promo-track { animation: none; } }
.prose p { margin: 0 0 10px; }
.rate { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 12px; }
.rate button { padding: 9px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; font-size: 14px; }
.rate button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
#fb-text { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: inherit; font: inherit; resize: vertical; }
.fb-row { display: flex; align-items: center; gap: 12px; margin: 10px 0 8px; }
.fb-row .btn { box-shadow: none; padding: 10px 18px; }
.fb-row .btn:disabled { opacity: .6; }
.fb-msg { font-size: 13px; color: var(--muted); } .fb-msg.ok { color: var(--restored); } .fb-msg.err { color: var(--off); }

/* Layout B: tabs, day picker, timeline */
.tabs { position: sticky; top: 49px; z-index: 19; display: flex; gap: 4px; padding: 8px 16px; background: var(--bg); justify-content: center; }
.tabs .seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.tabs button { border: 0; background: none; padding: 7px 18px; border-radius: 9px; font-weight: 650; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.days { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.days::-webkit-scrollbar { display: none; }
/* Five days on a phone: a label of more than one word ("3 days ago") goes onto two lines before any is cut. */
.days button { flex: 1 1 auto; min-width: min-content; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 4px;
  cursor: pointer; text-align: center; }
.days button span { display: block; font-weight: 650; font-size: 14px; line-height: 1.2; }
.days button i { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.days button.has i { color: var(--scheduled); font-weight: 600; }
.days button.on { background: var(--text); color: var(--bg); border-color: transparent; }
.days button.on i { color: inherit; opacity: .8; }
/* The day picker inside the schedule card, under its heading. */
.days-in { margin-top: 10px; margin-bottom: 14px; }
@media (max-width: 380px) { .days { gap: 4px; } .days button { padding: 10px 2px; } .days button span { font-size: 13px; } }

.tl { --label: 104px; position: relative; }
.tl-axis { position: relative; height: 18px; margin-top: 8px; margin-left: var(--label); font-size: 11px; color: var(--muted); }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-axis span:first-child { transform: none; } .tl-axis span:last-child { transform: translateX(-100%); }
.tl-row { display: flex; align-items: center; min-height: 40px; border-top: 1px solid var(--border); }
.tl-label { width: var(--label); flex: none; padding-right: 8px; min-width: 0; }
.tl-label .ln { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; flex: 1; height: 40px;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--border) calc(25% - 1px) 25%); }
.tl-bar { position: absolute; top: 9px; height: 22px; border-radius: 6px; background: var(--scheduled); color: #fff; font-size: 11px; font-weight: 650;
  display: flex; align-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; min-width: 3px; }
.tl-bar.now, .tl-bar.overdue { background: var(--shedding); }
.tl-bar.ended { background: var(--unknown); }
/* Load shedding the owner marked unclear, with power reported back soon after the start (src/owner.js). */
.tl-bar.uncertain, .tl-key i.unsure { background: repeating-linear-gradient(135deg, var(--unknown) 0 5px, color-mix(in srgb, var(--unknown) 45%, transparent) 5px 10px); }
.tl-bar.plan, .tl-bar.tbc { background: transparent; border: 2px dashed var(--scheduled); color: var(--scheduled); }
.tl-bar.est, .tl-key i.est { background: color-mix(in srgb, var(--estimate) 14%, transparent); border: 2px dotted var(--estimate); }
.tl-bar.ext { background: repeating-linear-gradient(135deg, var(--overdue) 0 5px, color-mix(in srgb, var(--overdue) 55%, transparent) 5px 10px); }
.tl-bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar[data-tip] { cursor: pointer; }
.tl-tip { position: absolute; z-index: 3; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700; padding: 4px 9px;
  border-radius: 7px; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px rgb(0 0 0 / .2); font-variant-numeric: tabular-nums; }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--off); z-index: 2; }
.tl-now-tag { position: absolute; top: 0; transform: translateX(-50%); background: var(--off); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 5px; }
.tl-empty { padding: 14px 0 4px; color: var(--muted); }
.tl-none { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 8px; font-size: 12px; font-style: italic; color: var(--muted); white-space: nowrap; overflow: hidden; }
.nosched { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.slots + .nosched { padding-top: 10px; border-top: 1px dashed var(--border); }
.tl-key { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.tl-key i { display: inline-block; width: 14px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

/* Map: a sheet over the page (A) or its own tab (B) */
.map-sheet { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.map-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border); background: var(--surface); }
.map-view { position: relative; height: calc(100dvh - 130px); }
/* The map fills what is left under the note, header and tabs, however many lines the note takes. */
body:has(> .map-view:not([hidden])) { display: flex; flex-direction: column; height: 100dvh; }
body:has(> .map-view:not([hidden])) > .map-view { flex: 1; height: auto; min-height: 0; }
#map { flex: 1; min-height: 0; height: 100%; background: var(--surface-2); }
.map-key { position: absolute; left: 12px; bottom: 24px; z-index: 500; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); display: grid; gap: 3px; }
.map-key small { max-width: 190px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.map-key:empty { display: none; }
/* Across the top of the map, so nobody reads the lines as exact. */
.map-wrap { padding-top: 30px; }
.map-note { position: absolute; top: 0; left: 0; right: 0; z-index: 600; height: 30px; margin: 0; padding: 0 12px; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; white-space: nowrap; overflow: hidden; color: var(--text); background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); }
.map-note b { margin-right: 4px; }
.map-mode { position: absolute; top: 40px; right: 10px; z-index: 500; display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); }
.map-mode button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 650; color: var(--muted); cursor: pointer; }
.map-mode button.on { background: var(--text); color: var(--bg); }
.line-label { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--lc);
  border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; }
.line-label::before { display: none; }
.map-key i { display: inline-block; width: 16px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.map-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.leaflet-container { font: inherit; }
.leaflet-tile-pane { filter: saturate(.35) contrast(.95); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(.92) hue-rotate(180deg) saturate(.3) brightness(.85); } }
.pop h3 { margin: 0 0 4px; font-size: 14px; }
.pop .st { font-weight: 600; }

/* Line picker */
dialog.sheet { width: min(520px, calc(100vw - 24px)); max-height: min(80vh, 680px); border: 1px solid var(--border); border-radius: 18px; padding: 0;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
dialog.sheet::backdrop { background: rgba(16, 24, 40, .45); }
.sheet-in { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.sheet-head h2 { margin: 0; font-size: 17px; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.sheet-body { padding: 4px 16px 8px; overflow: auto; }
.sheet-body input[type="search"] { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: inherit; font: inherit; }
.pick { list-style: none; margin: 10px 0 0; padding: 0; }
.pick label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border-top: 1px solid var(--border); cursor: pointer; }
.pick input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--text); }
.pick small { display: block; color: var(--muted); font-size: 12px; }
.sheet-foot { display: flex; justify-content: space-between; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
.sheet-foot .btn { box-shadow: none; padding: 10px 16px; }

@media (min-width: 820px) {
  .tl { --label: 130px; }
}
@media (max-width: 819px) {
  .tl-axis { margin-left: 0; }
  .tl-row { flex-direction: column; align-items: stretch; min-height: 0; padding-top: 7px; }
  .tl-label { width: auto; padding: 0 0 3px; }
  .tl-label .ln { background: none; padding: 0; font-size: 13px; }
  .tl-track { flex: none; height: 30px; }
  .tl-bar { top: 4px; }
}
@media (max-width: 380px) {
  .hero .big, .hero .stats b { font-size: 22px; }
  .tl { --label: 88px; }
}
.unofficial { font-size: 13px; padding-top: max(7px, env(safe-area-inset-top)); padding-bottom: 7px; color: var(--text);
  background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.unofficial .link { padding: 0; font-size: inherit; font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 2px;
  display: inline-flex; align-items: center; gap: 4px; }
.unofficial .link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; flex: none; }

/* Lines in load shedding now flash on the map, with their areas. */
@keyframes flash { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
.leaflet-interactive.flash { animation: flash 0.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .leaflet-interactive.flash { animation-duration: 3s; } }
.map-note .link { padding: 0; font-size: inherit; color: var(--scheduled); }
.prose .link { padding: 0; font-size: inherit; }

/* Language picker (top right): a globe and the language's code, with the phone's own list over it. */
.bar-end { display: flex; align-items: center; gap: 8px; flex: none; }
.lang { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; margin-inline-end: -6px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.lang:hover, .lang:focus-within { background: var(--surface-2); color: var(--text); }
.lang svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: none; }
.lang select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; border: 0; }
html.i18n-wait body { visibility: hidden; }
/* Right to left (Arabic): the timeline, map and banner keep their left-to-right layout. */
[dir="rtl"] .tl, [dir="rtl"] .map-view, [dir="rtl"] .promo { direction: ltr; }
/* A slot's times read 09:00 – 12:00 as in the groups, on the right. */
[dir="rtl"] .slot time { direction: ltr; unicode-bidi: isolate; text-align: right; }

/* The one-time note about languages, under the globe at the top right, pointing at it. */
.lang-note { position: fixed; right: 12px; z-index: 40; width: min(330px, calc(100vw - 24px)); padding: 14px; border-radius: 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 12px 32px rgba(16, 24, 40, .22); }
.lang-note::before { content: ""; position: absolute; top: -7px; right: var(--arrow, 24px); width: 12px; height: 12px; background: var(--surface);
  border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg); }
.lang-note b { display: block; font-size: 15px; }
.lang-note p { margin: 4px 0 10px; font-size: 13.5px; color: var(--muted); }
.lang-note-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lang-note-list button { padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: inherit; font: inherit; font-size: 13.5px; cursor: pointer; }
.lang-note .btn { width: 100%; }
.lang.pulse { color: var(--text); background: var(--surface-2); box-shadow: 0 0 0 2px var(--accent); animation: lang-pulse 1.6s ease-in-out infinite; }
@keyframes lang-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .lang.pulse { animation: none; } }

/* Why? on a box under Load shedding now, and its sheet: the message(s) it came from. */
.hero .why-link { font-size: 13px; font-weight: 650; padding: 2px 0; }
.hero .kick-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#why .why-src { margin: 12px 0 4px; font-size: 13.5px; color: var(--muted); }
#why .why-src b { color: var(--text); }
#why blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--border); background: var(--surface-2); border-radius: 8px; white-space: pre-wrap; font-size: 14px; }
