/* Stargazer — one dark look on purpose: it is a night sky.

   Layers (bottom → top): sky canvases · HUD · task card · time pop-up · panels · menu · toast · red light.
   HUD: menu and clock at the top; view, the main action and the atlas at the bottom. Everything else
   lives in the menu ("Настройки", "Созерцание") or in panels, so the sky stays clear.

   Tokens (colour, type, space, motion) are at the top; reports/Premium calm game UI design.md says where each comes from.
   Components: .glass (tinted surface over the sky) · .ibtn (square icon button) · .pill · .primary · .seg (segmented)
   · .panel with .phead/.pbody · .list of .item rows (.tg = switch) · .chip · .pop.
   Sizes: touch targets 48 px on touch screens, 44 with a mouse; spacing on a 4 px grid; radii 8/12/16/24. */
:root {
  /* ---- colour (reports/Premium calm game UI design.md). Neutrals share hue 262 (the night sky), surfaces step
     up in lightness instead of shadows, one gold accent. Text levels by APCA: text-1 Lc ≈ 90 (body), text-2 Lc ≈ 65
     (labels), text-3 Lc ≈ 47 (meta, 13 px and up). Hex here; the same colours in OKLCH below where supported. */
  --bg: #040811;
  --surface-1: #0c131e;               /* HUD buttons, cards */
  --surface-2: #151c29;               /* sheets, pop-ups */
  --surface-glass: rgba(12, 19, 30, 0.86);   /* over the moving sky: tinted, not blurred (blur re-renders every frame) */
  --border: #2a3344;
  --border-strong: #4d586c;
  --text-1: #e2e9f1;
  --text-2: #aebcce;
  --text-3: #8c9bb0;
  --accent: #f2c26f;                  /* gold, Lc 74 on the background */
  --accent-hi: #f7db98;
  --on-accent: #040811;
  --accent-soft: rgba(242, 194, 111, 0.14);
  --error: #f17871;
  --focus: #8dccf9;                   /* cool, so a focus ring never reads as "selected" (gold) */
  --scrim: rgba(2, 4, 9, 0.5);
  /* older names, kept so every rule below reads the same */
  --night: var(--bg); --ink: var(--text-1); --ink-dim: var(--text-2); --ink-faint: var(--text-3);
  --gold: var(--accent); --gold-hi: var(--accent-hi); --gold-soft: var(--accent-soft); --on-gold: var(--on-accent);
  --line: var(--border); --glass: var(--surface-glass); --glass-hi: rgba(21, 28, 41, 0.97); --danger: var(--error);
  --fill: rgba(255, 255, 255, 0.045);
  --fill-hi: rgba(255, 255, 255, 0.08);

  /* ---- type: Golos Text for everything, Lora Italic for names and titles (css/fonts.css) */
  --f-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-sky: "Lora", "Iowan Old Style", Georgia, serif;
  --t-cap: 12px;      /* overlines: uppercase, +0.08em */
  --t-sm: 13.5px;     /* secondary, hints */
  --t-ui: 15px;       /* buttons, rows */
  --t-body: 16px;     /* reading text */

  /* ---- space and shape: a 4 px grid; radii 8 · 12 · 16 · 24 · round */
  --r-md: 12px; --r-lg: 16px; --r-xl: 24px;
  --gut: max(12px, env(safe-area-inset-left, 0px));
  --gut-r: max(12px, env(safe-area-inset-right, 0px));
  --hud-top: 68px;      /* real bottom edge of the top HUD and height of the bottom one; ui/layout.js keeps them */
  --hud-bottom: 68px;
  --tap: 44px;          /* 48 on touch screens, below */

  /* ---- motion: entrances decelerate, exits accelerate and run ~30% shorter; short distances, long soft tails */
  --dur-instant: 100ms; --dur-quick: 160ms; --dur-base: 240ms; --dur-calm: 360ms; --dur-sheet: 500ms; --dur-scene: 700ms;
  --ease-out: cubic-bezier(0.05, 0.7, 0.1, 1);     /* Material 3 emphasized decelerate */
  --ease-in: cubic-bezier(0.3, 0, 0.8, 0.15);      /* Material 3 emphasized accelerate */
  --ease-std: cubic-bezier(0.2, 0, 0, 1);          /* Material 3 standard */
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);    /* iOS sheet */
  --ease-calm: cubic-bezier(0.4, 0.14, 0.3, 1);    /* IBM Carbon expressive */
  color-scheme: dark;
}
@supports (color: oklch(0 0 0)) {
  :root {
    --bg: oklch(0.135 0.022 262); --surface-1: oklch(0.185 0.026 262); --surface-2: oklch(0.225 0.028 262);
    --surface-glass: oklch(0.185 0.026 262 / 0.86); --border: oklch(0.31 0.03 262); --border-strong: oklch(0.46 0.035 262);
    --text-1: oklch(0.93 0.014 255); --text-2: oklch(0.79 0.03 255); --text-3: oklch(0.69 0.035 255);
    --accent: oklch(0.84 0.115 80); --accent-hi: oklch(0.9 0.09 88); --accent-soft: oklch(0.84 0.115 80 / 0.14);
    --error: oklch(0.71 0.15 25); --focus: oklch(0.82 0.09 240);
  }
}
@media (pointer: coarse) { :root { --tap: 48px; } }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }   /* no pull-to-refresh on Android */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: pan-x pan-y; }   /* no page pinch-zoom; lists still scroll */
[hidden] { display: none !important; }
body { background: var(--night); color: var(--ink); font-family: var(--f-ui); font-size: var(--t-ui); overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
h1, h2, h3, p { margin: 0; }
svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#stage { position: fixed; inset: 0; touch-action: none; cursor: grab; background: var(--night); }   /* never white, even without the GPU */
#stage.dragging { cursor: grabbing; }
#gl, #ov { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- base controls ---------- */
button, select {
  font: 500 var(--t-ui)/1.2 var(--f-ui); color: var(--ink); background: transparent; border: 0;
  min-height: var(--tap); padding: 0 14px; border-radius: var(--r-md); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color var(--dur-quick) var(--ease-std), color var(--dur-quick) var(--ease-std),
    opacity var(--dur-quick) var(--ease-std), transform var(--dur-quick) var(--ease-out), box-shadow var(--dur-base) var(--ease-std);
}
/* press: the control gives a little under the finger (rows in lists only darken) */
.ibtn:active, .pill:active, .chip:active, .seg > button:active, .place:active { transform: scale(.96); transition-duration: var(--dur-instant); }
.primary:active, .mitem:active { transform: scale(.98); transition-duration: var(--dur-instant); }
button:hover, select:hover { background: var(--fill-hi); }
button:active { background: rgba(255, 255, 255, 0.13); }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.list .item:focus-visible, .list > button:focus-visible { outline-offset: -2px; }   /* lists clip their overflow: the ring goes inside */
button:disabled { opacity: .45; cursor: default; }
button[aria-pressed="true"], button[aria-expanded="true"], #nightBtn.on, #skyPlace.on { background: var(--gold-soft); color: var(--gold); }
#codeBox textarea { width: 100%; min-height: 72px; padding: 10px 12px; font: 500 13px/1.4 var(--f-ui); color: var(--ink); background: var(--fill);
  border: 1px solid var(--line); border-radius: var(--r-md); resize: vertical; word-break: break-all; }
#codeBox .chips { margin-top: 8px; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; text-align: left;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%), linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: #0e1324; color: var(--ink); }
.num { font-variant-numeric: tabular-nums; }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
/* real frosted glass only where it is cheap: a mouse-driven wide screen. Over the live sky the blur is recomputed every
   frame; phones get the tinted surface, which looks nearly the same on a dark sky */
@media (pointer: fine) and (min-width: 721px) {
  .glass, .mitem { -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15); }
}
@media (prefers-reduced-transparency: reduce) { :root { --surface-glass: var(--surface-1); --glass-hi: var(--surface-2); } }
.ibtn { width: var(--tap); padding: 0; flex: none; }
/* the one way back, named after the place it leads to: "‹ Menu" (ui/sheets.js paintBack) */
.ibtn.named { width: auto; max-width: 46%; padding: 0 10px 0 4px; display: inline-flex; align-items: center; gap: 2px; font: 500 13.5px/1.1 var(--f-ui); color: var(--ink-dim); }
.ibtn.named .to { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ibtn.named svg { flex: none; }
.pill { padding: 0 16px; border-radius: 999px; }
/* the gold stays gold when hovered or pressed: the general button:hover / button:active fills outrank a bare .primary,
   so the states are named here too (without them the menu's "Play" turned dark under the pointer) */
.primary, .primary:hover, .primary:active { background: linear-gradient(180deg, var(--accent-hi), var(--accent) 55%); }
.primary { color: var(--on-gold); font-weight: 600; padding: 0 22px; border-radius: 999px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 8px 28px rgba(242, 194, 111, .22); }
/* Hover: the button never repaints itself. Two layers sit behind its text and only fade (opacity runs on the
   compositor, so nothing re-rasterises and nothing flickers): ::after a soft light over the gold, ::before a wider
   glow. A flat colour swap snapped (gradients do not transition) and `filter` re-drew the text on every frame.
   Only where a real pointer hovers, so a tap on a phone never leaves the button lit. */
.primary { position: relative; isolation: isolate; }
.primary::before, .primary::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  z-index: -1; opacity: 0; transition: opacity var(--dur-base) var(--ease-std); }
.primary::before { box-shadow: 0 0 0 1px rgba(247, 219, 152, .35), 0 10px 36px rgba(242, 194, 111, .3); }
.primary::after { background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .06) 60%); }
@media (hover: hover) { .primary:hover::before, .primary:hover::after { opacity: 1; } }
.primary:active::after { opacity: 0; transition-duration: var(--dur-instant); }
body.night .primary::before { display: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-lg); }
.seg > button { min-height: 38px; padding: 0 12px; border-radius: 11px; }
.seg.wide { display: flex; background: var(--fill); }
.seg.wide > button { flex: 1 1 0; min-width: 0; padding: 4px; font-size: 13.5px; white-space: normal; text-align: center; }
.seg.wide.rows { flex-wrap: wrap; }   /* five choices: three and two (the landscapes, on the sky's own sheet) */
.seg.wide.rows > button { flex: 1 1 30%; }
.hint, small { font-size: var(--t-sm); line-height: 1.45; color: var(--ink-dim); font-weight: 400; }
.tag { font: 600 12px/1 var(--f-ui); font-variant-numeric: tabular-nums; color: var(--on-gold); background: var(--gold); padding: 4px 7px; border-radius: 999px; }

/* ---------- HUD ---------- */
.hud { position: fixed; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-left: var(--gut); padding-right: var(--gut-r); pointer-events: none; transition: opacity var(--dur-calm) var(--ease-std); isolation: isolate; }
.hud > * { pointer-events: auto; }
/* a soft shade behind the HUD rows keeps them readable over a bright sky without boxing them in */
.hud::before { content: ""; position: absolute; left: 0; right: 0; height: calc(100% + 48px); pointer-events: none; z-index: -1; }
.hud.top::before { top: 0; background: linear-gradient(to bottom, rgba(4, 8, 17, .55), rgba(4, 8, 17, 0)); }
.hud.bottom::before { bottom: 0; background: linear-gradient(to top, rgba(4, 8, 17, .6), rgba(4, 8, 17, 0)); }
.hud.top { align-items: flex-start; top: 0; padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }
.hud.bottom { bottom: 0; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.hud.bottom .view { justify-self: start; }
.hud.bottom #play { grid-column: 2; min-height: 50px; font-size: 16px; white-space: normal; text-align: center; line-height: 1.15; }
.hud.bottom #atlasBtn { grid-column: 3; justify-self: end; }
.hgroup { display: flex; gap: 8px; }
.clock { font: 500 14px/1 var(--f-ui); font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap; }
#clockBtn { gap: 10px; }
#atlasBtn { position: relative; }
#atlasBtn.dot::after, .mitem.dot .mt::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
#atlasBtn.dot::after { top: 8px; right: 10px; }
.mitem.dot .mt { position: relative; }
.mitem.dot .mt::after { top: 1px; right: -12px; }
body.in-menu .hud, body.in-menu #task, body.zen .hud, body.zen #task, body.zen #toast { opacity: 0; pointer-events: none; }
body.in-menu .hud > *, body.zen .hud > * { pointer-events: none; }

/* ---------- time pop-up ---------- */
.pop { position: fixed; z-index: 8; top: calc(var(--hud-top) + 8px); right: var(--gut-r); width: min(340px, calc(100% - 24px));
  display: grid; gap: 10px; padding: 14px; background: var(--glass-hi); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .45); transform-origin: top right; animation: pop-in var(--dur-base) var(--ease-out); }
.pop.left { right: auto; left: var(--gut); transform-origin: top left; }
body.in-atlas .pop { z-index: 10; }   /* (a pop-up opened over the atlas, which stays under it: ui/sheets.js) */
.tgroup { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; max-width: min(340px, 92vw); }
.thead { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; margin-left: 25%; }   /* the place and the clock keep a row of their own: the chips sit under it together */
.nowchip { min-height: 36px; padding: 0 12px 0 10px; gap: 6px; font-size: 13.5px; color: var(--gold); border-color: rgba(242, 194, 111, .4); animation: rise var(--dur-base) var(--ease-out); }
.nowchip svg { width: 18px; height: 18px; }
#homeBtn .tripHome { color: var(--ink-dim); }
#placeBtn svg { width: 18px; height: 18px; }
#placeSheet .item { justify-content: space-between; width: 100%; }
/* the list of places grows with the cities found: it scrolls inside the pop-up, under the search */
#placeSheet { max-height: calc(100% - var(--hud-top) - 20px); grid-template-rows: auto auto minmax(0, 1fr); }
#placeList { overflow-y: auto; overscroll-behavior: contain; }
/* the row over a list of places: a search field to the eye (ui/dom.js searchRow) */
.item.search { justify-content: flex-start; gap: 10px; min-height: 46px; color: var(--ink-dim); background: var(--fill); border: 1px solid var(--line); border-radius: 12px; }
.item.search:hover { border-color: var(--gold); background: var(--fill); }
.item.search svg { width: 18px; height: 18px; color: var(--gold); }
.item.search > span { flex: 0 1 auto; }
#placeSheet .item.search { justify-content: flex-start; }
#pickTop { flex: none; padding: 2px 16px 8px; }
#pickTop:empty { display: none; }
#placeSheet .item .mm { color: var(--ink-dim); font-size: var(--t-sm); }
#homeBtn .tripHome::before { content: "·"; margin-right: 6px; }
.cstars .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cplan { font-size: var(--t-sm); line-height: 1.5; color: var(--ink-dim); }
.tnow { display: grid; gap: 2px; }
#timeBig { font-family: var(--f-sky); font-style: italic; font-size: 21px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }
#timeState { font-size: 13.5px; color: var(--gold); }
.ticks { position: relative; display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-dim); margin-top: -6px; }
.ticks .mid { position: absolute; left: calc(100% * 4 / 9); transform: translateX(-50%); }
.ticks .live { position: absolute; left: calc(100% * 5 / 9 + 3px); transform: translateX(-50%); color: var(--gold); }
.presets { gap: 8px; }
.pop .seg > button { font-size: 12.5px; }
input[type="range"] { width: 100%; accent-color: var(--gold); min-height: 32px; cursor: pointer; }
input[type="range"]:disabled { opacity: .4; cursor: default; }
.pop .line { border: 1px solid var(--line); }
.cap, .panel h3 { font-size: var(--t-cap); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }

/* ---------- task card ---------- */
#task { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(var(--hud-bottom) + 8px);
  width: min(420px, calc(100% - 24px)); max-height: calc(100% - var(--hud-top) - var(--hud-bottom) - 16px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--glass-hi); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: 0 16px 48px rgba(0, 0, 0, .4);
  padding: 14px 16px; display: grid; gap: 8px; transition: opacity var(--dur-calm) var(--ease-std); animation: rise-c var(--dur-calm) var(--ease-out); }
#task .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
#task .label { font-size: var(--t-cap); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
#task .stars { font-size: 15px; letter-spacing: 3px; color: var(--gold); display: inline-block; }
/* found: while the figure draws itself on the sky, the name glows once and the score settles in after it */
#task.won .target { animation: found-name 1.4s var(--ease-calm) 300ms both; }
#task.won .stars { animation: found-score 520ms var(--ease-out) 700ms both; }
@keyframes found-name { 0% { text-shadow: 0 0 0 rgba(242, 194, 111, 0); } 40% { text-shadow: 0 0 22px rgba(242, 194, 111, .55); } 100% { text-shadow: 0 0 8px rgba(242, 194, 111, .12); } }
@keyframes found-score { 0% { opacity: 0; transform: scale(.7); } 60% { opacity: 1; transform: scale(1.12); } 100% { transform: scale(1); } }
#task .target { font-family: var(--f-sky); font-style: italic; font-weight: 600; font-size: clamp(23px, 6.5vw, 28px); line-height: 1.15; color: var(--gold); overflow-wrap: anywhere; }
#task .note { font-size: var(--t-sm); color: var(--ink-dim); line-height: 1.45; }
/* the figure to look for, beside its name (ui/figureSketch.js) */
#task .tline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#task .tline .target { flex: 1 1 auto; min-width: 0; }
.sketch { flex: none; width: 68px; height: 68px; border-radius: var(--r-md); background: var(--fill); color: var(--ink); }
.sketch svg { display: block; width: 100%; height: 100%; }
.skl { fill: none; stroke: currentColor; stroke-opacity: .45; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.sks { fill: currentColor; }
/* the other games on the sheet "Играть": two tiles, each in a colour of its own (as two grey rows under the gold
   button nobody saw them) */
.gtiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gtile { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 3px; min-height: 98px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 16px; text-align: left; white-space: normal; background: var(--fill); }
.gtile:active { transform: scale(.98); transition-duration: var(--dur-instant); }
.gtile .gt { padding-right: 26px; font-size: 16.5px; font-weight: 600; }
.gtile .gm { font-size: 12.5px; line-height: 1.3; color: var(--ink-dim); }
.gico { position: absolute; right: 11px; top: 11px; width: 20px; height: 20px; }
#gWhere { border-color: rgba(110, 205, 190, .42); background: linear-gradient(160deg, rgba(60, 170, 160, .26), rgba(20, 60, 70, .14) 70%), var(--fill); }
#gWhere .gico { color: #9fe0d4; } #gWhere .gm { color: #a9d6cf; }
#gExpedition { border-color: rgba(235, 150, 115, .42); background: linear-gradient(160deg, rgba(210, 120, 80, .26), rgba(80, 40, 30, .14) 70%), var(--fill); }
#gExpedition .gico { color: #f0b79c; } #gExpedition .gm { color: #e3bfae; }
#gExpedition.locked { border-color: var(--line); background: var(--fill); }
#gExpedition.locked .gt, #gExpedition.locked .gico, #gExpedition.locked .gm { color: var(--ink-dim); }
body.night .gtile { background: var(--fill); }
#rDaily { align-self: center; }
#task .actions { margin-top: 2px; }
#task .actions > button:not(.ibtn) { flex: 1 1 auto; background: var(--fill); white-space: normal; text-align: center; }
#task .actions > button:not(.ibtn):hover { background: var(--fill-hi); }
#task .actions > button.primary:not(.ibtn) { background: var(--gold); color: var(--on-gold); }
#task #stop { color: var(--ink-dim); width: 36px; min-height: 36px; margin: -6px -8px -6px 0; }
#task .label { flex: 1 1 auto; min-width: 0; }
#task .actions { flex-wrap: wrap; }
/* over the whole-sky chart the card keeps its name and its buttons only: it used to cover the lower half of the disc */
body.chart #task .note, body.chart #task .sketch { display: none; }

/* ---------- panels: a drawer on the right on wide screens, a bottom sheet on phones ---------- */
.panel { position: fixed; z-index: 9; top: calc(var(--hud-top) + 8px); bottom: calc(var(--hud-bottom) + 8px); right: var(--gut-r); width: min(420px, calc(100% - 24px));
  display: flex; flex-direction: column; background: var(--glass-hi); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .04);
  animation: slide var(--dur-calm) var(--ease-out); }
/* A window (every panel but the atlas, which stands beside the living sky): in the middle of the screen, as the menu
   is, over a dimmed sky that is not turned or tapped while it is up; a tap on that sky is one step back
   (input/input.js). On a wide screen they were drawers down the right side with the sky live beside them: any press
   there closed them, into the menu or to the sky, and turned the sky as it did. */
#scrim { position: fixed; inset: 0; z-index: 8; background: var(--scrim); opacity: 0; pointer-events: none; touch-action: none; transition: opacity var(--dur-base) var(--ease-std); }
body.in-panel:not(.in-atlas) #scrim { opacity: 1; pointer-events: auto; }
@media (min-width: 721px) and (min-height: 501px) {
  /* in the middle of the screen, up and down too (the owner: hung from the top it looked pinned there). Its height
     eases when its content grows (the game's choices opening), so it stays in the middle without a jump. */
  .panel:not(#atlas) { top: 50%; bottom: auto; right: auto; left: 50%; translate: -50% -50%; width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); animation-name: window-in; }
  .panel:not(#atlas)[hidden].leaving { animation-name: fade-out; }
}
@keyframes window-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.phead { display: flex; align-items: center; gap: 4px; padding: 8px 8px 4px; flex: none; }
.phead h2 { flex: 1 1 auto; min-width: 0; font-family: var(--f-sky); font-style: italic; font-weight: 600; font-size: 24px; line-height: 1.15; padding: 0 8px; overflow-wrap: anywhere; text-wrap: balance; }
.phead .ibtn { color: var(--ink-dim); }
.phead .ibtn.hide { display: none; }   /* (no arrow, no gap for it: the title stood an arrow's width in from the card under it) */
.pbody { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; }
.pbody > *, #aMain > *, #aCard > * { flex: none; }
#aMain { display: flex; flex-direction: column; gap: 10px; }
#aMain:focus, #aCard:focus { outline: none; }   /* focused by the game when a card replaces what was pressed: a place to read from, not a control */
.panel h3 { padding: 10px 4px 0; }
.h3row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.count { font: 600 13px/1 var(--f-ui); font-variant-numeric: tabular-nums; color: var(--gold); padding-right: 4px; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--fill); border-radius: var(--r-lg); overflow: hidden; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; padding: 8px 14px; width: 100%;
  border-radius: 0; text-align: left; white-space: normal; font-size: var(--t-ui); font-weight: 500; line-height: 1.3; }
.list > .item + .item, .list > .trow + .trow, .list > .irow + .item, .list > .item + .irow, .list > .irow + .irow { border-top: 1px solid var(--line); }
/* a row with a small button of its own at its end (a found place and "take it off the list") */
.irow { display: flex; align-items: stretch; }
.irow > .item { flex: 1; min-width: 0; width: auto; }
.irow > .ibtn { height: auto; border-radius: 0; color: var(--ink-dim); }
.irow > .ibtn svg { width: 16px; height: 16px; }
.item > span { display: grid; gap: 2px; min-width: 0; }
.item.stack { display: grid; justify-content: stretch; gap: 8px; padding: 12px 14px; }
.item select { min-height: 38px; background-color: var(--fill-hi); flex: 0 1 auto; width: auto; min-width: 0; max-width: 62%; overflow: hidden; text-overflow: ellipsis; }
.item > span { flex: 1 1 auto; }
.item.tg::after { content: ""; flex: none; width: 40px; height: 24px; border-radius: 12px; background: rgba(255,255,255,.14);
  background-image: radial-gradient(circle at 12px 12px, #cfd6e8 8px, transparent 8.5px);
  transition: background-color var(--dur-quick) var(--ease-std); }
.item.tg[aria-pressed="true"] { background: transparent; color: var(--ink); }
.item.tg[aria-pressed="true"]::after { background-color: var(--gold); background-image: radial-gradient(circle at 28px 12px, var(--on-gold) 8px, transparent 8.5px); }
.item.tg:hover, .item:hover { background: var(--fill-hi); }
.item.danger { color: var(--danger); justify-content: center; }
.item.pick { gap: 8px; }
.item.pick > span:first-child { flex: 1 1 auto; }
/* (two lines before it is cut: on a 320 px phone "Современные (МАС)" lost its last letters to an ellipsis) */
.item.pick .val { flex: 0 1 auto; min-width: min-content; color: var(--ink-dim); font-weight: 500; text-align: right; overflow: hidden;   /* (never narrower than its longest word) */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.item.pick .chev { width: 18px; height: 18px; color: var(--ink-dim); }
.picker .opt { justify-content: space-between; }
.picker .opt[aria-selected="true"] { color: var(--gold); }
.picker .opt[aria-selected="true"]::after { content: ""; width: 20px; height: 20px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.picker { z-index: 12; }   /* above the menu, which it can be opened from */
.item.danger.confirm { background: rgba(255, 120, 100, .14); }
.credit { gap: 3px; font-size: 13.5px; line-height: 1.45; }
.credit b { font-weight: 600; }
.credit span, .credit small { min-width: 0; overflow-wrap: anywhere; }
.credit small { color: var(--ink-dim); }
.credit a, #creditsPanel .hint a { color: var(--gold); text-decoration: none; }
.credit a:hover, #creditsPanel .hint a:hover { text-decoration: underline; }
#creditsPanel .hint { padding: 0 4px 10px; }
#cTitle { font-size: 20px; }   /* "Источники и лицензии" fits a phone header */
#creditsPanel .list + .hint { padding: 10px 4px 0; }
#perf { padding: 4px; font-size: 11px; color: var(--ink-faint); }

/* tonight */
.trow { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 11px 14px; font-size: 14px; line-height: 1.5; }
.tlabel { color: var(--ink-dim); font-size: 12.5px; }
.tval { min-width: 0; overflow-wrap: anywhere; }
.tval .chip { margin: 3px 6px 3px 0; vertical-align: baseline; }
.progress { height: 4px; margin: 0 4px; border-radius: 2px; background: var(--fill-hi); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 2px; transition: width .4s ease; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 34px; padding: 6px 12px; font-size: 13px; font-weight: 500; border: 1px solid var(--line); border-radius: 999px; white-space: normal; text-align: left; line-height: 1.2; display: inline-flex; }
.chip .score { font-size: 10.5px; letter-spacing: 1px; color: var(--gold); }
/* how well a figure is known: four small dots; they pale when it has not been seen for long */
.chip .lvl { font-size: 9px; letter-spacing: 1.5px; color: var(--gold); margin-left: 7px; vertical-align: middle; }
.chip.due .lvl { opacity: .45; }
.clevel { font-size: 13px; color: var(--ink-dim); }
.rgain { margin-left: 8px; font-size: 11px; color: var(--gold); border: 1px solid rgba(242, 194, 111, .4); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
#mPlay { display: grid; justify-items: center; align-content: center; gap: 1px; }
#mToday { font-size: 11.5px; font-weight: 600; color: var(--on-gold); opacity: .72; line-height: 1.2; }
body.night #mToday { color: inherit; }
#mToday:empty { display: none; }
.chip.found { border-color: rgba(240,195,106,.45); color: var(--gold); }
.chip.below { color: var(--ink-dim); border-style: dashed; }
.chip.never { color: var(--ink-dim); border-style: dashed; }
.chip.never::before { content: ""; width: 13px; height: 13px; margin: 0 5px 0 -2px; flex: none; align-self: center; opacity: .8;
  background: currentColor; -webkit-mask: var(--pin) center / contain no-repeat; mask: var(--pin) center / contain no-repeat; }
.chip.star::before { content: "★"; margin-right: 5px; color: var(--gold); font-size: 11px; align-self: center; }
:root { --pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 21s-6.5-6.2-6.5-11a6.5 6.5 0 0 1 13 0c0 4.8-6.5 11-6.5 11z'/%3E%3Ccircle cx='12' cy='10' r='2.3'/%3E%3C/svg%3E"); }
#aSearch { width: 100%; min-height: 44px; margin: 4px 0 10px; padding: 0 14px; font: 500 var(--t-ui)/1.2 var(--f-ui); color: var(--ink);
  background: var(--fill); border: 1px solid var(--line); border-radius: 999px; }
#aSearch::placeholder { color: var(--ink-faint); }
#aList { display: block; }
#aList .chips + .ghead { margin-top: 16px; }
.ghead { font-size: var(--t-sm); line-height: 1.45; color: var(--ink-dim); margin: 6px 2px 8px; }
.ghead b { color: var(--ink); font-weight: 600; }
.more { margin-top: 12px; color: var(--gold); min-height: 40px; padding: 0 4px; font-size: var(--t-sm); text-align: left; white-space: normal; }
.chip.go { background: var(--gold); color: var(--on-gold); border-color: var(--gold); font-weight: 600; }
.chip.go:hover { background: var(--gold-hi); }

/* constellation card */
#aCard { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
#aCard .cbtn { align-self: flex-start; }
/* what a card's thing can be shown by, right under its name: where it is, the plan, the buttons in one row */
.cacts { display: grid; gap: 8px; }
.cbtns { display: flex; flex-wrap: wrap; gap: 8px; }
.cbtns .cbtn { flex: 1 1 140px; padding: 0 16px; }
/* "Read on Wikipedia" at the foot of a card: a quiet link, a finger's height */
.cwikirow { display: flex; padding: 2px 0 6px; }
.cwiki { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; color: var(--gold); font-size: var(--t-sm); text-decoration: none; }
.cwiki::after { content: " ↗"; white-space: pre; opacity: .8; }
.cwiki:hover { text-decoration: underline; }
.chead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cnames { display: grid; gap: 2px; min-width: 0; }
#aMain.searching > :not(#aSearch):not(#aList) { display: none; }
/* the atlas in three tabs: tonight and the Solar System, the constellations (the collection), the stars. (One long
   scroll put the collection two screens down, under nine planet tiles.) While searching, the field and what it found. */
#aMain:not(.searching)[data-tab="sky"] > [data-tab]:not([data-tab="sky"]), #aMain:not(.searching)[data-tab="cons"] > [data-tab]:not([data-tab="cons"]),
#aMain:not(.searching)[data-tab="stars"] > [data-tab]:not([data-tab="stars"]) { display: none; }
.atabs > button[aria-selected="true"] { background: var(--fill-strong, rgba(255, 255, 255, .10)); color: var(--ink); }
.cname { font-family: var(--f-sky); font-style: italic; font-weight: 600; font-size: 34px; line-height: 1.1; color: var(--gold); text-wrap: balance; overflow-wrap: anywhere; }
.clatin { font-size: 13px; color: var(--ink-dim); font-style: italic; }
.cstatus { font-size: 13px; color: var(--gold); }
.ctext { font-size: var(--t-body); line-height: 1.6; }
.cstars, .cwhere { display: grid; gap: 2px; font-size: var(--t-sm); line-height: 1.5; background: var(--fill); border-radius: var(--r-md); padding: 10px 12px; }
.cwhere { color: var(--ink-dim); }
.bfacts { gap: 8px; }
.ccap { padding: 6px 4px 0; }
/* A body as a telescope shows it now, under its name; Jupiter's moons where they stand; a moon beside our own */
.cport { display: grid; justify-items: center; gap: 6px; padding: 14px 10px 10px; border-radius: var(--r-md); background: radial-gradient(120% 90% at 50% 40%, rgba(40, 60, 110, .35), rgba(8, 12, 26, .55)); }
.cport canvas { display: block; max-width: 100%; }
.cport .hint { text-align: center; font-size: 12px; }
.jstrip { width: 100%; max-width: 340px; }
.jstrip svg { display: block; width: 100%; height: auto; overflow: visible; }
.jstrip text { fill: var(--ink-dim); stroke: none; font-size: 10px; font-family: var(--f-ui); }
.jstrip circle { stroke: none; }
.jstrip .jend { font-size: 9px; opacity: .7; }
.cmp { display: flex; align-items: flex-end; justify-content: center; gap: 28px; min-height: 96px; }
.cmpfig { display: grid; justify-items: center; gap: 6px; margin: 0; }
.cmpfig figcaption { font-size: 12px; color: var(--ink-dim); }
.cbtn.second { border: 1px solid var(--line); border-radius: 999px; color: var(--gold); font-weight: 600; }
/* "Start a new one" under "Continue": the second choice looks second (both stood in gold: which was the one?) */
#gStart.second { background: none; color: var(--gold); border: 1px solid var(--line); box-shadow: none; }
#gStart.second::before, #gStart.second::after { display: none; }
/* The Sun's family in the atlas: nine small portraits */
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.world { display: grid; justify-items: center; align-content: start; gap: 3px; padding: 10px 6px 9px; min-height: 104px; border-radius: var(--r-md); background: var(--fill); white-space: normal; text-align: center; line-height: 1.25; }
.world canvas { margin-bottom: 3px; }
.world .wname { font-size: 13px; font-weight: 600; }
.world .wstate { font-size: 11px; color: var(--ink-dim); }
.world.up .wstate { color: var(--gold); }
.cnote { padding: 0 4px; font-size: 12px; }   /* where a card's facts come from */   /* a second block of facts on a card: "the planet itself" */
/* the two sheets of a game: its rules before, its result after */
#setupPanel .pbody, #resultPanel .pbody { display: flex; flex-direction: column; gap: 12px; }
#setupPanel .primary.big, .ractions .primary.big { align-self: stretch; }
/* the rules in one line; "Изменить" is the row's own action, so it reads as one (gold), not as a value */
#gRules .val { color: var(--gold); font-weight: 600; overflow: visible; }
#gRulesText { font-weight: 600; }
#gBest:empty { display: none; }
#resultPanel .phead h2 { padding-left: 14px; }
.rhead { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 6px 0 2px; }
.rscore { font-family: var(--f-sky); font-style: italic; font-weight: 600; font-size: clamp(40px, 12vw, 52px); line-height: 1.05; color: var(--gold); }
#rBest.gold, #rRank { color: var(--gold); font-weight: 600; }
#rRank:not([hidden]) { animation: rise var(--dur-calm) var(--ease-calm) 600ms both; }
/* the result comes in: the score first, then the rounds one after another */
#rScore { animation: score-in 620ms var(--ease-out) 80ms both; }
#rScore.perfect { background: linear-gradient(100deg, var(--gold) 30%, #fff6dc 50%, var(--gold) 70%) 100% 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: score-in 620ms var(--ease-out) 80ms both, shine 2.6s var(--ease-calm) 700ms 2; }
body.night #rScore.perfect { background: none; color: inherit; }
@keyframes shine { to { background-position: 0 0; } }
@keyframes score-in { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: none; } }
#rRows .rrow { animation: rise var(--dur-calm) var(--ease-calm) both; }
#rRows .rrow:nth-child(1) { animation-delay: 260ms; } #rRows .rrow:nth-child(2) { animation-delay: 340ms; } #rRows .rrow:nth-child(3) { animation-delay: 420ms; }
#rRows .rrow:nth-child(4) { animation-delay: 500ms; } #rRows .rrow:nth-child(5) { animation-delay: 580ms; }
#rKnow:not(:empty), #rNext:not(:empty) { animation: rise var(--dur-calm) var(--ease-calm) 700ms both; }
#rKnow:empty, #rNext:empty { display: none; }
/* in the first round the introduction says what to do: the card keeps to the name and the figure */
body.coaching #task:not(.won) .note { display: none; }
.rrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: baseline; padding: 11px 14px; font-size: var(--t-body); }
.list > .rrow + .rrow { border-top: 1px solid var(--line); }
.rname { min-width: 0; overflow-wrap: anywhere; }
.rfig { display: inline-block; width: 30px; height: 30px; margin: -8px 10px -9px -4px; vertical-align: middle; color: var(--ink); }
.rfig.off { opacity: .4; }
/* a name of two words wraps beside its figure, not under it ("Столовая / Гора" with the figure between) */
.rname.withfig { position: relative; padding-left: 38px; }
.rname.withfig .rfig { position: absolute; left: -4px; top: 50%; margin: 0; transform: translateY(-50%); }
.rfig svg { display: block; width: 100%; height: 100%; }
.empty { display: grid; justify-items: center; gap: 6px; padding: 10px 8px 4px; text-align: center; }
.eart { width: 108px; color: var(--gold); opacity: .8; }
.eart svg { display: block; width: 100%; height: auto; }
.rnum { display: inline-block; min-width: 1.4em; color: var(--ink-dim); font-size: var(--t-sm); }
.rmeta { color: var(--ink-dim); font-size: var(--t-sm); }
.rstars { color: var(--gold); letter-spacing: 2px; font-size: 14px; white-space: nowrap; }
/* the day's screen: the figure itself (its lines draw themselves), its name where a game shows its score, a mark
   once it is found; under the buttons the streak, with the last seven days as a row of lights. (A calendar of five
   weeks stood here: half a screen of numbered squares that looked like buttons and did nothing.) */
#dailyPanel .pbody { display: flex; flex-direction: column; gap: 12px; }
.dname { font-size: clamp(30px, 9vw, 40px); overflow-wrap: anywhere; }
.dfig { width: 112px; height: 112px; margin-bottom: 6px; border-radius: 50%; color: var(--ink); }
.dfig svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dfig .skl { stroke-dasharray: var(--len, 200); stroke-dashoffset: var(--len, 200); animation: draw-line 1.8s var(--ease-calm) .25s forwards; }
.dfig.done { color: var(--gold); background: radial-gradient(closest-side, rgba(242, 194, 111, .17), transparent); }
.dbadge { display: inline-flex; align-items: center; gap: 7px; margin: 6px 0 4px; padding: 5px 13px 5px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: var(--t-sm); font-weight: 600; }
.dbadge[hidden] { display: none; }
/* a small gold disc with a check: "done" */
.mcheck { position: relative; flex: none; display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); }
.mcheck::after { content: ""; position: absolute; left: 6.5px; top: 3.5px; width: 4px; height: 8px; border: solid var(--on-gold); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.dstreak { display: grid; gap: 4px; padding: 14px 10px 13px; background: var(--fill); border-radius: var(--r-lg); text-align: center; }
.dweek { display: grid; grid-template-columns: repeat(7, 1fr); justify-items: center; margin-bottom: 8px; }
.wday { display: grid; justify-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-dim); }
.wday i { position: relative; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line); }
.wday.today { color: var(--ink); font-weight: 600; }
.ladder { margin: 2px 0 8px; font-size: 13px; color: var(--ink-dim); }
.ladder summary { cursor: pointer; color: var(--gold); width: max-content; padding: 6px 0; }
.ladder ol { list-style: none; margin: 4px 0 6px; padding: 0; display: grid; gap: 4px; }
.ladder li.past { color: var(--ink); }
.ladder li.now { color: var(--gold); font-weight: 600; }
.wday .wst { min-height: 10px; font-size: 8px; line-height: 10px; letter-spacing: -0.5px; color: var(--gold); font-weight: 400; }
.dwhy { max-width: 34em; margin: 6px auto 0; font-size: 12.5px; }
.wday.today i { box-shadow: inset 0 0 0 1.5px var(--gold); }
.wday.found i { background: var(--gold); box-shadow: 0 0 10px rgba(242, 194, 111, .35); }
.wday.found i::after { content: ""; position: absolute; left: 8px; top: 4.5px; width: 5px; height: 9.5px; border: solid var(--on-gold); border-width: 0 2px 2px 0; transform: rotate(45deg); }
#dStreak { font-weight: 600; }
#dMore:empty { display: none; }
#dNext { text-align: center; }
#dNext:empty { display: none; }
.ractions { display: flex; gap: 8px; flex-wrap: wrap; }
.ractions > button { flex: 1 1 140px; min-height: 48px; }
.ractions > button:not(.primary) { background: var(--fill); border-radius: 999px; }
.brow { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.brow .chips { margin-top: 0; }
.chips.cfig { margin-top: -4px; }   /* a star's constellation, under its name (ui/starCard.js) */
.cbtn { min-height: 48px; }

/* ---------- main menu ---------- */
#menu { overscroll-behavior: contain; position: fixed; inset: 0; z-index: 10; display: grid; place-items: start center; overflow-y: auto; padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(ellipse 75% 60% at 50% 50%, rgba(4, 6, 12, .72), rgba(4, 6, 12, .42) 70%, rgba(4, 6, 12, .3)),
              linear-gradient(to top, rgba(4, 6, 12, .55), transparent 40%);
  animation: fade var(--dur-scene) var(--ease-std); }
/* centred while it fits; when it is taller than the screen it starts at the top and scrolls (centred, its top was cut
   off and could not be reached) */
/* (its sizes follow the window smoothly: they stepped at 780 px of height, the rows, the gaps and the name all at once,
   and the menu jumped as the window was resized; and on a wide screen it stayed a 360 px column, lost in it.
   --mh: how far the height is over 780 px, as a length up to 120 px; each size takes its share of it) */
#menu { --mh: clamp(0px, 100vh - 780px, 120px); }   /* (a length: dividing one length by another is not in every browser yet) */
.mwrap { --mgap: calc(12px + var(--mh) * 0.1); width: min(clamp(360px, 30vw, 440px), 100%); display: grid; gap: var(--mgap); justify-items: center; text-align: center; margin-block: auto; }
/* the menu settles in piece by piece, quickly: 60 ms apart */
.mwrap > *, .mlist > * { animation: rise var(--dur-calm) var(--ease-calm) both; }
.mwrap > :nth-child(2) { animation-delay: 60ms; } .mlist > :nth-child(1) { animation-delay: 120ms; } .mlist > :nth-child(2) { animation-delay: 180ms; }
.mlist > :nth-child(3) { animation-delay: 240ms; } .mlist > :nth-child(4) { animation-delay: 300ms; } .mlist > :nth-child(n+5) { animation-delay: 340ms; }
.mwrap > .link { animation-delay: 380ms; }
.logo { font-family: var(--f-sky); font-style: italic; font-weight: 600; font-size: clamp(34px, min(13vw, max(min(11vw, 44px), calc(44px + var(--mh) * 0.1333))), 60px); line-height: 1; letter-spacing: .01em;
  color: #fbf3df; text-shadow: 0 0 32px rgba(242, 194, 111, .32), 0 2px 18px rgba(0, 0, 0, .6); }
.place { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 34px 0 16px; border-radius: 999px; font-size: 14.5px; color: var(--ink-dim); cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%), linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.place:hover { background-color: var(--fill-hi); }
.place b { color: var(--ink); font-weight: 600; }
.place .num { font-size: 13px; margin-left: 4px; }
.place:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }   /* (gold reads as "chosen") */
.tagline { margin-top: calc(-6px - var(--mh) * 0.0667); font-size: var(--t-sm); color: var(--ink-dim); text-wrap: balance; }
/* The menu in groups, not one list of eight rows: Play; the day's constellation; the two harder ways side by side;
   the two quiet ways side by side; the atlas. Settings are not a way to play: a gear in the corner. */
.mlist { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: calc(6px + var(--mh) * 0.0167); }
.mlist > * { grid-column: 1 / -1; }
.mlist > .mtile { grid-column: auto; min-height: 78px; justify-content: flex-start; padding: 11px 14px; }
.mtile .mm { font-size: 12px; line-height: 1.3; }
.mgear { position: absolute; z-index: 1; top: calc(env(safe-area-inset-top, 0px) + 10px); right: calc(env(safe-area-inset-right, 0px) + 12px); color: var(--ink-dim); }
.mgear:hover { color: var(--ink); }
.mgear.mclose { right: auto; left: calc(env(safe-area-inset-left, 0px) + 12px); }   /* (the menu had no visible way out but a tap on the sky around it) */
/* The day's constellation is a task for today, not one more way to play: gold at its edge, a word over its name.
   Done, it shows it: "found today" in gold, a check in its corner, the figure in gold, a gold edge without the glow
   (it used to lose all its gold and look like any other row). */
#mDaily { border-color: rgba(242, 194, 111, .5); background: linear-gradient(120deg, rgba(242, 194, 111, .17), rgba(242, 194, 111, .04) 62%), var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 22px rgba(242, 194, 111, .1); min-height: 66px; }
#mDaily.done { border-color: rgba(242, 194, 111, .5); background: var(--glass); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
#mDaily .mtag { display: inline-flex; align-items: center; gap: 4px; }
#mDaily .mcheck { display: none; transform: scale(.78); margin: -3px -1px -3px -2px; }
#mDaily.done .mcheck { display: inline-block; }
#mDaily.done .mm { color: var(--gold); letter-spacing: 1px; }
.mtag { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); opacity: .9; }
/* Contemplation is not a game: the colour of the night, a moon, its name in the hand the sky's names are written in */
#mZen { position: relative; border-color: rgba(120, 150, 235, .38); background: linear-gradient(160deg, rgba(70, 100, 200, .30), rgba(24, 34, 84, .22) 70%), var(--glass); }
#mZen:hover { border-color: rgba(150, 175, 245, .6); background: linear-gradient(160deg, rgba(80, 112, 215, .36), rgba(28, 40, 96, .26) 70%), var(--glass); }
#mZen .mt { font-family: var(--f-sky); font-style: italic; font-size: 18px; font-weight: 600; }
#mZen .mm { color: #aab8e6; }
.mico { position: absolute; right: 10px; top: 10px; width: 18px; height: 18px; color: #b9c6f2; opacity: .85; fill: none; stroke: currentColor; stroke-width: 1.6; }
body.night #mDaily, body.night #mZen { background: var(--glass); }
.big { min-height: 56px; font-size: 17px; }
.mitem { justify-content: space-between; width: 100%; min-height: 54px; padding: 8px 18px; border-radius: 16px; text-align: left; white-space: normal;
  background: var(--glass); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
.mitem:hover { background: rgba(21, 28, 41, .92); border-color: var(--border-strong); }
/* the day's figure on its row: the lines draw themselves each time the menu opens, the stars breathe */
#mDaily { position: relative; padding-right: 72px; }
.mfig { position: absolute; right: 14px; top: 50%; width: 46px; height: 46px; transform: translateY(-50%); color: var(--ink); pointer-events: none; }
.mfig.done { color: var(--gold); }
.mfig svg { display: block; width: 100%; height: 100%; overflow: visible; }
.mfig .skl { stroke-dasharray: var(--len, 200); stroke-dashoffset: var(--len, 200); animation: draw-line 1.8s var(--ease-calm) .7s forwards; }
.mfig .sks { animation: breathe 3.6s ease-in-out infinite; }
.mfig .sks:nth-of-type(3n) { animation-delay: -1.2s; } .mfig .sks:nth-of-type(3n+1) { animation-delay: -2.5s; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes breathe { 50% { opacity: .45; } }
/* three small stars by the title, each on its own slow beat */
.logo { position: relative; }
.spark { position: absolute; width: 9px; height: 9px; background: #fbe9bd; clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 4px rgba(242, 194, 111, .8)); animation: sparkle 4.2s ease-in-out infinite; opacity: 0; }
.spark.s1 { left: -14px; top: 2px; } .spark.s2 { right: -12px; top: -6px; width: 12px; height: 12px; animation-delay: -1.6s; } .spark.s3 { right: 22%; bottom: -9px; width: 7px; height: 7px; animation-delay: -3s; }
@keyframes sparkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); } 45%, 60% { opacity: .9; transform: scale(1) rotate(20deg); } }
.mitem .mt { font-size: var(--t-body); font-weight: 500; }
.mitem .mm { font-size: var(--t-sm); color: var(--ink-dim); text-align: left; }
/* a mode card: its name, and under it one line saying what you do there (beside the name the line wrapped and crowded it) */
.mitem { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; padding-top: 9px; padding-bottom: 9px; }
/* a phone held upright in a browser has about 670 px of height: the whole menu fits without scrolling */
#menu { padding-top: calc(14px + var(--mh) * 0.0833 + env(safe-area-inset-top, 0px)); padding-bottom: calc(14px + var(--mh) * 0.0833 + env(safe-area-inset-bottom, 0px)); }
.mlist .big { min-height: calc(50px + var(--mh) * 0.05); }
.mitem { min-height: calc(46px + var(--mh) * 0.0667); padding: calc(5px + var(--mh) * 0.025) calc(16px + var(--mh) * 0.0167); }
@media (max-height: 780px) {
  .mitem .mm { font-size: 12.5px; line-height: 1.3; }
}
/* a heading that only receives focus from the game (a sheet opening) shows no ring: it is not a stop for the Tab key */
[tabindex="-1"]:focus { outline: none; }
.ractions > button { white-space: nowrap; }
.mitem .mm.gold { color: var(--gold); }
.link { min-height: 40px; color: var(--ink-dim); font-size: 14px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.link:hover { background: transparent; color: var(--ink); }

/* ---------- "Another city" (ui/placeFind.js) ---------- */
.field { width: 100%; min-height: 44px; padding: 0 14px; font: 500 var(--t-ui)/1.2 var(--f-ui); color: var(--ink); background: var(--fill); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.field::placeholder { color: var(--ink-faint); }
.field:focus { border-color: var(--gold); }
.field:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
#pfSearch { margin: 4px 0 10px; }
#pfList:empty { display: none; }
#pfList .opt { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; text-align: left; }
#pfList .opt small { color: var(--ink-dim); font-size: var(--t-sm); white-space: nowrap; }
#pfNote:empty { display: none; }
.pfcoords { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-top: 6px; width: 100%; }
.pfcoords .field { min-width: 0; padding: 0 10px; }
.pfcoords button { min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--fill-hi); }

/* ---------- "Where am I?" (ui/whereCard.js): the round card's place and look, with two sliders ---------- */
#where { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(var(--hud-bottom) + 8px);
  width: min(420px, calc(100% - 24px)); max-height: calc(100% - var(--hud-top) - var(--hud-bottom) - 16px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--glass-hi); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: 0 16px 48px rgba(0, 0, 0, .4);
  padding: 14px 16px; display: grid; gap: 8px; transition: opacity var(--dur-calm) var(--ease-std); animation: rise-c var(--dur-calm) var(--ease-out); }
#where[hidden] { display: none; }
#where .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
#where .label { flex: 1 1 auto; min-width: 0; font-size: var(--t-cap); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
#where .stars { color: var(--gold); letter-spacing: 2px; white-space: nowrap; }
#where .target { font-family: var(--f-sky); font-style: italic; font-weight: 600; font-size: 24px; line-height: 1.2; color: var(--gold); text-wrap: balance; }
#where .note { font-size: var(--t-sm); line-height: 1.45; color: var(--ink-dim); white-space: pre-line; }
#where .note:empty { display: none; }
#wAsk { display: grid; gap: 6px; }
#wAsk[hidden] { display: none; }
#where .wrow { display: grid; gap: 2px; font-size: var(--t-sm); font-weight: 500; }
#where input[type="range"] { width: 100%; min-height: 36px; margin: 0; accent-color: var(--gold); }
#where .actions > button { flex: 1 1 auto; }
body.in-menu #where, body.zen #where { opacity: 0; pointer-events: none; }
/* the clock, the place and what leads to them would give the answer away */
body.where #skyPlace, body.where #clockBtn, body.where #nowBtn, body.where #homeBtn, body.where #play, body.where #atlasBtn, body.where #searchBtn { display: none !important; }
@media (max-height: 500px) and (min-width: 560px) {
  #where { left: calc(var(--gut) + env(safe-area-inset-left, 0px)); transform: none; width: min(320px, 48%); bottom: calc(var(--hud-bottom) + 4px); animation-name: fade; padding: 10px 14px; gap: 5px; }
  #where .target { font-size: 20px; }
}

/* ---------- introduction (ui/coach.js) ---------- */
#coach { position: fixed; z-index: 7; left: 50%; transform: translateX(-50%); top: calc(var(--hud-top) + 8px); width: min(420px, calc(100% - 24px));
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: center; padding: 12px 14px 8px;
  background: var(--glass-hi); border: 1px solid rgba(242, 194, 111, .35); border-radius: var(--r-xl);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .45); animation: rise-c var(--dur-calm) var(--ease-out); }
#coach .cicon { grid-row: span 2; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
#coach .cicon svg { width: 26px; height: 26px; display: none; animation: nudge 1.6s ease-in-out infinite; }
#coach[data-step="drag"] .s-drag, #coach[data-step="zoom"] .s-zoom, #coach[data-step="tap"] .s-tap, #coach[data-step="done"] .s-done { display: block; }
#coach .ctext { font-size: 15px; line-height: 1.4; font-weight: 500; }
#coach .cfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#coach .link { min-height: 36px; padding: 0 4px; font-size: 13.5px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong, #3c4860); }   /* (the line colour on the card's own colour: the dots ahead could not be seen) */
.dots i.on { background: var(--gold); }
.dots i.now { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
body.coaching #toast { top: calc(var(--hud-top) + 16px + var(--coach-h, 96px)); }
/* the first round on a phone: the guide's card and the round's card together left a third of the screen to the sky */
@media (max-width: 560px) and (orientation: portrait) {
  #coach.beside { padding: 10px 12px; gap: 4px 10px; }
  #coach.beside .cicon { width: 34px; height: 34px; } #coach.beside .cicon svg { width: 20px; height: 20px; }
  #coach.beside .ctext { font-size: 14px; line-height: 1.35; }
  body.coaching #task .sketch { width: 50px; height: 50px; }
}
#menuBtn.glow { animation: glow 2.4s var(--ease-calm) infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(242, 194, 111, .22), 0 8px 32px rgba(242, 194, 111, .4); } }
@keyframes nudge { 50% { transform: translate(2px, -2px); } }

/* ---------- toast, contemplation, loading, night mode ---------- */
#toast { position: fixed; z-index: 11; left: 50%; top: calc(var(--hud-top) + 8px); transform: translate(-50%, -6px);
  background: var(--glass-hi); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 10px 18px; font-size: var(--t-ui); line-height: 1.4; text-align: center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .4); opacity: 0; transition: opacity var(--dur-quick) var(--ease-in), transform var(--dur-quick) var(--ease-in); pointer-events: none; width: max-content; max-width: min(480px, calc(100% - 24px)); }
#toast.show { pointer-events: auto; opacity: 1; transform: translate(-50%, 0); transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
#toast.tap { cursor: pointer; }
#toast .tacts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
#toast .tact { min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--fill-hi); border: 1px solid var(--border-strong); color: var(--ink); font: 600 13.5px/1 var(--f-ui); }
#toast .tact:hover { border-color: var(--gold); color: var(--gold); }   /* (its own name: as "more" it took the atlas's "more" button's gold, margin and height) */
#toast b { font-family: var(--f-sky); font-style: italic; font-size: 18px; color: var(--gold); font-weight: 600; }
body.in-menu #toast { top: calc(env(safe-area-inset-top, 0px) + 16px); }
#zenHint { position: fixed; z-index: 8; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 24px); transform: translateX(-50%); text-align: center; width: max-content; max-width: calc(100% - 32px);
  font-family: var(--f-sky); font-style: italic; font-size: 16px; color: var(--ink-dim); opacity: 0; transition: opacity 1.5s ease; pointer-events: none; }
#zenHint.show { opacity: .85; }
/* leaving contemplation, its words go at once: they lay across the clock coming back for a moment */
#zenHint:not(.show) { transition-duration: var(--dur-instant); }
#zenCtl { position: fixed; z-index: 9; right: var(--gut-r); bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); display: flex; gap: 2px; padding: 3px;
  opacity: 0; pointer-events: none; transition: opacity 1.2s ease; }
#zenCtl button { font-size: 13px; }
body.zen #zenCtl { opacity: .45; pointer-events: auto; }
body.zen #zenCtl:hover, body.zen #zenCtl:focus-within { opacity: 1; }
#sleepVeil { position: fixed; inset: 0; z-index: 8; background: #000; opacity: 0; pointer-events: none; transition: opacity .5s ease; }
body.sleep #sleepVeil { opacity: .94; transition-duration: 25s; }   /* falls asleep slowly, wakes at once */
/* asleep, its buttons go dark with the rest (they stayed lit over the black veil all night); a tap anywhere wakes */
body.sleep #zenCtl, body.sleep #zenCtl:hover, body.sleep #zenCtl:focus-within { opacity: 0; pointer-events: none; transition: opacity 6s ease; }
/* contemplation passes over the day: the sky fades to black, the clock moves to the evening, the sky returns (zen/zen.js) */
#gl { transition: opacity 1.6s ease; }
body.booting #gl { opacity: 0; transition: none; }
body.zen-dip #gl { opacity: 0; transition-duration: 1.1s; }
body.zen-leave #gl, body.zen-leave #ov { opacity: 0; transition: opacity .4s ease; }   /* leaving contemplation: the sky's time comes back unseen */
#ov { transition: opacity 1.2s ease; }
#zenHint small { display: block; margin-top: 4px; font-size: .82em; opacity: .75; }
#loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; font-family: var(--f-sky); font-style: italic; font-size: 17px; color: var(--ink-dim); z-index: 20;
  background: radial-gradient(120% 55% at 50% 108%, rgba(44, 86, 140, .5), transparent 70%), linear-gradient(#04060c 0%, #060a1a 55%, #0b1634 100%); transition: opacity .45s ease; }
#loading.gone { opacity: 0; pointer-events: none; }
/* The loading screen is alive: the Big Dipper of the icon draws itself, each star lighting as the line reaches it,
   then they twinkle; the stars behind breathe; a meteor passes now and then. (It was a line of words on a flat night.) */
.lfig { width: min(250px, 64vw); height: auto; margin-bottom: 6px; overflow: visible; stroke: none; filter: drop-shadow(0 0 6px rgba(242, 194, 111, .5)); }
.lpath { fill: none; stroke: var(--gold); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; opacity: .9; stroke-dasharray: 1; stroke-dashoffset: 1; animation: l-draw 2.6s cubic-bezier(.45, 0, .3, 1) .4s forwards; }
.lstar { fill: #fff6e2; opacity: 0; transform-box: fill-box; transform-origin: center; animation: l-pop .7s ease-out var(--d) forwards, l-twinkle 2.8s ease-in-out calc(var(--d) + 2.6s) infinite; }
.ltitle { font: italic 600 clamp(34px, 10vw, 44px)/1.1 var(--f-sky); color: #fbf3df; text-shadow: 0 0 24px rgba(242, 194, 111, .25); animation: rise 1s ease .5s both; }
#lLine { animation: rise 1s ease 1s both; }
#loading > .lmeteor { position: absolute; left: 6%; top: 15%; width: 120px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, rgba(255, 244, 226, .95)); opacity: 0; animation: l-meteor 7s ease-in 2.4s infinite; }
@keyframes l-draw { to { stroke-dashoffset: 0; } }
@keyframes l-pop { from { opacity: 0; transform: scale(.2); } 60% { opacity: 1; transform: scale(1.6); } to { opacity: 1; transform: scale(1); } }
@keyframes l-twinkle { 50% { opacity: .5; transform: scale(.8); } }
@keyframes l-sky { 50% { opacity: .4; } }
@keyframes l-meteor { 0% { opacity: 0; transform: rotate(24deg) translateX(-140px); } 3% { opacity: 1; } 11%, 100% { opacity: 0; transform: rotate(24deg) translateX(52vw); } }
#loading:not([data-failed]) #reloadBtn { display: none; }
/* "Lighting the stars…": two handfuls of them come out behind the words while the files arrive (a phone's connection
   takes 3 to 7 seconds; the line stood alone on a flat night) */
#loading > * { position: relative; }
#loading::before, #loading::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; animation: light-up 1.8s ease-out .3s forwards, l-sky 5s ease-in-out 2.4s infinite; }
#loading::before { background-image:
  radial-gradient(circle at 14% 21%, #e9eeff 0 1.2px, transparent 1.9px), radial-gradient(circle at 78% 14%, #fff3dc 0 1.5px, transparent 2.3px),
  radial-gradient(circle at 31% 67%, #dfe8ff 0 1px, transparent 1.6px), radial-gradient(circle at 88% 58%, #e9eeff 0 1.1px, transparent 1.8px),
  radial-gradient(circle at 56% 31%, #ffe9d2 0 1px, transparent 1.6px), radial-gradient(circle at 8% 82%, #e9eeff 0 1.3px, transparent 2px),
  radial-gradient(circle at 66% 86%, #dfe8ff 0 1px, transparent 1.6px); }
#loading::after { animation-delay: 1.3s, 3.6s; animation-duration: 1.8s, 6.5s; background-image:
  radial-gradient(circle at 23% 38%, #dfe8ff 0 .9px, transparent 1.5px), radial-gradient(circle at 91% 31%, #e9eeff 0 1px, transparent 1.6px),
  radial-gradient(circle at 44% 12%, #e9eeff 0 1.1px, transparent 1.7px), radial-gradient(circle at 71% 71%, #fff3dc 0 1.2px, transparent 1.9px),
  radial-gradient(circle at 17% 55%, #e9eeff 0 .9px, transparent 1.5px), radial-gradient(circle at 49% 92%, #dfe8ff 0 1px, transparent 1.6px),
  radial-gradient(circle at 96% 84%, #ffe9d2 0 .9px, transparent 1.5px), radial-gradient(circle at 36% 5%, #e9eeff 0 .9px, transparent 1.5px); }
@keyframes light-up { to { opacity: .85; } }
#reloadBtn { font: 400 24px/1 var(--f-ui); border: 1px solid var(--line); border-radius: 999px; color: var(--ink); }
/* night mode (ui/night.js): keep only the red channel, then dim it all; small text grows and thickens,
   because dim red is hard to read (acuity in dim red light is low) */
#redLayer { position: fixed; inset: 0; z-index: 30; background: #ff0000; mix-blend-mode: multiply; pointer-events: none; }
#nightVeil { position: fixed; inset: 0; z-index: 31; background: #000; pointer-events: none; transition: opacity .2s; }
body.night { --ink-dim: #c8cedb; --line: rgba(220, 225, 240, 0.28); }
body.night .hint, body.night small, body.night .mm, body.night .tlabel, body.night #task .note { font-size: 14.5px; font-weight: 500; }
body.night button, body.night select, body.night .item { font-weight: 600; }
body.night .cap, body.night .panel h3, body.night #task .label { font-size: 12.5px; }
body.night .primary, body.night .primary:hover, body.night .primary:active { background: #7a6034; color: #fff6e6; box-shadow: none; }   /* the main button must not be the brightest thing at night */
body.night #menuBtn.glow { animation: none; }
/* under the red layer gold on dark and white on dark are one colour: what is chosen gets a ring (a switch shows it
   by itself) */
body.night button[aria-pressed="true"]:not(.tg) { box-shadow: inset 0 0 0 2px currentColor; }

/* a sheet that is closing: already [hidden] for the logic, still drawn while it leaves, never clickable */
.panel[hidden].leaving, .pop[hidden].leaving { display: flex !important; pointer-events: none; animation: slide-out var(--dur-base) var(--ease-in) forwards; }
.pop[hidden].leaving { display: grid !important; animation-name: pop-out; animation-duration: var(--dur-quick); }
#menu[hidden].leaving { display: grid !important; pointer-events: none; animation: fade-out var(--dur-calm) var(--ease-in) forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
@keyframes pop-out { to { opacity: 0; transform: scale(.97) translateY(-4px); } }
@keyframes slide-out { from { transform: none; } to { opacity: 0; transform: translateX(16px); } }
@keyframes sheet-out { from { transform: translateY(var(--drag-y, 0px)); } to { transform: translateY(100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
#task { animation-name: rise-c; }
@keyframes rise-c { from { opacity: 0; transform: translate(-50%, 6px); } }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ---------- smaller screens ---------- */
@media (max-width: 720px) {
  /* on phones a panel covers most of the screen: a solid background instead of a costly blur of the moving sky */
  .panel { -webkit-backdrop-filter: none; backdrop-filter: none; background: #0d1222; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: min(88%, calc(100% - env(safe-area-inset-top, 0px) - 24px));
    border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: 0; animation: sheet-up var(--dur-sheet) var(--ease-sheet);
    padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .panel[hidden].leaving { animation: sheet-out 380ms var(--ease-sheet) forwards; }
  .panel .phead::before { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--border-strong); }
  .phead { position: relative; padding-top: 14px; touch-action: none; cursor: grab; }   /* drag the header down to close (ui/sheetMotion.js) */
  .panel.dragging { animation: none; transition: none; }
  /* the sky behind a sheet steps back */
  body::after { content: ""; position: fixed; inset: 0; z-index: 8; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur-sheet) var(--ease-sheet); }
  body.in-panel::after { opacity: 1; }   /* (any panel: ui/sheets.js; a list here missed the city search) */
  #scrim { background: none; }   /* (the sky is dimmed by the line above already) */
  /* the atlas over the living sky: a fixed height, so it can glide between full and half (ui/journal.js setPeek) */
  #atlas { height: min(88%, calc(100% - env(safe-area-inset-top, 0px) - 24px)); transition: height var(--dur-sheet) var(--ease-sheet); }
  #atlas.peek { height: 44%; }
  @media (max-height: 500px) { #atlas.peek { height: 62%; } }
  body.in-atlas.atlas-peek::after { opacity: 0; }
}
@media (max-width: 560px) {
  /* phones: a short label under each icon, so every button says what it does */
  .view > button, #atlasBtn { flex-direction: column; gap: 2px; min-height: 50px; padding: 4px 8px; font-size: 10.5px; font-weight: 600; line-height: 1.1; white-space: nowrap; }
  .view > button svg, #atlasBtn svg { width: 20px; height: 20px; }
  #atlasBtn { border-radius: 14px; }
  #atlasBtn.dot::after { top: 5px; right: 8px; }
  .hud.bottom { grid-template-columns: auto minmax(0, 1fr) auto; }
  .hud.bottom #play { padding: 0 14px; min-height: 50px; justify-self: center; max-width: 100%; }
}
/* the smallest phones (320–360 px): no room for the magnifier beside the place and the clock (it pushed the clock off
   the screen's edge); the search stays in the atlas */
@media (max-width: 360px) { #searchBtn { display: none; } }
@media (max-width: 380px) {
  :root { --tap: 44px; }
  .trow { grid-template-columns: 1fr; gap: 0; }
  .clock { font-size: 12.5px; }
  .hud.bottom { gap: 6px; }
  .hud.bottom #play { font-size: 14px; padding: 0 12px; }
  .mitem { padding: 8px 14px; }
  .seg.wide > button { font-size: 12.5px; padding: 2px; }
}
/* low screens (a phone held sideways): a tighter card and menu so the sky stays visible */
@media (max-height: 500px) {
  .hud.top { padding-top: calc(env(safe-area-inset-top, 0px) + 8px); }
  .hud.bottom { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
  #task { padding: 10px 14px; gap: 5px; }
  #task .target { font-size: 21px; }
  #task .note { font-size: 12.5px; line-height: 1.35; }
  /* (two columns for a phone held sideways; a desktop's window made low keeps its one column: the menu turned into
     two columns at 500 px of height as the window was dragged) */
  @media (pointer: coarse) {
    .mwrap { width: min(620px, 100%); grid-template-columns: 1fr 1fr; align-items: center; gap: 12px 24px; }
    .mwrap .logo, .mwrap .place { grid-column: 1; }
    .mwrap .mlist { grid-column: 2; grid-row: 1 / span 3; }
    .mwrap .link { grid-column: 1; }
  }
  .mitem { min-height: 46px; }
  .big { min-height: 44px; }
  .panel { max-height: calc(100% - 8px); }
  /* the menu's rows closer, so the last one is not cut */
  #menu { padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .mlist { gap: 4px; }
  .mitem { min-height: 38px; padding: 2px 14px; }
  .mlist > .mtile { min-height: 44px; padding: 4px 12px; }
  .mitem .mm { font-size: 11px; }
  #mToday { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }   /* (one line: it is the reason to play today, and it was hidden on a phone on its side) */
  .pop { max-height: calc(100% - var(--hud-top) - 14px); overflow-y: auto; }
}
/* a low screen that is also wide (a phone on its side; not a narrow window in a split screen): the round card in the
   left corner, small, the sky to search is the rest of the screen (it stood in the middle); messages to the right */
@media (max-height: 500px) and (min-width: 560px) {
  #task { left: calc(var(--gut) + env(safe-area-inset-left, 0px)); transform: none; width: min(300px, 46%); bottom: calc(var(--hud-bottom) + 4px);
    /* (clear of the top row too: on the lowest screens, 320 px, a tall card lay over the menu's buttons) */
    max-height: calc(100% - var(--hud-top) - var(--hud-bottom) - 8px); animation-name: fade; }
  #task .sketch { width: 46px; height: 46px; }
  #toast { left: calc(50% + min(150px, 23%)); max-width: min(56%, 520px); }   /* (beside the round card, but wide enough: at 40% a star's line ran to ten lines) */
  /* the first round's guide beside the round card, not across it (it lay over the card's name and sketch) */
  #coach.beside { left: auto; right: calc(var(--gut) + env(safe-area-inset-right, 0px)); transform: none; width: min(400px, calc(100% - min(300px, 46%) - 3 * var(--gut)));
    animation-name: fade; padding: 8px 12px 4px; }
  #coach.beside .ctext { font-size: 13.5px; line-height: 1.35; }
}
/* a wide low screen (most phones held sideways are wider than 720 px): a sheet is a column down the right side, the
   full height of the screen. (It was the desktop's panel, squeezed between the top and bottom buttons: a strip 130 px
   high with the "Play" button lying across its edge.) */
@media (max-height: 500px) and (min-width: 721px) {
  .panel { top: calc(6px + env(safe-area-inset-top, 0px)); bottom: calc(6px + env(safe-area-inset-bottom, 0px)); right: calc(6px + env(safe-area-inset-right, 0px));
    width: min(400px, 54%); max-height: none; -webkit-backdrop-filter: none; backdrop-filter: none; background: #0d1222; }
}
/* reduced motion: things fade instead of moving; nothing slides, scales or pulses */
@media (prefers-reduced-motion: reduce) {
  /* (only what was animated becomes a fade: every element, re-drawn rows and pseudo-elements too, faded in) */
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .panel, .pop, #menu, #task, #where, #toast, .mitem, .rrow { animation-name: fade !important; animation-duration: var(--dur-quick) !important; }
  #toast, .panel, .pop, #menu { transition-property: opacity !important; transition-duration: var(--dur-quick) !important; }
  .panel[hidden].leaving, .pop[hidden].leaving, #menu[hidden].leaving { animation-name: fade-out !important; }
  #toast, #toast.show { transform: translate(-50%, 0); }
  .mfig .skl, .dfig .skl { stroke-dashoffset: 0; } .spark { opacity: .7; }
  .lpath { stroke-dashoffset: 0; } .lstar { opacity: 1; } #loading::before, #loading::after { opacity: .85; } #loading > .lmeteor { display: none; }
  button:active, .ibtn:active, .pill:active, .chip:active, .seg > button:active, .place:active, .primary:active, .mitem:active { transform: none; }
}

/* "Крупный текст" (Settings): every type token a size up; the sky's labels grow in render/overlay.js */
body.large { --t-cap: 13.5px; --t-sm: 15.5px; --t-ui: 17px; --t-body: 18.5px; }
body.large .chip { font-size: 15px; }
/* (and the small fixed sizes: "Large text" left the bottom bar's labels, the tags and the scores at 10.5 to 12.5 px) */
body.large .view > button, body.large #atlasBtn, body.large .mtag, body.large .chip .score { font-size: 12.5px; }
body.large .world .wstate, body.large .rgain, body.large #mToday, body.large .wday { font-size: 13.5px; }
body.large .gtile .gm, body.large .tlabel, body.large .mitem .mm, body.large .pop .seg > button, body.large #task .note { font-size: 14.5px; }
body.large .clock { font-size: 16px; }
body.large #toast b { font-size: 20px; }
/* time and place held during a game's round (ui/timeControls.js holdTimeAndPlace) */
.pop.locked [inert] { opacity: .4; }
.lockNote { margin: 2px 0 10px; color: var(--gold); }
#timePlace { width: 100%; margin: 4px 0 10px; border-radius: var(--r-md); background: var(--fill); }
#timePlace small { display: block; color: var(--ink-dim); font-size: var(--t-sm); }
#aCultureBtn { margin: 0 0 12px; }

/* Fingers need 44 px (WCAG 2.5.5, Apple HIG): small controls keep their look and get a taller hit area on touch.
   (At the end of the sheet, and as an area of their own: written above as a min-height, every rule below with a
   height of its own undid it, and the chips and the round's cross stayed 34 to 36 px. The segments keep their
   38 px: their frame clips anything laid beyond it.) */
@media (pointer: coarse) {
  .seg > button { min-height: 44px; }   /* (38 px: the one control on touch below the rest) */
  .chip, .nowchip, .link, .more, #task #stop, #coach .link { position: relative; }
  .chip::after, .nowchip::after, .link::after, .more::after, #task #stop::after, #coach .link::after {
    content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; min-width: 44px; transform: translateY(-50%); }
  #task #stop::after { left: 50%; right: auto; width: 44px; transform: translate(-50%, -50%); }
  /* (an iPhone zooms the page in when a field with letters under 16 px takes the focus, and does not zoom back; the
     page allows no pinch, so the HUD stayed cropped until a reload) */
  #aSearch, .field { font-size: max(16px, var(--t-ui)); } #codeBox textarea { font-size: 16px; }   /* ("Large text" is 17 px: not made smaller) */
}
/* Colours forced by the system (Windows contrast themes) drop every background: what is chosen and what is a button
   were told by the background alone. */
@media (forced-colors: active) {
  button, select, .field { border: 1px solid ButtonText; }
  button[aria-pressed="true"], button[aria-expanded="true"], [aria-selected="true"], [aria-current="true"] { outline: 2px solid Highlight; outline-offset: -3px; }
  button:disabled { opacity: 1; color: GrayText; border-color: GrayText; }
}

/* Settings → Reminders: the hour beside its button */
.remindRow { display: flex; gap: 8px; align-items: center; margin-top: 8px; } .remindRow select { flex: 0 0 auto; width: auto; min-width: 96px; }
/* a game's five rounds on the round card (ui/taskPanel.js): lit by the stars each won */
.gdots { display: inline-flex; gap: 4px; align-items: center; margin-left: 2px; }
.gdots[hidden] { display: none; }
.gdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.gdots i.now { background: transparent; box-shadow: 0 0 0 1.5px var(--gold); }
.gdots i.s0 { background: var(--border-strong); } .gdots i.s1 { background: color-mix(in srgb, var(--gold) 45%, transparent); }
.gdots i.s2 { background: color-mix(in srgb, var(--gold) 72%, transparent); } .gdots i.s3 { background: var(--gold); box-shadow: 0 0 6px var(--gold-soft); }

/* under any panel the "Play" button is not offered: the atlas is a place of its own to read and look (it stood under
   the atlas as under the menu, on a desktop beside the panel); the panel's own buttons lead on */
body.in-panel .hud.bottom #play { visibility: hidden; }
