/* The "Cosmic Dark" scheme of sharedUI/ui/theme/Color.kt: the app is dark-first by intent. */
:root {
    --bg: #111319;
    --bg-deep: #0b0e14;
    --surface-low: #191b21;
    --surface: #1d1f26;
    --surface-high: #282a30;
    --surface-highest: #33353b;
    --on-surface: #e2e2ea;
    --on-variant: #d0c6ab;
    --muted: #9aa0a6;
    --outline: #4d4732;
    --gold: #ffd700;
    --accent: #ffd700;        /* primaryContainer: gold, or the moon's silver-blue in lunar mode */
    --on-accent: #3a3000;
    --badge: var(--surface-high);
    --primary: #fff6df;
    /* EclipseTypeColors.kt */
    --total: #ffd700;
    --annular: #5b8def;
    --hybrid: #c77dff;
    --partial: #5a6473;
    --empty: #313640;
    --sky: #ced9ff;
    --hairline: #ffffff10;    /* dividers */
    --hover: #ffffff0d;       /* row and button hover wash */
    --glass: #111319cc;       /* pills floating over the map */
    --gutter: 16px;
    color-scheme: dark;
}
body.lunar { --accent: #b7c8e0; --on-accent: #1b2c3c; --on-variant: #bfc7d2; --primary: #eaf1fb; }

/* The light scheme (CosmicLightColors / MoonLightColors), when the system asks for it. As in the app,
   only the chrome changes: the map keeps its dark basemap and the lunar sky stays a night sky. */
@media (prefers-color-scheme: light) {
    :root {
        --bg: #fcfaf4;
        --bg-deep: #f6f3ea;
        --surface-low: #f6f3ea;
        --surface: #f0ede3;
        --surface-high: #eae7dc;
        --surface-highest: #e5e1d5;
        --on-surface: #1b1b16;
        --on-variant: #4c4838;
        --muted: #5f6368;
        --outline: #cfc9b4;
        --accent: #8a6d00;
        --on-accent: #fff1c2;
        --primary: #6e5a00;
        --hairline: #1b1b1614;
        --hover: #1b1b160d;
        --glass: #fcfaf4e0;
        color-scheme: light;
    }
    body.lunar { --accent: #3f6e9b; --on-accent: #eaf2fb; --on-variant: #46505c; --primary: #2c5a85; }
    /* The night views keep the dark scheme: the lunar sky and its slider, and the map's own panel. */
    #lunarView, #lunarBar, #view {
        --bg: #111319; --bg-deep: #0b0e14; --surface: #1d1f26; --surface-high: #282a30; --surface-highest: #33353b;
        --on-surface: #e2e2ea; --on-variant: #bfc7d2; --muted: #9aa0a6; --outline: #4d4732; --glass: #111319cc;
        color-scheme: dark;
    }
    body.lunar #lunarView, body.lunar #lunarBar { --accent: #b7c8e0; --on-accent: #1b2c3c; }
    #view .fab { --surface-high: #f0ede3; --surface-highest: #e5e1d5; background: var(--surface-high); color: var(--accent-light, #8a6d00); }
    body.lunar #view .fab { color: #3f6e9b; }
    .slot.lu { --lu-label: #46505c; }
    #learnBody img { filter: none; }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    background: var(--bg);
    color: var(--on-surface);
    font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
input, select {
    background: var(--bg-deep);
    border: 1px solid var(--outline);
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 0;
}
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.grow { flex: 1; }
[hidden] { display: none !important; }
button.icon { background: none; border: 0; border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; flex: none; }
button.icon:hover { background: var(--hover); }
button.icon svg { width: 22px; height: 22px; }
button.link { background: none; border: 0; padding: 4px 6px; color: var(--accent); }
button.link:disabled { color: var(--muted); cursor: default; }
button.tonal { background: var(--surface-highest); border: 0; border-radius: 20px; padding: 8px 16px; color: var(--accent); font-weight: 500; }

/* ---------- Shell (AdaptiveShell.kt): COMPACT < 600px ≤ MEDIUM < 840px ≤ EXPANDED ---------- */
#app { height: 100dvh; display: grid; grid-template-columns: 100%; position: relative; }
#mainPane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
#sidePane {
    display: flex; flex-direction: column; min-width: 0; min-height: 0;
    background: var(--surface-low); container-type: inline-size;
}
#surface { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
#surface > .slot { height: 100%; }
#sidePane .chrome { position: relative; height: 0; }
#sidePane .handle { display: none; }
#paneClose { position: absolute; right: 4px; top: 4px; z-index: 2; background: var(--surface-low); }

/* EXPANDED: map and surface as equal halves, side by side (or stacked on a portrait screen). */
@media (min-width: 840px) {
    #app { grid-template-columns: 1fr 1fr; }
    #sidePane { border-left: 1px solid var(--hairline); }
    #sidePane .chrome { display: none; }
}
@media (min-width: 840px) and (orientation: portrait) {
    #app { grid-template-columns: 100%; grid-template-rows: 1fr 1fr; }
    #sidePane { border-left: 0; border-top: 1px solid var(--hairline); }
}
/* MEDIUM: one pane at a time — an open surface replaces the map, full width, with a Close button. */
@media (min-width: 600px) and (max-width: 839.98px) {
    #sidePane { position: absolute; inset: 0; z-index: 20; }
}
/* COMPACT: a surface slides up as a full-screen sheet over the header too, with a scrim behind. */
@media (max-width: 599.98px) {
    #sidePane {
        position: fixed; left: 0; right: 0; bottom: 0; top: max(8px, env(safe-area-inset-top)); z-index: 40;
        border-radius: 28px 28px 0 0; box-shadow: 0 -4px 24px #0008;
        padding-bottom: env(safe-area-inset-bottom);
        animation: sheetUp 0.22s ease-out;
    }
    #sidePane .chrome { height: 36px; flex: none; touch-action: none; cursor: grab; }
    #sidePane .handle { display: block; width: 32px; height: 4px; border-radius: 2px; background: #ffffff66; margin: 14px auto 0; }
    #scrim { position: fixed; inset: 0; z-index: 39; background: #00000080; animation: fadeIn 0.2s; }
}
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- Header (AppHeader.kt) ---------- */
#appHeader {
    background: var(--surface); box-shadow: 0 1px 0 var(--hairline);
    padding: max(8px, env(safe-area-inset-top)) 12px 10px; flex: none; position: relative; z-index: 3;
    container-type: inline-size;
}
#appHeader .bar { display: flex; align-items: center; gap: 4px; }
.appTitle { font-weight: 600; font-size: 16px; white-space: nowrap; }
#locBtn {
    display: flex; align-items: center; gap: 4px; background: none; border: 0; border-radius: 20px;
    padding: 8px 10px; color: var(--accent); font-weight: 500; max-width: 40%; min-width: 0;
}
#locBtn:hover { background: var(--hairline); }
#locBtn svg { width: 18px; height: 18px; flex: none; }
#locName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* EclipseModeSwitch.kt: a two-position sun/moon switch. */
#modeSwitch { display: flex; background: var(--bg-deep); border: 1px solid var(--outline); border-radius: 18px; padding: 2px; flex: none; }
#modeSwitch button { border: 0; border-radius: 16px; background: none; width: 34px; height: 28px; padding: 0; font-size: 16px; color: var(--muted); }
#modeSwitch button[aria-checked=true] { background: var(--accent); color: var(--on-accent); }
.selectorRow { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
#selector {
    display: flex; align-items: center; gap: 8px; text-align: left; width: 100%;
    background: var(--surface-high); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
    border-radius: 16px; padding: 10px 14px 10px 16px;
}
#selector:hover { background: var(--surface-highest); }
.selText { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.selText > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#selLabel { color: var(--accent); font-size: 11px; font-weight: 500; letter-spacing: 0.04em; }
#selHeadline { font-size: 22px; line-height: 1.3; font-weight: 700; }
#selSub { color: var(--on-variant); }
#selector svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
#stats { display: flex; justify-content: space-between; gap: 8px; margin: 0; padding: 0 4px; }
#stats div { min-width: 0; }
#stats dt { color: var(--muted); font-size: 11px; font-weight: 500; }
#stats dd { margin: 0; font: 500 15px/1.4 ui-monospace, Menlo, monospace; white-space: nowrap; }
#stats button { background: none; border: 0; padding: 0; text-align: left; color: var(--accent); }
#stats button dd {
    text-decoration: underline dotted; text-underline-offset: 4px;
}
/* Selector and stats side by side once the header itself is ≥ 560px wide. */
@container (min-width: 560px) {
    .selectorRow { flex-direction: row; align-items: center; gap: 16px; }
    #selector { flex: 0.55; }
    #stats { flex: 0.45; }
}

/* ---------- Stage: the map (or lunar sky), its FABs, and the timeline ---------- */
#stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#view { position: relative; flex: 1; min-height: 0; background: var(--bg-deep); }
#solarView, #lunarView { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#fabs {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 8px;
    padding: 12px var(--gutter); pointer-events: none;
}
.fab {
    pointer-events: auto; border: 0; background: var(--surface-high); color: var(--accent);
    width: 40px; height: 40px; border-radius: 12px; font-weight: 700; font-size: 16px;
    box-shadow: 0 2px 6px #0007;
}
.fab.ext { width: auto; height: 52px; border-radius: 16px; padding: 0 18px 0 14px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.fab.ext svg { width: 22px; height: 22px; }
.fab:hover { background: var(--surface-highest); }
#status {
    position: absolute; right: 12px; top: 12px; font: 11px ui-monospace, Menlo, monospace; z-index: 2;
    color: var(--muted); background: var(--glass); border-radius: 6px; padding: 4px 8px; white-space: pre; pointer-events: none;
}
body:not(.debug) .lu .lu-status { display: none; } /* load and frame timings, shown with ?debug */
#bar { flex: none; background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
#timeline { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px var(--gutter) 8px; }
#clock { color: var(--accent); font: 500 14px ui-monospace, Menlo, monospace; }
#hourSlider { width: 100%; }

/* SunSlider.kt: a thin gold track and a small gold sun with a dark centre. */
input[type=range].sun { -webkit-appearance: none; appearance: none; background: none; border: 0; padding: 0; height: 24px; width: 100%; }
input[type=range].sun::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p, 50%), color-mix(in srgb, var(--accent) 30%, transparent) var(--p, 50%)); }
input[type=range].sun::-moz-range-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 30%, transparent); }
input[type=range].sun::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range].sun::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
    background: radial-gradient(circle, #000 2.5px, var(--accent) 3px); border: 0;
}
input[type=range].sun::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, #000 2.5px, var(--accent) 3px); border: 0; }

/* A set of eclipses on the map (SetPlaybackBar) */
#setClose { position: absolute; left: 12px; top: 12px; z-index: 3; }
#setPill {
    position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 3;
    background: var(--glass); border-radius: 16px; padding: 4px 12px; font-size: 12px; color: var(--on-variant);
}
#setBar {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px;
    margin: 0 12px 10px; padding: 8px 12px; background: color-mix(in srgb, var(--surface) 85%, transparent);
    border-radius: 24px;
}
#setPlay { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--on-accent); border: 0; padding: 0; }
#setPlay[hidden] + .setText { grid-column: 1 / 3; }
.setText b { display: block; color: var(--accent); font-weight: 600; }
.setText small { color: var(--muted); }
#setScrub { grid-column: 1 / -1; }
body.set #fabs { display: none; }

/* ---------- Surfaces (shared look: title, cards, rows) ---------- */
.surface { padding: 16px var(--gutter) 32px; max-width: 880px; margin: 0 auto; }
.surface h2 { font-size: 22px; margin: 4px 48px 4px 0; }
.surface .sub { color: var(--muted); margin: 0 0 12px; }
.card { background: var(--surface); border-radius: 20px; padding: 16px 18px; margin-top: 12px; }
.card h3 { margin: 0 0 10px; font-size: 16px; color: var(--accent); font-weight: 600; }
.card pre { margin: 0; font: 12px/1.5 ui-monospace, Menlo, monospace; overflow-x: auto; color: var(--on-surface); }
dl.rowsdl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
dl.rowsdl dt { color: var(--muted); }
dl.rowsdl dd { margin: 0; text-align: right; font-family: ui-monospace, Menlo, monospace; }

/* Chooser (EclipseChooser.kt) */
.chooser { display: flex; flex-direction: column; height: 100%; padding-bottom: 0; }
.chooser .filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { background: var(--surface); border: 1px solid var(--outline); border-radius: 8px; padding: 6px 12px; color: var(--on-surface); }
.chip[aria-pressed=true] { background: var(--surface-highest); color: var(--accent); border-color: var(--accent); }
.chooser .years { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; color: var(--muted); flex-wrap: wrap; }
.chooser .years input { width: 96px; text-align: center; color: var(--on-surface); }
.chooser .count { color: var(--muted); font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--hairline); }
.chooser .rows { list-style: none; margin: 0 calc(-1 * var(--gutter)); padding: 0; overflow: auto; flex: 1; min-height: 160px; }
.chooser .rows button {
    display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
    background: none; border: 0; padding: 10px var(--gutter);
}
.chooser .rows button:hover { background: var(--hover); }
.chooser .rows button.on { background: var(--surface-high); }
.chooser .rows b { display: block; font-weight: 500; font-size: 15px; }
.chooser .rows small { color: var(--muted); white-space: pre; }
.chooser .rows em { font-style: normal; color: var(--accent); font-family: ui-monospace, Menlo, monospace; }
.badge { width: 44px; height: 44px; border-radius: 50%; background: var(--badge); display: grid; place-items: center; flex: none; }
.typeIcon { width: 26px; height: 26px; stroke: none; }
.chooser .foot { padding: 10px 0 14px; display: flex; justify-content: center; border-top: 1px solid var(--hairline); }
@container (min-width: 880px) {
    .chooser { display: grid; grid-template-columns: 0.48fr 0.52fr; grid-template-rows: auto auto auto auto 1fr auto; column-gap: 24px; }
    .chooser > :not(.rows):not(.count):not(.foot) { grid-column: 1; }
    .chooser .count { grid-column: 2; grid-row: 1; }
    .chooser .rows { grid-column: 2; grid-row: 2 / 6; margin: 0; }
    .chooser .foot { grid-column: 1; grid-row: 5; border: 0; justify-content: start; }
}

/* Help (EclipseMapHelpContent.kt) */
.help .guide { margin: 0 0 8px; color: var(--on-variant); }
.legendRow { display: flex; gap: 14px; align-items: start; padding: 6px 0; }
.legendRow b { display: block; font-weight: 600; }
.legendRow small { color: var(--muted); }
.sw { flex: none; width: 28px; height: 20px; display: grid; place-items: center; }
.sw::before { content: ""; display: block; }
.sw.line::before { width: 28px; border-top: 3px solid var(--c); }
.sw.dash::before { width: 28px; border-top: 2px dashed var(--c); }
.sw.area::before { width: 24px; height: 14px; border-radius: 3px; }
.sw.area[style*=umbra]::before { background: #ffd7004d; border: 2px solid #ffd700; }
.sw.area[style*=penumbra]::before { background: var(--hairline); border: 1.5px solid #ffd70059; }
.sw.sun::before { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 5px #ffe08240; }
.sw.marker::before { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2.5px #fff; }
.sw.pin::before { width: 12px; height: 12px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #fff; border: 3px solid var(--c); }

/* ---------- Local circumstances (LocalCircumstancesSheet.kt) ---------- */
.local .place { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-right: 44px; }
.local .place b { font-size: 16px; }
.local .place small { display: block; color: var(--muted); }
.local .headline { font-size: 20px; font-weight: 600; margin: 12px 0 4px; color: var(--primary); }
.local .headline.none { color: var(--muted); font-size: 16px; }
.local .duration { color: var(--on-variant); }
.local .duration b { color: var(--accent); font-family: ui-monospace, Menlo, monospace; font-weight: 500; }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.stats2 div { background: var(--surface); border-radius: 12px; padding: 8px 12px; }
.stats2 dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.stats2 dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; }
#sky { width: 100%; max-width: 420px; aspect-ratio: 1; border-radius: 16px; display: block; margin: 0 auto; background: #000; }
.scrub { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 10px 0 4px; }
.scrub output { font: 500 18px ui-monospace, Menlo, monospace; }
.altaz { color: var(--muted); font: 12px ui-monospace, Menlo, monospace; white-space: pre; text-align: center; margin-top: 6px; }
.contacts { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.contacts th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11px; padding: 4px; }
.contacts td { padding: 7px 4px; border-top: 1px solid var(--hairline); }
.contacts tr { cursor: pointer; }
.contacts tr:hover td { background: var(--surface); }
.contacts td:nth-child(n+2) { text-align: right; }
.contacts tr.on td { color: var(--accent); }
.note { color: var(--muted); font-size: 12px; margin-top: 10px; }
.note button { font-size: inherit; padding: 0; }
@container (min-width: 880px) {
    .local { display: grid; grid-template-columns: 0.48fr 0.52fr; column-gap: 24px; align-items: start; }
    .local > .diagramCol { grid-column: 2; grid-row: 1 / 8; }
}

#toast {
    position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
    background: var(--surface-highest); color: var(--on-surface); border-radius: 8px; padding: 10px 16px; box-shadow: 0 2px 8px #0008;
}

#syzygyRoot { position: fixed; inset: 0; z-index: 45; background: var(--bg); }
#drawer .item.syzygy { margin-top: 12px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 16px; }
#drawer .item.syzygy b { display: block; color: var(--accent); }
#drawer .item.syzygy small { color: var(--muted); }

/* ---------- Guided tour (Walkthrough.kt) ---------- */
#tour { position: fixed; inset: 0; z-index: 70; }
#tour .hole {
    position: fixed; border-radius: 14px; box-shadow: 0 0 0 2px var(--accent), 0 0 0 100vmax #000000b3;
    transition: left .32s, top .32s, width .32s, height .32s, opacity .32s; pointer-events: none;
}
#tour .card {
    position: fixed; background: var(--surface-high); color: var(--on-surface); border-radius: 20px; padding: 20px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); box-shadow: 0 8px 24px #0009;
    transition: left .32s, top .32s;
}
#tour .head { display: flex; align-items: center; gap: 10px; font-size: 17px; }
#tour .head b { color: var(--accent); }
#tour p { margin: 8px 0 16px; color: var(--on-variant); }
#tour .foot { display: flex; align-items: center; gap: 4px; }
#tour .dots { display: flex; gap: 6px; align-items: center; }
#tour .dots i { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--on-variant) 35%, transparent); }
#tour .dots i.on { width: 9px; height: 9px; background: var(--accent); }
#tour .next { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 20px; padding: 8px 18px; font-weight: 600; }

/* ---------- Drawer (DrawerComponents.kt) ---------- */
#drawerScrim { position: fixed; inset: 0; z-index: 50; background: #00000080; animation: fadeIn 0.2s; }
#drawer {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 51; width: min(320px, 86vw); overflow: auto;
    background: var(--surface-low); display: flex; flex-direction: column; padding-bottom: 20px;
    border-radius: 0 16px 16px 0; animation: drawerIn 0.2s ease-out;
}
@keyframes drawerIn { from { transform: translateX(-100%); } }
#drawer .hero {
    padding: calc(28px + env(safe-area-inset-top)) 24px 20px; display: flex; flex-direction: column; gap: 2px;
    background: radial-gradient(ellipse at 50% 36%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), var(--bg-deep);
}
#drawer .hero b { font-size: 24px; color: var(--accent); }
#drawer .hero span { color: var(--muted); }
#drawer .section { padding: 18px 28px 6px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
#drawer .item {
    margin: 0 12px; text-align: left; background: none; border: 0; border-radius: 28px; padding: 12px 16px; color: var(--on-surface);
}
#drawer .item:hover { background: var(--hover); }
#drawer .item.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 600; }
#drawer .modeRow { display: flex; gap: 8px; margin: 0 24px; }
#drawer .modeRow button { flex: 1; border: 1px solid var(--outline); background: none; border-radius: 20px; padding: 8px; }
#drawer .modeRow button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
body.lunar .solarOnly, body:not(.lunar) .lunarOnly { display: none; }

/* ---------- Dialogs: location (LocationPicker.kt) and Learn pages ---------- */
dialog {
    background: var(--surface); color: var(--on-surface); border: 0; border-radius: 28px; padding: 24px;
    width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
}
dialog::backdrop { background: #00000080; }
dialog h2 { margin: 0 0 16px; font-size: 22px; font-weight: 500; }
#termText { color: var(--on-variant); margin: 0 0 8px; }
#placeInput { width: 100%; padding: 12px 14px; border-radius: 12px; }
#placeResults { list-style: none; margin: 8px 0; padding: 0; max-height: 50vh; overflow: auto; }
#placeResults li { padding: 10px 12px; border-radius: 10px; cursor: pointer; }
#placeResults li:hover, #placeResults li.active { background: var(--surface-high); }
#placeResults small { color: var(--muted); }
dialog .actions { display: flex; align-items: center; margin-top: 8px; }
#learnDialog { width: min(640px, calc(100vw - 16px)); padding: 0; overflow: hidden; display: none; flex-direction: column; }
#learnDialog[open] { display: flex; }
.learnHead { display: flex; align-items: center; padding: 16px 12px 8px 24px; }
.learnHead h2 { flex: 1; margin: 0; font-weight: 700; }
#learnBody { overflow: auto; padding: 0 24px 32px; color: var(--on-variant); }
#learnBody h2, #learnBody h3, #learnBody h4 { color: var(--on-surface); }
#learnBody img { display: none; } /* SolarHome passes no images on web either */
@media (max-width: 599.98px) {
    #learnDialog { width: 100vw; max-width: 100vw; max-height: calc(100dvh - 24px); margin: auto 0 0; border-radius: 28px 28px 0 0; }
}
