:root {
  --bg-deep: #0a0605;
  --bg-mid: #140c08;
  --bg-warm: #1f1208;
  --amber: #f59e0b;
  --amber-bright: #fbbf24;
  --gold: #ffd9a0;
  --pink: #ff5dc8;
  --cyan: #22d3ee;
  --text: #fdf3e3;
  --text-dim: #b39a7c;
  --line: rgba(245, 158, 11, 0.22);
  --panel: rgba(31, 18, 8, 0.55);
  /* driven from JS: aperture 0 (deep focus) → 1 (max bokeh) */
  --bk: 0.6;
}

* { box-sizing: border-box; }

[data-cloak] { display: none; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: ui-sans-serif, -apple-system, "SF Pro Display", "Inter", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% 0%, #2a1505 0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, #26041c 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 55%, var(--bg-warm) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* bottom padding clears the fixed answer bar */
  padding: 48px 20px calc(120px + env(safe-area-inset-bottom, 0px));
  position: relative;
}

/* === ambient bokeh backdrop — blur follows the aperture slider === */
.bg-bokeh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bg-bokeh i {
  position: absolute;
  display: block;
  border-radius: 50%;
  opacity: calc(0.10 + var(--bk) * 0.14);
  filter: blur(calc(14px + var(--bk) * 34px));
  transform: scale(calc(0.65 + var(--bk) * 0.5));
  transition: filter 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}
.bg-bokeh i:nth-child(1) { width: 260px; height: 260px; top: -4%; left: 4%; background: var(--amber); }
.bg-bokeh i:nth-child(2) { width: 180px; height: 180px; top: 16%; right: 8%; background: var(--pink); }
.bg-bokeh i:nth-child(3) { width: 130px; height: 130px; top: 46%; left: -3%; background: var(--cyan); }
.bg-bokeh i:nth-child(4) { width: 220px; height: 220px; bottom: 8%; right: -4%; background: var(--amber-bright); }
.bg-bokeh i:nth-child(5) { width: 110px; height: 110px; bottom: 22%; left: 22%; background: var(--pink); }
.bg-bokeh i:nth-child(6) { width: 90px; height: 90px; top: 8%; left: 46%; background: var(--gold); }
.bg-bokeh i:nth-child(7) { width: 150px; height: 150px; bottom: -4%; left: 52%; background: var(--cyan); }

/* === layout: card + isolated meter sidebar === */
.layout {
  width: 100%;
  max-width: 738px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}
/* The reservation for the sidebar, and only where there is a sidebar to
   reserve for. .layout-metered is bound to the isolated meter style
   (see index.html); the integrated one never renders the bar at all, so
   holding a column open for it would leave the whole app off-centre
   behind a dead strip, and .layout would stay 738px wide for a 680px
   card. Within the isolated style the reservation is unconditional even
   on the tabs the bar sits out (Settings, Eclipse), where data-if drops
   it from layout — otherwise the card would stretch wider on those two
   than on every other tab. Keep these numbers and the sidebar's own
   flex-basis/the .layout gap in sync. */
.layout:not(.layout-metered) { max-width: 680px; }
.layout > .card { flex: 1 1 auto; min-width: 0; }
.layout-metered > .card { max-width: calc(100% - 42px - 10px); }
.layout > .meter-sidebar {
  flex: 0 0 42px;
  position: sticky;
  top: 16px;
}
@media (min-width: 900px) {
  .layout { gap: 14px; }
  .layout-metered > .card { max-width: calc(100% - 42px - 14px); }
  .layout > .meter-sidebar { top: 24px; }
}

/* === card === */
.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  background: linear-gradient(160deg, rgba(42, 24, 8, 0.55) 0%, rgba(16, 9, 5, 0.92) 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 30px 26px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--gold) 0%, #fff 35%, var(--amber-bright) 70%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero h1 span { font-weight: 300; }
.hero .tag { margin: 4px 0 0; color: var(--text-dim); font-size: 0.9rem; }

/* === header row + camera-style mode dial === */
.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* A real camera mode dial: four fixed icon positions around the rim
   (top/right/bottom/left — Day/Night/Eclipse/Settings), a red needle
   that turns to point at whichever is active. The needle's rotation is
   painted from JS (app.js paintModeDial) rather than a CSS class per
   mode, so it can always take the shortest path around the circle
   instead of occasionally spinning the long way through 270°. */
.mode-dial {
  position: relative;
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
}
.mode-dial-face { display: block; width: 100%; height: 100%; overflow: visible; }
.dial-rim {
  fill: rgba(10, 6, 5, 0.75);
  stroke: var(--line);
  stroke-width: 1.5;
}
.dial-face {
  fill: rgba(245, 158, 11, 0.05);
  stroke: rgba(245, 158, 11, 0.18);
  stroke-width: 0.6;
}
.dial-tick { stroke: var(--text-dim); stroke-width: 1.4; stroke-linecap: round; }
.dial-indicator {
  transform-origin: 50px 50px;
  transition: transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.dial-needle {
  stroke: #ff4a4a;
  stroke-width: 2.2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(255, 74, 74, 0.75));
}
.dial-hub { fill: #1a0e02; stroke: var(--amber); stroke-width: 1; }

.dial-mark {
  position: absolute;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.2);
}
/* The button's own transform is its position on the rim, so the lit /
   active look lives on an inner span instead: scaling the button would
   scale its label along with it, and its filter would wash the label
   out. That also drops the four `.dial-mark-x.active` rules that used
   to exist only to restate each mark's translate alongside the
   scale. */
.dial-ico {
  display: block;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.dial-mark:hover .dial-ico { filter: brightness(1.3); }
.dial-mark.active .dial-ico {
  filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.85));
  transform: scale(1.12);
}
.dial-mark-day { top: -7px; left: 50%; transform: translateX(-50%); }
.dial-mark-night { right: -7px; top: 50%; transform: translateY(-50%); }
.dial-mark-eclipse { bottom: -7px; left: 50%; transform: translateX(-50%); }
.dial-mark-settings { left: -7px; top: 50%; transform: translateY(-50%); }

/* Instant labels for the icon-only controls: the rim of the mode dial
   and the meter bar's source column. The browser's own title tooltip
   answers "what is this" a second or so after you ask, which is longer
   than it takes to just tap the thing and find out — these are up in
   about a twentieth of that. The small delay that is left keeps them
   from strobing as the pointer crosses on its way somewhere else.
   Hover and focus-visible only: a keyboard user gets the same label,
   and on a touchscreen neither fires, which is the right answer for a
   control you reach by tapping anyway. */
.dial-tip,
.msrc::after {
  position: absolute;
  z-index: 5;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(10, 6, 5, 0.96);
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  transition: opacity 0.1s ease 0.03s, transform 0.1s ease 0.03s;
}
/* All four in one slot under the dial rather than beside their own
   mark: the top mark sits a few pixels below the top of the window,
   with no room above it, and a label on the right mark would run off
   the edge of a phone. One fixed spot also means the eye doesn't have
   to chase the label around the rim. */
.dial-tip {
  top: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(-3px);
}
.dial-mark-day:hover ~ .dial-tip-day,
.dial-mark-day:focus-visible ~ .dial-tip-day,
.dial-mark-night:hover ~ .dial-tip-night,
.dial-mark-night:focus-visible ~ .dial-tip-night,
.dial-mark-eclipse:hover ~ .dial-tip-eclipse,
.dial-mark-eclipse:focus-visible ~ .dial-tip-eclipse,
.dial-mark-settings:hover ~ .dial-tip-settings,
.dial-mark-settings:focus-visible ~ .dial-tip-settings {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === location pill === */
.loc-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 6, 5, 0.5);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.15);
}
.loc-pill:hover { border-color: var(--amber); }
.loc-pill-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-pill-name .country { color: var(--text-dim); font-weight: 400; }
.loc-pill-wx { display: flex; align-items: baseline; gap: 5px; color: var(--gold); font-weight: 600; }
.loc-pill-edit { color: var(--text-dim); font-size: 0.85rem; }

/* === light source tabs === */
.light-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 6, 5, 0.5);
}
.ltab {
  padding: 9px 4px;
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.2);
}
.ltab.active {
  color: #1a0e02;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, var(--amber) 100%);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.25);
}
@media (max-width: 420px) {
  .light-tabs { grid-template-columns: repeat(2, 1fr); }
}

/* === isolated light meter (Settings → light meter style) ===
   A slim vertical bar alongside the card at every viewport width — see
   .layout above, which is a row at all breakpoints, not just desktop.
   The three segments (brightness, warmth, source) stack in one narrow
   column; each thermometer itself reads bottom (dim/cool) → top
   (bright/warm), via .meter-gauge's column-reverse (source order is
   dim-icon, track, bright-icon — reversed so the FIRST one packs at
   the bottom). Kept intentionally small end to end per the "compact"
   note — this is a glanceable strip, not a second control panel. */
/* No boxed panel — the individual controls (tracks, source buttons)
   already carry their own border, so an outer card here would just be
   a redundant frame eating space around a bar this narrow. Padding
   only, for breathing room against the page edge and the card. */
.meter-sidebar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
}

.meter-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.meter-gauge {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
}

.meter-seg-icon { font-size: 0.68rem; line-height: 1; flex: 0 0 auto; }

.meter-track {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid var(--line);
  width: 22px;
  height: 92px;
}
.meter-track-bright {
  background: linear-gradient(0deg, #2a1a05 0%, #5b3a10 25%, #a3742c 50%, #f5b93b 78%, #fff3c4 100%);
}
.meter-track-warm {
  background: linear-gradient(0deg, #4b4a52 0%, #6a6875 24%, #4f7fb8 45%, #8fc0e6 58%, #f5b93b 80%, #ff7a3d 100%);
}

/* The gradient is the whole scale, always visible; a dark mask covers
   the unfilled portion (like a thermometer's empty tube), leaving a
   bright edge exactly at the reading. --p is that reading as a 0–1
   fraction, painted from JS (app.js paintMeterBar). */
.meter-fill {
  --p: 0;
  /* Length of the grab handle riding on top, when there is one. */
  --grab: 0px;
  position: absolute;
  inset: 0 0 auto 0;
  width: auto;
  height: calc(100% - (var(--grab) / 2 + var(--p) * (100% - var(--grab))));
  background: rgba(5, 3, 2, 0.76);
  transition: height 0.3s ease;
  /* The slider sits on top of this; never swallow a drag. */
  pointer-events: none;
}
/* Manual: the mask is what shows how far the handle has been pushed, so
   the two have to agree. A range input's thumb stops half its own
   length short of each end, so it travels (track − handle), not the
   whole track — subtract the same amount here or the bright edge slides
   out from under the handle towards the extremes. No easing either: the
   0.3s that smooths an incoming meter reading is lag under a finger. */
.meter-fill-grab {
  --grab: 12px;
  transition: none;
}
.meter-fill::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
}
.meter-fill-warm::after { background: #fff8ec; box-shadow: 0 0 8px rgba(255, 248, 236, 0.6); }

/* The manual thermometers: a native range input reskinned to sit right
   inside the read-only tube, rotated -90deg — the standard
   vertical-slider trick, its direction found empirically (see commit
   notes) rather than trusted from the transform math. Every rule here
   is qualified under .meter-slider-wrap: the app's own global
   `input[type="range"]` reskin (further down this file) has higher
   specificity than a bare class selector and would otherwise win the
   cascade regardless of source order, silently pinning these back to
   their unrotated size. touch-action: none matters here specifically
   because the control is rotated — without it, a real touch drag can
   get claimed by the browser's own scroll/pan gesture recognition
   instead of the slider, since a finger moving vertically over what the
   DOM still thinks of as a horizontal control is exactly the ambiguous
   case that heuristic gets wrong.

   inset: 0 rather than a repeated width/height: the wrap has to be the
   tube's inner box exactly. Given its own 22 x 92 it started one pixel
   right of and below the tube (the border-box the track reserves is a
   pixel of border wider than the content-box a child lays out in), and
   dragged the handle off the axis with it. */
.meter-slider-wrap { position: absolute; inset: 0; touch-action: none; }
.meter-slider-wrap .meter-slider {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Rotated, so these read swapped: the 90px is how far the handle runs
     UP the tube, the 20px is how far it spans ACROSS it. Both are the
     track's inner box (22 x 92 less its 1px border), which is what puts
     the handle on the tube's centre line and keeps it inside the
     rounded ends instead of being sliced by overflow: hidden. Change
     .meter-track's width or height and these two follow. */
  width: 90px;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  transform: translate(-50%, -50%) rotate(-90deg);
}
/* Deliberately no track of its own. The tube underneath already paints
   the whole scale and .meter-fill dims everything above the reading —
   a second opaque gradient here would cover that up, which is exactly
   how a manual drag ended up moving a handle across a bar that never
   changed. */
.meter-slider-wrap .meter-slider::-webkit-slider-runnable-track {
  height: 20px;
  background: transparent;
}
.meter-slider-wrap .meter-slider::-moz-range-track {
  height: 20px;
  background: transparent;
}
/* An ordinary grab handle: a short bar across the tube with three grip
   ridges, the width of the tube's inside so it reads as a marker at a
   level rather than a knob you turn. The ridge gradient runs along the
   handle's own x, which rotation turns into the across-the-tube lines
   you actually see. Sized in the local, unrotated axes as ever: the
   12px is its thickness up the tube, the 20px its span across.
   box-sizing + a ring drawn with inset box-shadow instead of a real
   border, so those two numbers stay the final ones — a border would
   push it past the tube's inner width and back under the clip. */
.meter-slider-wrap .meter-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 12px;
  height: 20px;
  /* Track and thumb are the same 20px across, so it is already centred. */
  margin-top: 0;
  border: none;
  border-radius: 4px;
  background:
    linear-gradient(90deg,
      transparent 0 3px, rgba(26, 14, 2, 0.38) 3px 4px,
      transparent 4px 5.5px, rgba(26, 14, 2, 0.38) 5.5px 6.5px,
      transparent 6.5px 8px, rgba(26, 14, 2, 0.38) 8px 9px,
      transparent 9px),
    linear-gradient(90deg, #d1912f 0%, #ffe7b6 42%, #fff9ee 58%, #f0b95c 100%);
  box-shadow: inset 0 0 0 1px rgba(26, 14, 2, 0.7), 0 0 9px rgba(245, 158, 11, 0.55);
}
.meter-slider-wrap .meter-slider::-moz-range-thumb {
  box-sizing: border-box;
  width: 12px;
  height: 20px;
  border: none;
  border-radius: 4px;
  background:
    linear-gradient(90deg,
      transparent 0 3px, rgba(26, 14, 2, 0.38) 3px 4px,
      transparent 4px 5.5px, rgba(26, 14, 2, 0.38) 5.5px 6.5px,
      transparent 6.5px 8px, rgba(26, 14, 2, 0.38) 8px 9px,
      transparent 9px),
    linear-gradient(90deg, #d1912f 0%, #ffe7b6 42%, #fff9ee 58%, #f0b95c 100%);
  box-shadow: inset 0 0 0 1px rgba(26, 14, 2, 0.7), 0 0 9px rgba(245, 158, 11, 0.55);
}

/* max-width caps how wide a long label (e.g. "mixed / artificial")
   can force this flex column — without it the text sizes to its own
   content and drags the whole sidebar wider than its flex-basis,
   which then throws off the Settings-tab width-matching math below
   (.layout > .card's max-width assumes the sidebar's real width). */
.meter-val {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  max-width: 32px;
}
.meter-val small { font-weight: 400; color: var(--text-dim); margin-left: 1px; }
.meter-val-warm { color: #ffd9a0; }

.meter-source {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
}
.msrc {
  position: relative;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.05);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.2);
}
.msrc:hover { border-color: var(--amber); }
/* Left of the column, into the card: the bar is already against the
   right edge of the window, so there is no room on the other side. */
.msrc::after {
  content: attr(data-tip);
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%) translateX(3px);
}
.msrc:hover::after,
.msrc:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.msrc.active {
  border-color: var(--amber);
  background: linear-gradient(135deg, var(--gold) 0%, var(--amber) 100%);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

/* === look "more" expander === */
.more-toggle {
  align-self: flex-start;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.more-toggle:hover { color: var(--gold); border-color: var(--amber); }

/* === location bar === */
.loc-bar { display: flex; gap: 10px; }

.geo-btn {
  flex: 0 0 auto;
  width: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.08);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.geo-btn:hover { border-color: var(--amber); background: rgba(245, 158, 11, 0.16); }
.geo-btn:disabled { opacity: 0.5; cursor: default; }

.search { flex: 1; display: flex; gap: 10px; }
.search-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 6, 5, 0.6);
  font: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--amber); }
.search-btn {
  padding: 11px 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--amber) 0%, #d97706 100%);
  color: #1a0e02;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.search-btn:disabled { opacity: 0.6; cursor: default; }

.geo-note { margin: -12px 0 0; font-size: 0.8rem; color: var(--text-dim); }

/* === location display === */

/* === error banner === */
.error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 93, 200, 0.4);
  border-radius: 12px;
  background: rgba(255, 93, 200, 0.08);
  font-size: 0.85rem;
}
.retry-btn {
  padding: 6px 14px;
  border: 1px solid var(--pink);
  border-radius: 9px;
  background: transparent;
  color: var(--pink);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.retry-btn:disabled { opacity: 0.5; cursor: default; }

/* === section heads === */
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sec-head h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sec-sub { font-size: 0.78rem; color: var(--text-dim); }

/* === time === */
/* The clock and its reset, as one unit in the middle of the scale row —
   baseline-aligned so the small button sits on the same line as the big
   figure rather than floating against its cap height. */
.time-read {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.now-btn {
  padding: 2px 6px;
  border: none;
  background: transparent;
  color: var(--cyan);
  font: inherit;
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
}
.now-btn:hover { text-decoration: underline; }

/* === sliders (shared) === */
.ctl { display: flex; flex-direction: column; gap: 8px; }
.ctl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.ctl-head label { font-size: 0.9rem; color: var(--text-dim); }
.ctl-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.ctl-scale {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.time-big {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.55), rgba(245, 158, 11, 0.15));
}
input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.55), rgba(245, 158, 11, 0.15));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  border: 2px solid #1a0e02;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--gold) 45%, var(--amber) 100%);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.7);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #1a0e02;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--gold) 45%, var(--amber) 100%);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.7);
}

/* time slider: night → day → night gradient with sunrise/sunset from data */
.time-ctl {
  --rise: 25%;
  --set: 75%;
}
.time-ctl input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg,
    #131029 0%,
    #131029 calc(var(--rise) - 7%),
    #f59e0b var(--rise),
    #8ec8f0 calc(var(--rise) + 10%),
    #8ec8f0 calc(var(--set) - 10%),
    #f5730b var(--set),
    #131029 calc(var(--set) + 7%),
    #131029 100%);
}
.time-ctl input[type="range"]::-moz-range-track {
  background: linear-gradient(90deg,
    #131029 0%,
    #131029 calc(var(--rise) - 7%),
    #f59e0b var(--rise),
    #8ec8f0 calc(var(--rise) + 10%),
    #8ec8f0 calc(var(--set) - 10%),
    #f5730b var(--set),
    #131029 calc(var(--set) + 7%),
    #131029 100%);
}

/* === condition chips === */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.05);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.83rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.chip:hover { border-color: var(--amber); color: var(--text); }
.chip.active {
  color: var(--gold);
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.16);
  font-weight: 600;
}

/* === result values (shared with the Night sky trio) === */
.res-sep { opacity: 0.5; }
.res-note {
  margin: 14px 0 0;
  font-size: 0.83rem;
  color: var(--pink);
}

/* === presets === */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preset {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.05);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.preset:hover { border-color: var(--amber); transform: translateY(-1px); }
.preset.active {
  border-color: var(--amber);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.22) 0%, rgba(245, 158, 11, 0.06) 100%);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.2);
}
.preset-name { font-weight: 700; }
.preset-desc { font-size: 0.78rem; color: var(--text-dim); }

.sliders { display: flex; flex-direction: column; gap: 18px; }

/* === ND filter & long-exposure timer === */
.nd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.nd-label { font-size: 0.9rem; color: var(--text-dim); }

/* === depth of field === */
.dof-sec { display: flex; flex-direction: column; gap: 14px; }
.dof-sec .sec-head { margin-bottom: 0; }

.dof-track {
  position: relative;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.12));
  overflow: hidden;
  /* --near/--far/--subj/--hyper set from the dof computed (log-scale %) */
}
.dof-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--near, 40%);
  width: calc(var(--far, 60%) - var(--near, 40%));
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.35), rgba(245, 158, 11, 0.18));
  border-left: 1px solid var(--gold);
  border-right: 1px solid var(--gold);
  transition: left 0.15s ease, width 0.15s ease;
}
.dof-cam {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
}
.dof-subj {
  position: absolute;
  left: var(--subj, 50%);
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  transition: left 0.15s ease;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}
.dof-hyper {
  position: absolute;
  left: var(--hyper, 90%);
  bottom: 2px;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--cyan);
  transition: left 0.15s ease;
}
.dof-read { margin: 0; font-size: 0.85rem; color: var(--text-dim); }
.dof-read b { color: var(--gold); font-variant-numeric: tabular-nums; }

.timer-btn {
  margin-top: 14px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.08);
  color: var(--gold);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.2);
}
.timer-btn:hover { border-color: var(--amber); }

.timer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px;
  background: rgba(5, 3, 2, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.timer-count {
  font-size: 5rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}
.timer-bar {
  width: min(320px, 80vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  overflow: hidden;
}
.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber), var(--gold));
  transition: width 0.1s linear;
}
.timer-sub { font-size: 0.85rem; color: var(--text-dim); }
.timer-cancel {
  padding: 12px 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.timer-cancel:hover { color: var(--pink); border-color: var(--pink); }

/* === bokeh preview === */
.preview {
  position: relative;
  height: 130px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #0d0716;
  overflow: hidden;
  /* driven from JS: --bright follows ISO exposure lift, --noise its grain */
}
.preview .scene {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #0d0716 0%, #1a0d20 60%, #241108 100%);
  filter: brightness(var(--bright, 1));
  transition: filter 0.2s ease;
}
.preview .noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--noise, 0);
  transition: opacity 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 120px 120px;
}
.lights i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(calc(0.5px + var(--bk) * 10px));
  transform: scale(calc(0.45 + var(--bk) * 1.1));
  opacity: calc(0.55 + var(--bk) * 0.35);
  transition: filter 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}
.lights i:nth-child(1)  { width: 26px; height: 26px; top: 18%; left: 6%;  background: var(--amber); }
.lights i:nth-child(2)  { width: 18px; height: 18px; top: 55%; left: 13%; background: var(--gold); }
.lights i:nth-child(3)  { width: 30px; height: 30px; top: 30%; left: 22%; background: var(--pink); }
.lights i:nth-child(4)  { width: 14px; height: 14px; top: 68%; left: 30%; background: var(--cyan); }
.lights i:nth-child(5)  { width: 22px; height: 22px; top: 14%; left: 38%; background: var(--amber-bright); }
.lights i:nth-child(6)  { width: 16px; height: 16px; top: 50%; left: 46%; background: var(--gold); }
.lights i:nth-child(7)  { width: 28px; height: 28px; top: 26%; left: 55%; background: var(--cyan); }
.lights i:nth-child(8)  { width: 15px; height: 15px; top: 64%; left: 62%; background: var(--pink); }
.lights i:nth-child(9)  { width: 24px; height: 24px; top: 12%; left: 70%; background: var(--amber); }
.lights i:nth-child(10) { width: 18px; height: 18px; top: 48%; left: 78%; background: var(--gold); }
.lights i:nth-child(11) { width: 27px; height: 27px; top: 24%; left: 87%; background: var(--pink); }
.lights i:nth-child(12) { width: 14px; height: 14px; top: 66%; left: 93%; background: var(--amber-bright); }
/* moving lights streak with slow shutters (--mb 0 frozen → 1 drawn out) */
.streaks i {
  position: absolute;
  display: block;
  height: 5px;
  width: calc(5px + var(--mb, 0) * 92px);
  max-width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, currentColor 0%, transparent 100%);
  opacity: calc(0.3 + var(--mb, 0) * 0.5);
  filter: blur(0.6px);
  transition: width 0.25s ease, opacity 0.25s ease;
}
.streaks i:nth-child(1) { top: 38%; left: 10%; color: #ffd9a0; transform: rotate(-6deg); }
.streaks i:nth-child(2) { top: 60%; left: 44%; color: #67e8f9; transform: rotate(4deg); }
.streaks i:nth-child(3) { top: 22%; left: 60%; color: #ff5dc8; transform: rotate(-3deg); }

.subject {
  position: absolute;
  bottom: 8px;
  left: 14px;
  font-size: 1.9rem;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}
.preview-tag-tl {
  top: 10px;
  left: 12px;
  right: auto !important;
  bottom: auto !important;
}
.preview-tag {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(10, 6, 5, 0.6);
  border-radius: 999px;
  padding: 4px 10px;
  backdrop-filter: blur(4px);
}

/* === photo light check === */
.scene-sec { display: flex; flex-direction: column; gap: 12px; }
.scene-sec .sec-head { margin-bottom: 0; }

/* --- analog light meter --- */
.meter-wrap {
  position: relative;
  max-width: 340px;
  margin: 0 auto;
  width: 100%;
}
.meter { display: block; width: 100%; height: auto; }
.meter .band {
  fill: none;
  stroke-width: 9;
  opacity: 0.85;
}
.m-emoji { font-size: 12px; text-anchor: middle; }
.m-tick {
  font-size: 7px;
  text-anchor: middle;
  fill: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.meter-needle {
  transform-origin: 100px 104px;
  transition: transform 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.meter-needle line {
  stroke: var(--gold);
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.6));
}
.meter-needle circle {
  fill: #1a0e02;
  stroke: var(--gold);
  stroke-width: 2;
}
.meter-read {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-top: 2px;
}
.meter-ev {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}
.meter-src { font-size: 0.7rem; color: var(--text-dim); }

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 16px;
  min-height: 56px;
  border: 1.5px dashed rgba(245, 158, 11, 0.45);
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.06);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.2);
}
.upload-btn:hover, .upload-btn:active { border-color: var(--amber); background: rgba(245, 158, 11, 0.12); }
.upload-main { font-weight: 700; }
.upload-sub { font-size: 0.75rem; color: var(--text-dim); }

.scene-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 6, 5, 0.5);
}
.scene-thumb {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
}
.scene-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.scene-label { font-weight: 700; }
.scene-ev { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.scene-ev span { color: var(--text-dim); font-weight: 400; font-size: 0.78rem; }
.scene-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.stat {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: rgba(245, 158, 11, 0.08);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.scene-clear {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  align-self: flex-start;
}
.scene-clear:hover { color: var(--pink); border-color: var(--pink); }

.scene-hist {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  background: rgba(10, 6, 5, 0.5);
  border: 1px solid rgba(245, 158, 11, 0.15);
}
.scene-tip { margin: 0; font-size: 0.82rem; color: var(--text-dim); }

/* --- live viewfinder --- */

.live-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 14px;
  background: rgba(10, 6, 5, 0.5);
}
.live-video {
  width: 118px;
  height: 88px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  background: #000;
}
.live-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.live-use {
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--amber) 100%);
  color: #1a0e02;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.live-stop {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.live-stop:hover { color: var(--pink); border-color: var(--pink); }

.again-row { display: flex; gap: 8px; flex-wrap: wrap; }
.again-row .upload-again { align-self: auto; }
.upload-again {
  align-self: flex-start;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--cyan);
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(34, 211, 238, 0.2);
}
.upload-again:hover, .upload-again:active { border-color: var(--cyan); }

.res-metered {
  color: var(--cyan-bright, #67e8f9);
  background: rgba(34, 211, 238, 0.12);
  border-radius: 999px;
  padding: 1px 9px;
}
.res-nd {
  color: var(--gold);
  background: rgba(245, 158, 11, 0.12);
  border-radius: 999px;
  padding: 1px 9px;
}

/* === night sky / astro === */
.astro {
  position: relative;
  border: 1px solid rgba(124, 92, 255, 0.35);
  border-radius: 16px;
  padding: 18px 20px;
  background:
    radial-gradient(1px 1px at 12% 22%, rgba(255, 255, 255, 0.9) 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 68%, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 51% 15%, rgba(255, 255, 255, 0.8) 50%, transparent 51%),
    radial-gradient(1px 1px at 67% 45%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 82% 25%, rgba(255, 255, 255, 0.7) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 92% 62%, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 24% 85%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 74% 88%, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
    radial-gradient(ellipse at 50% -40%, rgba(124, 92, 255, 0.22) 0%, transparent 70%),
    linear-gradient(180deg, #0b0820 0%, #120a26 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.astro .sec-head { margin-bottom: 0; }
.astro .sec-head h2 { color: #a99ae0; }

.lp-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lp-icon { font-size: 1.8rem; }
.lp-text { display: flex; flex-direction: column; gap: 2px; }
.lp-label { font-weight: 700; }
.lp-sub { font-size: 0.78rem; color: #a99ae0; }

.astro .chip { background: rgba(124, 92, 255, 0.07); border-color: rgba(124, 92, 255, 0.3); }
.astro .chip:hover { border-color: #9d84ff; }
.astro .chip.active {
  color: #d9ccff;
  border-color: #9d84ff;
  background: rgba(124, 92, 255, 0.2);
}

.astro input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.6), rgba(124, 92, 255, 0.15));
}
.astro input[type="range"]::-moz-range-track {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.6), rgba(124, 92, 255, 0.15));
}
.astro .ctl-val { color: #d9ccff; }

.astro-result { text-align: center; }
.astro-result .res-value { color: #d9ccff; text-shadow: 0 0 18px rgba(124, 92, 255, 0.45); }
.astro-line {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: #a99ae0;
}
.core-line { margin-top: 6px; }
.core-arrow {
  display: inline-block;
  color: #d9ccff;
  transform-origin: 50% 50%;
  margin: 0 2px;
}
.astro-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* === solar eclipse === */
.eclipse {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.eclipse .sec-head { margin-bottom: 0; }
.ec-subhead { margin-top: 4px; }

.ec-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(124, 92, 255, 0.12) 100%);
}
.ec-mag-block { display: flex; flex-direction: column; }
.ec-mag {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 22px rgba(245, 158, 11, 0.45);
}
.ec-mag-sub { margin-top: 4px; font-size: 0.75rem; color: var(--text-dim); }
.ec-count { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.ec-count-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ec-count-sub { margin-top: 3px; font-size: 0.75rem; color: var(--text-dim); }

@keyframes ec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.ec-count-live {
  color: var(--pink);
  animation: ec-pulse 1.6s ease-in-out infinite;
}

/* --- the sky: moon crossing the disc, daylight draining with it --- */
.ec-stage {
  --lit: 1;
  --obsc: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #2a1a3c 0%, #3a2412 55%, #1a0d06 100%);
}
/* the day going out, over the sky but under the sun itself */
.ec-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 40%, rgba(12, 8, 26, 0.55) 0%, rgba(3, 2, 8, 0.97) 100%);
  opacity: calc(var(--obsc) * 0.92);
  transition: opacity 0.2s ease;
}
.ec-disc {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 130px;
  height: 130px;
  overflow: visible;
}
.ec-sun { filter: drop-shadow(0 0 6px rgba(255, 196, 92, 0.8)); }
.ec-halo {
  opacity: calc(0.2 + var(--lit) * 0.8);
  transition: opacity 0.2s ease;
}
.ec-moon {
  fill: #0a0610;
  stroke: rgba(255, 226, 180, 0.25);
  stroke-width: 0.012;
  /* cx/cy/r are set from JS; browsers that treat them as CSS geometry
     properties get the glide for free, the rest just jump */
  transition: cx 0.12s linear, cy 0.12s linear, r 0.12s linear;
}
@keyframes ec-corona-spin { to { transform: rotate(360deg); } }
.ec-corona {
  transform-origin: 0 0;
  animation: ec-corona-spin 26s linear infinite;
}
.ec-readout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ec-phase { font-weight: 700; }
.ec-clock {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}
.ec-obsc { font-size: 0.8rem; color: var(--text-dim); }

.ec-scrub { gap: 10px; }
.ec-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.ec-btn {
  padding: 9px 14px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.06);
  color: var(--gold);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.2);
}
.ec-btn:hover { border-color: var(--amber); }

.ec-line {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.ec-arrow {
  display: inline-block;
  color: var(--gold);
  transform-origin: 50% 50%;
  margin-right: 4px;
}

/* --- what to bring --- */
.ec-gear {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ec-gear-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.04);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-dim);
}
.ec-gear-row.must {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
  color: var(--text);
}
.ec-gear-row.warn {
  border-color: rgba(255, 93, 200, 0.5);
  background: rgba(255, 93, 200, 0.1);
  color: var(--text);
}
.ec-gear-icon { flex: 0 0 auto; font-size: 1.05rem; }

/* --- how big the sun lands in the frame --- */
.ec-frame {
  display: flex;
  align-items: center;
  gap: 14px;
}
.ec-frame-svg { flex: 0 0 auto; width: 108px; height: 72px; }
.ec-frame-box {
  fill: rgba(10, 6, 5, 0.6);
  stroke: rgba(245, 158, 11, 0.35);
  stroke-width: 0.5;
}
.ec-frame-crop {
  fill: rgba(124, 92, 255, 0.1);
  stroke: #9d84ff;
  stroke-width: 0.4;
  stroke-dasharray: 1.2 0.8;
  transition: x 0.15s ease, y 0.15s ease, width 0.15s ease, height 0.15s ease;
}
.ec-frame-sun {
  fill: var(--gold);
  filter: drop-shadow(0 0 1px rgba(245, 158, 11, 0.9));
  transition: r 0.15s ease;
}
.ec-frame-note { margin: 0; font-size: 0.82rem; color: var(--text-dim); }

.ec-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ec-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.05);
}
.ec-card-h { font-size: 0.78rem; color: var(--text-dim); }
.ec-card-set {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.ec-card-sub { font-size: 0.74rem; color: var(--text-dim); }

.ec-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-dim);
}

@media (max-width: 520px) {
  .ec-stage { gap: 12px; padding: 12px; }
  .ec-disc { width: 104px; height: 104px; }
  .ec-clock { font-size: 1.35rem; }
  .ec-cards { grid-template-columns: 1fr; }
  .ec-count { align-items: flex-start; text-align: left; }
}

/* === settings === */
.settings {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings .sec-head { margin-bottom: 0; }
.settings-subhead { margin-top: 4px; }

.settings-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.settings-select {
  flex: 1 1 160px;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 6, 5, 0.6);
  color: var(--text);
  font: inherit;
  outline: none;
  cursor: pointer;
}
.settings-select:focus { border-color: var(--amber); }
.settings-row .search-input { flex: 2 1 220px; }

.settings-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.settings-note-top { margin-top: -4px; }
.settings-hint {
  margin: 0;
  padding: 12px 14px;
  border: 1px dashed rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.lens-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lens-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.05);
}
.lens-label { font-weight: 600; font-variant-numeric: tabular-nums; }
.lens-remove {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
}
.lens-remove:hover { color: var(--pink); border-color: var(--pink); }

.lens-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 6, 5, 0.4);
}
.lens-form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.lens-form-label {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.lens-form-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lens-form-dash { color: var(--text-dim); }
.lens-form-input {
  width: 64px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 6, 5, 0.6);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.lens-form-input:focus { border-color: var(--amber); }
.lens-form-input-wide { width: 100%; flex: 1; }
.lens-add {
  align-self: flex-start;
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--amber) 0%, #d97706 100%);
  color: #1a0e02;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.lens-add:hover { filter: brightness(1.08); }

@media (max-width: 520px) {
  .lens-form-input-wide { width: auto; flex: 1 1 90px; }
}

/* === fixed answer bar === */
.answer-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 12px calc(10px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.answer-sheet {
  pointer-events: auto;
  width: 100%;
  max-width: 560px;
  margin-bottom: 8px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 9, 5, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}
.sheet-light {
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.sheet-note { margin: 0; font-size: 0.85rem; color: var(--pink); }
.sheet-ok { color: var(--text-dim); }
.answer-sheet .timer-btn { margin-top: 4px; }

.answer-bar {
  pointer-events: auto;
  width: 100%;
  max-width: 560px;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(42, 24, 8, 0.92) 0%, rgba(16, 9, 5, 0.97) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.55), 0 0 24px rgba(245, 158, 11, 0.12);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.15);
}
.ab-badge { font-size: 1.1rem; flex: 0 0 auto; }
.ab-set {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.ab-set b {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}
.ab-set i { font-style: normal; color: var(--text-dim); }
.ab-warn { flex: 0 0 auto; }
.ab-chevron { flex: 0 0 auto; color: var(--text-dim); font-size: 0.8rem; }

@media (max-width: 420px) {
  .ab-set b { font-size: 1.05rem; }
  .ab-set { gap: 6px; }
}

/* === footer === */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  text-align: center;
}
.footer-credits {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer-credits a { color: var(--text-dim); text-decoration: underline dotted; }
.footer-credits a:hover { color: var(--gold); }
.spektrum-mark { width: 12px; height: 12px; vertical-align: -1px; margin-right: 2px; }

@media (max-width: 520px) {
  /* On a phone the card no longer needs to read as a boxed panel —
     the page edge (body's own side padding) is close enough to serve
     as the visual frame. Drop the border/background/blur/shadow and
     the internal padding; body's top padding shrinks too since the
     card isn't floating in a box anymore. hero-row keeps its own
     small padding/gap so the mode dial doesn't sit flush against the
     title or the page edge now that the card padding is gone. */
  body { padding-top: 16px; }
  .card {
    border: none;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    padding: 0;
  }
  .hero-row { gap: 16px; padding: 0 4px; }
  .res-value { font-size: 1.35rem; }
  .presets { grid-template-columns: 1fr; }
  .time-read { gap: 6px; }
}

/* The sidebar's own width is fixed (a slim bar reads the same at any
   size), so the card is what has to give room for it on a narrow
   phone — shrink the title and dial rather than let them collide. */
@media (max-width: 460px) {
  body { padding-left: 12px; padding-right: 12px; }
  .layout { gap: 8px; }
  .layout > .meter-sidebar { flex-basis: 38px; }
  .layout-metered > .card { max-width: calc(100% - 38px - 8px); }
  .hero h1 { font-size: 1.5rem; }
  .mode-dial { width: 54px; height: 54px; }
  .dial-mark { width: 20px; height: 20px; font-size: 0.72rem; line-height: 20px; }
  .dial-mark-day { top: -7px; }
  .dial-mark-eclipse { bottom: -7px; }
  .dial-mark-night { right: -7px; }
  .dial-mark-settings { left: -7px; }
}
