/*
 * Monochrome design system (Uber Base-style): black and white, flat surfaces, hairline
 * borders, bold tight type. Colour is used only where it carries meaning: the four
 * status colours, dam warning colours, and blue for water.
 */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f6;
  --surface-3: #eeeeee;
  --text: #000000;
  --muted: #5e5e5e;
  --border: #e2e2e2;
  --accent: #000000;
  --on-accent: #ffffff;
  --link: #276ef1;
  --hero-1: #000000;
  --hero-2: #000000;
  --hero-text: #ffffff;
  --shadow: none;

  /* status colours: the only colour in the interface */
  --safe: #05944f;     --safe-soft: #e6f2ed;
  --alert: #ffc043;    --alert-soft: #fff6e0;   --alert-ink: #7a5a00;
  --ready: #ff6937;    --ready-soft: #ffefe9;
  --danger: #e11900;   --danger-soft: #fde9e7;
  --unknown: #afafaf;  --unknown-soft: #eeeeee;
  --dam-blue: #276ef1; --dam-orange: #ff6937; --dam-red: #e11900;

  /* illustrations: greyscale, with blue reserved for water */
  --water: #276ef1;     --water-2: #6a9cf5;  --water-soft: rgba(39, 110, 241, .25); --rain: #276ef1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #121212; --surface-2: #1c1c1c; --surface-3: #262626; --text: #ffffff; --muted: #afafaf; --border: #2e2e2e;
    --accent: #ffffff; --on-accent: #000000; --link: #6a9cf5; --hero-1: #000000; --hero-2: #000000;
    --safe-soft: #0b2a1c; --alert-soft: #2e2610; --alert-ink: #ffc043; --ready-soft: #2e1a12; --danger-soft: #2e100c; --unknown-soft: #242424; --water: #4d8af5; --water-2: #2d5fc0; --water-soft: rgba(77, 138, 245, .3);
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #121212; --surface-2: #1c1c1c; --surface-3: #262626; --text: #ffffff; --muted: #afafaf; --border: #2e2e2e;
  --accent: #ffffff; --on-accent: #000000; --link: #6a9cf5; --hero-1: #000000; --hero-2: #000000;
  --safe-soft: #0b2a1c; --alert-soft: #2e2610; --alert-ink: #ffc043; --ready-soft: #2e1a12; --danger-soft: #2e100c; --unknown-soft: #242424; --water: #4d8af5; --water-2: #2d5fc0; --water-soft: rgba(77, 138, 245, .3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 "Inter", "Noto Sans Malayalam", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-underline-offset: 3px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -.02em; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.small { font-size: 13px; }

/* ---------- Hero ---------- */
.hero { background: #000; color: #fff; padding: 14px 0 40px; overflow: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 26px; height: 26px; fill: #fff; }
.logo .wave { fill: none; stroke: #000; stroke-width: 2; stroke-linecap: round; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.call { display: inline-flex; align-items: center; gap: 6px; background: var(--danger); color: #fff; text-decoration: none; font-weight: 600; padding: 8px 16px; border-radius: 999px; font-size: 15px; }
.call b { font-size: 17px; }

.hero-body { max-width: 760px; margin: 36px 0 0; text-align: left; }
.hero-art { display: none; }
.hero-art svg { width: 100%; display: block; }
.ha-hill { fill: rgba(255, 255, 255, .1); }
.ha-house rect { fill: #f7efe3; } .ha-house path { fill: #e07a5f; }
.ha-bank { fill: rgba(255, 255, 255, .16); }
.ha-water path { fill: #63b6f7; animation: heroWave 3s linear infinite; }
.ha-rain line { stroke: #9fd0f7; stroke-width: 2; stroke-linecap: round; animation: fall 1s linear infinite; }
.ha-rain line:nth-child(2) { animation-delay: .25s; } .ha-rain line:nth-child(3) { animation-delay: .5s; } .ha-rain line:nth-child(4) { animation-delay: .75s; }
@keyframes heroWave { to { transform: translateX(-40px); } }
.hero h1 { font-size: clamp(34px, 6vw, 56px); font-weight: 700; letter-spacing: -.035em; line-height: 1.05; }
.hero-lead { margin: 14px 0 24px; color: #cbcbcb; font-size: 18px; max-width: 560px; }
.search { position: relative; display: flex; gap: 8px; background: #fff; border-radius: 10px; padding: 6px; max-width: 640px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 18px; font-weight: 500; padding: 12px 8px 12px 42px; color: #000; background: transparent; }
.search-icon { position: absolute; left: 18px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: #7a8796; stroke-width: 2; stroke-linecap: round; }
.btn { font: inherit; font-weight: 600; padding: 12px 22px; border-radius: 8px; border: 0; cursor: pointer; }
.btn.primary { background: #000; color: #fff; font-size: 17px; }
.btn:disabled { opacity: .65; cursor: progress; }
.quick { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; margin-top: 14px; }
#quickPlaces { display: contents; }
.chip { background: #1f1f1f; color: #fff; border: 1px solid #333; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 15px; font-weight: 500; }
.chip:hover { background: #333; }
.chip-geo { background: #fff; color: #000; border-color: #fff; font-weight: 600; }
.chip-geo:hover { background: #e2e2e2; }

/* ---------- Sub-navigation ---------- */
.subnav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 93%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.subnav-row { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.subnav-row::-webkit-scrollbar { display: none; }
.subnav a { flex: none; padding: 15px 12px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 15px; border-bottom: 2px solid transparent; }
.subnav a.active, .subnav a:hover { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Layout ---------- */
main { padding: 8px 16px 48px; }
.section { margin-top: 44px; }
.section h2 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; letter-spacing: -.03em; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 16px; }
.lead { margin: 6px 0 0; color: var(--muted); font-size: 16px; max-width: 680px; }
.section > .lead { margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { background: transparent; color: var(--text); border: 0; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.notice { margin-top: 24px; display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border-radius: 12px; padding: 14px 16px; font-size: 15px; color: var(--muted); }
.notice strong { color: var(--text); }
.notice-icon { font-size: 18px; line-height: 1.3; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; flex: none; }
.badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.badge.safe { background: var(--safe-soft); color: var(--safe); }
.badge.alert { background: var(--alert-soft); color: var(--alert-ink); }
.badge.ready { background: var(--ready-soft); color: var(--ready); }
.badge.danger { background: var(--danger); color: #fff; }
.badge.unknown { background: var(--unknown-soft); color: var(--muted); }
.badge.dam-blue { background: var(--dam-blue); color: #fff; }
.badge.dam-orange { background: var(--dam-orange); color: #fff; }
.badge.dam-red { background: var(--dam-red); color: #fff; }

/* ---------- Result ---------- */
.result { margin-top: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; scroll-margin-top: 64px; }
.result-loading { padding: 34px 20px; text-align: center; color: var(--muted); }
.result-loading p { margin: 10px 0 0; }
.loader { display: inline-flex; gap: 7px; }
.loader span { width: 12px; height: 12px; border-radius: 50%; background: var(--water); animation: bounce 1s ease-in-out infinite; }
.loader span:nth-child(2) { animation-delay: .15s; } .loader span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-10px); opacity: .5; } }
.result-head { display: flex; align-items: center; gap: 18px; padding: 20px 22px; background: var(--unknown-soft); position: relative; }
.result-head.safe { background: var(--safe-soft); } .result-head.alert { background: var(--alert-soft); }
.result-head.ready { background: var(--ready-soft); } .result-head.danger { background: var(--danger-soft); }
.result-head .meter { width: 150px; flex: none; }
.rh-text .place { font-size: 15px; color: var(--muted); }
.rh-text h2 { font-size: clamp(23px, 3.6vw, 30px); margin: 4px 0 6px; }
.rh-text p { margin: 0; font-size: 17px; }
.head-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; align-items: center; }
.close { background: transparent; border: 0; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; padding: 2px 8px; border-radius: 8px; }
.result > .tech { margin: 14px 22px 0; }
.scene-wrap { margin: 0; border-bottom: 1px solid var(--border); }
.scene-wrap svg { display: block; width: 100%; height: auto; }
.scene-wrap figcaption { padding: 12px 22px; font-size: 16px; background: var(--surface-2); }
.scene-key { display: block; margin-bottom: 4px; color: var(--muted); font-size: 14.5px; }
.k-danger { color: var(--danger); }
.upstream { display: flex; gap: 10px; margin: 16px 22px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--ready); font-size: 15.5px; }
.upstream > span { font-size: 22px; }
.explain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; padding: 16px 22px 0; }
.explain { display: flex; gap: 14px; align-items: flex-start; background: var(--surface-2); border-radius: 16px; padding: 14px; }
.explain h3 { font-size: 14px; color: var(--muted); font-weight: 600; }
.explain p { margin: 4px 0 0; font-size: 15px; }
.explain .week { font-weight: 600; }
.ex-art { width: 92px; flex: none; }
.ex-icon { font-size: 44px; line-height: 1; width: 56px; text-align: center; flex: none; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-4px); } }
.big-line { font-size: 19px !important; font-weight: 700; line-height: 1.3; margin: 2px 0 4px !important; }
.todo { padding: 18px 22px 4px; }
.todo h3 { font-size: 19px; margin-bottom: 10px; }
.todo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.todo li { display: flex; gap: 12px; align-items: center; font-size: 16.5px; background: var(--surface-2); padding: 10px 14px; border-radius: 12px; }
.todo li span { font-size: 24px; }
.fineprint { margin: 12px 22px 18px; font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }

/* ---------- Today on our rivers ---------- */
#updatedAt { margin-bottom: 16px; }
.river-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.river-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; border-top: 4px solid var(--unknown); }
.river-card.safe { border-top-color: var(--safe); } .river-card.alert { border-top-color: var(--alert); }
.river-card.ready { border-top-color: var(--ready); } .river-card.danger { border-top-color: var(--danger); }
.rc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rc-top h3 { font-size: 16px; color: var(--muted); font-weight: 600; }
.rc-word { font-size: 34px; font-weight: 700; letter-spacing: -.03em; }
.river-card.safe .rc-word { color: var(--safe); } .river-card.alert .rc-word { color: var(--alert-ink); }
.river-card.ready .rc-word { color: var(--ready); } .river-card.danger .rc-word { color: var(--danger); }
.rc-lines { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.rc-lines li { display: flex; gap: 10px; font-size: 16px; }
.rc-lines li > span { font-size: 20px; line-height: 1.3; }
.rc-link { font-weight: 600; text-decoration: none; }
.skeleton-text { color: var(--muted); animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .4; } }

/* ---------- Cards (towns, dams) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-top > div { min-width: 0; }
.card h3 { font-size: 19px; }
.sub { font-size: 14px; color: var(--muted); }
p.sub { margin: 8px 0 0; }
.card .big-line { margin: 10px 0 6px !important; font-size: 17px !important; }
.trend { font-size: 14.5px; font-weight: 600; color: var(--muted); }
.trend.rising { color: var(--ready); } .trend.falling { color: var(--safe); }

.town-main { display: flex; gap: 14px; }
.town-art { width: 84px; flex: none; }
.town-art svg { width: 100%; display: block; }
.town-body { flex: 1; min-width: 0; }
.town-week { margin-top: 10px; font-size: 14.5px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; gap: 6px; }

.card.dam { display: flex; flex-direction: column; gap: 4px; }

.dam-gates { margin: 0; font-size: 15.5px; display: flex; gap: 8px; align-items: center; }
.dam-gates::before { content: "🚪"; }
.dam-gates.open::before { content: "💧"; }
.dam-alert { margin: 8px 0 0; font-size: 14.5px; border-radius: 10px; padding: 8px 10px; border-left: 4px solid; background: var(--surface-2); }
.dam-alert.blue { border-color: var(--dam-blue); } .dam-alert.orange { border-color: var(--dam-orange); } .dam-alert.red { border-color: var(--dam-red); }

/* ---------- Water flow diagram ---------- */

.card.dam.missing { opacity: .85; border-style: dashed; }
.dam-missing { height: 90px; display: grid; place-items: center; font-size: 44px; background: var(--surface-2); border-radius: 12px; margin-bottom: 8px; }

/* ---------- Dam fill graph ---------- */
.fill { margin: 10px 0 6px; }
.fill-words { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 17px; }
.fill-pct { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--water); }
.fill-bar { position: relative; height: 16px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 6px; }
.fill-bar > i { position: absolute; inset: 0 auto 0 0; width: var(--pct); background: linear-gradient(90deg, var(--water-2), var(--water)); border-radius: 8px; animation: grow 1.4s cubic-bezier(.2, .7, .25, 1) both; }
.fill-bar .q { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--surface); opacity: .7; }
.fill-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 3px; }
@keyframes grow { from { width: 0; } }

/* ---------- Technical details (eye button) ---------- */
.card-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.tech-toggle { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: background .2s, color .2s; }
.tech-toggle:hover { color: var(--text); }
.tech-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tech-toggle .slash { display: none; }
.tech-toggle[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tech-toggle[aria-expanded="true"] .slash { display: inline; }
.tech { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--border); font-size: 13.5px; font-variant-numeric: tabular-nums; animation: techIn .25s ease-out; }
@keyframes techIn { from { opacity: 0; transform: translateY(-4px); } }
.tech-head { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tech-note { font-weight: 600; text-transform: none; letter-spacing: 0; font-style: italic; color: var(--alert-ink); }
.tech-sub { font-weight: 700; font-size: 13px; margin: 12px 0 4px; }
.tech-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; }
.tech-grid dt { color: var(--muted); }
.tech-grid dd { margin: 0; text-align: right; font-weight: 600; }
.tech-grid dd .muted { display: block; font-size: 12px; }
.card-grid, .river-grid { align-items: start; }
.muted { color: var(--muted); font-weight: 400; }
.tech-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tech-table th, .tech-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.tech-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tech-table .num { text-align: right; }
.tech-table .total td { font-weight: 700; border-bottom: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tech-chart { margin: 10px 0 0; max-width: 520px; }
.tech-chart svg { width: 100%; display: block; background: var(--surface); border-radius: 10px; }
.tech-chart text { font-size: 9px; fill: var(--muted); }
.tech-chart .gl { stroke: var(--border); stroke-width: 1; }
.tech-chart .band { fill: var(--water-soft); opacity: .45; }
.tech-chart .median { stroke: var(--muted); stroke-dasharray: 4 3; }
.tech-chart .today { stroke: var(--text); stroke-dasharray: 2 2; opacity: .5; }
.tech-chart .obs, .tech-chart .fc { fill: none; stroke: var(--water); stroke-width: 2; }
.tech-chart .fc { stroke-dasharray: 5 3; }
.tech-chart figcaption { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.rain-bars { display: flex; gap: 8px; align-items: flex-end; }
.rb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; }
.rb-col { position: relative; width: 100%; max-width: 46px; height: 70px; background: var(--surface); border-radius: 6px; overflow: hidden; }
.rb-col i { position: absolute; left: 0; right: 0; bottom: 0; min-height: 2px; background: var(--water); animation: rise 1s ease-out both; --from: 70px; }
.rb.past { opacity: .55; }
.rb span { color: var(--muted); font-size: 11px; }

/* ---------- Colours legend ---------- */
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 10px; margin-top: 14px; }
.lg { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.lg .dot { width: 18px; height: 18px; border-radius: 50%; grid-row: span 2; align-self: start; margin-top: 3px; }
.lg b { font-size: 17px; }
.lg span:last-child { color: var(--muted); font-size: 14.5px; grid-column: 2; }
.lg.safe .dot { background: var(--safe); } .lg.alert .dot { background: var(--alert); }
.lg.ready .dot { background: var(--ready); } .lg.danger .dot { background: var(--danger); }
.lg.dam-blue .dot { background: var(--dam-blue); } .lg.dam-orange .dot { background: var(--dam-orange); } .lg.dam-red .dot { background: var(--dam-red); }
.sub-h { font-size: 19px; margin-top: 22px; }

/* ---------- Be ready ---------- */
.kit { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kit div { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; text-align: center; font-weight: 600; font-size: 15px; }
.kit span { display: block; font-size: 34px; margin-bottom: 4px; }
.dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; margin-top: 14px; }
.dos > div { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 18px; }
.do { border-top: 5px solid var(--safe) !important; } .dont { border-top: 5px solid var(--danger) !important; }
.dos h3 { font-size: 18px; }
.dos ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 5px; font-size: 16px; }

/* ---------- Footer ---------- */
.foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 15px; }
.foot p { margin: 0 0 8px; }
.helplines { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 18px; }
.helplines a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.helplines b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.helplines span { font-size: 14px; color: var(--muted); }

/* ================= Illustrations ================= */

.water { fill: var(--water); }
.water-front { fill: var(--water-2); opacity: .55; }
.flood { fill: var(--water); opacity: .82; }

.ha-rain line { stroke: var(--rain); stroke-width: 2.2; stroke-linecap: round; }

@keyframes fall { from { transform: translateY(-4px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(12px); opacity: 0; } }

.wave-move { animation: waveX 3.2s linear infinite; }
.wave-move.slow { animation-duration: 5s; animation-direction: reverse; }
@keyframes waveX { to { transform: translateX(var(--len)); } }
.rise { animation: rise 2s cubic-bezier(.2, .7, .25, 1) both; }
@keyframes rise { from { transform: translateY(var(--from)); } }

/* measuring pole */

/* glasses */
.glasses { width: 100%; display: block; }
.glasses .glass { fill: none; stroke: var(--muted); stroke-width: 2.5; stroke-linejoin: round; }
.glasses .water { fill: var(--water-2); }
.glasses .water.today { fill: var(--water); }
.glasses text { font-size: 12px; font-weight: 700; fill: var(--muted); }
.spill path { fill: none; stroke: var(--water); stroke-width: 3; stroke-linecap: round; }
.drip { fill: var(--water); animation: drip 1.2s ease-in infinite; }
.drip.d2 { animation-delay: .6s; }
@keyframes drip { from { transform: translateY(0); opacity: 1; } to { transform: translateY(40px); opacity: 0; } }

/* dam */

/* danger meter */
.meter { width: 100%; display: block; overflow: visible; }
.meter.sm { width: 110px; flex: none; }
.meter .zone { fill: none; stroke-width: 16; stroke-linecap: butt; opacity: .22; }
.meter .zone.on { opacity: 1; }
.meter .zone.safe { stroke: var(--safe); } .meter .zone.alert { stroke: var(--alert); }
.meter .zone.ready { stroke: var(--ready); } .meter .zone.danger { stroke: var(--danger); }
.meter .needle { transform-origin: 80px 80px; animation: needle 1.6s cubic-bezier(.3, 1.5, .5, 1) both; transform: rotate(var(--angle)); }
.meter .needle path, .meter .hub { fill: var(--text); }
@keyframes needle { from { transform: rotate(-90deg); } to { transform: rotate(var(--angle)); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .hero-body { text-align: left; }
  .hero-art { margin-left: 0; }
  .quick { justify-content: flex-start; }
  .search input { font-size: 16px; padding-left: 38px; }
  .btn.primary { padding: 12px 16px; }
  .result-head { flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; }
  .result-head .meter { width: 130px; }
  .scene-wrap figcaption, .todo { padding-left: 16px; padding-right: 16px; }
  .explain-grid { padding: 14px 16px 0; }
  .upstream { margin: 14px 16px 0; }
  .fineprint { margin: 12px 16px 16px; }
  .section h2 { font-size: 22px; }

  .town-main { gap: 10px; }
  .card-top { flex-wrap: wrap; }

  .town-art { width: 70px; }
}

@media (max-width: 400px) {
  .call-text { display: none; }
  .brand-name { font-size: 15px; }
}
@media (max-width: 400px) {
  .rc-top { flex-wrap: wrap; }
  .meter.sm { width: 92px; }
  .river-card, .card { padding-left: 12px; padding-right: 12px; }
}

/* ---------- Monochrome finishing ---------- */
.result-loading .loader span { background: var(--text); }
.lg, .kit div, .dos > div, .helplines a, .explain, .todo li, .fact, .town-week { border-radius: 12px; }
.badge { font-weight: 600; border-radius: 6px; }
.tech-toggle { background: var(--surface); }
.tech-toggle[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.fill-pct { color: var(--text); }
.fill-bar > i { background: var(--text); }
.rc-link { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.notice a, .foot a { color: var(--text); }
.do { border-top-color: var(--text) !important; } .dont { border-top-color: var(--danger) !important; }
.tech-table th, .tech-grid dt { color: var(--muted); }
/* Emoji stay as recognisable pictograms but in greyscale, so the page reads black and white. */
.kit span, .todo li span, .ex-icon, .rc-lines li > span, .town-week > span:first-child, .dam-gates::before, .upstream > span, .chip-geo, .call span, .dam-missing, .place, .notice-icon {
  filter: grayscale(1);
}

/* ---------- Refresh + timestamps ---------- */
.subnav-bar { display: flex; align-items: center; gap: 12px; }
.subnav-row { flex: 1; min-width: 0; }
.subnav-tools { flex: none; display: flex; align-items: center; gap: 10px; }
.data-time { font-size: 13px; color: var(--muted); white-space: nowrap; }
.refresh-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.refresh-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.refresh-btn:disabled { opacity: .6; cursor: progress; }
.refresh-btn.spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stamps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stamp { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 3px 10px 3px 8px; white-space: nowrap; }
.stamp svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.stamp.stale { color: var(--alert-ink); background: var(--alert-soft); }
#updatedAt { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 560px) {
  .data-time { display: none; }
  .refresh-btn span { display: none; }
  .refresh-btn { padding: 8px 10px; }
}

/* ================= Compact layout (less vertical scrolling) ================= */
/* Shorter header */
.hero { padding: 12px 0 22px; }
.hero-body { margin-top: 18px; }
.hero h1 { font-size: clamp(28px, 4.4vw, 44px); }
.hero-lead { margin: 8px 0 16px; font-size: 16.5px; }
.quick { margin-top: 10px; }
.chip { padding: 6px 14px; font-size: 14.5px; }

/* One tab at a time */
main { padding-top: 4px; }
.view { margin-top: 24px; }
.view[hidden] { display: none; }
.section-head { margin-bottom: 12px; }
.lead { font-size: 15.5px; }
.notice { margin-top: 16px; padding: 10px 14px; font-size: 14px; }

/* Denser cards */
.card-grid { gap: 12px; }
.card { padding: 14px; }
.card .big-line { margin: 6px 0 4px !important; }

.card.dam .sub:last-of-type { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dam-missing { height: 64px; font-size: 32px; }
.town-art { width: 70px; }
.town-week { margin-top: 8px; padding: 6px 10px; }
.rc-lines { margin: 10px 0; gap: 8px; }
.river-card { padding: 16px 18px; }
.swipe-hint { display: none; margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* Guide: colours and the emergency bag side by side */
.guide-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; margin-top: 12px; }
.guide-col h3 { font-size: 20px; margin-bottom: 4px; }
.guide-col .legend-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.guide-col .lg { padding: 10px 12px; }
.guide-col .lg b { font-size: 15.5px; }
.guide-col .lg span:last-child { font-size: 13.5px; }
.sub-h { font-size: 15px; margin: 16px 0 0; }
.guide-col .kit { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.guide-col .kit div { padding: 10px 6px; font-size: 13px; }
.guide-col .kit span { font-size: 26px; }
.guide-col .dos { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.guide-col .dos > div { padding: 12px 14px; }
.guide-col .dos ul { font-size: 14.5px; gap: 4px; }

/* Location result: picture on the left, explanation on the right (desktop) */
@media (min-width: 900px) {
  .result:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
  .result > .result-head, .result > .tech, .result > .fineprint, .result > .result-loading { grid-column: 1 / -1; }
  .result > .scene-wrap { grid-column: 1; grid-row: span 4; border-bottom: 0; border-right: 1px solid var(--border); align-self: stretch; }
  .result > .upstream, .result > .explain-grid, .result > .todo { grid-column: 2; }
  .result .explain-grid { grid-template-columns: 1fr; gap: 8px; padding-top: 14px; }
  .result .explain { padding: 10px 12px; }
  .result .ex-art { width: 70px; }
  .result .ex-icon { font-size: 32px; width: 40px; }
  .result .todo { padding-top: 14px; }
  .result .todo li { padding: 8px 12px; font-size: 15px; }
}

@media (max-width: 900px) {
  .guide-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* Phones: card lists become sideways-swipe rows instead of long stacks */
@media (max-width: 700px) {
  .card-grid, .river-grid {
    display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 86%;
    overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    margin: 0 -16px; padding: 2px 16px 6px; scroll-padding: 0 16px; scrollbar-width: none;
  }
  .card-grid::-webkit-scrollbar, .river-grid::-webkit-scrollbar { display: none; }
  .card-grid > *, .river-grid > * { scroll-snap-align: start; }

  .swipe-hint { display: block; }
  .guide-col .kit { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .guide-col .kit div { font-size: 11.5px; padding: 8px 4px; }
  .guide-col .legend-grid, .guide-col .dos { grid-template-columns: 1fr; }
  .hero-lead { font-size: 15px; }
}

/* Collapsed data notice */
.notice { display: block; padding: 0; }
.notice details { padding: 10px 14px; }
.notice summary { cursor: pointer; list-style: none; color: var(--text); font-size: 14.5px; }
.notice summary::-webkit-details-marker { display: none; }
.notice summary::after { content: " ›"; color: var(--muted); }
.notice details[open] summary::after { content: " ⌄"; }
.notice details p { margin: 8px 0 0; }

/* Compact footer */
.foot { margin-top: 32px; padding-top: 16px; font-size: 13px; }
.helplines { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.helplines a { flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 12px; }
.helplines b { font-size: 20px; }
.helplines span { font-size: 12px; line-height: 1.3; }
.foot p { margin: 0 0 6px; }

@media (max-width: 700px) {
  /* Quick towns: one sideways row instead of wrapping lines */
  .quick { flex-wrap: nowrap; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px; scrollbar-width: none; }
  .quick::-webkit-scrollbar { display: none; }
  .quick .chip { flex: none; }
  .hero-lead { display: none; }
  .hero-body { margin-top: 12px; }
  .hero h1 { margin-bottom: 14px; }
}
@media (min-width: 1100px) {
  #damCards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #townCards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #townCards .town-art { width: 56px; }
}

/* ================= Responsive width: use the screen ================= */
:root { --gutter: clamp(16px, 3.2vw, 48px); --page-max: 1840px; }
.wrap { max-width: var(--page-max); padding-left: var(--gutter); padding-right: var(--gutter); }
main { padding: 4px var(--gutter) 48px; }
@media (max-width: 700px) {
  .card-grid, .river-grid, .quick { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scroll-padding: 0 var(--gutter); }
}

/* Header: search on the left, "Right now" summary on the right (wide screens) */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px 48px; align-items: end; }
.hero-glance { display: none; }
@media (min-width: 1000px) {
  .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); }
  .hero-glance:not(:empty) { display: block; background: #141414; border: 1px solid #2a2a2a; border-radius: 14px; padding: 14px 16px; }
}
.hg-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: #afafaf; margin-bottom: 6px; }
.hg-row { display: grid; grid-template-columns: 12px auto 1fr; grid-template-areas: "dot river word" ". line line"; gap: 0 10px; align-items: center;
  padding: 10px 0; border-top: 1px solid #2a2a2a; color: #fff; text-decoration: none; }
.hg-row:first-of-type { border-top: 0; }
.hg-row:hover .hg-river { text-decoration: underline; }
.hg-dot { grid-area: dot; width: 10px; height: 10px; border-radius: 50%; background: var(--unknown); }
.hg-row.safe .hg-dot { background: var(--safe); } .hg-row.alert .hg-dot { background: var(--alert); }
.hg-row.ready .hg-dot { background: var(--ready); } .hg-row.danger .hg-dot { background: var(--danger); }
.hg-row.dams .hg-dot { background: #fff; border-radius: 2px; }
.hg-river { grid-area: river; font-weight: 600; font-size: 16px; }
.hg-word { grid-area: word; justify-self: end; font-weight: 700; font-size: 16px; }
.hg-row.alert .hg-word { color: var(--alert); } .hg-row.ready .hg-word { color: var(--ready); }
.hg-row.danger .hg-word { color: #ff6b5a; } .hg-row.safe .hg-word { color: #3ccf87; }
.hg-line { grid-area: line; font-size: 13.5px; color: #afafaf; }
.hg-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hg-foot .stamp { background: #1f1f1f; color: #afafaf; }

/* Today: two river cards + all dams at a glance */
@media (min-width: 1100px) {
  .river-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr); }
}
.river-card.dams-now { border-top-color: var(--text); }
.dams-now .rc-word { font-size: 26px; }
.ds-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 7px; }
.ds-list li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(40px, 1fr) 40px 72px; gap: 10px; align-items: center; font-size: 14px; }
.ds-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-stale { color: var(--alert-ink); }
.ds-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.ds-bar i { display: block; height: 100%; background: var(--text); border-radius: 4px; }
.ds-pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ds-gate { font-size: 12.5px; color: var(--muted); text-align: right; }
.ds-gate.open { color: var(--water); font-weight: 600; }

/* Card grids fill the row: as many columns as fit */
#damCards, #townCards { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
@media (min-width: 1100px) { #townCards .town-art { width: 60px; } }
@media (max-width: 700px) {
  #damCards, #townCards { grid-template-columns: none; }
}

/* Wide sections: let readable text run a little longer */
.lead { max-width: 820px; }

@media (min-width: 701px) and (max-width: 1099px) {
  .river-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .river-card.dams-now { grid-column: 1 / -1; }
  .dams-now .ds-list { grid-template-columns: 1fr 1fr; column-gap: 32px; }
}
.rc-word { font-size: clamp(26px, 2.6vw, 34px); white-space: nowrap; }

/* ================= Scale & spacing: smaller components, more white space ================= */
body { font-size: 15px; line-height: 1.55; }

/* Header */
.hero { padding: 14px 0 36px; }
.brand-name { font-size: 16px; }
.logo { width: 22px; height: 22px; }
.call { padding: 6px 14px; font-size: 13.5px; }
.call b { font-size: 15px; }
.hero-body { margin-top: 28px; }
.hero h1 { font-size: clamp(26px, 3.2vw, 40px); }
.hero-lead { font-size: 15.5px; margin: 10px 0 20px; }
.search { padding: 5px; max-width: 560px; }
.search input { font-size: 16px; padding: 9px 8px 9px 38px; }
.search-icon { width: 17px; height: 17px; left: 16px; }
.btn.primary { font-size: 15px; padding: 9px 18px; }
.quick { margin-top: 12px; gap: 6px; }
.chip { font-size: 13px; padding: 5px 12px; }
.hero-grid { gap: 24px 64px; }
.hero-glance:not(:empty) { padding: 12px 16px; }
.hg-row { padding: 8px 0; }
.hg-river, .hg-word { font-size: 14px; }
.hg-line { font-size: 12.5px; }

/* Tab bar */
.subnav a { font-size: 14px; padding: 13px 10px; }
.refresh-btn { font-size: 13px; padding: 6px 12px; }
.refresh-btn svg { width: 14px; height: 14px; }
.data-time { font-size: 12.5px; }

/* Sections: more air between blocks */
.view { margin-top: 40px; }
.section h2 { font-size: clamp(22px, 2.2vw, 28px); }
.section-head { margin-bottom: 20px; gap: 12px 32px; }
.lead { font-size: 14.5px; margin-top: 6px; }
#updatedAt { margin: 8px 0 20px; }
.notice { margin-top: 20px; }
.notice summary { font-size: 13.5px; }
.card-grid, .river-grid { gap: 20px; }
.seg button { font-size: 13.5px; padding: 6px 14px; }

/* Cards */
.card { padding: 18px; }
.card h3 { font-size: 16px; }
.sub { font-size: 12.5px; }
.card .big-line, .big-line { font-size: 15px !important; }
.badge { font-size: 12px; padding: 3px 9px; }
.badge::before { width: 7px; height: 7px; }
.tech-toggle { width: 30px; height: 30px; }
.tech-toggle svg { width: 16px; height: 16px; }
.stamps { gap: 6px; margin-top: 10px; }
.stamp { font-size: 11.5px; padding: 2px 9px 2px 7px; }
.trend { font-size: 13px; }
.town-week { font-size: 13.5px; }
.town-art, #townCards .town-art { width: 52px; }

/* River cards */
.river-card { padding: 20px 22px; }
.rc-top h3 { font-size: 13.5px; }
.rc-word { font-size: clamp(22px, 2vw, 28px); }
.meter.sm { width: 84px; }
.rc-lines { margin: 14px 0; gap: 10px; }
.rc-lines li { font-size: 14px; }
.rc-lines li > span { font-size: 16px; }
.rc-link { font-size: 14px; }
.ds-list { gap: 9px; margin: 14px 0; }
.ds-list li { font-size: 13px; }
.ds-bar { height: 6px; }

/* Dam cards */
.card.dam { gap: 6px; }

.fill { margin: 8px 0 4px; }
.fill-words { font-size: 14.5px; }
.fill-pct { font-size: 20px; }
.fill-bar { height: 10px; }
.fill-scale { font-size: 11px; }
.dam-gates { font-size: 13.5px; }
.dam-alert { font-size: 13px; }
p.sub { margin-top: 6px; }

/* Location result */
.result { margin-top: 28px; }
.result-head { padding: 20px 24px; gap: 20px; }
.result-head .meter { width: 120px; }
.rh-text .place { font-size: 13px; }
.rh-text h2 { font-size: clamp(20px, 2.2vw, 26px); }
.rh-text p { font-size: 15px; }
.scene-wrap figcaption { font-size: 14px; padding: 14px 24px; }
.explain h3 { font-size: 12.5px; }
.explain p { font-size: 14px; }
.todo h3 { font-size: 16px; }
.todo li { font-size: 14px; }
.todo li span { font-size: 18px; }

/* Flow + journey */

/* Guide */
.guide-grid { gap: 40px; margin-top: 16px; }
.guide-col h3 { font-size: 17px; }
.guide-col .legend-grid, .guide-col .kit, .guide-col .dos { gap: 10px; margin-top: 14px; }
.guide-col .lg b { font-size: 14px; }
.guide-col .lg span:last-child { font-size: 12.5px; }
.guide-col .kit div { font-size: 12.5px; }
.guide-col .kit span { font-size: 22px; }
.dos h3 { font-size: 15px; }
.guide-col .dos ul { font-size: 13.5px; }

/* Footer */
.foot { margin-top: 56px; padding-top: 24px; font-size: 12.5px; }
.helplines { gap: 12px; margin-bottom: 16px; }
.helplines b { font-size: 18px; }
.helplines span { font-size: 11.5px; }

@media (max-width: 700px) {
  .view { margin-top: 28px; }
  .card-grid, .river-grid { gap: 14px; }
  .result-head { padding: 18px; }
}
.hero h1 { font-size: clamp(26px, 2.8vw, 36px); }

/* ================= River map (Leaflet + OpenStreetMap) ================= */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.map-box { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
#riverMap { height: clamp(440px, 70vh, 780px); background: var(--surface-2); }
.map-side { display: grid; gap: 14px; }
.ms-river { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.ms-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.ms-top h3 { font-size: 16px; }
.ms-river p { margin: 6px 0 0; font-size: 13.5px; }
.ms-travel { font-size: 13px !important; color: var(--muted); border-left: 3px solid var(--text); padding-left: 10px; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; justify-self: start; }
.btn-ghost:hover { background: var(--surface-2); }

.leaflet-container { font-family: inherit; background: var(--surface-2); }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-bar a { color: var(--text); }
path.map-river { stroke: var(--water); stroke-linecap: round; stroke-linejoin: round; fill: none; opacity: .92; cursor: pointer; }
path.map-river.minor { opacity: .45; cursor: default; }
path.map-river.st-safe { stroke: var(--safe); } path.map-river.st-alert { stroke: var(--alert); }
path.map-river.st-ready { stroke: var(--ready); } path.map-river.st-danger { stroke: var(--danger); }
path.map-river:hover { opacity: 1; }
path.map-flow { stroke: #fff; fill: none; stroke-linecap: round; stroke-dasharray: 1 12; opacity: .85; animation: mapflow 1.1s linear infinite; }
@keyframes mapflow { to { stroke-dashoffset: -13; } }
path.map-town { fill: var(--unknown); fill-opacity: 1; stroke: var(--surface); }
path.map-town.st-safe { fill: var(--safe); } path.map-town.st-alert { fill: var(--alert); }
path.map-town.st-ready { fill: var(--ready); } path.map-town.st-danger { fill: var(--danger); }
path.map-you { fill: var(--text); fill-opacity: 1; stroke: var(--surface); }
.map-dam { display: block; width: 14px; height: 14px; background: var(--text); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--text); border-radius: 3px; }
.map-dam.alert-blue { border-color: var(--dam-blue); } .map-dam.alert-orange { border-color: var(--dam-orange); } .map-dam.alert-red { border-color: var(--dam-red); }
.map-dam.missing { background: var(--surface); box-shadow: 0 0 0 1px var(--muted); }
.leaflet-tooltip.map-label, .leaflet-tooltip.map-town-label { background: none; border: 0; box-shadow: none; padding: 0; color: var(--text);
  font-weight: 600; text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface), 0 0 3px var(--surface); }
.leaflet-tooltip.map-label::before, .leaflet-tooltip.map-town-label::before { display: none; }
.map-label.river-label { font-size: 12.5px; font-style: italic; color: var(--water); }
.map-label.water-label { font-size: 12px; font-style: italic; color: var(--muted); letter-spacing: .04em; }
.leaflet-tooltip.map-town-label { font-size: 11.5px; }
.leaflet-tooltip.map-tip, .leaflet-tooltip.map-you-label { background: var(--text); color: var(--bg); border: 0; border-radius: 6px; font-size: 12px; font-weight: 600; padding: 3px 8px; box-shadow: none; }
.leaflet-tooltip.map-tip::before, .leaflet-tooltip.map-you-label::before { border-top-color: var(--text); }
.map-popup .leaflet-popup-content-wrapper { border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.map-popup .leaflet-popup-tip { background: var(--surface); }
.map-popup .leaflet-popup-content { margin: 12px 14px; min-width: 210px; font-size: 13.5px; line-height: 1.45; }
.pop-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.pop-top b { font-size: 14.5px; }
.pop p { margin: 4px 0; }
.pop-week { font-weight: 600; }
.pop-fill { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.pop-fill b { font-size: 18px; }
.pop .fill-bar { height: 8px; margin: 4px 0 6px; }
.pop .stamps { margin-top: 8px; }
.pop-tech { margin-top: 8px; font-size: 12.5px; }
.pop-tech summary { cursor: pointer; font-weight: 600; }
.pop-tech .tech-grid { margin-top: 6px; }
.map-legend { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 12px; display: grid; gap: 4px; }
.ml-row { display: flex; align-items: center; gap: 8px; }
.ml-line { display: inline-block; width: 20px; height: 4px; border-radius: 2px; background: var(--water); }
.ml-line.st-safe { background: var(--safe); } .ml-line.st-alert { background: var(--alert); }
.ml-line.st-ready { background: var(--ready); } .ml-line.st-danger { background: var(--danger); }
.ml-width { display: inline-block; width: 20px; height: 10px; background: linear-gradient(90deg, var(--muted) 0 100%); clip-path: polygon(0 40%, 100% 0, 100% 100%, 0 60%); }
.ml-row .map-dam { width: 12px; height: 12px; border-width: 2px; }
.result-head .head-actions .btn-ghost { padding: 5px 12px; }

@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  #riverMap { height: 62vh; min-height: 380px; }
  .map-side { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
}
@media (max-width: 560px) {
  .result-head .head-actions .see-map { display: none; }
  .map-legend { font-size: 11px; padding: 6px 8px; }
}
.map-legend summary { cursor: pointer; font-weight: 600; list-style: none; }
.map-legend summary::-webkit-details-marker { display: none; }
.map-legend[open] summary { margin-bottom: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.map-legend:not([open]) { padding: 5px 10px; }

/* Open in Organic Maps */
.om-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px; border-radius: 999px; background: var(--text); color: var(--bg) !important; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.om-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.om-link:hover { opacity: .85; }
.ms-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ms-actions .om-link { margin-top: 0; }
.head-actions .om-link { margin-top: 0; padding: 5px 12px; }
@media (max-width: 560px) { .head-actions .om-link { display: none; } }

/* ================= Place-first layout ================= */
.top-links { display: flex; align-items: center; gap: 14px; }
.top-link { color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; }
.top-link:hover { text-decoration: underline; }
a.brand { color: #fff; text-decoration: none; }
.search-msg { color: #ffb4a8; font-size: 14px; margin: 10px 0 0; }

/* Home: only the search */
body.is-home .hero { padding-bottom: 12vh; }
body.is-home .hero-body { margin-top: 12vh; }
body.is-home .hero h1 { font-size: clamp(30px, 4.6vw, 52px); }
body.is-home .foot { margin-top: 32px; }
/* Dashboard: the header shrinks to a search bar for changing place */
body.is-dash .hero { padding-bottom: 16px; }
body.is-dash .hero-body { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; max-width: none; }
body.is-dash .hero h1, body.is-dash .hero-lead { display: none; }
body.is-dash .search { flex: 1 1 360px; max-width: 520px; }
body.is-dash .quick { margin-top: 0; }

/* Dashboard header */
.dash { margin-top: 24px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; }
.dh-kicker { font-size: 13.5px; color: var(--muted); }
.dash-head h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.03em; margin-top: 2px; }
.dh-actions { display: flex; align-items: center; gap: 8px; }

/* Calendar strip */
.cal { display: flex; align-items: center; gap: 8px; margin: 18px 0 20px; }
.cal-strip { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.cal-step { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.cal-today { flex: none; }
.cal-pick input { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.cal-day { flex: none; width: 50px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 7px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.cal-day:hover { border-color: var(--text); }
.cal-day.future { border-style: dashed; color: var(--muted); }
.cal-day.today { font-weight: 700; border-color: var(--text); }
.cal-day.on { background: var(--text); color: var(--bg); border-color: var(--text); border-style: solid; }
.cd-wd { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.cd-n { font-size: 17px; font-weight: 700; line-height: 1.1; }
.cd-m { font-size: 10px; color: inherit; opacity: .7; }
.cd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); margin-top: 2px; }
.cd-dot.safe { background: var(--safe); } .cd-dot.alert { background: var(--alert); } .cd-dot.ready { background: var(--ready); } .cd-dot.danger { background: var(--danger); }

/* Widgets */
.widgets { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: start; }
.w { grid-column: span 12; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.w-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.w-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.w-note { font-size: 13.5px; color: var(--muted); margin: 8px 0 0; }
.w-sub { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.w .tech { margin-top: 12px; }
@media (min-width: 1000px) {
  .w-status { grid-column: span 4; grid-row: 1; }
  .w-map { grid-column: 5 / span 8; grid-row: 1 / span 2; }
  .w-todo { grid-column: span 4; grid-row: 2; }
  .w-up, .w-down { grid-column: span 6; }
  .w-flow { grid-column: span 8; }
  .w-rain { grid-column: span 4; }
}
@media (min-width: 700px) and (max-width: 999px) {
  .w-status, .w-todo, .w-up, .w-down { grid-column: span 6; }
}

/* Status widget */
.ws-date { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.ws-main { display: flex; align-items: center; gap: 16px; }
.ws-main .meter { width: 116px; flex: none; }
.ws-word { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.ws-word.safe { color: var(--safe); } .ws-word.alert { color: var(--alert-ink); } .ws-word.ready { color: var(--ready); } .ws-word.danger { color: var(--danger); }
.ws-line { margin: 4px 0 0; font-size: 14px; }
.ws-amount { display: flex; align-items: center; gap: 12px; margin-top: 14px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.ws-glass { width: 76px; flex: none; }
.ws-where, .ws-ground { font-size: 13.5px; color: var(--muted); margin: 10px 0 0; }
.ws-where b { color: var(--text); }

/* What to do */
.todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.todo-list li { display: flex; gap: 10px; align-items: center; font-size: 14px; background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.todo-list li span { font-size: 18px; filter: grayscale(1); }

/* Map widget */
.w-map { padding: 16px; }
.w-map .map-box { height: clamp(380px, 58vh, 640px); }
.w-map #riverMap { height: 100%; }
path.map-river.faded { opacity: .22; }
path.map-flow.faded { display: none; }
.leaflet-tooltip.map-label.faded { opacity: .45; }
.ml-you { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--text); }

/* Upstream / downstream */
.ud-list { list-style: none; margin: 0; padding: 0; }
.ud-item { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.ud-item:first-child { border-top: 0; padding-top: 2px; }
.ud-icon { margin-top: 3px; }
.ud-icon.map-dam { width: 14px; height: 14px; border-width: 2px; }
.ud-icon.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--unknown); }
.ud-icon.dot.safe { background: var(--safe); } .ud-icon.dot.alert { background: var(--alert); } .ud-icon.dot.ready { background: var(--ready); } .ud-icon.dot.danger { background: var(--danger); }
.ud-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.ud-dist { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ud-fill { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-top: 4px; }
.ud-fill .ds-bar { width: 90px; flex: none; }
.ud-line { font-size: 13.5px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ud-line.open { color: var(--water); font-weight: 600; }
.ud-body .badge { margin-top: 5px; }

/* River water chart */
.flow-chart { width: 100%; height: auto; display: block; }
.fc-band { fill: var(--surface-3); }
.fc-med { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.fc-future { fill: var(--surface-2); opacity: .7; }
.fc-line { fill: none; stroke: var(--water); stroke-width: 2.5; stroke-linejoin: round; }
.fc-line.fc { stroke-dasharray: 6 4; }
.fc-today { stroke: var(--muted); stroke-dasharray: 2 3; }
.fc-sel { stroke: var(--text); stroke-width: 1.5; }
.fc-dot { fill: var(--text); stroke: var(--surface); stroke-width: 2; }
.fc-hit { fill: transparent; cursor: pointer; }
.fc-hit:hover { fill: var(--text); fill-opacity: .05; }
.flow-chart text { font-size: 11px; fill: var(--muted); }

/* Rain */
.wr-main { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 15px; }
.wr-icon { font-size: 30px; filter: grayscale(1); }
.rain-strip { display: grid; grid-template-columns: repeat(38, minmax(0, 1fr)); gap: 2px; height: 72px; align-items: end; }
.rs-bar { height: 100%; padding: 0; border: 0; background: transparent; display: flex; align-items: flex-end; cursor: pointer; border-radius: 2px; }
.rs-bar:hover { background: var(--surface-2); }
.rs-bar i { display: block; width: 100%; background: var(--water); border-radius: 2px 2px 0 0; }
.rs-bar.future i { opacity: .5; }
.rs-bar.on { background: var(--surface-3); }
.rs-bar.on i { background: var(--text); opacity: 1; }
.rs-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

.dash-note { font-size: 12.5px; color: var(--muted); margin: 18px 0 0; max-width: 900px; }
.dash-note a { color: var(--muted); }

@media (max-width: 700px) {
  .cal-today, .cal-pick { display: none; }
  .cal-day { width: 46px; }
  .widgets { gap: 14px; }
  .w { padding: 14px; }
  .w-map .map-box { height: 380px; }
  .dh-actions .data-time { display: none; }
  body.is-dash .quick { display: none; }
}
.dh-actions .om-link { margin-top: 0; padding: 7px 12px; }
.pop .om-link { margin-top: 8px; }

/* ================= Cartographic map style ================= */
/* Water on plain paper, one magenta accent. */
:root { --ink: #0b0b0b; --paper: #fbfaf7; --map-accent: #e4007c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ink: #e9e9e9; --paper: #111; --map-accent: #ff4fb0; } }
:root[data-theme="dark"] { --ink: #e9e9e9; --paper: #111; --map-accent: #ff4fb0; }

.w-map .leaflet-container { background: var(--paper); }
path.map-water { fill: var(--ink); fill-opacity: 1; stroke: var(--ink); stroke-width: .6; }
path.map-grid { stroke: var(--ink); stroke-opacity: .35; fill: none; }

/* Rivers: black ribbons; status only as an edge colour */
path.map-river, path.map-river.st-safe, path.map-river.st-alert, path.map-river.st-ready, path.map-river.st-danger { stroke: var(--ink); opacity: 1; }
path.map-river.minor { stroke: var(--ink); opacity: .75; }
path.map-river.faded { opacity: .28; }
path.map-edge { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .6; }
path.map-edge.st-alert { stroke: var(--alert); } path.map-edge.st-ready { stroke: var(--ready); } path.map-edge.st-danger { stroke: var(--danger); }
path.map-flow { stroke: var(--paper); stroke-dasharray: 1 15; opacity: .7; }

/* Markers */
.map-dam { background: var(--paper); border: 2.5px solid var(--ink); box-shadow: none; border-radius: 2px; width: 12px; height: 12px; }
.map-dam.alert-blue { border-color: var(--dam-blue); } .map-dam.alert-orange { border-color: var(--dam-orange); } .map-dam.alert-red { border-color: var(--dam-red); }
.map-dam.missing { border-style: dashed; border-color: var(--muted); }
path.map-town { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
path.map-town.st-alert { fill: var(--alert); } path.map-town.st-ready { fill: var(--ready); } path.map-town.st-danger { fill: var(--danger); }
path.map-you, path.map-you.st-safe, path.map-you.st-alert, path.map-you.st-ready, path.map-you.st-danger { fill: var(--map-accent); stroke: var(--paper); stroke-width: 3; }

/* Labels: italic river names, small spaced capitals for places */
.leaflet-tooltip.map-label, .leaflet-tooltip.map-town-label { text-shadow: 0 0 2px var(--paper), 0 0 2px var(--paper), 0 0 3px var(--paper), 0 0 4px var(--paper); }
.map-label.river-label { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400; font-size: 13px; color: var(--ink); letter-spacing: .02em; }
.map-label.water-label { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400; font-size: 12.5px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.leaflet-tooltip.map-town-label { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.leaflet-tooltip.map-you-label { background: var(--map-accent); color: #fff; border-radius: 3px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; }
.leaflet-tooltip.map-you-label::before { border-top-color: var(--map-accent); }
.leaflet-tooltip.map-tip { border-radius: 3px; font-size: 11px; letter-spacing: .04em; }

/* Key */
.map-legend { border-radius: 4px; font-size: 11.5px; }
.ml-water { display: inline-block; width: 22px; height: 6px; background: var(--ink); border-radius: 1px; }
.ml-edge { display: inline-block; width: 22px; height: 8px; background: var(--ink); box-shadow: 0 0 0 2.5px var(--alert); border-radius: 1px; }
.ml-edge.st-ready { box-shadow: 0 0 0 2.5px var(--ready); } .ml-edge.st-danger { box-shadow: 0 0 0 2.5px var(--danger); }
.ml-town { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); }
.ml-you { background: var(--map-accent); box-shadow: 0 0 0 1px var(--map-accent); border-color: var(--paper); }
.leaflet-bar a { border-radius: 2px !important; }
.w-map .map-box { border-radius: 6px; }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--text); border-bottom-color: var(--border); }
.leaflet-bar { border-color: var(--border) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }
.map-dam.other { width: 9px; height: 9px; border-width: 1.5px; border-color: var(--muted); background: var(--paper); }

/* ================= Language switch ================= */
.lang-switch { display: inline-flex; border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px; padding: 2px; }
.lang-switch button { font: inherit; font-size: 13px; font-weight: 600; line-height: 1; color: #fff; background: none; border: 0; border-radius: 999px; padding: 6px 10px; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: #fff; color: #000; }
.lang-switch button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lang-switch [lang="ml"] { font-family: "Noto Sans Malayalam", "Inter", system-ui, sans-serif; }
.lang-switch button { min-width: 34px; }
.lang-switch [lang="ml"] { font-size: 16px; padding-block: 3px 5px; }
@media (max-width: 480px) {
  .top-links { gap: 10px; }
  .brand-name { font-size: 14px; line-height: 1.1; }
  .brand { min-width: 0; }
}
html:lang(ml) .helplines span { overflow-wrap: anywhere; }
/* Malayalam runs longer and taller than English: a little more line height, a little less display size. */
html:lang(ml) body { line-height: 1.65; }
html:lang(ml) :is(h1, h2, h3, .ws-word, .w-title) { letter-spacing: 0; }
html:lang(ml) body.is-home .hero h1 { font-size: clamp(26px, 4vw, 42px); line-height: 1.3; }
html:lang(ml) .ws-word { font-size: 26px; line-height: 1.3; }

/* ================= Official alerts ================= */
:root { --lvl-red: var(--danger); --lvl-orange: var(--ready); --lvl-yellow: var(--alert); --lvl-blue: var(--dam-blue); }
.ws-colour { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ws-colour::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: currentColor; }
.ws-colour.safe::before { background: var(--safe); } .ws-colour.alert::before { background: var(--alert); }
.ws-colour.ready::before { background: var(--ready); } .ws-colour.danger::before { background: var(--danger); }
.ws-basis { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; padding-left: 10px; border-left: 2px solid var(--border); }
.ws-basis.official { color: var(--text); font-weight: 600; border-left-color: var(--text); }

.official { margin: 0 0 20px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.official:empty { display: none; }
.official.lvl-red { border: 2px solid var(--lvl-red); }
.official.lvl-orange { border: 2px solid var(--lvl-orange); }
.official.lvl-yellow { border: 2px solid var(--lvl-yellow); }
.of-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.of-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.of-item { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.of-item b { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.of-tag { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 6px; color: #fff; margin-top: 1px; }
.of-item.lvl-red .of-tag { background: var(--lvl-red); }
.of-item.lvl-orange .of-tag { background: var(--lvl-orange); }
.of-item.lvl-yellow .of-tag { background: var(--lvl-yellow); color: #000; }
.of-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.of-none { margin: 0; font-size: 14px; }
.of-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13.5px; }
.of-links a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Suggestions: places under an official alert */
.chip-alert { display: inline-flex; align-items: center; gap: 8px; }
.chip-alert i { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--unknown); }
.chip-alert.lvl-red i { background: var(--lvl-red); } .chip-alert.lvl-orange i { background: var(--lvl-orange); }
.chip-alert.lvl-yellow i { background: var(--lvl-yellow); } .chip-alert.lvl-blue i { background: var(--lvl-blue); }
.chip-alert.lvl-red { border-color: var(--lvl-red); }
/* Alerts must all be visible on phones, so the chips wrap instead of scrolling sideways. */
@media (max-width: 640px) { body.is-home .quick { flex-wrap: wrap; overflow: visible; } }
.quick-none { align-self: center; font-size: 13.5px; color: rgba(255, 255, 255, .7); }

.official-links { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.official-links a { font-weight: 600; color: var(--text); }
.official-links span { color: var(--muted); }
.collector-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.collector-links a { font-size: 13px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; }
.collector-links a:hover { border-color: var(--text); }

/* Search box: never wider than the screen. A text field has a built-in minimum width (about 20
   characters), which grows with the phone's text size and pushed the box and its Check button
   off-screen. width: 0 lets the field shrink; flex-grow fills the space that's left. */
.search { width: 100%; min-width: 0; }
.search input { width: 0; flex: 1 1 0; min-width: 0; text-overflow: ellipsis; }
.search .btn { flex: none; white-space: nowrap; }
body.is-dash .search { flex: 1 1 260px; min-width: 0; }
@media (max-width: 400px) {
  .search .btn { padding-inline: 14px; }
}
/* Status: the words beside the meter wrap instead of pushing the card wider on small phones. */
.ws-main > div { min-width: 0; }
.ws-word { overflow-wrap: anywhere; }
@media (max-width: 360px) { .ws-main .meter { width: 84px; } .ws-main { gap: 10px; } }
