:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --bg: #F6F8F7;
  --card: #FFFFFF;
  --text: #13201C;
  --muted: #5B6B66;
  --line: #E1E7E4;
  --accent: #0E8A6A;
  --accent-soft: #E3F4EE;
  --quote: #F2F6F4;
  --good: #2E9E5B; --moderate: #E9B824; --sensitive: #F07B3F; --unhealthy: #E02D3C; --very: #8E3B9E; --unknown: #9AA5A1;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1412; --card: #161F1C; --text: #E8EFEC; --muted: #9AACA6; --line: #26332F;
    --accent: #3CC79C; --accent-soft: #15302A; --quote: #1C2723;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1412; --card: #161F1C; --text: #E8EFEC; --muted: #9AACA6; --line: #26332F;
  --accent: #3CC79C; --accent-soft: #15302A; --quote: #1C2723;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); }
a { color: var(--accent); }
h1 { font-size: clamp(24px, 4vw, 32px); line-height: 1.2; margin: 8px 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 28px 0 4px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }

.top { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 18px; }
.logo { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); position: relative; }
.logo::after { content: ""; position: absolute; left: 6px; right: 6px; top: 9px; height: 8px; border: 2.5px solid #fff; border-bottom: 0; border-radius: 10px 10px 0 0; }
.status { margin-left: auto; font-size: 12px; color: var(--muted); }
.status b { color: var(--accent); font-weight: 600; }
.icon-btn { background: none; border: 0; color: var(--text); padding: 6px; border-radius: 8px; cursor: pointer; }
.icon-btn:hover { background: var(--accent-soft); }

.menu { position: fixed; right: 16px; top: 58px; z-index: 1003; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; display: flex; flex-direction: column; min-width: 220px; }
.menu button { text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.menu button:hover, .menu-link:hover { background: var(--accent-soft); }
.menu-link { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 10px; }
.menu-lang { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 12px 6px; }
.menu-lang-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.lang-switch { display: flex; gap: 4px; background: var(--quote); border-radius: 10px; padding: 3px; }
.menu .lang-switch button { flex: 1; text-align: center; padding: 7px 6px; font-size: 13px; border-radius: 8px; }
.menu .lang-switch button[aria-pressed="true"] { background: var(--card); color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }

.ask { display: flex; gap: 10px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.ask:focus-within { border-color: var(--accent); }
.ask textarea { flex: 1; border: 0; resize: none; font: inherit; background: transparent; color: var(--text); outline: none; padding: 6px; min-width: 0; }
.ask button { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font: 600 15px var(--font); cursor: pointer; }
.ask button:disabled { opacity: .6; cursor: progress; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 8px; }
.chip { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 7px 13px; font: 14px var(--font); cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--accent); }

.answer { margin-top: 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.answer .text { font-size: 17px; white-space: pre-wrap; }
.answer sup a { text-decoration: none; font-weight: 600; font-size: 12px; padding: 0 2px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.meta .fast { color: var(--accent); font-weight: 600; }
.notfound { border-left: 4px solid var(--sensitive); }
/* Text arriving word by word, with a blinking caret */
.answer.streaming .text::after { content: ""; display: inline-block; width: 8px; height: 1.1em; margin-left: 2px; vertical-align: -2px;
  background: var(--accent); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .answer.streaming .text::after { animation: none; } }

.src { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card); scroll-margin-top: 80px; }
.src.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.src blockquote { margin: 0 0 8px; padding: 8px 12px; background: var(--quote); border-left: 3px solid var(--accent); border-radius: 6px; font-size: 15px; }
.src .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.src .n { font-weight: 700; color: var(--accent); }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .04em; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.badge.live { background: var(--accent); color: #fff; border-color: var(--accent); }
.verified { color: var(--accent); font-weight: 600; }

.loading { margin-top: 22px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.good { background: var(--good); } .dot.moderate { background: var(--moderate); } .dot.sensitive { background: var(--sensitive); } .dot.unhealthy { background: var(--unhealthy); } .dot.very { background: var(--very); }
.small { font-size: 13px; margin: -4px 0 10px; }
/* Map markers: the PM2.5 value inside a coloured circle, like AAI's map */
.pm-pin { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; font: 700 12px var(--font);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pm-pin.moderate { color: #3A2E00; }
.pm-icon { display: grid; place-items: center; }
.zoomed-out .pm-pin { width: 13px; height: 13px; font-size: 0; border-width: 1.5px; }
.map { height: min(65vh, 520px); border-radius: var(--radius); border: 1px solid var(--line); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat.models { grid-column: 1 / -1; }
.mbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; margin: 10px 0; background: var(--line); }
.mbar i { display: block; min-width: 4px; }
.mlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.mlist li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; }
.mlist .mname { font-weight: 600; }
.mlist .mnum { color: var(--muted); margin-left: auto; }
ul.plain { padding-left: 18px; }
.sources-list { list-style: none; padding: 0; }
.sources-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.error { margin-top: 18px; color: var(--unhealthy); }

.providers { display: grid; gap: 10px; margin-bottom: 18px; }
.provider { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.provider:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.provider.off { opacity: .55; cursor: not-allowed; }
.provider input { margin-top: 4px; accent-color: var(--accent); }
.provider b { display: block; }
.provider small { color: var(--muted); }
.tag { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 1px 6px; margin-left: 6px; background: var(--accent-soft); color: var(--accent); }
.field { display: block; font-weight: 600; margin-bottom: 18px; }
.field input { display: block; width: 100%; margin-top: 6px; font: 15px var(--font); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.field small { display: block; font-weight: 400; margin-top: 6px; }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font: 600 15px var(--font); cursor: pointer; margin-right: 10px; }
.local-info { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 10px; margin-bottom: 18px; }
.hw { width: 100%; border-collapse: collapse; font-size: 14px; }
.hw th, .hw td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.hw th { color: var(--muted); font-weight: 600; }
/* Sensor details sheet */
.pm-icon { cursor: pointer; }
.sheet { position: fixed; inset: 0; z-index: 1500; display: grid; place-items: center; padding: 16px; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 20, 17, .45); }
.sheet-panel { position: relative; width: min(460px, 100%); max-height: min(86vh, 760px); overflow-y: auto; background: var(--bg);
  border-radius: 20px; padding: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.sheet-close { position: sticky; float: right; top: 0; margin: 4px 4px -38px 0; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.9); color: #13201C; display: grid; place-items: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.st-head { border-radius: 16px; padding: 18px; color: #fff; }
.st-head.moderate { color: #2E2400; }
.st-top { display: flex; justify-content: space-between; gap: 12px; padding-right: 30px; }
.st-name { font-size: 19px; font-weight: 700; line-height: 1.25; margin: 0; }
.st-sub { font-size: 13px; opacity: .85; margin-top: 4px; }
.st-trend { text-align: right; white-space: nowrap; font-size: 13px; opacity: .95; }
.st-trend b { display: block; font-size: 20px; }
.st-rule { border: 0; border-top: 1px solid currentColor; opacity: .25; margin: 14px 0 10px; }
.st-label { font-size: 13px; opacity: .85; }
.st-cat { font-weight: 700; font-size: 16px; }
.st-value { display: flex; align-items: flex-end; justify-content: space-between; }
.st-value b { font-size: 56px; line-height: 1; letter-spacing: -.02em; }
.st-value b small { font-size: 18px; font-weight: 500; opacity: .8; margin-left: 6px; }
.st-face { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; }
.st-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-top: 12px; }
.st-card h3 { font-size: 16px; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.st-card h3 span { font-size: 12px; font-weight: 400; color: var(--muted); }
.st-chart { width: 100%; height: 150px; display: block; }
.st-chart text { font: 11px var(--font); fill: var(--muted); }
.st-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.st-stats div { background: var(--quote); border-radius: 12px; padding: 8px; text-align: center; }
.st-stats span { display: block; font-size: 12px; color: var(--muted); }
.st-stats b { font-size: 20px; }
.st-extra { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.st-advice { margin: 0; padding-left: 18px; }
.st-advice li { margin: 4px 0; }
@media (max-width: 560px) {
  .sheet { place-items: end center; padding: 0; }
  .sheet-panel { width: 100%; border-radius: 20px 20px 0 0; max-height: 88vh; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .st-value b { font-size: 46px; }
}

/* Voice agent */
main { padding-bottom: 120px; }
.voice { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 1002; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.voice-btn { display: flex; align-items: center; gap: 8px; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 14px 20px;
  font: 600 15px var(--font); cursor: pointer; box-shadow: 0 8px 24px rgba(14,138,106,.35); }
.voice-btn .stop { display: none; }
.voice.live .voice-btn { background: var(--unhealthy); box-shadow: 0 8px 24px rgba(214,69,69,.35); }
.voice.live .voice-btn .mic { display: none; } .voice.live .voice-btn .stop { display: block; }
.voice.live .voice-label { display: none; }
.voice-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; width: min(340px, calc(100vw - 32px));
  box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.voice-status { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--unknown); }
.voice[data-mode="listening"] .pulse { background: var(--accent); animation: beat 1.2s ease-in-out infinite; }
.voice[data-mode="speaking"] .pulse { background: var(--moderate); animation: beat .6s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.6); opacity: .5; } }
.voice-line { margin: 6px 0 0; font-size: 14px; color: var(--muted); max-height: 4.5em; overflow: hidden; }
#ghost { position: fixed; left: 0; top: 0; z-index: 2000; pointer-events: none; opacity: 0; transform: translate(50vw, 80vh);
  transition: transform .6s cubic-bezier(.3,.7,.2,1), opacity .3s; filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
#ghost.on { opacity: 1; }
#ghost.click::after { content: ""; position: absolute; left: -12px; top: -12px; width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--accent); animation: ripple .4s ease-out forwards; }
@keyframes ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #ghost { transition: none; } .pulse { animation: none !important; } }

@media (max-width: 560px) {
  .hw { font-size: 13px; }
  .ask { flex-direction: column; align-items: stretch; }
  .status { display: none; }
  .top .icon-btn { margin-left: auto; }
  main { padding-top: 16px; }
  .voice-btn { padding: 14px; }
  .voice-label { display: none; }
  .menu { left: 16px; right: 16px; }
  .src .row { font-size: 12px; }
}

/* Accuracy test on the dashboard */
#evalBox h2 { margin-top: 28px; }
.evalcard { display: flex; gap: 18px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.evalcard p { margin: 0 0 6px; }
.evalscore { text-align: center; min-width: 110px; }
.evalscore b { display: block; font-size: 38px; color: var(--good); line-height: 1.1; }
.evalscore span { color: var(--muted); font-size: 13px; }
.evallist { margin-top: 10px; }
.evallist summary { cursor: pointer; color: var(--accent); }
.evallist ol { padding-left: 22px; font-size: 14px; }
.evallist li { margin: 4px 0; }
@media (max-width: 560px) { .evalcard { flex-direction: column; align-items: stretch; } }

/* Admin page: add research */
.admin { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.small-switch button { padding: 4px 10px; font-size: 13px; }
.card-form { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; }
.card-form label { font-weight: 600; margin-top: 8px; }
.card-form input, .card-form select { width: 100%; font: 15px var(--font); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.card-form .primary { align-self: flex-start; margin-top: 14px; }
.card-form .primary:disabled { opacity: .6; cursor: wait; }
.card-form .error, .card-form .ok { margin: 8px 0 0; }
.ok { color: var(--good); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-docs li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.admin-actions { display: flex; gap: 14px; white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.link-btn.danger { color: var(--unhealthy); }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } .admin-docs li { flex-direction: column; align-items: flex-start; } }
a.primary { display: inline-block; text-decoration: none; }

/* Answer actions: feedback, share, policy brief */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.act { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 6px 12px; font: 14px var(--font); cursor: pointer; }
.act:hover { border-color: var(--accent); }
.act[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.act-msg { font-size: 13px; color: var(--muted); word-break: break-all; }

/* Policy brief (one A4 page when printed) */
.brief-page { background: #E9EEEC; }
.brief-tools { max-width: 210mm; margin: 0 auto; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brief { max-width: 210mm; margin: 0 auto 40px; background: #fff; color: #13201C; padding: 14mm 14mm 10mm; box-shadow: 0 2px 16px rgba(0,0,0,.08); font-size: 12.5px; line-height: 1.45; }
.brief .muted { color: #5B6B66; }
.brief-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--accent); padding-bottom: 8px; margin-bottom: 10px; flex-wrap: wrap; gap: 6px; }
.brief-head .logo { display: inline-block; vertical-align: middle; }
.brief-label { text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; color: #5B6B66; margin: 6px 0 0; }
.brief h1 { font-size: 20px; margin: 2px 0 10px; }
.brief h2 { font-size: 14px; margin: 10px 0 6px; color: var(--accent); }
.brief h3 { font-size: 11.5px; margin: 10px 0 2px; color: #5B6B66; font-weight: 600; }
.brief-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.brief-findings { margin: 0; padding-left: 18px; }
.brief-findings li { margin: 0 0 6px; }
.brief sup { color: var(--accent); font-weight: 600; }
.kpis { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.kpi { border: 1px solid #E1E7E4; border-left: 4px solid var(--accent); border-radius: 8px; padding: 6px 8px; }
.kpi b { display: block; font-size: 16px; line-height: 1.2; }
.kpi span, .kpi small { display: block; font-size: 10.5px; color: #5B6B66; }
.brief svg { width: 100%; height: auto; display: block; }
.brief svg .lbl { font-size: 9px; fill: #5B6B66; }
.brief svg .val { font-size: 9px; fill: #13201C; font-weight: 600; }
.brief svg .ref { stroke: #5B6B66; stroke-dasharray: 3 3; stroke-width: .8; }
.brief-sources { margin: 0; padding-left: 18px; font-size: 11px; }
.brief-sources li { margin: 0 0 5px; }
.brief-sources q { display: block; color: #3b4a45; font-style: italic; }
.brief-sources a { color: var(--accent); word-break: break-all; }
.brief-foot { margin-top: 10px; padding-top: 6px; border-top: 1px solid #E1E7E4; font-size: 10px; color: #5B6B66; }
@media (max-width: 700px) { .brief { padding: 18px 16px; } .brief-grid, .kpis { grid-template-columns: 1fr; } }
@media print {
  @page { size: A4; margin: 0; }
  .no-print { display: none !important; }
  .brief-page { background: #fff; }
  .brief { box-shadow: none; margin: 0; max-width: none; font-size: 11.5px; }
  .brief-grid { grid-template-columns: 1.15fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr 1fr; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* History */
.history-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.danger-act { color: var(--unhealthy); }
.hist { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.hist summary { cursor: pointer; line-height: 1.4; }
.hist-body { margin-top: 10px; }
.hist-body p { margin: 0 0 8px; }
.hist-body ol { margin: 0 0 10px; padding-left: 20px; }
@media print {
  body.printing-history .top, body.printing-history .menu, body.printing-history .voice, body.printing-history .ghost,
  body.printing-history .view:not(#view-history), body.printing-history .no-print { display: none !important; }
  body.printing-history .hist { break-inside: avoid; border-color: #ccc; }
}

/* Schools ranking */
.school-list { list-style: none; padding: 0; margin: 12px 0 0; counter-reset: sc; }
.school-list li { display: grid; grid-template-columns: 2.2fr 1.4fr 48px auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); counter-increment: sc; }
.school-list li.sc-note { display: block; border: 0; counter-increment: none; }
.sc-name::before { content: counter(sc) ". "; color: var(--muted); }
.sc-bar { height: 10px; background: var(--quote); border-radius: 6px; overflow: hidden; }
.sc-bar i { display: block; height: 100%; border-radius: 6px; }
.sc-val { text-align: right; }
.sc-map { padding: 4px 10px; font-size: 13px; }
@media (max-width: 560px) { .school-list li { grid-template-columns: 1fr 44px auto; } .sc-bar { grid-column: 1 / -1; grid-row: 2; } }

/* Chat widget (inside its frame on other websites) */
html.tw-html, .tw-page { background: transparent !important; margin: 0; overflow: hidden; height: 100%; }
.tw-launcher { position: fixed; bottom: 16px; right: 16px; width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #0E8A6A; display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.22), inset 0 0 0 3px rgba(255,255,255,.35);
  transition: transform .15s ease; }
.tw-launcher:hover { transform: scale(1.06); }
.tw-launcher:focus-visible, .tw-icon:focus-visible, .tw-send:focus-visible, .tw-mic:focus-visible { outline: 3px solid #1f6feb; outline-offset: 2px; }
.tw-badge { position: absolute; top: -4px; right: -4px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: #fff; color: #13201C;
  font: 700 13px/26px var(--font); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.tw-launcher.tw-bad::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid currentColor; opacity: 0; animation: tw-ring 2.4s ease-out infinite; color: inherit; }
.tw-launcher.tw-bad { color: #fff; }
@keyframes tw-ring { 0% { transform: scale(.9); opacity: .6; } 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tw-launcher.tw-bad::after { animation: none; } .tw-launcher { transition: none; } }
.tw-left .tw-launcher, .tw-left .tw-nudge { right: auto; left: 16px; }

.tw-nudge { position: fixed; right: 16px; bottom: 92px; width: calc(100% - 32px); max-width: 290px; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px 14px 4px 14px; padding: 12px 30px 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 14px; line-height: 1.4; }
.tw-nudge p { margin: 0 0 6px; }
.tw-x { position: absolute; top: 4px; right: 6px; background: none; border: 0; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px; }
.tw-link { background: none; border: 0; padding: 0; color: var(--accent); font: 600 14px var(--font); cursor: pointer; }

.tw-panel { position: fixed; inset: 10px; display: flex; flex-direction: column; background: var(--card); color: var(--text); border-radius: 18px;
  border: 1px solid var(--line); box-shadow: 0 10px 34px rgba(0,0,0,.22); overflow: hidden; font-size: 14.5px; }
@media (max-width: 519px) { .tw-panel { inset: 0; border-radius: 0; border: 0; } }
.tw-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; background: var(--accent); color: #fff; }
.tw-head .logo { background: #fff; flex: none; }
.tw-head .logo::after { border-color: var(--accent); }
.tw-title { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.tw-title span { font-size: 12px; opacity: .9; }
.tw-icon { background: rgba(255,255,255,.16); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.tw-icon:hover { background: rgba(255,255,255,.28); }
.tw-air { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--quote); }
.tw-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.tw-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.tw-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; line-height: 1.45; word-wrap: break-word; }
.tw-bot { align-self: flex-start; background: var(--quote); border-bottom-left-radius: 4px; }
.tw-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.tw-err { color: var(--unhealthy); }
.tw-bot sup { color: var(--accent); font-weight: 700; }
.tw-spoken { align-self: flex-start; font-size: 12.5px; color: var(--muted); font-style: italic; max-width: 88%; }
.tw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tw-chips .chip { font-size: 13px; text-align: left; }
.tw-srcs { margin-top: 8px; font-size: 13px; }
.tw-srcs summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.tw-srcs ol { padding-left: 18px; margin: 6px 0 0; }
.tw-srcs li { margin-bottom: 8px; }
.tw-srcs blockquote { margin: 0 0 3px; padding-left: 8px; border-left: 3px solid var(--accent); font-style: italic; }
.tw-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: 13px; }
.tw-acts button { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; cursor: pointer; font-size: 13px; }
.tw-acts button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tw-typing i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--muted); animation: tw-dot 1s infinite; }
.tw-typing i:nth-child(2) { animation-delay: .15s; } .tw-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tw-dot { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.tw-voice { display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 13px; color: var(--accent); border-top: 1px solid var(--line); }
.tw-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: center; }
.tw-compose input { flex: 1; min-width: 0; font: 15px var(--font); padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.tw-send, .tw-mic { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; flex: none; }
.tw-send { background: var(--accent); color: #fff; }
.tw-send:disabled { opacity: .5; cursor: wait; }
.tw-mic { background: var(--accent-soft); color: var(--accent); }
.tw-mic .stop { display: none; }
.tw-mic.live { background: var(--unhealthy); color: #fff; }
.tw-mic.live .mic { display: none; } .tw-mic.live .stop { display: block; }
.tw-foot { padding: 0 12px 10px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* Widget page inside the platform: a pretend website with the widget in its corner */
.wd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.wd-site { position: relative; isolation: isolate; height: 620px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.wd-bar { display: flex; gap: 6px; align-items: center; padding: 8px 12px; background: #EEF2F0; border-bottom: 1px solid #E1E7E4; font-size: 12px; color: #5B6B66; }
.wd-bar i { width: 10px; height: 10px; border-radius: 50%; background: #d0d7d4; }
.wd-fake { padding: 22px; color: #13201C; }
.wd-fake b { display: block; height: 14px; background: #E9EEEC; border-radius: 6px; margin: 10px 0; }
.wd-fake h3 { margin: 0 0 12px; }
.wd-copy { margin-top: 8px; }
.wd-langs { display: flex; gap: 8px; margin: 10px 0; }
@media (max-width: 760px) { .wd-grid { grid-template-columns: 1fr; } .wd-site { height: 560px; } }
.snippet { background: var(--quote); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: 13px; }
.demo-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.wd-list { padding-left: 20px; } .wd-list li { margin-bottom: 6px; }

/* Widget views: tabs, map, sensor card, schools */
.tw-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--card); }
.tw-tabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 4px; font: 600 13px var(--font); color: var(--muted); cursor: pointer; }
.tw-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tw-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tw-view[hidden] { display: none !important; }
.tw-scroll { overflow-y: auto; overscroll-behavior: contain; display: block; }
.tw-map { flex: 1; min-height: 200px; }
.tw-note { margin: 0; padding: 6px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.tw-pad { padding: 10px 14px; margin: 0; }
.tw-st-head { color: #fff; padding: 10px 14px 12px; }
.tw-st-head h3 { margin: 6px 0 2px; font-size: 16px; }
.tw-st-val b { font-size: 30px; }
.tw-back { background: rgba(255,255,255,.22); color: #fff; border: 0; border-radius: 8px; padding: 3px 9px; font: 600 12px var(--font); cursor: pointer; }
.tw-spark { width: 100%; height: auto; display: block; }
.tw-spark text { font-size: 10px; fill: var(--muted); }
.tw-sc { list-style: none; margin: 0; padding: 0 8px 10px; counter-reset: tsc; }
.tw-sc li { counter-increment: tsc; }
.tw-sc button { width: 100%; display: grid; grid-template-columns: 1.5fr 1fr 38px; gap: 8px; align-items: center; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 7px 6px; font: 13px var(--font); color: var(--text); text-align: left; cursor: pointer; }
.tw-sc button:hover { background: var(--quote); }
.tw-sc-name::before { content: counter(tsc) ". "; color: var(--muted); }
.tw-sc-bar { height: 8px; background: var(--quote); border-radius: 5px; overflow: hidden; }
.tw-sc-bar i { display: block; height: 100%; border-radius: 5px; }
.tw-sc b { text-align: right; }
.tw-linkmsg { align-self: flex-start; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); border-radius: 12px; padding: 8px 12px; font-weight: 600; text-decoration: none; }
.tw-srcs li.flash { background: var(--accent-soft); border-radius: 6px; transition: background .3s; }

/* Time saved (the track's metric) */
.stat.saved { grid-column: 1 / -1; background: var(--accent-soft); border-color: var(--accent); }
.stat.saved b { font-size: 32px; color: var(--accent); }
.saved-line { margin: -4px 0 14px; font-weight: 600; color: var(--accent); }

/* Ask / Check a claim */
.mode-tabs { display: inline-flex; gap: 4px; background: var(--quote); border-radius: 999px; padding: 4px; margin: 6px 0 10px; }
.mode-tabs button { border: 0; background: none; border-radius: 999px; padding: 7px 14px; font: 600 14px var(--font); color: var(--muted); cursor: pointer; }
.mode-tabs button[aria-selected="true"] { background: var(--card); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.verdict { display: inline-block; font-weight: 700; padding: 6px 12px; border-radius: 10px; margin-bottom: 10px; }
.v-supported { background: #E3F4EA; color: #1E7A45; }
.v-contradicted { background: #FCE4E6; color: #B4202D; }
.v-partly { background: #FDF0E2; color: #A9551A; }
.v-not-covered { background: var(--quote); color: var(--muted); }

/* Research gaps (AAI team) */
.gaps { margin-top: 26px; }
.small-act { font-size: 12px; padding: 3px 10px; vertical-align: middle; }
.gaps-list { padding-left: 22px; }
.gaps-list > li { margin-bottom: 14px; }
.gap-head { display: flex; justify-content: space-between; gap: 10px; }
.gap-bar { display: block; height: 7px; background: var(--quote); border-radius: 4px; margin: 5px 0; overflow: hidden; }
.gap-bar i { display: block; height: 100%; background: var(--sensitive); border-radius: 4px; }
.gaps-list ul { margin: 2px 0 0; padding-left: 16px; }
.differ { display: inline-block; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 10px; margin-bottom: 10px; background: #EEF0FB; color: #3B4A9A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .differ { background: #23284A; color: #B9C1F2; } }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400 !important; } .check input { width: auto !important; }

/* Automatic chart in answers */
.answer-chart { margin: 12px 0 4px; max-width: 420px; }
.answer-chart figcaption { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.answer-chart svg { width: 100%; height: auto; display: block; }
.answer-chart .ch-l { font-size: 10px; fill: var(--muted); }
.answer-chart .ch-v { font-size: 10px; font-weight: 600; fill: var(--text); }

/* Source tools: quote card image and APA reference */
.src-tools { margin-left: auto; display: inline-flex; gap: 6px; }
.mini { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font: 600 12px var(--font); color: var(--muted); cursor: pointer; }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.cite-out { margin: 6px 0 0; word-break: break-word; }

/* Guided tour */
.tour-start { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 7px 16px; font: 600 14px var(--font); cursor: pointer; margin: 0 0 12px; }
.tour-start:hover { background: var(--accent); color: #fff; }
.tour-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 1004; width: min(720px, calc(100% - 24px)); background: rgba(19, 32, 28, .94); color: #fff;
  border-radius: 16px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.tour-caption { margin: 6px 0 10px; font-size: 16px; line-height: 1.45; }
.tour-dots { display: flex; gap: 4px; }
.tour-dots i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); }
.tour-dots i.on { background: #3CC79C; }
.tour-ctrls { display: flex; gap: 8px; justify-content: flex-end; }
.tour-b { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 999px; padding: 6px 14px; font: 600 13px var(--font); cursor: pointer; }
.tour-b:hover { background: rgba(255,255,255,.22); }
.touring .voice { bottom: 150px; }
.tour-invite { position: fixed; left: 16px; bottom: 16px; z-index: 1003; display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--accent);
  border-radius: 999px; padding: 4px 6px 4px 4px; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.tour-go { background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 8px 14px; font: 600 14px var(--font); cursor: pointer; }
.tour-invite .tour-x, .tour-bar .tour-x { background: none; border: 0; color: inherit; font-size: 16px; cursor: pointer; padding: 4px 8px; }
@media (max-width: 560px) { .tour-caption { font-size: 15px; } .tour-invite { right: 90px; } }

/* =====================================================================================================
   inDrive theme (layer on top of the base styles): lime #C1F11D + ink #141414, the iD mark, a dark
   header, a side drawer menu, light motion and a branded cursor. CSS only: no extra requests, no JS cost.
   ===================================================================================================== */
:root {
  --brand: #C1F11D; --brand-2: #D6FB5A; --ink: #141414; --on-brand: #141414;
  --bg: #F3F5EE; --card: #FFFFFF; --text: #141414; --muted: #5C6257; --line: #E2E6D9;
  --accent: #4B6E00; --accent-soft: #EEF8CC; --quote: #F4F7EB;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px rgba(20, 20, 20, .06);
  --shadow-lift: 0 2px 4px rgba(20, 20, 20, .06), 0 14px 34px rgba(20, 20, 20, .10);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --idmark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect width='100' height='100' rx='30' fill='%23C1F11D'/%3E%3Crect x='24' y='22' width='14' height='14' rx='3' fill='%23141414'/%3E%3Crect x='24' y='42' width='14' height='36' rx='3' fill='%23141414'/%3E%3Cpath d='M44 25a3 3 0 0 1 3-3h9a28 28 0 0 1 0 56h-9a3 3 0 0 1-3-3v-8a3 3 0 0 1 3-3h9a14 14 0 0 0 0-28h-9a3 3 0 0 1-3-3z' fill='%23141414'/%3E%3C/svg%3E");
  /* A lime dot with an ink ring as the cursor; a ring on anything clickable */
  --cur: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='5.5' fill='%23C1F11D' stroke='%23141414' stroke-width='2'/%3E%3C/svg%3E") 12 12, auto;
  --cur-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='11' fill='rgba(193,241,29,.35)' stroke='%23141414' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='3' fill='%23141414'/%3E%3C/svg%3E") 16 16, pointer;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0D0A; --card: #16180F; --text: #F1F4EA; --muted: #A2A897; --line: #282C20;
    --accent: #C1F11D; --accent-soft: #232E07; --quote: #1C2014;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); --shadow-lift: 0 14px 34px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #0C0D0A; --card: #16180F; --text: #F1F4EA; --muted: #A2A897; --line: #282C20;
  --accent: #C1F11D; --accent-soft: #232E07; --quote: #1C2014;
}

html { cursor: var(--cur); scroll-behavior: smooth; }
a, button, [role="tab"], summary, label.provider, .chip, .leaflet-marker-icon, .pm-icon { cursor: var(--cur-hand); }
input, textarea, [contenteditable] { cursor: text; }
::selection { background: var(--brand); color: var(--ink); }
body { background: var(--bg); letter-spacing: -0.005em; }
body::before { /* a soft lime glow behind the page */
  content: ""; position: fixed; inset: -20vh -10vw auto auto; width: 70vw; height: 70vh; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(193, 241, 29, .22), transparent 70%);
}
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }

/* ---------- Header: ink bar, the iD mark, the name ---------- */
.top { background: rgba(20, 20, 20, .92); border-bottom: 1px solid rgba(255, 255, 255, .06); color: #fff; padding: 10px 16px;
  backdrop-filter: saturate(160%) blur(10px); }
.brand { color: #fff; gap: 10px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--idmark) center / cover no-repeat; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
.logo::after { display: none; }
.brand-name { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name small { font-size: 11px; font-weight: 600; color: var(--brand); letter-spacing: .04em; text-transform: uppercase; }
.top .status { color: rgba(255, 255, 255, .65); }
.top .status b { color: var(--brand); }
.top .icon-btn { color: #fff; }
.top .icon-btn:hover { background: rgba(255, 255, 255, .1); }

/* ---------- Side drawer menu: scrolls, language first, icons, dimmed page behind ---------- */
.menu { position: fixed; top: 0; right: 0; bottom: 0; height: 100dvh; width: min(340px, 88vw); border-radius: 22px 0 0 22px; border: 0;
  padding: 16px 12px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; gap: 2px; z-index: 1003;
  box-shadow: 0 0 0 100vmax rgba(12, 13, 10, .45), -12px 0 40px rgba(0, 0, 0, .25); animation: drawer .28s var(--ease); }
@keyframes drawer { from { transform: translateX(40px); opacity: 0; } }
.menu-lang { order: -1; border-top: 0; border-bottom: 1px solid var(--line); margin: 0 0 8px; padding: 6px 6px 14px; }
.menu > button, .menu-link { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; font-weight: 500; transition: background .15s, transform .15s var(--ease); }
.menu > button:hover, .menu-link:hover { background: var(--accent-soft); transform: translateX(-2px); }
.menu > button::before { width: 22px; text-align: center; font-size: 17px; }
#tourMenu { background: var(--brand); color: var(--on-brand); font-weight: 700; margin-bottom: 6px; }
#tourMenu:hover { background: var(--brand-2); }
.menu [data-view="map"]::before { content: "🗺"; } .menu [data-view="schools"]::before { content: "🏫"; }
.menu [data-view="history"]::before { content: "🕘"; } .menu [data-view="dashboard"]::before { content: "📊"; }
.menu [data-view="widget"]::before { content: "🧩"; } .menu [data-view="sources"]::before { content: "📚"; }
.menu [data-view="about"]::before { content: "ℹ️"; } .menu [data-view="ai"]::before { content: "⚙️"; }
.menu .lang-switch button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }

/* ---------- Hero ---------- */
main { max-width: 820px; padding-top: 34px; }
#view-ask > h1 { font-size: clamp(32px, 5.6vw, 54px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.04; margin: 6px 0 12px; }
#view-ask > h1::after { content: ""; display: block; width: 72px; height: 7px; border-radius: 4px; background: var(--brand); margin-top: 14px; }
#view-ask > .lead { font-size: 18px; max-width: 620px; }
.view > h1 { font-weight: 800; letter-spacing: -0.03em; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.hero-stats span { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; color: var(--muted); box-shadow: var(--shadow); }
.hero-stats b { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.hero-stats .hs-saved { background: var(--ink); border-color: var(--ink); color: rgba(255, 255, 255, .75); }
.hero-stats .hs-saved b { color: var(--brand); }
.tour-start { background: var(--ink); color: #fff; border: 0; padding: 9px 18px; box-shadow: var(--shadow); transition: transform .15s var(--ease), box-shadow .15s; }
.tour-start:hover { background: var(--ink); color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-lift); }

/* ---------- Ask box and buttons ---------- */
.ask { border-radius: 22px; padding: 10px 10px 10px 14px; border: 1.5px solid var(--line); box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.ask:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(193, 241, 29, .55), var(--shadow); }
.ask textarea { font-size: 17px; }
.ask button, .primary, .tw-send, .tour-go, .badge.live, .tw-user, .voice-btn {
  background: var(--brand); color: var(--on-brand); }
.ask button, .primary { border-radius: 14px; font-weight: 700; padding: 12px 22px; transition: transform .12s var(--ease), background .15s, box-shadow .15s; }
.ask button:hover, .primary:hover { background: var(--brand-2); box-shadow: 0 6px 18px rgba(193, 241, 29, .45); }
.ask button:active, .primary:active, .act:active, .chip:active, .tour-start:active { transform: scale(.97); }
.badge.live { border-color: var(--brand); }
.mode-tabs { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mode-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.chip { border-radius: 999px; padding: 8px 14px; transition: border-color .15s, background .15s, transform .15s var(--ease); }
.chip:hover { border-color: var(--ink); background: var(--accent-soft); transform: translateY(-1px); }
.act { transition: border-color .15s, background .15s, transform .12s var(--ease); }
.act:hover { border-color: var(--ink); }
.act[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ---------- Answer and sources ---------- */
.answer { border-radius: 22px; padding: 22px; border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.answer::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--brand); }
.answer.notfound::before { background: var(--sensitive); }
.answer .text { font-size: 17.5px; line-height: 1.65; }
.answer sup a { background: var(--brand); color: var(--on-brand); border-radius: 6px; padding: 0 5px; margin: 0 1px; }
.answer.streaming .text::after { background: var(--brand); }
.meta .fast { color: var(--accent); }
.src { border-radius: 16px; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s var(--ease); }
.src:hover { box-shadow: var(--shadow-lift); }
.src blockquote { border-left-color: var(--brand); border-left-width: 4px; background: var(--quote); }
.src .n { color: var(--text); background: var(--brand); border-radius: 6px; padding: 0 6px; }
.verified { color: var(--accent); }
.spinner { border-top-color: var(--brand); border-right-color: var(--ink); }

/* ---------- Cards everywhere ---------- */
.stat, .hist, .evalcard, .card-form, .provider, .local-info, .gaps-list > li { box-shadow: var(--shadow); border-radius: 18px; }
.stat { transition: transform .2s var(--ease), box-shadow .2s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.stat b { font-weight: 800; letter-spacing: -0.02em; }
.stat.saved { background: var(--ink); border-color: var(--ink); color: #fff; }
.stat.saved b { color: var(--brand); font-size: 38px; }
.stat.saved span, .stat.saved small { color: rgba(255, 255, 255, .72); }
.evalscore b { color: var(--accent); }
.map { border-radius: 22px; box-shadow: var(--shadow); }

/* ---------- Voice button and the widget ---------- */
.voice-btn { box-shadow: 0 10px 28px rgba(20, 20, 20, .25); font-weight: 700; transition: transform .15s var(--ease), box-shadow .15s; }
.voice-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(20, 20, 20, .32); }
.voice[data-mode="listening"] .pulse { background: var(--brand); }
.tw-head { background: var(--ink); }
.tw-head .logo { box-shadow: none; }
.tw-launcher { box-shadow: 0 8px 24px rgba(0, 0, 0, .25), inset 0 0 0 3px rgba(255, 255, 255, .5); }
.tw-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.tw-mic { background: var(--accent-soft); color: var(--text); }

/* ---------- Footer ---------- */
.site-foot { max-width: 820px; margin: 0 auto; padding: 18px 16px 90px; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; border-top: 1px solid var(--line); }
.site-foot .id-mini { width: 18px; height: 18px; border-radius: 5px; background: var(--idmark) center / cover; display: inline-block; vertical-align: -4px; margin-right: 6px; }

/* ---------- Motion: things rise in, once, quickly (and not at all for people who turn motion off) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
/* Only when the page is on screen (html.anim is set by app.js): content is never left invisible */
.anim .view:not([hidden]) > h1,
.anim .view:not([hidden]) > .lead,
.anim .hero-stats,
.anim .ask,
.anim .mode-tabs,
.anim .tour-start,
.anim .answer,
.anim .src,
.anim .stat,
.anim .hist,
.anim .evalcard,
.anim .school-list li,
.anim .gaps-list > li,
.anim .chip { animation: rise .45s var(--ease) both; }
.view > .lead, .hero-stats { animation-delay: .05s; }
.mode-tabs, .tour-start { animation-delay: .08s; }
.ask { animation-delay: .1s; }
.chip:nth-child(1) { animation-delay: .14s; } .chip:nth-child(2) { animation-delay: .18s; } .chip:nth-child(3) { animation-delay: .22s; } .chip:nth-child(4) { animation-delay: .26s; }
.src:nth-of-type(2) { animation-delay: .06s; } .src:nth-of-type(3) { animation-delay: .12s; } .src:nth-of-type(4) { animation-delay: .18s; }
.stat:nth-child(2) { animation-delay: .05s; } .stat:nth-child(3) { animation-delay: .1s; } .stat:nth-child(4) { animation-delay: .15s; } .stat:nth-child(5) { animation-delay: .2s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 560px) {
  main { padding-top: 22px; }
  .top .status { display: none; }
  .brand-name small { display: none; }
  .menu { width: 88vw; }
}
/* Dark mode details for the inDrive theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mode-tabs button[aria-selected="true"] { background: var(--brand); color: var(--on-brand); }
  :root:not([data-theme="light"]) .stat.saved, :root:not([data-theme="light"]) .hero-stats .hs-saved,
  :root:not([data-theme="light"]) .tour-start { border: 1px solid #3A4410; }
  :root:not([data-theme="light"]) .ask:focus-within { border-color: var(--brand); }
}
/* Live pill: the air in Almaty now */
.live-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px;
  padding: 6px 14px 6px 10px; font: 500 13px var(--font); box-shadow: var(--shadow); margin-bottom: 14px; transition: transform .15s var(--ease), box-shadow .15s; }
.live-pill:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.live-pill b { color: var(--text); }
.live-pill .lp-tag { color: var(--cat, var(--accent)); letter-spacing: .06em; font-size: 11px; }
.live-pill { max-width: 100%; }
.lp-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cat, var(--good)); position: relative; flex: none; }
.anim .live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--cat, var(--good)); animation: livepulse 1.8s ease-out infinite; }
@keyframes livepulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
/* Dashboard: five cards fit on one row on a laptop */
.stats { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
/* Compare */
:root { --cmp-a: #4B6E00; --cmp-b: #5B6CF0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cmp-a: #C1F11D; --cmp-b: #8C9BFF; } }
:root[data-theme="dark"] { --cmp-a: #C1F11D; --cmp-b: #8C9BFF; }
.menu [data-view="compare"]::before { content: "🆚"; }
.cp-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 16px; }
.cp-pick select { font: 15px var(--font); padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); min-width: 0; max-width: 100%; }
.cp-pick select:disabled { opacity: 1; color: var(--text); }
.cp-vs { color: var(--muted); font-weight: 600; }
.cp-head { font-size: 22px; font-weight: 800; line-height: 1.25; margin: 4px 0 2px; }
.cp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.cp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; border-top: 4px solid var(--c); }
.cp-card.cp-a { --c: var(--cmp-a); } .cp-card.cp-b { --c: var(--cmp-b); }
.cp-card h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.cp-card h3 i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.cp-card b { display: block; font-size: 28px; } .cp-card b small { font-size: 13px; font-weight: 500; color: var(--muted); }
.cp-card > span { color: var(--muted); font-size: 13px; }
.cp-card ul { margin: 10px 0 0; font-size: 13px; display: grid; gap: 4px; }
.cp-chart svg { width: 100%; height: auto; }
.cp-chart rect.cp-a { fill: var(--cmp-a); } .cp-chart rect.cp-b { fill: var(--cmp-b); }
.cp-limit { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; opacity: .7; }
@media (max-width: 560px) { .cp-cards { grid-template-columns: 1fr; } .cp-head { font-size: 19px; } }
.cp-chart { max-width: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 10px; }
.cp-chart .ch-l { font-size: 12px; }
.cp-card ul { list-style: none; padding: 0; }
.cp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.cp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cp-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cp-legend i.cp-a { background: var(--cmp-a); } .cp-legend i.cp-b { background: var(--cmp-b); }
.cp-legend i.cp-dash { height: 0; width: 18px; border-top: 2px dashed var(--muted); border-radius: 0; }
/* Best time to go out */
.menu [data-view="outdoor"]::before { content: "🕐"; }
.sc-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.od-nowline { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 0 0 12px; }
.od-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.od-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-left: 6px solid var(--c); display: grid; gap: 4px; }
.od-card b { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.od-tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.od-best .od-tag { color: var(--accent); }
.od-worst .od-tag { color: var(--unhealthy); }
.od-val { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.od-advice { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 14px 0 4px; }
.od-est { opacity: .45; }
.od-band-best { fill: var(--accent); opacity: .12; }
.od-band-worst { fill: var(--unhealthy); opacity: .08; }
.od-now { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 2 3; }
.od-now-t { font-size: 10px; }
.cp-legend i.od-l-solid { background: var(--moderate); } .cp-legend i.od-l-est { background: var(--moderate); opacity: .45; }
.cp-legend i.od-l-best { background: var(--accent); opacity: .3; } .cp-legend i.od-l-worst { background: var(--unhealthy); opacity: .25; }
@media (max-width: 560px) { .od-cards { grid-template-columns: 1fr; } .od-card b { font-size: 26px; } }
/* Installable app */
.menu .menu-install { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.menu-hint { margin: 0 12px 8px; font-size: 13px; color: var(--muted); }
.offline-bar { position: sticky; top: 0; z-index: 60; background: var(--ink); color: #fff; text-align: center; padding: 8px 14px; font-size: 14px; }
