/* Yerevan 3D — one layout system.
 * Desktop: panel top-left, topics top-centre, search top-right, time bottom-centre, drawers on the right.
 * Phone (≤640 px): topics on top, search behind a button, the panel is a bottom sheet with the time bar in it,
 * drawers and cards are sheets that rise from the bottom. */
:root {
  --glass: rgba(12, 15, 24, 0.74);
  --solid: rgba(13, 16, 26, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --line2: rgba(255, 255, 255, 0.18);
  --text: #eef1f7;
  --muted: #9aa5ba;
  --tuff: #f0a184;
  --real: #ff9a3d;
  --sim: #7fd6ff;
  --gap: 16px;
  --r: 18px;
  --blur: blur(18px) saturate(1.4);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.38);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0a0e17; overflow: hidden; }
body { font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Armenian", Roboto, sans-serif; color: var(--text); -webkit-tap-highlight-color: transparent; }
#map { position: fixed; inset: 0; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- shared surfaces ---------- */
#panel, #timebar, #modes, #q, #q-open {
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.sheet, #news, #cuts, #near, #place-card, #welcome, #ask {
  background: var(--solid); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 14px 46px rgba(0, 0, 0, 0.5);
}
.chipbtn, .places button, #timebar button, #news-filters button, #cuts-filters button, #permit-types button, #near-here {
  font-size: 12px; color: var(--text); cursor: pointer; white-space: nowrap;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.places button:hover, #timebar button:hover, #news-filters button:hover, #cuts-filters button:hover, #permit-types button:hover { background: rgba(255, 255, 255, 0.14); }
.close, #news-close, #cuts-close, #near-close, #welcome-close, #ask-close {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center; font-size: 20px; line-height: 1;
  color: var(--muted); background: rgba(255, 255, 255, 0.06); border: 0; border-radius: 50%; cursor: pointer;
}
.close:hover, #news-close:hover, #cuts-close:hover, #near-close:hover, #welcome-close:hover, #ask-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.14); }

/* ---------- panel ---------- */
#panel { position: fixed; z-index: 5; top: var(--gap); left: var(--gap); width: 292px; max-height: calc(100% - 2 * var(--gap) - 84px);
  padding: 16px 18px 14px; border-radius: var(--r); overflow: auto; scrollbar-width: none; overscroll-behavior: contain; }
#panel::-webkit-scrollbar { display: none; }
#panel .grab { display: none; }
#panel header { position: relative; padding-right: 64px; }
#panel header .hy { font-size: 30px; font-weight: 800; letter-spacing: 0.06em; line-height: 1;
  background: linear-gradient(100deg, #ffd0b8, var(--tuff) 55%, #e2725b); -webkit-background-clip: text; background-clip: text; color: transparent; }
#panel header .sub { color: var(--muted); margin-top: 6px; font-size: 12.5px; letter-spacing: 0.02em; }
#panel .tools { position: absolute; top: 0; right: 0; display: flex; gap: 4px; }
#help, #fold { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06);
  color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 700; padding: 0; transition: transform 0.2s, color 0.15s, background 0.15s; }
#help:hover, #fold:hover { color: var(--text); background: rgba(255, 255, 255, 0.14); }
#panel.min #fold { transform: rotate(-90deg); }
#lang { display: flex; gap: 2px; margin-top: 10px; }
#lang button { font-size: 10.5px; color: var(--muted); background: none; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; cursor: pointer; }
#lang button.on { color: var(--text); border-color: var(--line); background: rgba(255, 255, 255, 0.08); }
.clock { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 2px; }
#clock { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; }
#sunstate { color: var(--muted); font-size: 12.5px; }
#weather { color: var(--muted); font-size: 12.5px; min-height: 18px; }
#weather b { color: var(--text); font-size: 14px; }
#weather .wind { display: inline-block; }
#teaser { display: none; }
#mode-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
#panel.min section, #panel.min #mode-hint { display: none !important; }

section { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
h2 { margin: 0 0 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.real { background: var(--real); box-shadow: 0 0 8px var(--real); }
.dot.air { background: #34c759; box-shadow: 0 0 8px #34c759; }
.dot.sim { background: var(--sim); box-shadow: 0 0 8px var(--sim); }
.airline { color: var(--muted); font-size: 11.5px; margin-top: 8px; line-height: 1.45; }
.airline a, #quake a { color: var(--sim); text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats b { display: block; font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stats span { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.25; }

/* topic content shows only in its topic */
#panel section[data-m] { display: none; }
.toggles label[data-m], .toggles label.auto { display: none; }
body[data-mode="city"] #panel section[data-m~="city"], body[data-mode="air"] #panel section[data-m~="air"], body[data-mode="move"] #panel section[data-m~="move"],
body[data-mode="build"] #panel section[data-m~="build"], body[data-mode="power"] #panel section[data-m~="power"], body[data-mode="news"] #panel section[data-m~="news"],
body[data-mode="more"] #panel section[data-m~="more"] { display: block; }
body[data-mode="city"] #panel section.toggles[data-m~="city"], body[data-mode="move"] #panel section.toggles[data-m~="move"], body[data-mode="more"] #panel section.toggles[data-m~="more"] { display: grid; }
body[data-mode="city"] .toggles label[data-m~="city"], body[data-mode="move"] .toggles label[data-m~="move"], body[data-mode="more"] .toggles label[data-m~="more"] { display: flex; }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 10px; }
.toggles label { align-items: center; gap: 8px; cursor: pointer; font-size: 13px; user-select: none; min-height: 24px; }
.toggles input { position: absolute; opacity: 0; }
.toggles i { width: 30px; height: 18px; border-radius: 10px; background: rgba(255, 255, 255, 0.16); position: relative; transition: background 0.2s; flex: none; }
.toggles i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggles input:checked + i { background: var(--tuff); }
.toggles input:checked + i::after { transform: translateX(12px); }
.toggles input:focus-visible + i { outline: 2px solid #fff; outline-offset: 2px; }

/* city card: live facts, each a door into its topic */
#brief { font-size: 12.5px; line-height: 1.5; color: #dfe5f0; margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(120deg, rgba(120, 60, 200, 0.14), rgba(240, 120, 160, 0.08)); border: 1px solid rgba(191, 90, 242, 0.25); }
#brief[hidden] { display: none; }
#brief small { display: block; margin-top: 5px; font-size: 10px; color: var(--muted); }
#facts button { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 13.5px; background: rgba(255, 255, 255, 0.05); border: 1px solid transparent; border-radius: 12px;
  padding: 9px 10px; margin-bottom: 6px; cursor: pointer; text-align: left; transition: background 0.15s, border-color 0.15s; }
#facts button:hover { background: rgba(240, 161, 132, 0.16); border-color: rgba(240, 161, 132, 0.6); }
#facts .ic { width: 20px; display: inline-flex; justify-content: center; color: var(--tuff); }
#facts .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
#facts .lb::first-letter { text-transform: uppercase; }
#facts b { font-variant-numeric: tabular-nums; }
#facts .go { color: var(--muted); }

/* air */
#a-chart { margin-top: 8px; }
#a-chart .axis, #a-week .axis { display: flex; gap: 6px; justify-content: space-between; font-size: 9.5px; color: var(--muted); }
#a-chart[hidden], #a-best[hidden] { display: none; }
#a-best { color: #cfe9d6; }
#a-advice { color: var(--text); margin-top: 4px; }
#a-rank summary, #a-more summary { cursor: pointer; color: var(--text); }
#a-rank ol { list-style: none; margin: 6px 0 4px; padding: 0; }
#a-rank li { display: flex; align-items: center; gap: 7px; padding: 2px 0; color: var(--text); font-size: 12px; }
#a-rank li i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#a-rank .go { color: var(--text); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
#a-rank .go:hover { color: var(--sim); }
#a-rank li b { margin-left: auto; font-variant-numeric: tabular-nums; }
#a-rank li small { color: var(--muted); width: 22px; text-align: right; }
#a-more .days { display: flex; justify-content: space-between; margin: 8px 0 4px; }
#a-more .days span { text-align: center; }
#a-more .days small { display: block; color: var(--muted); font-size: 10px; }
#a-more .days b { font-size: 14px; }
#a-week { margin-top: 6px; }
#quake { margin-top: 12px; }

/* construction */
#permit-filters { display: flex; flex-direction: column; gap: 5px; margin: 10px 0; }
#permit-filters button { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: rgba(255, 255, 255, 0.04); border: 1px solid transparent; border-radius: 10px; padding: 7px 9px; cursor: pointer; text-align: left; }
#permit-filters button.on { color: var(--text); background: rgba(255, 255, 255, 0.09); border-color: var(--line); }
#permit-filters i { width: 9px; height: 9px; border-radius: 50%; flex: none; opacity: 0.35; }
#permit-filters button.on i { opacity: 1; }
#permit-filters small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
#permit-types { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 10px; }
#permit-types button { color: var(--muted); font-size: 11.5px; padding: 4px 10px; }
#permit-types button.on { color: var(--text); background: rgba(255, 154, 61, 0.16); border-color: rgba(255, 154, 61, 0.55); }
#permit-types small, #cuts-filters small { color: var(--muted); margin-left: 3px; font-variant-numeric: tabular-nums; }

/* transport */
#live-traffic[hidden] { display: none !important; }
#live-traffic-list button { display: flex; align-items: center; gap: 8px; width: 100%; font-size: 12.5px; background: rgba(255, 255, 255, 0.04); border: 1px solid transparent; border-radius: 10px; padding: 6px 9px; margin-top: 5px; cursor: pointer; text-align: left; }
#live-traffic-list button:hover { border-color: var(--line); background: rgba(255, 255, 255, 0.09); }
#live-traffic-list i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#live-traffic-list span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#live-traffic-list b { font-variant-numeric: tabular-nums; }
#live-traffic-list small { color: var(--muted); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- topics bar ---------- */
#modes { position: fixed; z-index: 6; top: var(--gap); left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; max-width: calc(100% - 2 * 292px - 6 * var(--gap));
  overflow-x: auto; scrollbar-width: none; border-radius: 999px; }
#modes::-webkit-scrollbar { display: none; }
#modes button { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 7px 13px; cursor: pointer; white-space: nowrap; flex: none; transition: background 0.15s, color 0.15s; }
#modes button:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
#modes button.on { color: #10131c; background: linear-gradient(100deg, #ffd0b8, var(--tuff)); font-weight: 600; }
#modes .ic { display: inline-flex; }
#modes .ic svg { display: block; }
#modes button b { font-size: 10.5px; font-weight: 700; background: rgba(255, 255, 255, 0.16); color: var(--text); border-radius: 999px; padding: 0 6px; }
#modes button.on b { background: rgba(16, 19, 28, 0.2); color: #10131c; }
#modes button b:empty { display: none; }
#city-chips { position: fixed; z-index: 5; top: calc(var(--gap) + 54px); left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; width: max-content; max-width: calc(100% - 2 * 292px - 6 * var(--gap)); }
#city-chips[hidden] { display: none; }
#city-chips button { font-size: 11.5px; color: var(--muted); background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; cursor: pointer; display: flex; align-items: center; gap: 5px; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); white-space: nowrap; }
#city-chips button.on { color: var(--text); border-color: rgba(255, 255, 255, 0.35); }
#city-chips i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; opacity: 0.4; }
#city-chips button.on i { opacity: 1; }
#city-chips small { color: var(--muted); }

/* ---------- search ---------- */
#search { position: fixed; z-index: 7; top: var(--gap); right: var(--gap); width: 292px; }
#q-open { display: none; }
#q { width: 100%; font: inherit; color: var(--text); border-radius: 999px; padding: 10px 16px; outline: none; -webkit-appearance: none; appearance: none; }
#q::placeholder { color: var(--muted); }
#q:focus { border-color: var(--tuff); }
#q-list { list-style: none; margin: 6px 0 0; padding: 6px; background: var(--solid); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
#q-list[hidden] { display: none; }
#q-list li { padding: 8px 10px; border-radius: 9px; cursor: pointer; }
#q-list li:hover, #q-list li:focus { background: rgba(255, 255, 255, 0.09); outline: none; }
#q-list b { display: block; font-weight: 600; font-size: 13.5px; }
#q-list span { display: block; color: var(--muted); font-size: 11.5px; }
#q-list .hist { font-size: 10.5px; opacity: 0.75; }
/* map buttons sit under the search field */
.maplibregl-ctrl-top-right { top: calc(var(--gap) + 50px); right: calc(var(--gap) - 10px); }
.maplibregl-ctrl-group { background: var(--glass) !important; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--line); box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 34px; height: 34px; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.6); opacity: 0.85; }
.maplibregl-ctrl-group button:hover { background: rgba(255, 255, 255, 0.1) !important; }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib { display: none; }

/* ---------- Ask Yerevan (AI) ---------- */
#ask-open { display: none; position: fixed; z-index: 7; top: var(--gap); right: calc(var(--gap) + 292px + 8px); height: 42px; padding: 0 14px 0 12px; align-items: center; gap: 7px;
  border-radius: 999px; border: 1px solid rgba(191, 90, 242, 0.55); color: #f3e6ff; font-size: 13px; font-weight: 600; cursor: pointer;
  background: linear-gradient(120deg, rgba(120, 60, 200, 0.55), rgba(240, 120, 160, 0.45)), var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow); }
#ask-open:hover { border-color: #d9a6ff; }
body.first.has-ai #ask-open { animation: invite 1.6s ease-in-out 2.5s 2; }
@keyframes invite { 0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(191, 90, 242, 0.55); } 50% { box-shadow: var(--shadow), 0 0 0 10px rgba(191, 90, 242, 0); } }
body.has-ai #ask-open { display: flex; }
#ask { position: fixed; z-index: 8; top: calc(var(--gap) + 54px); right: var(--gap); bottom: var(--gap); width: 380px; display: flex; flex-direction: column;
  transform: translateX(calc(100% + 32px)); transition: transform 0.28s ease, visibility 0.28s; visibility: hidden; }
#ask.open { transform: none; visibility: visible; }
#ask header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 16px 8px; }
#ask h1 { margin: 0; font-size: 19px; font-weight: 700; background: linear-gradient(100deg, #e5c7ff, #ff9ec4); -webkit-background-clip: text; background-clip: text; color: transparent; }
#ask .sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
#ask-list { list-style: none; margin: 0; padding: 4px 14px 10px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
#ask-list li { max-width: 92%; font-size: 13.5px; line-height: 1.45; }
#ask-list li p { margin: 0 0 6px; } #ask-list li p:last-child { margin-bottom: 0; }
#ask-list li ul { margin: 2px 0 6px; padding-left: 18px; } #ask-list li li { max-width: none; margin: 2px 0; }
#ask-list .user { align-self: flex-end; background: rgba(191, 90, 242, 0.22); border: 1px solid rgba(191, 90, 242, 0.35); padding: 8px 12px; border-radius: 14px 14px 4px 14px; }
#ask-list .assistant { align-self: flex-start; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); padding: 9px 12px; border-radius: 14px 14px 14px 4px; }
#ask-list .err { color: #ffb4ab; }
#ask-list .hello { max-width: none; color: var(--muted); }
#ask-list .examples { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
#ask-list .examples button { text-align: left; font-size: 13px; color: var(--text); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; cursor: pointer; }
#ask-list .examples button:hover { border-color: rgba(191, 90, 242, 0.6); background: rgba(191, 90, 242, 0.12); }
#ask-list .typing { display: flex; gap: 4px; padding: 12px 14px; }
#ask-list .typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
#ask-list .typing span:nth-child(2) { animation-delay: 0.2s; } #ask-list .typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
#ask-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
#ask-q { flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--text); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; outline: none; }
#ask-q:focus { border-color: #bf5af2; }
#ask-mic { background: rgba(255, 255, 255, 0.08) !important; color: var(--text) !important; display: grid; place-items: center; }
#ask-mic.on { background: #ff453a !important; animation: blink 1.2s infinite; }
.pop .ask-here { margin-top: 8px; font-size: 12px; font-weight: 600; color: #f3e6ff; cursor: pointer; border-radius: 999px; padding: 5px 11px; border: 1px solid rgba(191, 90, 242, 0.55); background: linear-gradient(120deg, rgba(120, 60, 200, 0.35), rgba(240, 120, 160, 0.25)); }
#ask-form button { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; cursor: pointer; font-size: 18px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #8e44d8, #e0628f); }
body.asking #camctl, body.asking #news, body.asking #cuts { display: none; }

/* Ararat's peaks on the horizon */
.peak { pointer-events: none; text-align: center; color: #2b3650; font-size: 12px; line-height: 1.15; text-shadow: 0 0 4px #fff, 0 0 8px rgba(255, 255, 255, 0.9); white-space: nowrap; }
.peak b { display: block; font-weight: 700; }
.peak span { font-size: 10.5px; opacity: 0.8; }
.peak::after { content: ""; display: block; width: 1px; height: 10px; margin: 2px auto 0; background: rgba(43, 54, 80, 0.5); }
body[data-mode]:not([data-mode="city"]) .peak { display: none; }

/* ---------- camera buttons ---------- */
#camctl { position: fixed; z-index: 5; right: var(--gap); top: calc(var(--gap) + 54px); display: flex; flex-direction: column; gap: 1px; border-radius: 14px; overflow: hidden;
  background: var(--line); border: 1px solid var(--line); box-shadow: var(--shadow); }
#camctl button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; cursor: pointer; color: var(--text); font-size: 18px; font-weight: 600;
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); transition: background 0.15s; }
#camctl button:hover { background: rgba(40, 46, 62, 0.92); }
#cam-3d { font-size: 12.5px !important; letter-spacing: 0.04em; }
#cam-north.off { opacity: 0.75; }
#cam-me.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #0a84ff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(10, 132, 255, 0.25); }
body:has(#news.open) #camctl, body:has(#cuts.open) #camctl, body:has(#place-card:not([hidden])) #camctl { display: none; }

/* ---------- quick places and time ---------- */
.places { position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(var(--gap) + 74px); max-width: calc(100% - 2 * 292px - 6 * var(--gap)); display: none; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.places::-webkit-scrollbar { display: none; }
body[data-mode="city"] .places { display: flex; }
.places button { flex: none; background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); padding: 6px 12px; }
.places button:hover { background: rgba(40, 46, 62, 0.92); }
.places button.accent { border-color: var(--tuff); color: #ffd9c9; }

#timebar { position: fixed; z-index: 5; left: 50%; bottom: var(--gap); transform: translateX(-50%); width: min(600px, calc(100% - 2 * 292px - 6 * var(--gap)));
  padding: 9px 14px 7px; display: flex; align-items: center; gap: 10px; border-radius: var(--r); }
#timebar button { flex: none; }
#timebar button.on { background: rgba(240, 161, 132, 0.25); border-color: var(--tuff); color: #ffd9c9; }
.slider { flex: 1; min-width: 0; }
#hour { width: 100%; margin: 0; accent-color: var(--tuff); display: block; }
.ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }

#credit { position: fixed; z-index: 4; right: 12px; bottom: 8px; font-size: 10.5px; color: rgba(255, 255, 255, 0.72); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); white-space: nowrap; }
#credit a { color: #fff; }

/* ---------- drawers and cards (right side on desktop) ---------- */
#news-btn, #cuts-btn { display: none !important; }
#news, #cuts { position: fixed; z-index: 8; top: calc(var(--gap) + 54px); right: var(--gap); bottom: var(--gap); width: 372px; display: flex; flex-direction: column;
  transform: translateX(calc(100% + 32px)); transition: transform 0.28s ease, visibility 0.28s; visibility: hidden; }
#news.open, #cuts.open { transform: none; visibility: visible; }
#news header, #cuts header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 16px 10px; }
#news h1, #cuts h1 { margin: 0; font-size: 19px; font-weight: 700; }
#news-sub, #cuts-sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
#news-filters, #cuts-filters { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: none; flex: none; }
#news-filters::-webkit-scrollbar, #cuts-filters::-webkit-scrollbar { display: none; }
#news-filters button, #cuts-filters button { font-size: 11.5px; padding: 4px 10px; color: var(--muted); flex: none; }
#news-filters button.on { color: var(--text); background: rgba(240, 161, 132, 0.25); border-color: var(--tuff); }
#cuts-filters button.on { color: var(--text); background: rgba(255, 255, 255, 0.12); border-color: var(--c, var(--tuff)); }
#news-list, #cuts-list { list-style: none; margin: 0; padding: 0 10px; overflow: auto; flex: 1; overscroll-behavior: contain; }
#news-list li, #cuts-list li { padding: 11px 8px 11px 10px; border-top: 1px solid var(--line); overflow: hidden; }
#news-list .meta, #cuts-list .meta { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#cuts-list .meta b { color: var(--text); }
#news-list .chip, #cuts-list .chip { border: 1px solid; border-radius: 999px; padding: 0 7px; font-size: 10.5px; }
#news-list .title { display: block; color: var(--text); text-decoration: none; font-size: 13.5px; line-height: 1.38; margin: 5px 0; }
#news-list .title:hover { text-decoration: underline; }
#cuts-list .title { font-size: 13px; line-height: 1.42; margin: 5px 0; cursor: pointer; }
#cuts-list .title.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
#news-list .where, #cuts-list .where { font-size: 12px; color: var(--sim); background: none; border: 0; padding: 0; cursor: pointer; }
#news-list .empty { color: var(--muted); border: 0; }
#news-list .mt { display: inline-block; font-size: 10px; color: var(--muted); border: 1px dashed var(--line2); border-radius: 6px; padding: 0 5px; margin: 0 6px 4px 0; }
#news-list .thumb { float: right; width: 84px; height: 62px; object-fit: cover; border-radius: 8px; margin: 2px 0 4px 10px; background: rgba(255, 255, 255, 0.06); }
#cuts-list .src { font-size: 11.5px; color: var(--muted); text-decoration: none; }
#cuts-list .src:hover { color: var(--sim); }
#news footer, #cuts footer { color: var(--muted); font-size: 10.5px; padding: 8px 16px 12px; border-top: 1px solid var(--line); }

#near { position: fixed; z-index: 7; right: var(--gap); bottom: calc(var(--gap) + 74px); width: 340px; max-height: calc(100% - 200px); overflow: auto; }
#near[hidden] { display: none; }
#near header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 14px 4px; }
#near h1 { margin: 0; font-size: 16px; font-weight: 700; }
#near-list { list-style: none; margin: 0; padding: 4px 14px; }
#near-list li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
#near-list li:first-child { border-top: 0; }
#near-list .ic { font-size: 17px; width: 22px; text-align: center; flex: none; }
#near-list b { display: block; font-size: 13.5px; font-weight: 600; }
#near-list small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 2px; }
#near-list a, #near-list .go { color: var(--sim); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
#near-list b .go { font-weight: 600; }
#near footer { display: flex; flex-direction: column; gap: 6px; padding: 8px 14px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10.5px; }
#near-here { align-self: flex-start; font-size: 11.5px; }

#place-card { position: fixed; z-index: 7; top: calc(var(--gap) + 54px); right: var(--gap); width: 320px; overflow: hidden; }
#place-card[hidden] { display: none; }
#place-card img { display: block; width: 100%; height: 160px; object-fit: cover; }
#place-card .body { padding: 14px 16px; }
#place-card h1 { margin: 0 0 6px; font-size: 17px; font-weight: 700; padding-right: 26px; }
#place-card p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.5; color: #d4dae8; }
#place-card a { color: var(--sim); font-size: 12px; text-decoration: none; }
#place-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(12, 15, 24, 0.75); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }

/* ---------- welcome ---------- */
#welcome { position: fixed; z-index: 9; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(400px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 22px 22px 16px; border-radius: 22px; }
#welcome[hidden] { display: none; }
#welcome .hero { margin: -22px -22px 14px; height: 150px; overflow: hidden; border-radius: 22px 22px 0 0; position: relative; }
#welcome .hero img, #welcome .hero video { width: 100%; height: 100%; object-fit: cover; object-position: center 60%; display: block; }
#welcome .hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(13, 16, 26, 0.94)); }
#welcome-close { z-index: 2; background: rgba(12, 15, 24, 0.55) !important; color: #fff !important; }
#welcome h1 { margin: 0 0 4px; font-size: 24px; font-weight: 800; background: linear-gradient(100deg, #ffd0b8, var(--tuff) 55%, #e2725b); -webkit-background-clip: text; background-clip: text; color: transparent; }
#today { color: #ffe9dd; font-size: 12.5px; margin: 2px 0 8px; min-height: 16px; }
#welcome p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
#welcome button[data-go] { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font-size: 14px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 7px; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
#welcome button[data-go]:hover { background: rgba(240, 161, 132, 0.18); border-color: var(--tuff); }
#welcome button[data-go] span:first-child { font-size: 18px; width: 22px; display: inline-flex; justify-content: center; color: var(--tuff); flex: none; }
#welcome button.ai { display: none; border-color: rgba(191, 90, 242, 0.45); background: linear-gradient(120deg, rgba(120, 60, 200, 0.22), rgba(240, 120, 160, 0.16)); }
#welcome button.ai span:first-child { color: #e5c7ff; }
body.has-ai #welcome button.ai { display: flex; }
#welcome small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 8px; }
#welcome-close { position: absolute; top: 12px; right: 12px; }

/* ---------- small things ---------- */
#toast { position: fixed; z-index: 10; left: 50%; bottom: calc(var(--gap) + 120px); transform: translate(-50%, 10px); background: var(--solid); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#err { position: fixed; top: 16px; right: 16px; z-index: 11; background: #7a1f1f; padding: 10px 14px; border-radius: 10px; max-width: 360px; }
#err[hidden] { display: none; }

.maplibregl-popup-content { background: var(--solid); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); font: inherit; min-width: 180px; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; right: 4px; top: 2px; width: 26px; height: 26px; border-radius: 50%; }
.maplibregl-popup-close-button:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.pop .tag { color: var(--real); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 600; padding-right: 18px; }
.pop .name { font-size: 15px; font-weight: 650; margin: 3px 0 4px; padding-right: 14px; }
.pop .row { color: var(--muted); font-size: 12px; margin-top: 3px; }
.pop .route { font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.08); border: 1.5px solid; border-radius: 7px; padding: 1px 7px; margin: 0 4px 4px 0; cursor: pointer; min-width: 30px; }
.pop a { color: var(--sim); font-size: 12px; text-decoration: none; display: inline-block; margin-top: 6px; }
.pop .photo { display: block; margin: -2px 0 8px; }
.pop .photo img { display: block; width: 100%; max-height: 150px; object-fit: cover; border-radius: 8px; }

/* ---------- middle widths: icons only in the topics bar ---------- */
@media (max-width: 1320px) {
  #modes .lb { display: none; }
  #modes button.on .lb { display: inline; }
  #modes, #city-chips, .places { max-width: calc(100% - 292px - 4 * var(--gap)); }
  #modes { left: calc(292px + 2 * var(--gap)); right: auto; transform: none; }
  #search { width: 220px; }
  #modes { max-width: calc(100% - 292px - 220px - 5 * var(--gap)); }
  #city-chips { left: calc(292px + 2 * var(--gap)); transform: none; justify-content: flex-start; }
  .places { left: calc(292px + 2 * var(--gap)); transform: none; }
  #timebar { left: calc(292px + 2 * var(--gap)); transform: none; width: min(600px, calc(100% - 292px - 3 * var(--gap))); }
}

/* a drawer is open on the right: centre things move into the space left between panel and drawer */
@media (min-width: 641px) {
  body:has(#ask.open) #timebar { left: calc(292px + 2 * var(--gap)); transform: none; width: min(600px, calc(100% - 292px - 380px - 4 * var(--gap))); }
  body:has(#news.open) #timebar, body:has(#cuts.open) #timebar { left: calc(292px + 2 * var(--gap)); transform: none; width: min(600px, calc(100% - 292px - 372px - 4 * var(--gap))); }
  body:has(#news.open) #modes, body:has(#cuts.open) #modes { left: calc(292px + 2 * var(--gap)); transform: none; max-width: calc(100% - 292px - 292px - 4 * var(--gap)); }
  body:has(#news.open) #modes .lb, body:has(#cuts.open) #modes .lb { display: none; }
  body:has(#news.open) #modes button.on .lb, body:has(#cuts.open) #modes button.on .lb { display: inline; }
  body:has(#news.open) .maplibregl-ctrl-top-right, body:has(#cuts.open) .maplibregl-ctrl-top-right { display: none; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  :root { --gap: 10px; }
  .maplibregl-ctrl-top-right { display: none; }
  /* on a phone: compass, 2D/3D and where-am-I only (pinch, twist and two-finger drag do the rest), above the sheet */
  #camctl { top: auto; right: 8px; bottom: calc(var(--bottom) + 190px); }
  #camctl .desk { display: none; }
  #camctl button { width: 42px; height: 42px; }
  body:has(#panel:not(.min)) #camctl { display: none; }

  #modes { top: calc(var(--top) + 8px); left: 8px; right: 56px; max-width: none; transform: none; padding: 3px;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  #modes button { padding: 8px 11px; }
  #modes .lb { display: none; }
  #modes button.on .lb { display: inline; }
  #city-chips { top: calc(var(--top) + 58px); left: 8px; right: 8px; transform: none; width: auto; max-width: none; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  #city-chips::-webkit-scrollbar { display: none; }

  /* search: a round button; open = full-width field with quick places under it */
  #search { top: calc(var(--top) + 8px); right: 8px; left: auto; width: 42px; }
  #ask-open { top: calc(var(--top) + 8px); right: 56px; width: 42px; padding: 0; justify-content: center; }
  #ask-open span { display: none; }
  body.has-ai #modes { right: 104px; }
  #ask { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 80%; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: var(--bottom); transform: translateY(105%); z-index: 11; }
  #ask-q { font-size: 16px; }
  #ask { transition: transform 0.28s ease, height 0.28s ease, visibility 0.28s; }
  #ask.peek { height: 30%; }
  #ask.peek #ask-list .user { display: none; }
  #ask header { cursor: pointer; }
  #ask::before { content: ""; display: block; width: 38px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
  #q-open { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--text); cursor: pointer; padding: 0; }
  #q, #q-list { display: none; }
  #search .places { display: none; }
  #search.open { left: 8px; width: auto; z-index: 12; }
  #search.open #q-open { display: none; }
  #search.open #q { display: block; padding: 11px 16px; font-size: 16px; }   /* 16 px: iOS does not zoom the page on focus */
  #search.open #q-list:not([hidden]) { display: block; max-height: 46vh; }
  #search.open .places { display: flex; position: static; transform: none; max-width: none; margin-top: 8px; flex-wrap: wrap; overflow: visible; }
  #search.open .places button { background: var(--solid); padding: 8px 12px; font-size: 13px; }

  /* the panel becomes a bottom sheet */
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72%; padding: 4px 16px calc(12px + var(--bottom)); border-radius: 20px 20px 0 0; border-bottom: 0;
    transition: max-height 0.25s ease; }
  #panel .grab { display: block; width: 100%; height: 22px; cursor: grab; position: relative; touch-action: none; }
  #panel .grab::after { content: ""; position: absolute; left: 50%; top: 8px; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
  #panel header { padding-right: 70px; touch-action: none; }
  #panel header .hy { font-size: 20px; }
  #panel header .sub { display: none; }
  #lang { margin-top: 8px; }
  #panel.min header .hy, #panel.min #lang, #panel.min #help { display: none; }
  #panel.min header { min-height: 0; padding: 0; }
  #panel.min .tools { top: 2px; }
  .clock { margin: 6px 0 0; padding-right: 40px; }
  #panel.min .clock { margin-top: 0; }
  #clock { font-size: 22px; }
  #weather { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #panel.min #teaser:not([hidden]) { display: block; margin-top: 6px; font-size: 12px; color: #e9dcff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
  #timebar { position: static; transform: none; width: auto; margin: 10px 0 2px; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; gap: 8px; }
  #timebar button { padding: 7px 11px; }
  #hour { height: 26px; }
  .toggles label { min-height: 32px; font-size: 14px; }
  #facts button { padding: 11px 10px; }
  #permit-filters button { padding: 9px 10px; }

  /* drawers and cards rise from the bottom, over the sheet */
  #news, #cuts { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 78%; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: var(--bottom); transform: translateY(105%); z-index: 9; }
  #news::before, #cuts::before, #near::before, #place-card::before { content: ""; display: block; width: 38px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
  #news header, #cuts header { padding-top: 8px; }
  #near { left: 0; right: 0; bottom: 0; width: auto; max-height: 70%; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: var(--bottom); z-index: 9; }
  #place-card { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 70%; overflow: auto; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: var(--bottom); z-index: 9; }
  #place-card::before { position: absolute; left: 50%; margin-left: -19px; top: 0; z-index: 1; }
  #place-card img { height: 150px; }
  #place-close { top: 14px; }
  .maplibregl-popup-content { max-width: calc(100vw - 32px); }
  #toast { bottom: calc(var(--bottom) + 140px); }
  #credit { display: none; }
}
