/* ==========================================================================
   SatPass Tracker
   An observation console: dark night-sky ground, amber for sunlit geometry,
   slate blue for eclipse, and monospaced figures wherever numbers must align.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #EFF2F7;
  --bg-grad: radial-gradient(120% 80% at 50% 0%, #FFFFFF 0%, #EFF2F7 55%);
  --surface: #FFFFFF;
  --surface-2: #F5F7FB;
  --surface-3: #E9EDF5;
  --ink: #121926;
  --ink-strong: #060B14;
  --muted: #5A6577;
  --faint: #8A94A6;
  --line: #D6DCE7;
  --line-strong: #BFC8D8;

  --accent: #9A6A0C;          /* sunlit / glint */
  --accent-bright: #C98A18;
  --accent-wash: #FBF0D9;
  --cool: #3B5C8C;            /* eclipse / shadow */
  --cool-wash: #E4EAF4;
  --good: #1E7A56;
  --good-wash: #DDF0E8;
  --warn: #9A5312;
  --warn-wash: #FBEADA;
  --danger: #A32D28;

  --track-lit: #C98A18;
  --track-shadow: #6E80A0;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .18);

  --font-display: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "IBM Plex Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --gutter: clamp(1rem, 3vw, 2rem);
  --topbar-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #080B12;
    --bg-grad: radial-gradient(130% 90% at 50% -10%, #131B2B 0%, #080B12 60%);
    --surface: #10161F;
    --surface-2: #161E2B;
    --surface-3: #1D2735;
    --ink: #E6EBF4;
    --ink-strong: #FFFFFF;
    --muted: #8E9BB0;
    --faint: #67748A;
    --line: #232D3D;
    --line-strong: #334054;

    --accent: #F0B44A;
    --accent-bright: #FFC968;
    --accent-wash: #2C2211;
    --cool: #7FA0CE;
    --cool-wash: #17202E;
    --good: #52BE95;
    --good-wash: #12241D;
    --warn: #E0954C;
    --warn-wash: #291D10;
    --danger: #E5716B;

    --track-lit: #FFC968;
    --track-shadow: #55688A;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #080B12;
  --bg-grad: radial-gradient(130% 90% at 50% -10%, #131B2B 0%, #080B12 60%);
  --surface: #10161F;
  --surface-2: #161E2B;
  --surface-3: #1D2735;
  --ink: #E6EBF4;
  --ink-strong: #FFFFFF;
  --muted: #8E9BB0;
  --faint: #67748A;
  --line: #232D3D;
  --line-strong: #334054;

  --accent: #F0B44A;
  --accent-bright: #FFC968;
  --accent-wash: #2C2211;
  --cool: #7FA0CE;
  --cool-wash: #17202E;
  --good: #52BE95;
  --good-wash: #12241D;
  --warn: #E0954C;
  --warn-wash: #291D10;
  --danger: #E5716B;

  --track-lit: #FFC968;
  --track-shadow: #55688A;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink-strong);
  text-wrap: balance;
  line-height: 1.3;
  margin: 0;
}

a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a:hover { text-decoration-color: currentColor; }

:where(button, input, select, textarea, a):focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* Browsers give figure a 40px side margin by default, which quietly stole a
   fifth of every chart's width. */
figure { margin: 0; }
figcaption { margin: 0; }

/* Any class that sets `display` outranks the browser's own [hidden] rule, so
   the attribute silently stops working - which is how the display-name field
   ended up showing on the sign-in form. Assert it once, for everything. */
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1320px; margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 1.25rem;
}

.brand {
  display: flex; align-items: center; gap: .6rem;
  color: var(--ink-strong); text-decoration: none;
  font-family: var(--font-display); font-weight: 900;
  font-size: 1.22rem; letter-spacing: .01em; white-space: nowrap;
}
.brand-mark { width: 32px; height: 32px; color: var(--accent); flex: none; }
.brand-thin { font-weight: 500; color: var(--muted); margin-left: .3em; }

.topnav { display: flex; gap: .15rem; margin-left: .5rem; overflow-x: auto; }
.topnav a {
  padding: .4rem .7rem; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 500;
  white-space: nowrap;
}
.topnav a:hover { color: var(--ink); background: var(--surface-2); }
.topnav a[aria-current="page"] {
  color: var(--ink-strong); background: var(--surface-3);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex: none; }
/* The nav scrolls sideways when the bar is tight; the actions (and the
   account button's label) never shrink or wrap. */
.topnav { min-width: 0; flex: 1 1 auto; }
#account-btn { white-space: nowrap; flex: none; }
#nav-toggle { display: none; }   /* id outranks .icon-btn's display:grid */

.icon-btn, .ghost-btn, .primary-btn, .link-btn {
  font-family: inherit; cursor: pointer; border-radius: var(--radius-sm);
  transition: background-color .15s, border-color .15s, color .15s;
}
.icon-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  width: 32px; height: 32px; display: grid; place-items: center;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }

.ghost-btn {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  padding: .38rem .8rem; font-size: .85rem; font-weight: 500;
}
.ghost-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }

.primary-btn {
  border: 1px solid transparent; background: var(--accent); color: #16110A;
  padding: .42rem .95rem; font-size: .88rem; font-weight: 600;
}
:root[data-theme="dark"] .primary-btn { color: #1A1204; }
.primary-btn:hover { background: var(--accent-bright); }
.primary-btn:disabled, .ghost-btn:disabled { opacity: .5; cursor: not-allowed; }

.link-btn {
  border: none; background: none; color: var(--accent);
  font-size: .85rem; padding: .3rem 0; text-decoration: underline;
  text-underline-offset: 3px;
}

/* Context bar --------------------------------------------------------------- */

.context-bar {
  max-width: 1320px; margin: 0 auto;
  padding: .45rem var(--gutter) .55rem;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.context-chip {
  display: flex; align-items: baseline; gap: .5rem;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 999px; padding: .22rem .8rem;
  font-family: inherit; font-size: .82rem; color: var(--ink); cursor: pointer;
}
.context-chip:hover { border-color: var(--accent); }
.chip-label { color: var(--faint); font-size: .72rem; letter-spacing: .04em; }
.chip-value { font-family: var(--font-mono); font-weight: 500; }
.context-spacer { flex: 1; }
.context-note { color: var(--faint); font-size: .76rem; font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.main {
  flex: 1;
  max-width: 1320px; width: 100%; margin: 0 auto;
  padding: 1.6rem var(--gutter) 3rem;
}

.page-head { margin-bottom: 1.4rem; }
.eyebrow {
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: .2rem;
}
.page-head h1 { font-size: clamp(1.45rem, 3.5vw, 1.95rem); font-weight: 900; }
/* 62ch holds only ~31 CJK characters, which broke Japanese one-line ledes
   into an awkward short second line. 56em fits a full Japanese sentence;
   text-wrap: balance evens out anything that still wraps. */
.page-head p { color: var(--muted); margin: .35rem 0 0; max-width: 56em; text-wrap: balance; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .85rem 1.1rem; border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 1rem; font-weight: 700; }
.card-head .spacer { flex: 1; }
.card-body { padding: 1.1rem; }
.card-body.tight { padding: .5rem; }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) {
  .grid-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}

.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field-grid {
  display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
/* Fixed two-across variant: paired fields stay side by side at every width,
   with .field-wide rows (name, timezone) spanning the full line. */
.field-grid-pair { grid-template-columns: 1fr 1fr; }
.field-label {
  font-size: .74rem; letter-spacing: .05em; color: var(--muted);
  font-weight: 600; text-transform: uppercase;
}

input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="date"], input[type="time"],
input[type="search"], textarea, select {
  font-family: var(--font-mono); font-size: .9rem;
  padding: .45rem .6rem;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  width: 100%; min-width: 0;
}
input[type="search"] { -webkit-appearance: none; appearance: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select { font-family: var(--font-body); }
/* iOS Safari zooms the whole page onto any focused field whose text is
   under 16px - on the fullscreen map that reads as the screen suddenly
   magnifying. Touch devices get 16px fields on the map stage. */
@media (hover: none) and (pointer: coarse) {
  .map-stage input, .map-stage select { font-size: 16px; }
}

.checkbox {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .85rem; color: var(--ink); cursor: pointer;
}
.checkbox input { width: auto; accent-color: var(--accent); }

.form-error {
  color: var(--danger); font-size: .85rem; margin: .6rem 0 0;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

/* --------------------------------------------------------------------------
   Pass list
   -------------------------------------------------------------------------- */

.pass-list { display: flex; flex-direction: column; }

.pass-row {
  display: grid; align-items: center; gap: .9rem;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  padding: .75rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.pass-row:last-child { border-bottom: none; }
.pass-row:hover { background: var(--surface-2); }
.pass-row[aria-current="true"] {
  background: var(--accent-wash);
  box-shadow: inset 3px 0 0 var(--accent);
}

.pass-date {
  text-align: center; font-family: var(--font-mono); line-height: 1.25;
}
.pass-date .dow { font-size: .68rem; color: var(--faint); letter-spacing: .08em; }
.pass-date .dm { font-size: 1.02rem; font-weight: 600; color: var(--ink-strong); }

.pass-main { min-width: 0; }
.pass-times {
  display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.pass-times .t-main { font-size: 1.02rem; font-weight: 600; color: var(--ink-strong); }
.pass-times .t-sep { color: var(--faint); }
.pass-times .t-dur { color: var(--muted); font-size: .8rem; }
.pass-meta {
  display: flex; gap: .5rem 1rem; flex-wrap: wrap;
  font-size: .8rem; color: var(--muted); margin-top: .1rem;
}
.pass-meta b { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }

.pass-side { display: flex; align-items: center; gap: .8rem; }

.mag-badge {
  font-family: var(--font-mono); font-weight: 600; font-size: .95rem;
  padding: .12rem .5rem; border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--ink-strong);
  border: 1px solid var(--line);
}
.mag-badge.bright { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .03em;
  padding: .1rem .55rem; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.pill.sunlit  { background: var(--accent-wash); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.pill.umbra   { background: var(--cool-wash);   color: var(--cool);   border-color: color-mix(in srgb, var(--cool) 40%, transparent); }
.pill.penumbra{ background: var(--warn-wash);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.visible { background: var(--good-wash);   color: var(--good);   border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.pill.daylight{ background: var(--surface-3);   color: var(--muted);  border-color: var(--line); }

.spark { width: 56px; height: 30px; flex: none; }

/* --------------------------------------------------------------------------
   Charts
   -------------------------------------------------------------------------- */

/* The sky chart carries the stars and the whole pass geometry at once, so it
   gets a row of its own rather than competing for width with the plots. */
.chart-layout { display: flex; flex-direction: column; gap: 1.1rem; }

.chart-card.hero { display: flex; flex-direction: column; align-items: center; }
.chart-card.hero > * { width: 100%; max-width: 780px; }
.chart-card.hero svg { max-width: 780px; margin: 0 auto; }

/* Two columns on a desktop width: four plots then land as a tidy 2x2 and each
   gets roughly half the page instead of a third. */
.chart-grid {
  display: grid; gap: .7rem; align-items: start;
  /* min() keeps the track from forcing a column wider than the screen, which
     would otherwise make the whole page scroll sideways on a phone. */
  grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
}
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; }
.avail-btn { min-width: 2.4rem; text-align: center; font-family: var(--font-mono); }
.avail-line { font-size: .76rem; line-height: 1.5; white-space: normal; }
.avail-line.yes  { color: var(--good); }
.avail-line.no   { color: var(--danger); }
.avail-line.none { color: var(--faint); }

.suggest-list {
  position: absolute; left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  max-height: 260px; overflow-y: auto;
}
.suggest-list:empty { display: none; }
.suggest-item {
  display: flex; gap: .6rem; align-items: baseline; width: 100%;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: .45rem .6rem; font-size: .85rem;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: var(--surface-2); }
.suggest-item .coords {
  margin-left: auto; font-family: var(--font-mono); font-size: .74rem;
  color: var(--muted); white-space: nowrap;
}
.avail-btn.yes { color: var(--good); border-color: var(--good); }
.avail-btn.no  { color: var(--danger); border-color: var(--danger); }

.png-btn {
  font-family: var(--font-mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .06em; padding: .45rem .55rem; flex: none;
}

/* --------------------------------------------------------------------------
   Guided tours
   -------------------------------------------------------------------------- */

.tour-module-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--ink); text-decoration: none;
}
a.tour-module-row:hover { border-color: var(--line-strong); }
.tour-module-row.is-off { opacity: .55; }
.tour-module-title { font-weight: 600; flex: 1 1 auto; min-width: 0; }
.tour-progress {
  flex: 0 0 8rem; height: 6px; border-radius: 3px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}
.tour-progress-fill {
  display: block; height: 100%; border-radius: 3px;
  background: var(--accent);
}
.tour-class-row {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .3rem 0; font-size: .88rem;
}

/* The player: one slide at a time, a dot rail below. */
.tour-stage {
  padding: 1.4rem 1.6rem .6rem; min-height: 22rem;
}
.tour-slide-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 .8rem; }
.tour-figure { text-align: center; margin: .4rem 0 .9rem; }
.tour-figure img { max-width: min(100%, 620px); height: auto; }
.tour-body { max-width: 46rem; line-height: 1.85; }
.tour-body p { margin: 0 0 .8rem; }
.tour-body ul, .tour-body ol { margin: 0 0 .8rem; padding-left: 1.4rem; }
.tour-body li { margin: .25rem 0; }
.tour-body .math-display { display: block; text-align: center; margin: .7rem 0; }
.tour-table-wrap { overflow-x: auto; margin: .6rem 0 .9rem; }
.tour-nav {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1.1rem; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.tour-dots { display: flex; gap: .35rem; flex-wrap: wrap; }
.tour-dot {
  width: 9px; height: 9px; border-radius: 50%; padding: 0;
  border: 1px solid var(--line-strong); background: transparent; cursor: pointer;
}
.tour-dot.quiz { border-radius: 2px; }
.tour-dot.active { background: var(--accent); border-color: var(--accent); }

/* "See the real satellites" chips - a step's links out to the live catalog */
.tour-catalog {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
  margin: .2rem 0 .9rem;
}
.tour-catalog-label { font-size: .8rem; color: var(--muted); }
.tour-catalog-chip {
  display: inline-block; padding: .28rem .7rem; border-radius: 999px;
  border: 1px solid var(--line-strong); font-size: .82rem;
  text-decoration: none; color: var(--ink); background: transparent;
}
.tour-catalog-chip:hover { border-color: var(--accent); color: var(--accent); }

/* Interactive lesson scenes */
.tour-scene { margin: .3rem 0 .8rem; }
.lesson-wrap { position: relative; }
.lesson-canvas {
  display: block; width: 100%; border-radius: 12px;
  background: #0A101C; touch-action: none; cursor: grab;
}
.lesson-canvas:active { cursor: grabbing; }
.lesson-controls {
  display: flex; align-items: center; gap: .5rem 0.8rem; flex-wrap: wrap;
  margin-top: .5rem;
}
.lesson-controls .ghost-btn { padding: .3rem .6rem; font-size: .85rem; }
.lesson-readout { font-size: .8rem; color: var(--muted); }
.lesson-slider {
  display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem;
}
.lesson-slider input[type="range"] { width: 9rem; }
.lesson-slider .num { min-width: 2.6rem; text-align: right; }
.lesson-caption { margin: .4rem 0 0; }

/* Quiz blocks */
.tour-question {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .8rem 1rem; margin: .7rem 0; max-width: 46rem;
}
.tour-question.correct { border-color: color-mix(in srgb, var(--good) 60%, transparent); }
.tour-question.wrong { border-color: color-mix(in srgb, #E8975A 60%, transparent); }
.tour-question-prompt { margin-bottom: .5rem; line-height: 1.7; }
.tour-choice {
  display: flex; gap: .5rem; align-items: flex-start;
  padding: .3rem 0; cursor: pointer;
}
.tour-choice input { margin-top: .3rem; accent-color: var(--accent); }
.tour-choice-text p { margin: 0; }
.tour-feedback { margin-top: .5rem; }
.tour-explain { margin-top: .4rem; font-size: .9rem; color: var(--muted); line-height: 1.7; }
.tour-quiz-intro { color: var(--muted); }
@media (max-width: 640px) {
  .tour-stage { padding: 1rem .9rem .4rem; }
  .tour-progress { flex-basis: 4.5rem; }
}

/* Phone-only disclosure: the display toolbars fold behind one 表示設定
   button, so the sky or the globe keeps the screen. */
.controls-disclosure {
  display: none; align-items: center; gap: .4rem;
  font-size: .8rem; align-self: flex-start; margin-bottom: .4rem;
}
@media (max-width: 640px) {
  .controls-disclosure { display: inline-flex; }
  .skyview-toggles:not(.open),
  .map-toolbar-main:not(.open) { display: none !important; }
}

/* View-opening buttons: the label folds away on a phone and the button
   becomes a square mark, like the share/fullscreen icons. */
.icon-collapse svg { flex: none; }
@media (max-width: 520px) {
  .icon-collapse .btn-label { display: none; }
  .ghost-btn.icon-collapse {
    width: 2rem; height: 2rem; padding: 0; justify-content: center;
  }
  .globe-roster-view.icon-collapse {
    width: 1.5rem; height: 1.5rem; padding: 0; justify-content: center;
  }
}
.chart-card h3 {
  font-size: .78rem; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .35rem;
}
.chart-card svg { display: block; width: 100%; height: auto; }
/* The chart-sizing rule above must not reach the icons inside the header
   buttons (PNG, open-in-planetarium): they keep their own attribute size. */
.chart-card .ghost-btn svg, .chart-card .link-btn svg {
  display: inline; width: auto; height: auto; max-width: none; margin: 0;
}
.chart-note { font-size: .76rem; color: var(--faint); margin: .4rem 0 0; line-height: 1.5; }

.chart-legend { display: flex; gap: .35rem .9rem; flex-wrap: wrap; font-size: .75rem; color: var(--muted); margin-top: .4rem; }
@media (max-width: 480px) {
  /* Five bands on a phone: tighter gaps keep the set on one line rather
     than stranding the last entry alone below. */
  .chart-legend { gap: .3rem .55rem; font-size: .72rem; }
}
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* SVG primitives */
.axis      { stroke: var(--line-strong); fill: none; stroke-width: 1; }
.gridline  { stroke: var(--line); fill: none; stroke-width: 1; }
.gridline.dashed { stroke-dasharray: 2 4; }
.axis-text { fill: var(--faint); font-family: var(--font-mono); font-size: 10px; }
.axis-title{ fill: var(--muted); font-family: var(--font-body); font-size: 11px; }
.track-lit    { stroke: var(--track-lit); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.track-shadow { stroke: var(--track-shadow); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 5 4; }
.marker-start { fill: var(--good); }
.marker-end   { fill: var(--danger); }
.marker-peak  { fill: var(--accent); }
.marker-text  { fill: var(--muted); font-family: var(--font-mono); font-size: 9.5px; }
/* Globe. The Earth keeps a night-sky palette in both themes: a pale ocean
   would bleach out the satellite markers and the terminator. */
:root {
  --globe-ocean: #0D1729;
  --globe-land: #22355A;
  --globe-land-edge: #35507E;
  --globe-graticule: #1C2B49;
  --globe-limb: #3A5182;
  --globe-night: rgba(2, 5, 14, .55);
  --globe-label: #C9D6EE;
}

/* Globe hero: the sphere on one side, a live readout on the other, so the
   card fills a desktop width instead of stranding a circle in whitespace. */
.globe-hero {
  display: grid; gap: 1.4rem; align-items: center;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 860px) {
  .globe-hero { grid-template-columns: minmax(320px, 520px) minmax(0, 1fr); }
}

.globe-wrap { position: relative; display: flex; justify-content: center; }
.globe-canvas {
  width: 100%; max-width: 520px; aspect-ratio: 1 / 1;
  display: block; cursor: grab; touch-action: none;
}

/* Rows keep a readable width and the list scrolls sideways when its
   column runs narrow (phones, embeds, mid-width windows) - names must
   never be crushed to nothing. The right-edge shadow hints at the
   overflow and slides away once fully scrolled. */
.globe-roster {
  display: flex; flex-direction: column;
  overflow-x: auto;
  background:
    linear-gradient(270deg, var(--surface) 35%, transparent)
      right center / 1.4rem 100% no-repeat local,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .55), transparent)
      right center / 1rem 100% no-repeat scroll;
}
.globe-roster-row { min-width: 34rem; }
.globe-roster-row {
  display: grid; align-items: center; gap: .3rem .7rem;
  /* toggle | name | values | sunlit pill | view button */
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  padding: .38rem .2rem; border-bottom: 1px solid var(--line);
}
.globe-roster-row:last-child { border-bottom: none; }
.globe-roster-row:hover { background: var(--surface-2); }
/* Switched off: dimmed but still readable, so the figures stay available. */
.globe-roster-row.is-off .globe-roster-name,
.globe-roster-row.is-off .globe-roster-values { opacity: .42; }
.globe-roster-row.is-off .pill { opacity: .35; }

.globe-roster-toggle { display: flex; align-items: center; cursor: pointer; }
.globe-roster-toggle input { width: auto; accent-color: var(--accent); margin: 0; }

.globe-roster-name {
  font-weight: 600; color: var(--ink-strong); font-size: .9rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: none;
}
.globe-roster-name:hover { text-decoration: underline; }

.globe-roster-actions {
  display: flex; gap: .9rem; justify-content: flex-end; padding-top: .5rem;
}
.globe-roster-values { font-size: .8rem; color: var(--muted); }
.globe-canvas:active { cursor: grabbing; }
.globe-legend {
  display: flex; gap: .9rem; flex-wrap: wrap; justify-content: center;
  font-size: .74rem; color: var(--muted); margin-top: .5rem;
}
.globe-legend i {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
  margin-right: .3rem; vertical-align: -1px;
}

.sky-disc     { fill: color-mix(in srgb, var(--cool) 8%, transparent); stroke: var(--line-strong); }

/* The sky chart works in an 800-unit square while the cartesian plots are much
   smaller, so its strokes and type are sized here rather than sharing the
   defaults - otherwise everything on it renders roughly twice too heavy. */
.sky-chart .track-lit,
.sky-chart .track-shadow { stroke-width: 2.6; }
.sky-chart .track-shadow { stroke-dasharray: 7 6; }
.sky-chart .gridline     { stroke-width: 1; }
.sky-chart .gridline.dashed { stroke-dasharray: 3 6; }
.sky-chart .axis-text    { font-size: 11px; }
.sky-chart .cursor-dot   { r: 5; stroke-width: 2; }

.cardinal-major {
  fill: var(--muted); font-family: var(--font-body); font-size: 15px;
  font-weight: 600;
}
.cardinal-minor {
  fill: var(--faint); font-family: var(--font-body); font-size: 11px;
}

.time-tick  { stroke: var(--ink-strong); stroke-width: 1.6; opacity: .75; }
.time-label {
  fill: var(--ink-strong); font-family: var(--font-mono); font-size: 13px;
  font-weight: 600; paint-order: stroke;
  stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round;
}

/* With the star field on, the disc becomes an actual night sky in both themes:
   stars need a dark ground to read at all, so the grid and labels invert with
   it rather than following the page. */
.sky-night .sky-disc  { fill: #0A1120; stroke: #2A3550; }
.sky-night .gridline  { stroke: #1E2942; }
.sky-night .axis-text { fill: #6E7C96; }
.sky-night .cardinal-major { fill: #A9B8D4; }
.sky-night .cardinal-minor { fill: #6E7C96; }
.sky-night .constellation-line {
  stroke: #33486F; fill: none; stroke-width: 0.9; stroke-linecap: round;
}
.sky-night .star      { fill: #EAF0FC; }
.sky-night .star-name {
  fill: #8FA3C6; font-family: var(--font-mono); font-size: 10px;
  paint-order: stroke; stroke: #0A1120; stroke-width: 2.5px;
}
.sky-night .time-tick  { stroke: #FFFFFF; opacity: .85; }
.sky-night .time-label { fill: #FFFFFF; stroke: #0A1120; }
.cursor-dot   { fill: var(--ink-strong); stroke: var(--surface); stroke-width: 1.5; }
.cursor-line  { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }

/* Twilight timeline -------------------------------------------------------- */

.twilight { margin-top: .4rem; }
.twilight svg { display: block; width: 100%; height: auto; }
.tw-night  { fill: #0B1220; }
.tw-astro  { fill: #16233C; }
.tw-naut   { fill: #24375C; }
.tw-civil  { fill: #3E5A85; }
.tw-day    { fill: #86A9D6; }
:root[data-theme="dark"] .tw-day { fill: #4E7CB4; }
.tw-label  { fill: var(--faint); font-family: var(--font-mono); font-size: 9.5px; }
.tw-pass   { fill: var(--accent); }

.sun-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: .7rem; margin-top: 1rem; }
.sun-item {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .55rem .7rem; background: var(--surface-2);
  /* Uniform field height whatever the value length - ragged rows read
     as clutter. */
  min-height: 3.6rem; display: flex; flex-direction: column;
  justify-content: center; gap: .1rem;
}
@media (max-width: 480px) {
  .sun-item .v { font-size: .88rem; }
}
.sun-item .k { font-size: .72rem; color: var(--muted); letter-spacing: .03em; }
.sun-item .v { font-family: var(--font-mono); font-size: 1rem; font-weight: 600; color: var(--ink-strong); }
.sun-item .v.none { color: var(--faint); font-weight: 400; font-size: .85rem; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.data { border-collapse: collapse; width: 100%; font-size: .84rem; }
table.data th, table.data td {
  padding: .38rem .6rem; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data th {
  position: sticky; top: 0; background: var(--surface-2);
  font-size: .7rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; z-index: 1;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tr.shadowed td { color: var(--muted); }
table.data tr.shadowed td:first-child { box-shadow: inset 2px 0 0 var(--track-shadow); }

.table-scroll { max-height: 420px; overflow-y: auto; }

/* --------------------------------------------------------------------------
   Search results
   -------------------------------------------------------------------------- */

.result-list { display: flex; flex-direction: column; }
.result-row {
  display: grid; gap: .3rem 1rem; align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: .65rem 1.1rem; border-bottom: 1px solid var(--line);
  cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; font: inherit; color: inherit;
}
.result-row:last-child { border-bottom: none; }
.result-row:hover { background: var(--surface-2); }
.result-name { font-weight: 600; color: var(--ink-strong); font-size: .95rem; }
.result-name .decayed { color: var(--faint); font-weight: 400; font-size: .8rem; margin-left: .4rem; }
.result-ids {
  display: flex; gap: .8rem; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: .78rem; color: var(--muted);
}
.result-tags { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }

.tag {
  font-size: .68rem; font-weight: 600; letter-spacing: .04em;
  padding: .05rem .45rem; border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--line);
}
.tag.pay { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); background: var(--good-wash); }
.tag.deb { color: var(--faint); }

/* --------------------------------------------------------------------------
   Detail header, definition lists, misc
   -------------------------------------------------------------------------- */

.detail-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1.2rem; }
.detail-head h1 { font-size: clamp(1.4rem, 3.4vw, 1.9rem); }
.detail-ids { display: flex; gap: .9rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: .84rem; color: var(--muted); margin-top: .25rem; }

dl.spec { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem 1.2rem; margin: 0; }
dl.spec div { min-width: 0; }
dl.spec dt { font-size: .72rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
dl.spec dd { margin: .1rem 0 0; font-family: var(--font-mono); font-size: .92rem; color: var(--ink-strong); font-variant-numeric: tabular-nums; }

.notice {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .7rem .9rem; border-radius: var(--radius-sm);
  font-size: .85rem; line-height: 1.55;
  border: 1px solid var(--line); background: var(--surface-2);
}
.notice.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-wash); color: var(--warn); }
.notice.info { border-color: color-mix(in srgb, var(--cool) 40%, transparent); background: var(--cool-wash); color: var(--cool); }
.notice strong { font-weight: 700; }

.empty {
  text-align: center; padding: 2.6rem 1.2rem; color: var(--muted);
}
.empty h3 { font-size: 1.02rem; margin-bottom: .35rem; color: var(--ink); }
.empty p { margin: 0 auto; max-width: 46ch; font-size: .9rem; }

.loading { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .88rem; padding: 1.6rem 1.1rem; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.fav-btn { display: inline-flex; align-items: center; gap: .35rem; }
.fav-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

.site-item {
  display: flex; align-items: center; gap: .45rem .7rem; flex-wrap: wrap;
  padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: .4rem;
}
.site-item .checkbox { white-space: nowrap; }
.site-item .name { font-weight: 600; }
.site-item .coords { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }
.site-item.is-default { border-color: var(--accent); }

.dialog h2:focus { outline: none; }
/* Slack's official "Add to Slack" image button on the landing page. */
.add-to-slack { display: inline-block; line-height: 0; border-radius: 6px; }
.add-to-slack img { display: block; width: 139px; height: 40px; }
.saved-sites-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
}
.saved-sites-head .field-label { margin: 0; }
.saved-sites-head a { font-size: .8rem; color: var(--accent); text-decoration: none; }
.saved-sites-head a:hover { text-decoration: underline; }
.saved-site-list { display: flex; flex-direction: column; margin-bottom: .9rem; }
.saved-site-btn {
  display: flex; gap: .6rem; align-items: baseline; width: 100%; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  padding: .4rem .6rem; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius-sm); margin-bottom: .3rem;
}
.saved-site-btn:hover { border-color: var(--accent); }
.saved-site-btn .coords { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); margin-left: auto; }

/* --------------------------------------------------------------------------
   Dialogs and toasts
   -------------------------------------------------------------------------- */

.dialog {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  padding: 0; max-width: 520px; width: calc(100vw - 2rem);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(4, 8, 16, .58); backdrop-filter: blur(3px); }
.dialog-body { padding: 1.3rem; display: flex; flex-direction: column; gap: 1rem; }
.dialog-body h2 { font-size: 1.1rem; font-weight: 700; }
.dialog-hint { font-size: .82rem; color: var(--muted); margin: 0; }
.dialog-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.toast-stack {
  position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 60;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  padding: .6rem .9rem; font-size: .86rem; max-width: 340px;
  animation: toast-in .2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 1.2rem var(--gutter) 2rem;
  max-width: 1320px; margin: 0 auto; width: 100%;
  color: var(--muted); font-size: .8rem;
}
.footer p { margin: .2rem 0; }
.footer-fine { color: var(--faint); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 780px) {
  /* Nav and account controls fight for the same row on a phone, so the nav
     drops to a scrollable second row of its own. */
  .topbar-inner {
    height: auto; flex-wrap: wrap; gap: .5rem;
    padding-top: .5rem; padding-bottom: .5rem;
  }
  .brand { font-size: 1.02rem; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-by { font-size: .54rem; }
  #nav-toggle { display: grid; }
  /* The nav collapses behind the hamburger and drops down as a full-width
     vertical panel when opened. */
  .topnav { display: none; }
  .topnav.open {
    display: flex; flex-direction: column; order: 3;
    width: 100%; margin: 0 0 .35rem; padding: .3rem 0 0;
    border-top: 1px solid var(--line); row-gap: .1rem;
  }
  .topnav.open a { padding: .55rem .6rem; font-size: .95rem; }
  .topnav::-webkit-scrollbar { display: none; }
  .ghost-btn { padding: .34rem .6rem; }

  .context-bar { padding-top: .35rem; padding-bottom: .45rem; }
  .context-note { width: 100%; }

  .pass-row { grid-template-columns: 54px minmax(0, 1fr); gap: .6rem; }
  .pass-side { grid-column: 1 / -1; justify-content: flex-start; padding-left: .1rem; }
  .spark { display: none; }
  table.data { font-size: .78rem; }
  .sun-table { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
}

/* -- all-satellite map ---------------------------------------------------- */
.map-toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .6rem 1rem; margin-bottom: .6rem;
}
.map-toolbar .field { margin: 0; }
.map-canvas {
  max-width: none; aspect-ratio: auto;
  height: clamp(420px, 66vh, 820px);
  border-radius: 14px;
}
.map-legend {
  display: flex; flex-wrap: wrap; gap: .25rem 1.1rem;
  margin-top: .55rem;
}
.seg {
  display: inline-flex; border: 1px solid var(--line);
  border-radius: 9px; overflow: hidden;
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: .82rem; padding: .38rem .7rem; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--surface-3); color: var(--text); }
.zoom-controls { display: inline-flex; gap: .3rem; }
.zoom-controls button {
  width: 2rem; height: 2rem; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-size: 1rem; line-height: 1; cursor: pointer;
}
.zoom-controls button:hover { border-color: var(--accent); }
.map-popup {
  position: absolute; z-index: 5; min-width: 200px; max-width: 280px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: .6rem .75rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  font-size: .84rem; pointer-events: auto;
}
.map-popup .name { font-weight: 600; padding-right: 1.4rem; overflow-wrap: anywhere; }
.map-popup .meta { color: var(--muted); font-family: var(--font-mono); font-size: .76rem; margin: .2rem 0 .45rem; }
.map-popup a { font-size: .82rem; }
.map-popup .close {
  position: absolute; top: .3rem; right: .35rem;
  border: 0; background: transparent; color: var(--muted);
  font-size: 1rem; cursor: pointer; padding: .1rem .3rem;
}

.footer-links { margin-top: .45rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }

/* Name fields: one row of Japanese names, one row of English names. */
.name-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Pass page: globe column tops out; the forecast list runs long beside it. */
.pass-hero { align-items: start; }

.avail-line.maybe { color: var(--warn); }
.avail-btn.maybe { color: var(--warn); border-color: var(--warn); }

/* Search rows inside a dropdown suggestion list sit a little tighter. */
.suggest-list .result-row { padding: .5rem .7rem; }
.suggest-list .result-name { font-size: .88rem; }

/* A shift assignment that contradicts the member's own x answer. */
.tag.against-no {
  color: var(--danger); border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

/* A shift assignment whose member answered "maybe". */
.tag.against-maybe {
  color: var(--warn); border-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}

/* The group's watched-satellite list: search-style rows inside the card. */
.sat-list { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sat-row { grid-template-columns: minmax(0, 1fr) auto auto; padding: .55rem .7rem; cursor: pointer; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-by {
  font-size: .62rem; font-weight: 600; letter-spacing: .08em;
  color: var(--faint); font-family: var(--font-body, inherit);
}

/* Legal pages: phrase-aware Japanese line breaking where the browser has it,
   so names and terms are not split mid-word. */
.legal-body { line-height: 1.85; }
/* Phrase boundaries come as zero-width spaces (BudouX); keep-all stops the
   browser breaking anywhere else, and anywhere still rescues long URLs. */
.legal-body p:lang(ja), .legal-body li:lang(ja) { word-break: keep-all; overflow-wrap: anywhere; }

/* An informational (non-error) notice inside the auth dialog. */
.form-error.is-info { color: var(--good); }

/* Member names in the availability lines double as admin edit buttons. */
.avail-name {
  border: none; background: none; padding: 0; font: inherit;
  color: inherit; text-decoration: underline dotted; cursor: pointer;
}
.avail-name:hover { color: var(--accent); }

/* Screenshots inside the usage guide. */
.help-shot {
  width: 100%; max-width: 900px; display: block;
  border: 1px solid var(--line); border-radius: 10px; margin: .35rem 0;
}

/* The shift-management dropdown on the schedule card. */
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  min-width: 13rem; padding: .3rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-md);
}
.menu-item {
  display: block; width: 100%; text-align: left;
  padding: .5rem .7rem; border: none; background: none;
  font: inherit; color: inherit; cursor: pointer; border-radius: 6px;
}
.menu-item:hover { background: var(--surface-2); }

/* Availability dropdown (pointer devices) mirrors the cycle button's tones. */
.avail-select {
  width: auto; font-size: .82rem; padding: .2rem 1.3rem .2rem .45rem;
  font-family: var(--font-mono);
}
.avail-select.yes { color: var(--good); border-color: var(--good); }
.avail-select.no { color: var(--danger); border-color: var(--danger); }
.avail-select.maybe { color: var(--warn); border-color: var(--warn); }

/* The observation leader stands out among the shift chips. */
.tag.leader {
  color: var(--accent); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Moon and planets on the sky chart. */
.body-halo { fill: currentColor; opacity: .18; }
.body-dot  { fill: currentColor; }
.body-name {
  font-size: 11px; font-family: var(--font-body);
  fill: color-mix(in srgb, var(--ink) 75%, transparent);
}
.sky-night .body-name { fill: #C9D6EE; }
.moon-dark { fill: #2A3346; }
.moon-lit  { fill: #F2EFE4; }
.body-moon-halo { color: #F2EFE4; }
.body-sun     { color: #FFD24A; }
.body-mercury { color: #C9C3B8; }
.body-venus   { color: #FFF2C4; }
.body-mars    { color: #E8836A; }
.body-jupiter { color: #F0D9A8; }
.body-saturn  { color: #E7D6A0; }

/* Fullscreen map: the stage becomes the whole screen and the globe takes
   whatever height the controls leave. Separate rules per prefix - one
   unknown selector would invalidate the whole list. */
/* Doubled class: `.map-stage { position: relative }` further down (the
   pinned corner button) has equal specificity and would win by order,
   leaving touch devices' pseudo-fullscreen inert. */
.map-stage.map-stage-maximised {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg); overflow: auto;
}
/* Fullscreen is edge-to-edge: no padding, no rounded corners, the map
   filling every pixel the device gives us. The controls keep their own
   breathing room instead. Separate rules per prefix - one unknown selector
   would invalidate the whole list. */
.map-stage:fullscreen { background: var(--bg); padding: 0; width: 100vw; height: 100vh; }
.map-stage:-webkit-full-screen { background: var(--bg); padding: 0; width: 100vw; height: 100vh; }
.map-stage:fullscreen,
.map-stage.map-stage-maximised {
  display: flex; flex-direction: column; height: 100%; overflow: hidden; padding: 0;
}
/* iOS Safari: a fixed inset-0 box spans the LAYOUT viewport, which is taller
   than what is visible while the browser toolbars are up - the globe centred
   in it sat visibly low on iPhones. dvh tracks the visible height; browsers
   without it drop the line and keep the 100% above. */
.map-stage.map-stage-maximised { height: 100dvh; }
.map-stage:-webkit-full-screen { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.map-stage:fullscreen .map-toolbar,
.map-stage-maximised .map-toolbar { padding: .5rem .8rem 0; margin-bottom: .35rem; }
/* The phone's 表示設定 disclosure shares the top strip with the pinned
   back/forward buttons - step aside. */
.map-stage:fullscreen .controls-disclosure,
.map-stage-maximised .controls-disclosure { margin-left: 5.9rem; }
.map-stage:-webkit-full-screen .controls-disclosure { margin-left: 5.9rem; }
/* Centre the disclosure on the pinned back/forward buttons' row: they sit
   at .55rem and are a touch taller than this button. */
.map-stage.map-stage-maximised .controls-disclosure {
  margin-top: calc(.6rem + env(safe-area-inset-top, 0px));
}
.embed-mode .map-stage-maximised .controls-disclosure { margin-left: 0; }
.map-stage:-webkit-full-screen .map-toolbar { padding: .5rem .8rem 0; margin-bottom: .35rem; }
.map-stage:fullscreen .map-legend,
.map-stage-maximised .map-legend { padding: 0 .8rem .35rem; }
.map-stage:-webkit-full-screen .map-legend { padding: 0 .8rem .35rem; }
.map-stage:fullscreen > .chart-note,
.map-stage-maximised > .chart-note { padding: 0 .8rem; }
.map-stage:-webkit-full-screen > .chart-note { padding: 0 .8rem; }
.map-stage:fullscreen .globe-wrap,
.map-stage-maximised .globe-wrap { flex: 1 1 auto; min-height: 0; }
.map-stage:-webkit-full-screen .globe-wrap { flex: 1 1 auto; min-height: 0; }
.map-stage:fullscreen .map-canvas,
.map-stage-maximised .map-canvas { height: 100%; border-radius: 0; }
.map-stage:-webkit-full-screen .map-canvas { height: 100%; border-radius: 0; }

/* The touch pseudo-fullscreen goes further: the canvas takes the WHOLE
   screen (absolute, behind everything) so the globe's centre is the
   screen's centre whether or not the control rows are showing - stacked
   in flow, they pushed the canvas down and the planet with it. The rows
   float on top on a translucent wash, and the time controls dock at the
   bottom edge, player-style, so the top chrome stays small on a phone. */
.map-stage.map-stage-maximised .globe-wrap {
  position: absolute; inset: 0; flex: none;
}
.map-stage.map-stage-maximised .map-canvas { width: 100%; }
.map-stage.map-stage-maximised .map-toolbar,
.map-stage.map-stage-maximised .map-legend,
.map-stage.map-stage-maximised .controls-disclosure,
.map-stage.map-stage-maximised > .chart-note {
  position: relative; z-index: 6;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.map-stage.map-stage-maximised .map-toolbar-main {
  padding-top: calc(.5rem + env(safe-area-inset-top, 0px));
  /* The wash strip's bottom edge otherwise sits right against the last
     row (the satellite search field). */
  padding-bottom: .6rem;
}
/* Everything from the hover/status notes down settles at the bottom edge -
   notes first, then the time row, then the legend - as ONE continuous bar:
   the rows' own margins would let the canvas glint through between them
   (the notes carry inline margins, hence the important). */
.map-stage.map-stage-maximised > .chart-note {
  order: 2; margin: 0 !important; padding-top: .15rem; padding-bottom: .15rem;
}
.map-stage.map-stage-maximised > .chart-note:first-of-type {
  margin-top: auto !important; padding-top: .35rem;
}
.map-stage.map-stage-maximised .map-toolbar:not(.map-toolbar-main) {
  order: 3; margin-top: 0; margin-bottom: 0; padding-bottom: .4rem;
}
.map-stage.map-stage-maximised .map-legend { order: 4; margin-top: 0; }
/* In the bottom peek the notes stay hidden, so the returning time row
   anchors the stack instead. */
.map-stage.map-stage-maximised.controls-gone.footer-back
  .map-toolbar:not(.map-toolbar-main):not([hidden]) { margin-top: auto; }
/* Without a visible time row (non-members), the first note anchors the
   bottom stack instead; the inline margin needs the important. */
.map-stage.map-stage-maximised:not(
    :has(.map-toolbar:not(.map-toolbar-main):not([hidden]))) > .chart-note:first-of-type {
  margin-top: auto !important;
}
.map-stage.map-stage-maximised .map-legend {
  padding-bottom: calc(.35rem + env(safe-area-inset-bottom, 0px));
}

/* Once the idle fade finishes, the controls leave the layout entirely and
   the map claims their rows - the whole screen is globe. */
.map-stage.controls-gone .map-toolbar,
.map-stage.controls-gone .map-legend,
.map-stage.controls-gone .controls-disclosure,
.map-stage.controls-gone > .chart-note { display: none; }

/* Satellite search on the map. */
.map-search-results {
  position: absolute; top: 100%; left: 0; z-index: 25;
  min-width: 15rem; max-height: 15rem; overflow-y: auto;
  margin-top: 3px; padding: .25rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-md);
}
.map-search-hit {
  display: block; width: 100%; text-align: left;
  padding: .35rem .5rem; border: none; background: none;
  font: inherit; font-size: .82rem; color: inherit;
  cursor: pointer; border-radius: 6px; white-space: nowrap;
}
.map-search-hit:hover { background: var(--surface-2); }
.map-search-empty { padding: .35rem .5rem; font-size: .82rem; color: var(--muted); }

/* Membership tier, shown at the top of the account dialog. Each rank keeps
   its own accent so the badge is recognisable at a glance. */
.tier-card {
  position: relative;
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .75rem; margin-bottom: .8rem;
  border: 1px solid var(--tier-line, var(--line));
  border-radius: 12px;
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--tier-accent, var(--accent)) 14%, transparent),
    transparent 70%);
}
.tier-badge { display: grid; place-items: center; flex: none; }
.tier-badge svg { width: 42px; height: 42px; display: block; }
.tier-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.tier-name {
  font-family: var(--font-display); font-weight: 800; font-size: 1.02rem;
  color: var(--tier-accent, var(--accent)); letter-spacing: .02em;
}
.tier-note { font-size: .78rem; color: var(--muted); }
/* Approved students carry the chip inside the card's top-right corner. */
.tier-student {
  position: absolute; top: .45rem; right: .6rem;
  font-size: .6rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: .08rem .5rem; border-radius: 999px;
  color: var(--tier-accent, var(--accent));
  border: 1px solid color-mix(in srgb, var(--tier-accent, var(--accent)) 55%, transparent);
  background: color-mix(in srgb, var(--tier-accent, var(--accent)) 10%, transparent);
}

.tier-osumi     { --tier-accent: #E8A33D; --tier-line: #6A4E1E; }
.tier-kiku      { --tier-accent: #7FC7E8; --tier-line: #2C5468; }
.tier-hayabusa  { --tier-accent: #C9A6F0; --tier-line: #4A3A66; }
.tier-club_ssdl { --tier-accent: #58D3A6; --tier-line: #23604A; }

/* Embedded mode: the map is the whole page, with none of the site chrome. */
.embed-mode .topbar,
.embed-mode .footer,
.embed-mode .site-footer,
.embed-mode .context-bar,
.embed-mode .page-head { display: none !important; }
/* The iframe is the whole page: the stage flexes to exactly the viewport
   and the canvas takes whatever the control rows leave, so nothing ever
   scrolls inside the embed. dvh first, 100vh as the fallback. */
.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
.embed-mode main { padding: 0; max-width: none; height: 100vh; height: 100dvh; }
.embed-mode .card { border: none; border-radius: 0; background: transparent; height: 100%; }
.embed-mode .card-body { padding: .55rem .7rem; }
.embed-mode .card-body.map-stage {
  display: flex; flex-direction: column; height: 100%;
}
.embed-mode .globe-wrap { flex: 1 1 auto; min-height: 0; }
.embed-mode .map-canvas { height: 100%; width: 100%; border-radius: 0; }

/* The badge crediting the source, over the embedded canvas. */
.embed-brand {
  position: absolute; right: .6rem; bottom: .6rem; z-index: 24;
  display: inline-flex; align-items: center; gap: .42rem;
  padding: .32rem .7rem; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink); text-decoration: none;
  font-size: .76rem; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
.embed-brand svg { width: 17px; height: 17px; color: var(--accent-bright, #FFC968); }
.embed-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.embed-brand-by {
  font-size: .62rem; font-weight: 500; color: var(--muted);
  letter-spacing: .04em;
}
.embed-brand:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

/* The map's loading heartbeat: an orbiting ring over the empty canvas. */
.map-loading {
  position: absolute; inset: 0; z-index: 12;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .8rem;
  pointer-events: none;
  /* Seat-back style: the rendered Earth fills the frame behind the mark.
     The image is dark, so the type colours are fixed, not themed. */
  background: #04070D url('/data/loading.jpg') center / cover no-repeat;
  border-radius: 12px; overflow: hidden;
}
.map-loading-text {
  display: flex; align-items: center; gap: .5rem;
  color: #B9C4D6; font-size: .84rem; margin: 0;
}
.map-loading-spinner {
  display: inline-block; flex: none;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, #FFC968 30%, transparent);
  border-top-color: #FFC968;
  animation: map-loading-spin 1.1s linear infinite;
}
/* The site mark, echoing the header brand over the imagery. */
.map-loading-brand {
  display: flex; align-items: center; gap: .7rem;
  color: #F2F6FF;
  font-family: var(--font-display); font-weight: 900; font-size: 1.7rem;
  letter-spacing: .01em; white-space: nowrap;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .6);
}
.map-loading-brand svg { width: 46px; height: 46px; color: #FFC968; flex: none; }
.map-loading-brand .brand-thin { color: #A9B6CB; }
.map-loading-brand .brand-by { color: #8C99AF; }
@keyframes map-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .map-loading-spinner { animation-duration: 4s; }
}
.embed-notice {
  display: grid; place-items: center; gap: .5rem;
  min-height: 60vh; text-align: center; color: var(--muted); padding: 1.5rem;
}

/* Embed-code panel in the account dialog. */
.embed-panel {
  margin-bottom: .8rem; padding: .6rem .7rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2);
}

/* Rank picker in the admin list: coloured to match the badge it sets. */
.tier-select { color: var(--tier-accent, var(--ink)); border-color: var(--tier-line, var(--line)); }

/* Fullscreen: the controls fade out of the way and return when the pointer
   reaches the top. The globe keeps its height either way, so nothing jumps. */
.map-stage.fullscreen-active .map-toolbar,
.map-stage.fullscreen-active .map-legend,
.map-stage.fullscreen-active > .chart-note {
  transition: opacity .25s ease, transform .25s ease;
}
.map-stage.fullscreen-active.controls-away .map-toolbar {
  opacity: 0; transform: translateY(-8px); pointer-events: none;
}
.map-stage.fullscreen-active.controls-away .map-legend,
.map-stage.fullscreen-active.controls-away .controls-disclosure,
.map-stage.fullscreen-active.controls-away > .chart-note {
  opacity: 0; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .map-stage.fullscreen-active .map-toolbar,
  .map-stage.fullscreen-active .map-legend,
  .map-stage.fullscreen-active > .chart-note { transition: none; }
}

/* The handle that stays when the fullscreen controls have slipped away: a
   quiet grab-bar at the top edge, out of the way but discoverable. */
.map-controls-handle {
  display: none;
  position: absolute;
  top: calc(6px + env(safe-area-inset-top, 0px));
  left: 50%; transform: translateX(-50%);
  z-index: 30;
  padding: .45rem 1.4rem;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.map-controls-handle .grip {
  display: block; width: 34px; height: 4px; border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
}
.map-stage.controls-gone .map-controls-handle { display: block; }
/* The grip is the way back for fingers; a mouse wakes the chrome at the
   screen edge, so desktops never need the pill floating over the view. */
@media (hover: hover) and (pointer: fine) {
  .map-stage.controls-gone .map-controls-handle,
  .skyview-idle .map-controls-handle { display: none; }
}

/* Bottom-edge peek in fullscreen: just the legend returns. The controls-away
   fade above still applies at this point (the class stays on), so the peek
   must also win back opacity and clicks - display alone left a bare black
   strip where the category switches should be. */
.map-stage.controls-gone.footer-back .map-legend { display: flex; }
.map-stage.controls-gone.footer-back .map-toolbar:not(.map-toolbar-main):not([hidden]) {
  display: flex;
}
.map-stage.fullscreen-active.controls-away.footer-back .map-legend,
.map-stage.fullscreen-active.controls-away.footer-back
  .map-toolbar:not(.map-toolbar-main):not([hidden]) {
  opacity: 1; pointer-events: auto; transform: none;
}
/* The peek belongs to the BOTTOM edge. With the time row hidden (live
   mode) nothing carries the bottom anchor, and the legend surfaced at the
   top of the column instead - it takes the anchor itself then. */
.map-stage.map-stage-maximised.controls-gone.footer-back:not(
    :has(.map-toolbar:not(.map-toolbar-main):not([hidden]))) .map-legend {
  margin-top: auto;
}

/* With the fullscreen controls away, a selected satellite floats only its
   orbit selector - a small chip below the top edge, out of the layout so
   nothing shifts. */
.map-stage.controls-gone.orbit-peek .map-toolbar:not([hidden]) {
  display: flex !important;
  position: absolute; top: calc(6px + env(safe-area-inset-top, 0px));
  left: 50%; transform: translateX(-50%);
  width: auto; z-index: 28; margin: 0; padding: .4rem .7rem;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(8px);
}
.map-stage.controls-gone.orbit-peek .map-toolbar > * { display: none !important; }
.map-stage.controls-gone.orbit-peek .map-toolbar > .orbit-field {
  display: block !important; margin: 0;
}
/* The grab handle would collide with the chip; the chip is affordance enough. */
.map-stage.controls-gone.orbit-peek .map-controls-handle { display: none; }

/* The playback slider, in the site's own amber instead of the browser's
   default blue: a thin quiet track with a warm thumb. */
.sim-slider {
  -webkit-appearance: none; appearance: none;
  height: 22px; background: transparent; cursor: pointer;
}
.sim-slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: color-mix(in srgb, var(--line-strong) 85%, transparent);
}
.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  margin-top: -5px;
  background: var(--accent-bright);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.sim-slider::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: color-mix(in srgb, var(--line-strong) 85%, transparent);
}
.sim-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent-bright);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.sim-slider:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.play-btn { display: inline-flex; align-items: center; justify-content: center; }
.play-btn svg { display: block; }

/* The 360-degree sky views. The canvas owns its gestures. */
.skyview-wrap { position: relative; }
.skyview-canvas {
  display: block; width: 100%;
  height: clamp(380px, 68vh, 760px);
  background: #050A14; border-radius: 14px;
  touch-action: none; cursor: grab;
}
.skyview-canvas:active { cursor: grabbing; }
/* The loading heartbeat over the skeleton's canvas: above the (empty) HUD
   panel (z 24) but below the fullscreen button (z 26), like the map's. */
.skyview-wrap .map-loading { z-index: 25; border-radius: 14px; }
.skyview-controls { margin-top: .55rem; }
.skyview-sensor-active { border-color: var(--accent); color: var(--accent-bright, #FFC968); }
.skyview-toggles { margin-bottom: .5rem; }
/* The pinned corner cluster: cross-view jumps, share and fullscreen in one
   flex row (the map's .map-fs-wrap, sky-view flavoured). */
.skyview-corner {
  position: absolute; top: .55rem; right: .6rem; z-index: 26;
  display: flex; gap: .45rem;
}
/* The pinned-overlay fullscreen, shared by both sky views. It needs no user
   gesture, so a jump from the fullscreen map can arrive already maximised. */
.skyview-stage.skyview-maximised {
  position: fixed; inset: 0; z-index: 60;
  height: 100dvh; overflow: hidden;
  background: var(--bg); padding: 0;
  display: flex; flex-direction: column;
}
/* Like the maximised map: the canvas takes the WHOLE screen, behind
   everything, so hiding or showing the control rows never resizes it -
   no re-aim, no wobble, no leftover margins. The rows float on top on a
   translucent wash; the time controls dock at the bottom edge. */
.skyview-maximised .skyview-wrap { position: absolute; inset: 0; flex: none; }
.skyview-maximised .skyview-canvas { width: 100%; height: 100%; border-radius: 0; }
.skyview-maximised .skyview-toggles,
.skyview-maximised .controls-disclosure,
.skyview-maximised .skyview-controls,
.skyview-maximised .skyview-legend {
  position: relative; z-index: 26;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.skyview-maximised .skyview-toggles {
  margin-bottom: 0;
  padding: calc(.5rem + env(safe-area-inset-top, 0px)) .8rem .4rem;
  /* Tall enough that the pinned corner buttons always sit fully inside
     the bar's wash, whatever the row's own content height. */
  min-height: calc(3.1rem + env(safe-area-inset-top, 0px));
  align-content: center;
}
/* The pinned corner buttons sit ABOVE the toggle bar's wash - with equal
   z-index the later-in-DOM bar painted over half of them. */
.skyview-maximised .skyview-corner {
  z-index: 27;
  top: calc(.55rem + env(safe-area-inset-top, 0px));
}
/* On a phone the 表示設定 disclosure IS the top bar: a full-width wash
   strip, so the corner buttons sit on it instead of on the bare sky. */
.skyview-maximised .controls-disclosure {
  align-self: stretch; margin: 0; border: none; border-radius: 0;
  justify-content: flex-start;
  /* Clear the back/forward buttons on the left and the corner cluster on
     the right - both pinned over this wash strip. */
  padding: calc(.55rem + env(safe-area-inset-top, 0px))
    var(--corner-pad, 6.5rem) .55rem 5.9rem;
  min-height: calc(3.1rem + env(safe-area-inset-top, 0px));
}
.embed-mode .skyview-maximised .controls-disclosure { padding-left: .8rem; }
.skyview-maximised .skyview-controls {
  margin-top: auto;
  padding: .5rem .8rem;
}
.skyview-maximised .skyview-legend {
  margin: 0;
  padding: 0 .8rem calc(.4rem + env(safe-area-inset-bottom, 0px));
}

/* The fullscreen toggle pins to the stage's top-right corner, outside the
   toolbar's flow, so it neither wraps nor pushes anything. */
.map-stage { position: relative; }
.map-fs-wrap {
  position: absolute; top: .55rem; right: .65rem; z-index: 26;
  display: flex; gap: .45rem;
}
.map-toolbar-main { padding-right: 3rem; }
@media (min-width: 641px) {
  .map-toolbar-main { padding-right: var(--corner-pad, 3rem); }
  .map-stage:fullscreen .map-toolbar-main,
  .map-stage-maximised .map-toolbar-main {
    padding-right: var(--corner-pad, 3.4rem); padding-left: 5.6rem;
  }
  .map-stage:-webkit-full-screen .map-toolbar-main {
    padding-right: var(--corner-pad, 3.4rem); padding-left: 5.6rem;
  }
}
.map-stage:fullscreen .map-fs-wrap,
.map-stage-maximised .map-fs-wrap {
  top: calc(.55rem + env(safe-area-inset-top, 0px));
}
.map-stage:-webkit-full-screen .map-fs-wrap { top: calc(.55rem + env(safe-area-inset-top, 0px)); }
/* It hides with the rest of the chrome, and returns with it. */
.map-stage.fullscreen-active .map-fs-wrap { transition: opacity .25s ease; }
.map-stage.fullscreen-active.controls-away .map-fs-wrap { opacity: 0; pointer-events: none; }

/* Browser-style back/forward, pinned top-left - fullscreen only, where the
   browser's own chrome is out of reach. */
.nav-hist-wrap {
  position: absolute; top: .55rem; left: .65rem; z-index: 27;
  display: none; gap: .45rem;
}
.map-stage:fullscreen .nav-hist-wrap,
.map-stage-maximised .nav-hist-wrap,
.map-stage:-webkit-full-screen .nav-hist-wrap,
.skyview-stage:fullscreen .nav-hist-wrap,
.skyview-maximised .nav-hist-wrap {
  display: flex;
  top: calc(.55rem + env(safe-area-inset-top, 0px));
  left: calc(.65rem + env(safe-area-inset-left, 0px));
}
.map-stage.fullscreen-active .nav-hist-wrap { transition: opacity .25s ease; }
.map-stage.fullscreen-active.controls-away .nav-hist-wrap { opacity: 0; pointer-events: none; }

/* Quiet identity mark in the canvas's bottom-right corner. It stays clear
   of the info panels by construction (the POV HUD keeps to the left), and
   in fullscreen it only appears once the chrome has stepped aside - while
   the bottom docks are up it yields the corner to them. */
.brand-corner {
  position: absolute; z-index: 8;
  right: calc(.6rem + env(safe-area-inset-right, 0px));
  bottom: calc(.55rem + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: flex-end; gap: .12rem;
  font-size: .66rem; letter-spacing: .02em; white-space: nowrap;
  line-height: 1.2; text-align: right;
  color: #9AA7BB; opacity: .55; pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.brand-corner .bc-brand {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; color: #C4CFDF;
}
.brand-corner svg { width: 13px; height: 13px; color: #FFC968; flex: none; }
.map-stage.fullscreen-active .brand-corner,
.skyview-maximised .brand-corner,
.skyview-stage:fullscreen .brand-corner {
  opacity: 0; transition: opacity .3s ease;
}
.map-stage.fullscreen-active.controls-away .brand-corner,
.skyview-maximised.skyview-idle .brand-corner,
.skyview-stage:fullscreen.skyview-idle .brand-corner { opacity: .55; }
/* Narrow screens shorten the line in steps, so it never crowds the info
   panel in the opposite corner:
   (c) Kiyoaki Okudaira - Kyushu University Hanada Lab
   -> (c) Kiyoaki Okudaira - Kyushu University -> (c) Kiyoaki Okudaira */
@media (max-width: 720px) {
  .brand-corner .bc-lab { display: none; }
}
@media (max-width: 480px) {
  .brand-corner .bc-univ { display: none; }
  .brand-corner svg { display: none; }
  .brand-corner { font-size: .62rem; }
  .brand-corner .bc-brand { font-size: .66rem; }
}
/* On a narrow POV screen the info panel's width is content-driven and can
   reach across the bottom - when it is up, the corner yields entirely
   rather than peeking out from behind it. Switch the panel off and the
   mark returns. */
@media (max-width: 640px) {
  .skyview-wrap:has(.skyview-hud:not([hidden])) .brand-corner { display: none; }
}

/* Admin lists never wrap mid-cell - the card scrolls sideways instead. */
.admin-table th, .admin-table td { white-space: nowrap; }

/* Account settings: a sidebar sub-menu picks one section; on phones the
   menu folds into a horizontal chip row above the content. */
.settings-layout {
  display: grid; grid-template-columns: 12.5rem minmax(0, 1fr);
  gap: 1.2rem; align-items: start;
}
.settings-nav { display: flex; flex-direction: column; gap: .25rem; }
.settings-nav-item {
  text-align: left; padding: .55rem .8rem; border-radius: 9px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: .92rem; cursor: pointer;
}
.settings-nav-item:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.settings-nav-item.active {
  color: var(--ink); font-weight: 600;
  background: var(--surface); border-color: var(--line);
}
.settings-content > .card + .card { margin-top: 1rem; }
@media (max-width: 720px) {
  .settings-layout { grid-template-columns: 1fr; gap: .8rem; }
  .settings-nav {
    flex-direction: row; overflow-x: auto; padding-bottom: .2rem;
    scrollbar-width: none;
  }
  .settings-nav-item { white-space: nowrap; border-color: var(--line); }
}

/* The sky views' stage anchors its pinned fullscreen button, like the map. */
.skyview-stage { position: relative; }
.skyview-toggles { padding-right: 3rem; }
/* Desktop-only clearances: the corner cluster overlays the toggle row's
   right edge, and in fullscreen the history buttons overlay its left. On a
   phone the toggles are a disclosure panel BELOW those buttons, so the
   clearances would only hollow out its sides. */
@media (min-width: 641px) {
  .skyview-toggles { padding-right: var(--corner-pad, 3rem); }
  .skyview-maximised .skyview-toggles,
  .skyview-stage:fullscreen .skyview-toggles { padding-left: 5.6rem; }
}

/* Seat-back flight-map readout, floating over the satellite view. */
.skyview-hud {
  position: absolute; z-index: 24;
  /* Clear of rounded device corners, and gliding above the fullscreen
     bottom dock while the chrome is up (the JS drives `bottom`). */
  left: calc(.7rem + env(safe-area-inset-left, 0px));
  bottom: calc(.7rem + env(safe-area-inset-bottom, 0px));
  transition: bottom .3s ease;
  padding: .5rem .75rem; border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: .78rem; line-height: 1.5;
  pointer-events: none; max-width: min(72vw, 24rem);
}
.skyview-hud-name { font-weight: 700; font-size: .88rem; margin-bottom: .15rem; }
.skyview-hud-row { display: flex; gap: .6rem; min-width: 0; }
.skyview-hud-label { color: var(--muted); min-width: 3.2em; flex: none; }
/* Long values (a nearby-city name under 直下点) trim instead of poking
   past the panel edge. */
.skyview-hud-row .num {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.skyview-legend { gap: .2rem .9rem; margin: .45rem 0 .1rem; }

/* Native fullscreen for the sky views mirrors the pinned overlay. */
.skyview-stage:fullscreen {
  height: 100vh; overflow: hidden;
  background: var(--bg); padding: .5rem .6rem;
  display: flex; flex-direction: column;
}
.skyview-stage:fullscreen .skyview-wrap { flex: 1 1 auto; min-height: 0; }
.skyview-stage:fullscreen .skyview-canvas { height: 100%; border-radius: 0; }

/* Fullscreen chrome steps aside after a quiet moment; opacity only, so the
   canvas never resizes underneath. */
.skyview-toggles, .skyview-legend, .skyview-controls, .skyview-corner,
.nav-hist-wrap, .skyview-stage .controls-disclosure {
  transition: opacity .3s ease;
}
.skyview-idle .skyview-toggles,
.skyview-idle .skyview-legend,
.skyview-idle .skyview-controls,
.skyview-idle .skyview-corner,
.skyview-idle .nav-hist-wrap,
.skyview-idle .controls-disclosure {
  opacity: 0; pointer-events: none;
}

/* Embed issuing: the share button next to fullscreen, chips in the dialog,
   the issued-code rows in the account panel. */
.embed-chip-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.embed-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .78rem; padding: .12rem .3rem .12rem .5rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel, rgba(124, 140, 166, .12));
}
.embed-chip-x {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: .9rem; line-height: 1; padding: 0 .15rem;
}
.embed-chip-x:hover { color: var(--warn, #ff8f8f); }
.embed-token-row {
  display: flex; align-items: center; gap: .25rem .6rem; flex-wrap: wrap;
  padding: .35rem 0; border-top: 1px solid var(--line); font-size: .84rem;
}
.embed-token-row:first-child { border-top: none; }
/* Name half and action half wrap as units: one tidy line on desktop, two
   tidy lines on a phone - never a scatter. */
.embed-token-head {
  display: flex; align-items: center; gap: .5rem;
  flex: 1 1 auto; min-width: 11rem;
}
.embed-token-actions {
  display: flex; align-items: center; gap: .6rem; white-space: nowrap;
}
.embed-token-view {
  font-size: .72rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: .05rem .35rem;
  white-space: nowrap;
}
.embed-token-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Second stage of the fullscreen fade: the rows leave the layout and the
   sky takes every pixel the device has. */
.skyview-gone .skyview-toggles,
.skyview-gone .skyview-legend,
.skyview-gone .controls-disclosure,
.skyview-gone .skyview-controls { display: none; }

/* Per-satellite jump into its own view, in the home roster. */
.globe-roster-view {
  font-size: .72rem; color: var(--muted); text-decoration: none;
  border: 1px solid var(--line); border-radius: 6px; padding: .1rem .35rem;
  margin-left: .35rem; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .25rem;
}
.globe-roster-view svg { width: 12px; height: 12px; }
.globe-roster-view:hover { color: var(--accent-bright, #FFC968); border-color: var(--line-strong); }

/* The sky views' grip handle appears once the fullscreen chrome is idle -
   for fingers only; a mouse wakes the chrome at the screen edge. */
.skyview-idle .map-controls-handle { display: block; }
@media (hover: hover) and (pointer: fine) {
  .skyview-idle .map-controls-handle { display: none; }
}

/* Fullscreen: the sky sits in the middle, the time controls dock at the
   bottom - the same arrangement as the map's maximised layout. */
.skyview-stage.skyview-maximised .skyview-wrap,
.skyview-stage:fullscreen .skyview-wrap { order: 1; }
.skyview-stage:fullscreen .skyview-controls { order: 2; margin-top: .5rem; }
.skyview-stage.skyview-maximised .skyview-controls {
  order: 2; margin-top: auto; margin-bottom: 0;
}
.skyview-controls { margin-bottom: .5rem; }
.skyview-stage.skyview-maximised .skyview-legend,
.skyview-stage:fullscreen .skyview-legend { order: 3; }

@media (max-width: 780px) {
  /* Everything but theme and account folds into the hamburger panel. */
  .topnav .context-bar {
    display: flex; border-top: 1px solid var(--line);
    margin-top: .3rem; padding: .5rem .4rem .2rem;
  }

  /* The roster keeps its full width and scrolls sideways instead of
     crushing the satellite names into ellipses. */
  /* (The roster's sideways scroll is global now - see .globe-roster.) */
}


/* Globe language picker, every header width. */
.lang-menu-wrap { position: relative; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 90;
  display: flex; flex-direction: column; min-width: 8.5rem;
  padding: .3rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.4));
}
.lang-option {
  text-align: left; padding: .5rem .7rem; font-size: .9rem;
  background: none; border: none; color: var(--ink);
  border-radius: 8px; cursor: pointer;
}
.lang-option:hover { background: var(--surface-2); }
.lang-option[aria-pressed="true"] {
  color: var(--accent-bright, #FFC968); font-weight: 600;
}
@media (max-width: 780px) {
  /* One-line header: brand pushes the actions to the right edge. */
  .brand { margin-right: auto; }
}
@media (max-width: 480px) {
  .topbar-inner { gap: .35rem; }
  .topbar-actions { gap: .3rem; }
  .brand { font-size: .95rem; gap: .35rem; }
  .brand-mark { width: 22px; height: 22px; }
  #account-btn { padding: .3rem .5rem; font-size: .8rem; }
  .icon-btn { width: 34px; height: 34px; }
}

/* observation records: facts as tabs (capture / processing / orbit) */
.obs-tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.obs-tab { background: transparent; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); padding: .28rem .8rem;
  font: inherit; font-size: .84rem; cursor: pointer; }
.obs-tab:hover { border-color: var(--line-strong); color: inherit; }
.obs-tab.active { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent); }
/* observation records: facts table (item > value) */
.obs-facts { border-collapse: collapse; width: 100%; font-size: .86rem; }
.obs-facts td { padding: .28rem .55rem; vertical-align: top; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.obs-facts tr.group-start td { border-top: 1px solid var(--line-strong); }
.obs-facts tr:first-child td { border-top: none; }
.obs-facts-item { color: var(--muted); white-space: nowrap; width: 11em; }
.obs-facts-value { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* observation records: media selector thumbnails */
.obs-thumbs { display: flex; gap: .5rem; flex-wrap: wrap; }
.obs-thumb { background: var(--surface-2); border: 2px solid var(--line); border-radius: 10px; padding: .25rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .2rem; width: 110px; color: var(--muted); font: inherit; }
.obs-thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; background: #000; display: block; }
.obs-thumb-icon { width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; background: #000; border-radius: 6px; font-size: 1.6rem; color: #ddd; }
.obs-thumb-label { font-size: .72rem; line-height: 1.2; text-align: center; }
.obs-thumb:hover { border-color: var(--line-strong); }
.obs-thumb.active { border-color: var(--accent); color: var(--accent); }

/* observation records: viewer + slide mode */
.obs-viewer { width: 100%; max-width: 520px; min-height: 200px; background: #000; border-radius: 8px; overflow: hidden; }
.obs-viewer video, .obs-viewer img { width: 100%; display: block; background: #000; }
.obs-selbar { position: sticky; bottom: .5rem; z-index: 5; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .5rem .9rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.obs-target-chip { cursor: pointer; }
.obs-stage-wrap { width: 100%; background: #000; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.obs-stage-wrap.ar-16x9 .obs-stage { aspect-ratio: 16 / 9; width: min(100%, calc((100vh - 13rem) * 16 / 9)); }
.obs-stage-wrap.ar-4x3 .obs-stage { aspect-ratio: 4 / 3; width: min(100%, calc((100vh - 13rem) * 4 / 3)); }
.obs-stage { margin: 0 auto; background: #0b0e14; color: #e8e8ea; container-type: size; }
.obs-stage-wrap:fullscreen { border-radius: 0; width: 100vw; height: 100vh; }
.obs-stage-wrap.ar-16x9:fullscreen .obs-stage { width: min(100vw, calc(100vh * 16 / 9)); }
.obs-stage-wrap.ar-4x3:fullscreen .obs-stage { width: min(100vw, calc(100vh * 4 / 3)); }
.obs-selbar select, .obs-present-controls select { width: auto; }
.obs-slide { height: 100%; display: flex; flex-direction: column; padding: 2.2cqh 2.4cqw; box-sizing: border-box; gap: 1.6cqh; }
.obs-slide-head { display: flex; align-items: center; gap: 1cqw; }
.obs-slide-title { font-size: 5.2cqh; font-weight: 800; line-height: 1.1; }
.obs-slide-sub { font-size: 2.6cqh; color: #b6b9c2; margin-top: .6cqh; }
.obs-slide-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2cqw; }
.obs-slide-media { display: flex; flex-direction: column; gap: 1.2cqh; min-height: 0; }
.obs-slide-media .obs-viewer { max-width: none; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.obs-slide-media .obs-viewer video, .obs-slide-media .obs-viewer img { width: auto; max-width: 100%; max-height: 100%; height: 100%; object-fit: contain; }
.obs-slide-media .obs-thumbs { gap: .8cqw; }
.obs-slide-media .obs-thumb { width: 9cqw; padding: .3cqh; }
.obs-slide-media .obs-thumb img, .obs-slide-media .obs-thumb-icon { width: 8cqw; height: 8cqw; }
.obs-slide-media .obs-thumb-label { font-size: 1.7cqh; }
.obs-slide-facts { min-height: 0; overflow: auto; }
.obs-slide-facts .obs-tab { font-size: 2.4cqh; padding: .6cqh 1.6cqw; }
.obs-slide-facts .obs-facts { font-size: 2.5cqh; }
.obs-slide-facts .obs-facts td { padding: .7cqh 1cqw; }
.obs-slide-facts .obs-facts-item { width: 14cqw; }
.obs-slide-foot { display: flex; align-items: center; font-size: 2cqh; color: #8a8e99; }
.obs-slide-num { font-size: 2.6cqh; color: #b6b9c2; font-variant-numeric: tabular-nums; align-self: flex-start; }
.obs-brand { display: inline-flex; align-items: center; gap: .8cqw; color: #e8e8ea; }
.obs-brand-mark { width: 5.5cqh; height: 5.5cqh; color: var(--accent, #e0a83a); flex: none; }
.obs-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.obs-brand-name { font-size: 2.8cqh; font-weight: 800; letter-spacing: .01em; }
.obs-brand-thin { font-weight: 500; color: #b6b9c2; margin-left: .3em; }
.obs-brand-by { font-size: 1.7cqh; color: #8a8e99; }
@media (max-width: 720px) { .obs-slide-body { grid-template-columns: 1fr; } }

/* "The URL has changed" strip shown once after a redirect from the old host. */
.site-moved {
  position: sticky; top: 0; z-index: 60;
  padding: .55rem 1rem; text-align: center; font-size: .85rem; font-weight: 600;
  background: var(--warn); color: #1a1200;
  transition: opacity .4s ease;
}
.site-moved-hide { opacity: 0; }
