/* Levana — map-first night-sky UI with a five-tab bottom navigation */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b1026;
  --bg2: #141a3a;
  --card: #1a2147;
  --text: #eef1ff;
  --dim: #9aa3c7;
  --gold: #ffd166;
  --blue: #7ec8ff;
  --green: #58d68d;
  --red: #ff8a80;
  --glass: rgba(16, 22, 52, 0.82);
  --panel: rgba(9, 13, 34, 0.94);
  --edge: rgba(120, 134, 200, 0.28);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --topbar: calc(56px + var(--safe-t));
  --tabbar: calc(62px + var(--safe-b));
  /* room kept above the tab bar for the raised centre orb */
  --orb-lift: 30px;
  --peek: 118px;
  /* the fully-open sheet stops short of the compass rail so it stays reachable */
  --railspace: 196px;
}

html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; }

/* ---------- icons ---------- */

.ico {
  width: 1.15em; height: 1.15em;
  flex: none;
  vertical-align: -0.2em;
}
[data-icon] { display: inline-flex; line-height: 0; }
h1 [data-icon], h2 [data-icon], h3 [data-icon] { color: var(--gold); margin-right: 0.45rem; }
h3 .ico { width: 1.05em; height: 1.05em; }
.btn [data-icon], .chip [data-icon] { margin-right: 0.4rem; }
.moon-dark { fill: #232c5c; }
.moon-lit { fill: var(--gold); }
.moon-rim { fill: none; stroke: rgba(255, 209, 102, 0.35); stroke-width: 1; }
.ico-clear { color: var(--blue); }
.ico-good { color: var(--text); }
.ico-mid { color: var(--dim); }
.ico-poor { color: #6f7aa8; }

/* ---------- map as the background ---------- */

#map { position: absolute; inset: 0; background: var(--bg); z-index: 0; }
.leaflet-container { font: inherit; background: var(--bg); }

/*
 * OpenStreetMap's standard tiles are a daytime map, and this app is mostly open
 * at night. Inverting and rotating the hue turns them into a night map — dark
 * ground, water still reading as water — without a paid dark basemap. The
 * filter is on the layer rather than the whole tile pane, so the Daylight
 * basemap can opt out of it and the beam, walk line and markers above keep
 * their own colours either way.
 */
.tiles-night {
  filter: invert(1) hue-rotate(180deg) brightness(0.82) contrast(0.95) saturate(0.55);
}

/* ---------- layers control ---------- */

.leaflet-control-layers {
  background: var(--glass) !important;
  backdrop-filter: blur(12px);
  border: 1px solid var(--edge) !important;
  border-radius: 14px !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45) !important;
  color: var(--text);
}
.leaflet-control-layers-toggle {
  width: 42px !important; height: 42px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23eef1ff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.4 21 8l-9 4.6L3 8z'/%3E%3Cpath d='M3 12.4 12 17l9-4.6'/%3E%3Cpath d='M3 16.6 12 21.2l9-4.6'/%3E%3C/svg%3E") !important;
  background-size: 22px 22px !important;
  background-position: center !important;
}
.leaflet-control-layers-expanded {
  padding: 0.55rem 0.7rem !important;
  font: inherit; font-size: 0.86rem;
  min-width: 8.5rem;
}
.leaflet-control-layers-list label { display: block; padding: 0.18rem 0; cursor: pointer; }
.leaflet-control-layers-list label span { display: inline-flex; align-items: center; gap: 0.4rem; }
.leaflet-control-layers-separator {
  border-top: 1px solid var(--edge) !important;
  margin: 0.4rem 0 !important;
}
.leaflet-control-layers input { accent-color: var(--gold); }
/* clear of the top bar, and of the compass rail opposite it */
.leaflet-top.leaflet-left { top: calc(var(--topbar) + 8px); }
[dir="rtl"] .leaflet-top.leaflet-left { left: auto; right: 0; }
/*
 * Required credit for the tiles. It lives in the strip between the bottom of
 * the collapsed sheet and the tab bar — the one band of map nothing else
 * occupies — so the licence stays legible without taking a bite out of the
 * view or riding above the sheet.
 */
.leaflet-control-attribution {
  background: rgba(10, 14, 36, 0.7) !important;
  color: var(--dim) !important;
  font-size: 9.5px !important;
  line-height: 1.4;
  padding: 1px 6px !important;
  border-radius: 0 6px 0 0;
  margin: 0 0 calc(var(--tabbar) + 3px) !important;
}
.leaflet-control-attribution a { color: var(--dim) !important; }

/* keeps the top bar and rail legible over bright tiles */
.map-veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(11, 16, 38, 0.85) 0, rgba(11, 16, 38, 0) 22%),
    linear-gradient(to top, rgba(11, 16, 38, 0.75) 0, rgba(11, 16, 38, 0) 26%);
}

.map-pin { color: var(--gold); filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.9)); }
.map-pin svg { width: 30px; height: 30px; }
.map-pin-walk { color: var(--green); filter: drop-shadow(0 0 7px rgba(88, 214, 141, 1)); }
.map-pin-walk svg { width: 34px; height: 34px; }

/*
 * The spot to walk to is the one thing on the map that asks something of the
 * reader, so it announces itself: a ring that pulses out from under the pin,
 * and its distance and direction on a label that never has to be tapped for.
 */
.walk-halo span {
  display: block; width: 100%; height: 100%;
  border-radius: 50%;
  border: 2px solid var(--green);
  background: rgba(88, 214, 141, 0.18);
  animation: walk-pulse 2.2s ease-out infinite;
}
@keyframes walk-pulse {
  0%   { transform: scale(0.45); opacity: 0.95; }
  70%  { transform: scale(1);    opacity: 0.12; }
  100% { transform: scale(1);    opacity: 0; }
}
.walk-label.leaflet-tooltip {
  background: rgba(10, 14, 36, 0.92);
  border: 1px solid var(--green);
  border-radius: 9px;
  padding: 0.24rem 0.5rem;
  color: var(--text);
  font: inherit; font-size: 0.76rem; font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.walk-label.leaflet-tooltip::before { display: none; }   /* no callout arrow */

/* ---------- top bar ---------- */

#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  height: var(--topbar);
  padding: var(--safe-t) 0.6rem 0;
  display: flex; align-items: center; gap: 0.55rem;
}
.tb-logo { color: var(--gold); filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.5)); }
.tb-logo .ico { width: 26px; height: 26px; }
.tb-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start;
  position: relative;
  padding: 0 1.1rem 0 0;
  background: none; border: 0; color: inherit;
  font: inherit; text-align: start;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.tb-text:active { opacity: 0.7; }
.tb-place, .tb-status { display: block; max-width: 100%; }
/* the caret says the name is a control, not a caption */
.tb-caret {
  position: absolute; inset-inline-end: 0; top: 50%;
  transform: translateY(-50%);
  color: var(--dim); line-height: 0;
}
.tb-caret .ico { width: 15px; height: 15px; }
#placeBtn[aria-expanded="true"] .tb-caret { transform: translateY(-50%) rotate(180deg); }
.tb-place {
  font-weight: 700; font-size: 0.98rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
.tb-status {
  font-size: 0.78rem; color: var(--gold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
.icon-btn {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.icon-btn .ico { width: 21px; height: 21px; }
.icon-btn:active { transform: scale(0.94); }

/* ---------- searching from the top bar ---------- */

.top-search {
  position: absolute; z-index: 40;
  top: var(--topbar); left: 0.5rem; right: 0.5rem;
  padding: 0.6rem 0.7rem 0.7rem;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--edge);
  border-radius: 0 0 18px 18px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.top-search.on { transform: none; opacity: 1; }
.top-search[hidden] { display: none; }
.top-search .search { margin-top: 0; }
.top-search .search-results { max-height: 46vh; overflow-y: auto; }
.top-search > .btn { width: 100%; margin-top: 0.5rem; }
#topSearchClose { flex: none; padding: 0.65rem 0.8rem; }

/* ---------- views ---------- */

.view { display: none; }
.view.on { display: block; }

/* the map view is a pass-through frame: its controls float over the live map */
#viewMap { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#viewMap > * { pointer-events: auto; }

/* every other tab is a full-height scrolling panel over the map */
.panel {
  position: absolute; z-index: 15;
  left: 0; right: 0; top: 0; bottom: var(--tabbar);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--panel);
  backdrop-filter: blur(18px);
  /* the last line has to clear the raised centre orb, not sit under it */
  padding: calc(var(--topbar) + 0.4rem) 0.7rem calc(1.5rem + var(--orb-lift));
}

/* over the map the top bar floats; over a panel it has to be opaque, or the
   text scrolls through it */
body:not([data-view="map"]) #topbar {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--edge);
}
.panel-title { font-size: 1.55rem; letter-spacing: -0.01em; margin-bottom: 0.15rem; }
.panel-sub { color: var(--dim); font-size: 0.88rem; margin-bottom: 0.9rem; }

/* ---------- bottom navigation ---------- */

.tabbar {
  position: absolute; z-index: 50;
  left: 0; right: 0; bottom: 0;
  height: var(--tabbar);
  padding-bottom: var(--safe-b);
  display: flex; align-items: stretch;
  background: rgba(10, 14, 38, 0.92);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--edge);
}
.tab {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.18rem;
  background: none; border: 0;
  color: var(--dim);
  font: inherit; font-size: 0.63rem; letter-spacing: 0.01em;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.tab .tab-ico .ico { width: 23px; height: 23px; }
.tab-label { white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--gold); }
.tab:active { transform: scale(0.96); }

/* the map tab is the centre of the app: a raised circle straddling the bar */
/* padding lines its label up with the labels either side of it */
.tab-center { position: relative; justify-content: flex-end; padding-bottom: 0.75rem; }
.tab-orb {
  position: absolute;
  /* rises 24px above the bar, leaving the bottom of the tab for its label */
  bottom: calc(100% - 36px);
  left: 50%; transform: translateX(-50%);
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  background: radial-gradient(circle at 35% 30%, #23306c, #10163a 78%);
  border: 1px solid rgba(255, 209, 102, 0.45);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), 0 0 20px rgba(255, 209, 102, 0.16);
  transition: box-shadow 0.2s, transform 0.15s;
}
.tab-orb .ico { width: 30px; height: 30px; }
.tab-center[aria-selected="true"] .tab-orb,
.tab-center[aria-pressed="true"] .tab-orb {
  border-color: var(--gold);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 209, 102, 0.42);
}
.tab-center:active .tab-orb { transform: translateX(-50%) scale(0.94); }

/* ---------- compass rail ---------- */

.rail {
  position: absolute; z-index: 20;
  right: 0.6rem; top: calc(var(--topbar) + 10px);
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
}
.dial-mini {
  position: relative; width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--edge);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.dial-mini[hidden] { display: none; }
.dial { position: absolute; inset: 4px; border-radius: 50%; transition: transform 0.15s linear; }
.dial span { position: absolute; color: var(--dim); font-size: 0.62rem; font-weight: 700; }
.dial-n { top: 2px; left: 50%; transform: translateX(-50%); color: var(--red) !important; }
.dial-s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.dial-e { right: 4px; top: 50%; transform: translateY(-50%); }
.dial-w { left: 4px; top: 50%; transform: translateY(-50%); }
.needle {
  position: absolute; inset: 0; display: flex; justify-content: center;
  transition: transform 0.15s linear; pointer-events: none;
}
.needle::before {
  content: ""; position: absolute;
  top: 24px; bottom: 50%; left: calc(50% - 2.5px);
  width: 5px; border-radius: 3px;
  background: linear-gradient(to top, transparent, var(--gold));
}
.needle-moon { position: absolute; top: 11px; color: var(--gold); }
.needle-moon .ico { width: 16px; height: 16px; }

.rail-read {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 0.25rem 0.5rem;
  font-size: 0.76rem; font-weight: 700; text-align: center;
  min-width: 84px;
  font-variant-numeric: tabular-nums;
}
.rail-read small { display: block; font-weight: 400; color: var(--dim); font-size: 0.68rem; }
.rail-btn {
  width: 52px; height: 52px;
  border-radius: 16px;
  border: 1px solid var(--edge);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.05rem;
  font: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.rail-btn .ico { width: 22px; height: 22px; }
.rail-btn[hidden] { display: none; }
.rail-btn small { font-size: 0.55rem; color: var(--dim); letter-spacing: 0.04em; }
.rail-btn-hero { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 209, 102, 0.22); }
.rail-btn-hero .ico { color: var(--gold); }
.rail-btn:active { transform: scale(0.94); }

/* ---------- find button, floating on the map ---------- */

.find-btn {
  position: absolute; z-index: 22;
  right: 0.6rem;
  bottom: calc(var(--tabbar) + var(--orb-lift) + var(--peek) + 14px);
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.55rem 0.95rem 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--glass);
  backdrop-filter: blur(12px);
  color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s, transform 0.15s;
}
.find-btn .ico { width: 19px; height: 19px; color: var(--gold); }
.find-btn:active { transform: scale(0.95); }
/* the open sheet would swallow it, so it steps aside */
.find-btn.is-hidden { opacity: 0; pointer-events: none; }

/* ---------- pointing overlay ---------- */

.aim-overlay {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(6, 9, 26, 0.96);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.9rem; padding: calc(var(--safe-t) + 1rem) 1rem calc(var(--safe-b) + 1rem);
}
.aim-overlay[hidden] { display: none; }
.vf-box {
  position: relative;
  width: min(92vw, 460px);
  aspect-ratio: 3 / 4;
  max-height: 62vh;
  border: 2px solid var(--edge);
  border-radius: 20px;
  background: radial-gradient(circle at 50% 45%, #16204a 0%, #080d24 78%);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.vf-locked { border-color: var(--green); box-shadow: 0 0 30px rgba(88, 214, 141, 0.45); }
.vf-cross {
  position: absolute; left: 50%; top: 50%;
  width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border: 2px solid rgba(154, 163, 199, 0.7); border-radius: 50%;
}
.vf-cross::before, .vf-cross::after { content: ""; position: absolute; background: rgba(154, 163, 199, 0.7); }
.vf-cross::before { left: 50%; top: -16px; bottom: -16px; width: 2px; margin-left: -1px; }
.vf-cross::after { top: 50%; left: -16px; right: -16px; height: 2px; margin-top: -1px; }
.vf-locked .vf-cross { border-color: var(--green); }
.vf-moon {
  position: absolute; line-height: 0; color: var(--gold);
  transform: translate(-50%, -50%);
  transition: left 0.1s linear, top 0.1s linear;
  filter: drop-shadow(0 0 12px rgba(255, 209, 102, 0.9));
}
.vf-moon .ico { width: 38px; height: 38px; }
.vf-moon-edge { animation: vf-pulse 1s ease-in-out infinite; }
@keyframes vf-pulse { 50% { transform: translate(-50%, -50%) scale(1.35); } }
.vf-arrow {
  position: absolute; line-height: 0;
  color: #2f3a70; transition: color 0.15s, transform 0.15s;
}
.vf-arrow .ico { width: 30px; height: 30px; }
.vf-arrow.on { color: var(--gold); transform: scale(1.3); }
.vf-up { top: 8px; left: 50%; margin-left: -15px; }
.vf-down { bottom: 8px; left: 50%; margin-left: -15px; }
.vf-left { left: 10px; top: 50%; margin-top: -15px; }
.vf-right { right: 10px; top: 50%; margin-top: -15px; }
/* the "nothing to point at" answer stands where the viewfinder would be */
.vf-below { display: block; font-size: 1.05rem; line-height: 1.6; max-width: 22rem; }
.vf-box[hidden] { display: none; }

.vf-text { text-align: center; min-height: 3em; font-size: 1.05rem; }
.ok { color: var(--green); }
.warn { color: var(--gold); }

/* ---------- bottom sheet (map tab) ---------- */

/*
 * The sheet floats above the tab bar rather than running off the bottom of the
 * screen, so it collapses by shrinking to the handle rather than by sliding
 * out of view — nothing to hide off-screen when there is no screen edge below.
 */
.sheet {
  position: absolute; z-index: 25;
  left: 0.4rem; right: 0.4rem;
  bottom: calc(var(--tabbar) + var(--orb-lift));
  height: var(--peek);
  max-height: calc(100% - var(--topbar) - var(--tabbar) - var(--orb-lift) - var(--railspace));
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--edge);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.5);
  transition: height 0.3s cubic-bezier(0.22, 0.8, 0.3, 1);
  display: flex; flex-direction: column;
}
.sheet.open {
  height: calc(100% - var(--topbar) - var(--tabbar) - var(--orb-lift) - var(--railspace));
}
.sheet.dragging { transition: none; }

.sheet-handle {
  flex: none;
  width: 100%;
  background: none; border: 0; color: inherit;
  padding: 0.5rem 1rem 0.6rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  cursor: pointer; text-align: center;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.grip { width: 42px; height: 5px; border-radius: 3px; background: #46508a; flex: none; }
.sheet-peek {
  font-size: 0.92rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sheet-peek b { color: var(--gold); }
.sheet-peek .ico { vertical-align: -0.22em; }
.sheet-body {
  flex: 1; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 0.6rem 1rem;
}
.sheet:not(.open) .sheet-body { overflow: hidden; }

/* ---------- weather strip ---------- */

.weather-bar {
  display: flex; align-items: center; gap: 0.35rem;
  margin-bottom: 0.7rem;
  padding: 0.3rem 0.4rem;
  background: var(--bg2);
  border: 1px solid #262f5f;
  border-radius: 14px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.weather-bar::-webkit-scrollbar { display: none; }
.wb-label {
  flex: none; font-size: 0.62rem; color: var(--dim);
  writing-mode: vertical-rl; transform: rotate(180deg);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding-right: 0.2rem;
}
.wb-hour {
  flex: none; min-width: 46px;
  display: flex; flex-direction: column; align-items: center; gap: 0.05rem;
  padding: 0.25rem 0.2rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.68rem; color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.wb-hour .ico { width: 18px; height: 18px; }
.wb-hour .wb-t { color: var(--text); font-weight: 600; }
.wb-in { background: rgba(126, 200, 255, 0.09); border-color: rgba(126, 200, 255, 0.3); }
.wb-best { background: rgba(255, 209, 102, 0.14); border-color: var(--gold); }
.wb-best .wb-t { color: var(--gold); }
.wb-empty { color: var(--dim); font-size: 0.8rem; padding-left: 0.4rem; }

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border: 1px solid #262f5f;
  border-radius: 16px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.7rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}
/* cards fill in on the first refresh; until then they shouldn't leave a box */
.card:empty { display: none; }
.card h2 { font-size: 1.1rem; margin-bottom: 0.35rem; }
.card h3 {
  font-size: 1rem; margin-bottom: 0.5rem;
}
.card p { margin-bottom: 0.4rem; }
.card p:last-child { margin-bottom: 0; }
.dim { color: var(--dim); font-size: 0.85rem; }

.btn {
  padding: 0.65rem 1rem;
  border-radius: 12px;
  border: 1px solid #2c3565;
  background: var(--bg2);
  color: var(--text);
  font: inherit; font-size: 0.95rem;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1a2e; font-weight: 600; }
.btn:disabled { opacity: 0.7; cursor: default; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.6rem 0 0.3rem; }
.btn-row .btn { flex: 1 1 auto; }
/* the flex display would otherwise win over the hidden attribute */
.btn-row[hidden] { display: none; }

.search { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.search input {
  flex: 1; min-width: 0; padding: 0.65rem 0.85rem;
  border-radius: 12px; border: 1px solid #2c3565;
  background: var(--bg2); color: var(--text); font: inherit; font-size: 1rem;
}
.search input::placeholder { color: var(--dim); }
.status { font-size: 0.88rem; color: var(--dim); margin-top: 0.5rem; }
.status.error { color: var(--red); }

.chip {
  padding: 0.35rem 0.65rem; border-radius: 999px;
  border: 1px solid #2c3565; background: var(--bg2);
  color: var(--dim); font: inherit; font-size: 0.82rem;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.chip-on { background: var(--gold); border-color: var(--gold); color: #1a1a2e; font-weight: 600; }
.seg { display: inline-flex; gap: 0.35rem; }
.minhag-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.7rem; margin-bottom: 0.55rem; flex-wrap: wrap;
}

.now-card { display: flex; gap: 0.85rem; align-items: flex-start; }
.moon-face { flex: none; line-height: 0; filter: drop-shadow(0 0 12px rgba(255, 209, 102, 0.45)); }
.now-text { flex: 1; min-width: 0; }
.until {
  display: flex; align-items: flex-start; gap: 0.4rem;
  background: rgba(255, 209, 102, 0.1);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 0.35rem 0.6rem; margin: 0.5rem 0;
}
.until [data-icon] { color: var(--gold); margin-top: 0.15rem; }

.kl-open { border-color: var(--green); } .kl-open h3 [data-icon] { color: var(--green); }
.kl-urgent { border-color: var(--gold); }
.kl-wait h3, .kl-closed h3 { color: var(--dim); }

.plan-grid { display: flex; flex-direction: column; gap: 0.45rem; }
.plan-grid > div { display: flex; justify-content: space-between; gap: 0.7rem; }
.plan-label { color: var(--dim); font-size: 0.88rem; }
.plan-value { font-weight: 600; text-align: right; }
.plan-row-hl .plan-value { color: var(--green); }
.plan-row-warn .plan-value { color: var(--red); }

/* nights */
.nights-ok { border-color: var(--green); }
.nights-wait { border-color: var(--blue); }
.nights-tight { border-color: var(--gold); }
.rec {
  display: flex; align-items: flex-start; gap: 0.45rem;
  background: rgba(126, 200, 255, 0.1);
  border: 1px solid rgba(126, 200, 255, 0.4);
  border-radius: 12px; padding: 0.6rem 0.7rem; margin-bottom: 0.6rem;
}
.rec [data-icon] { margin-top: 0.15rem; color: var(--blue); }
.nights-ok .rec { background: rgba(88, 214, 141, 0.12); border-color: rgba(88, 214, 141, 0.45); }
.nights-ok .rec [data-icon] { color: var(--green); }
.nights-tight .rec { background: rgba(255, 209, 102, 0.12); border-color: rgba(255, 209, 102, 0.45); }
.nights-tight .rec [data-icon] { color: var(--gold); }
.nights { display: flex; flex-direction: column; gap: 0.35rem; }
.night {
  display: grid; grid-template-columns: 4.6rem 1fr auto;
  align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  background: var(--bg2); border: 1px solid #2c3565; border-radius: 10px;
  font-size: 0.88rem;
}
.night-pick { border-color: var(--green); background: rgba(88, 214, 141, 0.1); }
.night-off { opacity: 0.5; }
.night-day { font-weight: 700; }
.night-time { color: var(--dim); font-variant-numeric: tabular-nums; }
.night-sky { display: flex; align-items: center; gap: 0.3rem; font-variant-numeric: tabular-nums; }
.badge {
  grid-column: 1 / -1; justify-self: start;
  font-size: 0.7rem; padding: 0.1rem 0.5rem;
  border-radius: 999px; border: 1px solid currentColor;
}
.badge-good { color: var(--green); }
.badge-bad { color: var(--red); }
.badge-dim { color: var(--dim); }

/* obstruction + skyline chart */
.ob-clear { border-color: var(--green); } .ob-clear h3 [data-icon] { color: var(--green); }
.ob-blocked { border-color: var(--red); } .ob-blocked h3 [data-icon] { color: var(--red); }
.ob-go {
  display: flex; align-items: flex-start; gap: 0.45rem;
  background: rgba(88, 214, 141, 0.12);
  border: 1px solid rgba(88, 214, 141, 0.45);
  border-radius: 12px; padding: 0.6rem 0.7rem; margin: 0.55rem 0;
}
.ob-go [data-icon] { color: var(--green); margin-top: 0.15rem; }
.skyline-svg {
  display: block; width: 100%; height: auto;
  margin: 0.7rem 0 0.35rem;
  background: linear-gradient(to bottom, #0a1030 0%, #16204a 100%);
  border: 1px solid #2c3565; border-radius: 12px;
}
.sk-grid { stroke: #2c3565; stroke-width: 1; stroke-dasharray: 3 5; }
.sk-gridlabel { fill: #7d88b8; font-size: 12px; }
.sk-roof { fill: #05081c; stroke: #4a5590; stroke-width: 1.5; }
.sk-horizon { stroke: #4a5590; stroke-width: 1.5; }
.sk-track { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 6 4; }
.sk-ghost { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 6 4; opacity: 0.28; }
.sk-tick { fill: var(--gold); }
.sk-ticklabel { fill: #d8c390; font-size: 12px; text-anchor: middle; }
.sk-hidden { opacity: 0.35; }
.sk-moon { fill: var(--gold); stroke: #fff6dd; stroke-width: 1.5; }
.sk-azlabel { fill: #aab3d7; font-size: 13px; font-weight: 700; text-anchor: middle; }
.sk-legend { color: var(--dim); font-size: 0.78rem; margin: 0.1rem 0 0.3rem; }

/* weather detail card */
.sky-big { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 1.05rem; font-weight: 600; }
.strip { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.5rem 0; -webkit-overflow-scrolling: touch; }
.strip-hour {
  min-width: 54px;
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  background: var(--bg2); border: 1px solid #2c3565; border-radius: 10px;
  padding: 0.4rem 0.3rem; font-size: 0.78rem;
}
.strip-best { border-color: var(--gold); box-shadow: 0 0 8px rgba(255, 209, 102, 0.3); }
.strip-hour .ico { width: 20px; height: 20px; }

/* ---------- nusach ---------- */

.nusach-toggles {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  margin: 0.7rem 0;
}
.text-size { display: inline-flex; gap: 0.3rem; margin-left: auto; }
.text-size .chip { min-width: 2.4rem; font-variant-numeric: tabular-nums; }

/* jumping between 21 sections beats scrolling past them in the dark */
.nusach-nav {
  display: flex; gap: 0.35rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.5rem 0;
  margin-bottom: 0.3rem;
  border-top: 1px solid #2c3565; border-bottom: 1px solid #2c3565;
}
.nusach-nav::-webkit-scrollbar { display: none; }
.nusach-jump {
  flex: none;
  padding: 0.3rem 0.6rem; border-radius: 999px;
  border: 1px solid #2c3565; background: var(--bg2);
  color: var(--dim); font: inherit; font-size: 0.76rem; white-space: nowrap;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.nusach-jump:active { transform: scale(0.96); }

#nusachBody { font-size: calc(1rem * var(--nusach-scale, 1)); }
.nusach-sec { margin-bottom: 1.3rem; scroll-margin-top: calc(var(--topbar) + 8px); }
.nusach-sec h4 {
  font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gold); margin-bottom: 0.35rem; font-weight: 700;
}
.nusach-times {
  color: var(--dim); font-weight: 400; letter-spacing: 0;
  text-transform: none;
}
.nusach-cite { color: var(--dim); font-size: 0.78em; margin-bottom: 0.35rem; }
.nusach-instr {
  color: #c6cdf0; font-size: 0.86em;
  border-left: 2px solid var(--gold); padding-left: 0.6rem;
  margin-bottom: 0.5rem;
}
.nusach-he {
  font-size: 1.3em; line-height: 2; text-align: right;
  font-family: "Times New Roman", "David", serif; margin-bottom: 0.4rem;
}
.nusach-tl { font-style: italic; color: #c6cdf0; margin-bottom: 0.3rem; }
.nusach-en { color: var(--dim); margin-bottom: 0.3rem; }
.nusach-note {
  border-left: 3px solid #2c3565; padding-left: 0.7rem;
  background: rgba(20, 26, 58, 0.5);
  border-radius: 0 8px 8px 0; padding-top: 0.5rem; padding-bottom: 0.5rem;
}
.nusach-note h4 { color: var(--dim); }

/* the app cannot say anything useful without a place, so this leads the sheet */
.need-card { border-color: var(--gold); }
.need-card[hidden] { display: none; }
.need-card .warn:empty { display: none; }
.need-card .btn-row { margin-bottom: 0; }

/* ---------- settings controls ---------- */

.seg-wrap { flex-wrap: wrap; }

.acct-name {
  width: 100%;
  background: var(--bg2); border: 1px solid #2c3565; border-radius: 12px;
  color: var(--text); font: inherit; font-size: 1rem;
  padding: 0.6rem 0.85rem; margin-bottom: 0.7rem;
}
.acct-name:focus { outline: none; border-color: var(--gold); }
.acct-name::placeholder { color: var(--dim); }

/* A switch, because a reminder is on or off rather than an action you take. */
.switch-row {
  display: flex; align-items: center; gap: 0.75rem;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.switch-text { flex: 1; font-size: 0.92rem; }
.switch { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  flex: none; width: 48px; height: 28px;
  border-radius: 999px;
  background: var(--bg2); border: 1px solid #2c3565;
  transition: background 0.18s, border-color 0.18s;
  display: flex; align-items: center; padding: 2px;
}
.switch-knob {
  width: 22px; height: 22px; border-radius: 50%;
  background: #6f7aa8;
  transition: transform 0.18s, background 0.18s;
}
.switch:checked ~ .switch-track { background: rgba(255, 209, 102, 0.25); border-color: var(--gold); }
.switch:checked ~ .switch-track .switch-knob { transform: translateX(20px); background: var(--gold); }
.switch:focus-visible ~ .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* this month */
.said-done { border-color: var(--green); }
.said-done h3 [data-icon] { color: var(--green); }
.said-open { border-color: var(--gold); }

/* building height legend */
.legend-row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.legend-scale { display: inline-flex; align-items: center; gap: 0.2rem; }
.legend-swatch {
  width: 18px; height: 10px; border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ---------- right-to-left ---------- */

/*
 * Hebrew and Yiddish flip the text, and with it the furniture that hangs off
 * the edges of the map: the compass rail, the Find button, the tile credit and
 * the order of the tabs.
 */
[dir="rtl"] .rail { right: auto; left: 0.6rem; }
[dir="rtl"] .find-btn { right: auto; left: 0.6rem; }
[dir="rtl"] .leaflet-bottom.leaflet-left { left: auto; right: 0; }
[dir="rtl"] .leaflet-control-attribution { border-radius: 6px 0 0 0; }
[dir="rtl"] .nusach-instr { border-left: 0; border-right: 2px solid var(--gold); padding-left: 0; padding-right: 0.6rem; }
[dir="rtl"] .until { border-left: 0; border-right: 3px solid var(--gold); border-radius: 8px 0 0 8px; }
[dir="rtl"] .nusach-note { border-left: 0; border-right: 3px solid #2c3565; padding-left: 0; padding-right: 0.7rem; }
[dir="rtl"] .plan-value { text-align: left; }
[dir="rtl"] .text-size { margin-left: 0; margin-right: auto; }
/* the transliteration is Latin script whichever way the page runs */
[dir="rtl"] .nusach-tl { direction: ltr; text-align: left; }

/* ---------- settings: a list of subjects, each with its own page ---------- */

/* somewhere clearer to drive to, on the last night of the window */
.elsewhere:empty { display: none; }
.elsewhere {
  margin: 0.6rem 0 0.2rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--edge);
}
.elsewhere-head {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem;
}
.elsewhere-head [data-icon] { color: var(--blue); line-height: 0; }
.elsewhere-head .ico { width: 17px; height: 17px; }

/* the title, with a way out of the panel beside it */
.panel-head {
  display: flex; align-items: flex-start; gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.panel-head > div { flex: 1; min-width: 0; }
.panel-head .panel-sub { margin-bottom: 0; }
.panel-head .icon-btn { margin-top: 0.15rem; }

/* numbered instructions, as on the install page */
.steps { padding-inline-start: 1.25rem; margin: 0.2rem 0 0; }
.steps li { margin-bottom: 0.4rem; }
.steps li:last-child { margin-bottom: 0; }

.menu-list {
  background: var(--card);
  border: 1px solid #262f5f;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}
.menu-row {
  display: flex; align-items: center; gap: 0.7rem;
  width: 100%;
  padding: 0.85rem 0.9rem;
  background: none; border: 0;
  border-bottom: 1px solid #232b57;
  color: var(--text); font: inherit; font-size: 0.97rem;
  text-align: start; text-decoration: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row[hidden] { display: none; }
.menu-row:active { background: var(--bg2); }
.row-ico { color: var(--gold); line-height: 0; }
.row-ico .ico { width: 20px; height: 20px; }
.row-label { flex: 1; min-width: 0; }
/* the current answer, so the list says what is set without being opened */
.row-value {
  color: var(--dim); font-size: 0.85rem;
  max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-go { color: var(--dim); line-height: 0; }
.row-go .ico { width: 17px; height: 17px; }

.settings-menu[hidden] { display: none; }
.subpage[hidden] { display: none; }
.subpage-head {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.subpage-head h1 { font-size: 1.35rem; letter-spacing: -0.01em; }
.back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  border: 1px solid var(--edge); background: var(--bg2);
  color: var(--text);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.back-btn:active { transform: scale(0.96); }
.back-btn .ico { width: 19px; height: 19px; }

/* ---------- side navigation ---------- */

.drawer-scrim {
  position: absolute; inset: 0; z-index: 58;
  background: rgba(4, 7, 22, 0.6);
  opacity: 0; transition: opacity 0.25s ease;
}
.drawer-scrim.on { opacity: 1; }
.drawer-scrim[hidden] { display: none; }

.drawer {
  position: absolute; z-index: 59;
  top: 0; bottom: 0; left: 0;
  width: min(310px, 84vw);
  display: flex; flex-direction: column;
  padding: var(--safe-t) 0 var(--safe-b);
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--edge);
  transform: translateX(-102%);
  transition: transform 0.26s ease;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.drawer.on { transform: none; }
.drawer[hidden] { display: none; }

.drawer-head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 0.8rem 0.7rem;
  border-bottom: 1px solid var(--edge);
}
.drawer-logo { color: var(--gold); line-height: 0; }
.drawer-logo .ico { width: 27px; height: 27px; }
.drawer-name { font-size: 1.05rem; font-weight: 600; }
.drawer-sub { color: var(--dim); font-size: 0.78rem; }
.drawer-head .icon-btn { margin-left: auto; }

.drawer-list { padding: 0.4rem 0.4rem 0.2rem; }
.drawer-row {
  display: flex; align-items: center; gap: 0.7rem;
  width: 100%;
  padding: 0.7rem 0.6rem;
  border: 0; border-radius: 11px;
  background: none; color: var(--text);
  font: inherit; font-size: 0.95rem;
  text-align: start; text-decoration: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.drawer-row[hidden] { display: none; }
.drawer-row:active { background: var(--bg2); }
.drawer-rule { border: 0; border-top: 1px solid var(--edge); margin: 0.4rem 0.6rem; }
.drawer-foot {
  margin-top: auto;
  padding: 0.9rem 0.9rem calc(0.9rem + var(--safe-b));
  color: var(--dim); font-size: 0.76rem; line-height: 1.7;
}

/* the drawer comes from whichever edge the language starts at */
[dir="rtl"] .drawer {
  left: auto; right: 0;
  border-right: 0; border-left: 1px solid var(--edge);
  transform: translateX(102%);
}
[dir="rtl"] .drawer.on { transform: none; }
[dir="rtl"] .drawer-head .icon-btn { margin-left: 0; margin-right: auto; }
/* chevrons point the way the reader is going, which reverses with the script */
[dir="rtl"] .row-go, [dir="rtl"] .back-btn { transform: scaleX(-1); }

/* ---------- footer ---------- */

.site-foot {
  text-align: center;
  padding: 0.4rem 0 0.2rem;
  color: var(--dim);
  font-size: 0.78rem;
  line-height: 1.6;
}
.foot-zikuy { color: var(--gold); opacity: 0.75; }
.foot-brand { color: var(--text); opacity: 0.85; }
.foot-links { display: flex; justify-content: center; gap: 0.45rem; }
.foot-build { color: var(--dim); opacity: 0.6; font-size: 0.7rem; letter-spacing: 0.02em; }
.foot-link { color: var(--dim); text-decoration: underline; text-underline-offset: 2px; }
.foot-link:hover, .foot-link:focus { color: var(--text); }

/* ---------- contact form ---------- */

.contact-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.contact-form input, .contact-form textarea {
  padding: 0.65rem 0.85rem;
  border-radius: 12px; border: 1px solid #2c3565;
  background: var(--bg2); color: var(--text); font: inherit; font-size: 1rem;
  width: 100%;
}
.contact-form textarea { resize: vertical; min-height: 5.5rem; line-height: 1.5; }
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--dim); }
.contact-form .btn-row { margin: 0.1rem 0 0; }
.contact-form[hidden] { display: none; }
/* the honeypot is off-screen rather than display:none, which some bots skip */
.hp {
  position: absolute; left: -9999px; width: 1px; height: 1px;
  overflow: hidden;
}

/* ---------- saved places ---------- */

.places { list-style: none; margin: 0.5rem 0 0.2rem; }
.places[hidden] { display: none; }
.place-row {
  display: flex; align-items: stretch; gap: 0.4rem;
  border: 1px solid #2c3565;
  border-radius: 12px;
  background: var(--bg2);
  margin-bottom: 0.4rem;
  overflow: hidden;
}
/* the one you are standing on already */
.place-here { border-color: var(--gold); }
.place-go {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.6rem 0.7rem;
  border: 0; background: none; color: var(--text);
  font: inherit; text-align: start;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.place-go:active { background: var(--card); }
.place-ico { color: var(--gold); line-height: 0; }
.place-ico .ico { width: 17px; height: 17px; }
.place-label { font-size: 0.95rem; }
.place-where {
  color: var(--dim); font-size: 0.8rem;
  margin-inline-start: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%;
}
.place-del {
  flex: none; width: 44px;
  border: 0; border-inline-start: 1px solid #2c3565;
  background: none; color: var(--dim);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.place-del:active { color: var(--red); }
.place-del .ico { width: 17px; height: 17px; }
.places-empty { padding: 0.2rem 0 0.3rem; font-size: 0.85rem; }
/* in the top-bar panel they are quick picks, above the button */
.places-quick { margin: 0.5rem 0 0; max-height: 34vh; overflow-y: auto; }

/* the permission line on the Location page */
.perm-row {
  display: flex; align-items: baseline; gap: 0.5rem;
  margin: 0.6rem 0 0.2rem;
  font-size: 0.9rem;
}
.perm-label { color: var(--dim); }
.perm-state { font-weight: 600; }
.perm-yes { color: var(--green); }
.perm-no { color: var(--red); }
.perm-maybe { color: var(--gold); }

/* ---------- place suggestions ---------- */

/*
 * Under the search box rather than floating over it: the Location page
 * scrolls, and an overlay that has to be positioned against a scrolling parent
 * is a lot of machinery for a list of five.
 */
.search-results {
  list-style: none;
  margin: 0.45rem 0 0;
  border: 1px solid #2c3565;
  border-radius: 12px;
  background: var(--bg2);
  overflow: hidden;
}
.search-results[hidden] { display: none; }
.sugg {
  display: block; width: 100%;
  padding: 0.6rem 0.75rem;
  border: 0; border-bottom: 1px solid #232b57;
  background: none; color: var(--text);
  font: inherit; text-align: start;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.search-results li:last-child .sugg { border-bottom: 0; }
.sugg:active { background: var(--card); }
.sugg-name { display: block; font-size: 0.95rem; }
.sugg-where {
  display: block; color: var(--dim); font-size: 0.8rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- new version available ---------- */

/*
 * A home-screen app is never closed, so it can sit on an old version for
 * months. This drops in under the top bar rather than over the tab bar, which
 * the install card already uses, and asks rather than reloading — someone may
 * be halfway through the seder.
 */
.update-bar {
  position: absolute; z-index: 57;
  top: calc(var(--topbar) + 8px);
  left: 0.6rem; right: 0.6rem;
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 0.6rem 0.55rem 0.8rem;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--gold);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  transform: translateY(-140%);
  opacity: 0;
  transition: transform 0.26s ease, opacity 0.26s ease;
}
.update-bar.on { transform: none; opacity: 1; }
.update-bar[hidden] { display: none; }
.update-ico { color: var(--gold); line-height: 0; }
.update-ico .ico { width: 20px; height: 20px; }
.update-text { flex: 1; min-width: 0; font-size: 0.88rem; }
.update-bar .btn { padding: 0.45rem 0.8rem; font-size: 0.88rem; }
.update-bar .icon-btn { width: 34px; height: 34px; }
.update-bar .icon-btn .ico { width: 17px; height: 17px; }

/* ---------- install prompt ---------- */

/*
 * Sits above the tab bar and over the sheet, because it is asked once and
 * wants an answer. It slides up from behind the bar rather than appearing on
 * top of whatever the reader was looking at.
 */
.install-card {
  position: absolute; z-index: 55;
  left: 0.6rem; right: 0.6rem;
  bottom: calc(var(--tabbar) + 10px);
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  transform: translateY(calc(100% + var(--tabbar) + 16px));
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}
.install-card.on { transform: none; opacity: 1; }
.install-card[hidden] { display: none; }
.install-head { display: flex; gap: 0.7rem; align-items: flex-start; }
.install-ico { color: var(--gold); line-height: 0; margin-top: 0.15rem; }
.install-ico .ico { width: 26px; height: 26px; }
.install-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.install-ios {
  display: flex; align-items: center; gap: 0.45rem;
  margin-top: 0.6rem;
}
.install-ios[hidden] { display: none; }
.install-ios [data-icon] { color: var(--gold); line-height: 0; }
.install-ios .ico { width: 18px; height: 18px; }
.install-card .btn-row { margin-bottom: 0; }
/* .btn sets display, which would otherwise win over the hidden attribute —
   and on iOS the Add button is hidden, because there it cannot work. */
.install-card .btn[hidden] { display: none; }
/* the Find button sits exactly where the card lands, and would show around its
   edges — it comes back the moment the card is answered */
body.install-open .find-btn { opacity: 0; pointer-events: none; }

/* ---------- wide screens: panels become a centred column ---------- */

@media (min-width: 840px) {
  :root { --railspace: 0px; }
  .panel { padding-left: 0; padding-right: 0; background: rgba(9, 13, 34, 0.9); }
  .panel > * { max-width: 640px; margin-left: auto; margin-right: auto; }
  .panel > .card { display: block; }
  .panel > .card:empty { display: none; }
  .sheet {
    left: 0.6rem; right: auto; top: calc(var(--topbar) + 8px);
    bottom: calc(var(--tabbar) + 12px);
    width: 420px;
    height: auto !important; max-height: none;
  }
  .sheet-handle { cursor: default; }
  .sheet-body { overflow-y: auto; }
  .sheet:not(.open) .sheet-body { overflow-y: auto; }
  .find-btn { bottom: calc(var(--tabbar) + 24px); }
  .find-btn.is-hidden { opacity: 1; pointer-events: auto; }
  /* on the map the top bar shares the sidebar's column; on a panel it spans */
  body[data-view="map"] #topbar { left: 0; width: 460px; }
  .tabbar {
    left: 50%; right: auto; transform: translateX(-50%);
    bottom: 10px;
    width: min(620px, calc(100% - 1.2rem));
    border: 1px solid var(--edge);
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
  .map-veil { display: none; }
  /* the tab bar is a floating pill here, so the card clears it and centres */
  .install-card {
    left: 50%; right: auto; transform: translateX(-50%) translateY(140%);
    width: min(420px, calc(100% - 1.2rem));
    bottom: calc(var(--tabbar) + 22px);
  }
  .install-card.on { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .dial, .needle, .vf-moon, .find-btn, .tab-orb, .install-card,
  .update-bar, .top-search { transition: none; }
  .walk-halo span { animation: none; opacity: 0.5; transform: scale(0.85); }
  .vf-moon-edge { animation: none; }
}
