/* ============================================================
   DON'T FALL ASLEEP
   A game you win by losing.
   Made with love by Nebula Tactic. © Nebula Tactic.
   ------------------------------------------------------------
   Design rules baked into this stylesheet:
   - nothing is ever pure white, nothing ever flashes
   - every transition is measured in seconds, not milliseconds
   - the JS only ever moves CSS custom properties, never styles
   ============================================================ */

:root {
  /* --- live state, written by the visual controller in app.js --- */
  --dim: 0;              /* 0 = session start, ~0.8 = almost gone   */
  --text-op: 1;          /* prompt opacity                          */
  --star-op: 0.85;       /* star field opacity                      */
  --ring-op: 0;          /* target ring opacity                     */
  --moon-size: 132px;    /* moon diameter                           */
  --moon-glow: 1;        /* glow multiplier                         */
  --moon-x: 50%;         /* moon position on the stage              */
  --moon-y: 50%;
  --moon-dur: 6000ms;    /* how long the moon takes to drift        */
  --breath: 9s;          /* moon breathing period                   */

  /* --- palette: deep night, never black-black until the end --- */
  --bg-0: #05070d;
  --bg-1: #080c16;
  --bg-2: #0b1120;
  --ink: 203, 214, 236;  /* rgb parts so opacity can be composed    */
  --ink-op: 0.72;

  --fade: 2.4s;          /* the standard slow cross-fade            */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: dark;
}

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

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg-0);
  color: rgba(var(--ink), var(--ink-op));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  letter-spacing: 0.06em;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  padding:
    env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus { outline: none; }
button:focus-visible {
  outline: 1px solid rgba(var(--ink), 0.45);
  outline-offset: 6px;
  border-radius: 4px;
}

/* ------------------------------------------------------------ *
   Night sky
 * ------------------------------------------------------------ */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 50% 18%, var(--bg-2) 0%, var(--bg-1) 45%, var(--bg-0) 100%);
}

#stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: var(--star-op);
  transition: opacity 6s var(--ease);
  animation: drift 300s linear infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-14px, 10px, 0); }
}

/* a very faint horizon haze so the screen is never flat black */
.haze {
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to top, rgba(28, 42, 74, 0.28), transparent 85%);
  opacity: 0.9;
}

/* ------------------------------------------------------------ *
   Stage + moon
 * ------------------------------------------------------------ */

.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.moon {
  position: absolute;
  left: var(--moon-x);
  top: var(--moon-y);
  width: max(var(--moon-size), 88px);   /* touch target never shrinks below 88px */
  height: max(var(--moon-size), 88px);
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  transition: left var(--moon-dur) var(--ease),
              top  var(--moon-dur) var(--ease),
              width var(--fade) var(--ease),
              height var(--fade) var(--ease),
              opacity var(--fade) var(--ease);
  display: grid;
  place-items: center;
  opacity: 0;
}

.moon.is-visible { opacity: 1; }

.moon-body {
  display: block;
  width: var(--moon-size);
  height: var(--moon-size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 32%,
      #eef3ff 0%,
      #d9e2f6 32%,
      #aebbd8 62%,
      #7f8db0 88%,
      #6d7a9c 100%);
  box-shadow:
    0 0 calc(38px * var(--moon-glow)) calc(6px * var(--moon-glow)) rgba(150, 176, 230, 0.22),
    0 0 calc(110px * var(--moon-glow)) calc(28px * var(--moon-glow)) rgba(96, 128, 200, 0.13),
    inset -8px -10px 26px rgba(40, 52, 82, 0.5);
  transition: width var(--fade) var(--ease),
              height var(--fade) var(--ease),
              box-shadow var(--fade) var(--ease),
              transform 1.6s var(--ease);
  animation: breathe var(--breath) ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1);     filter: brightness(1);    }
  50%      { transform: scale(1.035); filter: brightness(1.06); }
}

/* the acknowledgement: a single soft swell, no bounce, no colour */
.moon.acked .moon-body {
  animation: none;
  transform: scale(1.12);
  filter: brightness(1.18);
}

.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 216px;
  height: 216px;
  margin: -108px 0 0 -108px;
  border-radius: 50%;
  border: 1px solid rgba(var(--ink), 0.16);
  opacity: var(--ring-op);
  transition: opacity 3.5s var(--ease);
  pointer-events: none;
}

/* neutral imagery word */
.word {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
  font-size: clamp(2.1rem, 12vw, 3.4rem);
  font-weight: 200;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  opacity: 0;
  transition: opacity 3.2s var(--ease);
  pointer-events: none;
}

.word.is-visible { opacity: calc(0.92 * var(--text-op)); }

/* ------------------------------------------------------------ *
   Prompt line
 * ------------------------------------------------------------ */

.prompt {
  position: fixed;
  left: 50%;
  bottom: calc(15vh + 46px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  width: min(88vw, 460px);
  text-align: center;
  font-size: clamp(1.05rem, 4.6vw, 1.35rem);
  font-weight: 300;
  letter-spacing: 0.14em;
  color: rgba(var(--ink), 0.66);
  opacity: 0;
  transition: opacity var(--fade) var(--ease);
  pointer-events: none;
  min-height: 2em;
}

.prompt.is-visible { opacity: var(--text-op); }

/* ------------------------------------------------------------ *
   Header + footer bars
   Present on the title screen, gone a few seconds into play,
   back again on a tap near the top or bottom edge.
 * ------------------------------------------------------------ */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 1;
  transition: opacity 2.4s var(--ease);
}

.bar.is-hidden { opacity: 0; pointer-events: none; }

/* dialogs own the screen while they are open */
body.panel-open .bar { opacity: 0; pointer-events: none; }

.bar-top {
  top: 0;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right))
           10px calc(16px + env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(5, 7, 13, 0.72), rgba(5, 7, 13, 0));
}

.bar-bottom {
  bottom: 0;
  flex-direction: column;
  gap: 2px;
  padding: 10px calc(16px + env(safe-area-inset-right))
           calc(10px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background: linear-gradient(to top, rgba(5, 7, 13, 0.72), rgba(5, 7, 13, 0));
}

/* --- brand ------------------------------------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  width: 26px;
  height: 26px;
  flex: none;
  filter: drop-shadow(0 0 6px rgba(140, 168, 226, 0.28));
}

.brand-name {
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(var(--ink), 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- header buttons ---------------------------------------- */

.bar-actions { display: flex; align-items: center; gap: 2px; flex: none; }

.icon-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(var(--ink), 0.52);
  transition: color 1s var(--ease), background 1s var(--ease);
}

.icon-btn svg { width: 21px; height: 21px; display: block; }
.icon-btn:active { background: rgba(var(--ink), 0.06); color: rgba(var(--ink), 0.85); }

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

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.foot-link {
  min-height: 40px;
  padding: 8px 8px;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: rgba(var(--ink), 0.44);
  transition: color 1s var(--ease);
}

.foot-link:active { color: rgba(var(--ink), 0.8); }

.footer-links .dot { color: rgba(var(--ink), 0.22); }

.credit-line {
  margin: 0;
  text-align: center;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  color: rgba(var(--ink), 0.3);
}

.credit-line .heart { color: rgba(196, 152, 174, 0.55); }

body.readable .brand-name,
body.readable .foot-link { color: rgba(var(--ink), 0.86); }
body.readable .credit-line { color: rgba(var(--ink), 0.62); }
body.readable .icon-btn { color: rgba(var(--ink), 0.86); }

/* --- toast: one line, only ever after a deliberate tap ----- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 22;
  margin: 0;
  width: min(84vw, 380px);
  padding: 14px 18px;
  border: 1px solid rgba(var(--ink), 0.12);
  border-radius: 14px;
  background: rgba(9, 13, 24, 0.92);
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.7;
  letter-spacing: 0.1em;
  color: rgba(var(--ink), 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s var(--ease);
}

.toast.is-visible { opacity: 1; }

/* ------------------------------------------------------------ *
   Veil — the whole screen quietly going out
 * ------------------------------------------------------------ */

.veil {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: #000;
  opacity: var(--dim);
  pointer-events: none;
  transition: opacity 8s linear;
}

/* ------------------------------------------------------------ *
   Screens (onboarding, settings, endings)
 * ------------------------------------------------------------ */

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: calc(78px + env(safe-area-inset-top)) 24px
           calc(92px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(5, 7, 13, 0.92), rgba(5, 7, 13, 0.97));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 1.6s var(--ease);
  overflow-y: auto;
}

.screen[hidden] { display: none; }
.screen.is-open { opacity: 1; }
.screen.quiet { background: rgba(0, 0, 0, 0.72); }

.screen-inner {
  width: min(100%, 420px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.slide[hidden] { display: none; }

.slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: soft-in 2s var(--ease) both;
}

@keyframes soft-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.title {
  margin: 0 0 6px;
  font-size: clamp(1.75rem, 9.4vw, 2.5rem);
  font-weight: 200;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  line-height: 1.35;
  color: rgba(var(--ink), 0.9);
}

.sub {
  margin: 0 0 18px;
  font-size: 0.86rem;
  letter-spacing: 0.2em;
  color: rgba(var(--ink), 0.42);
}

.line {
  margin: 0;
  font-size: clamp(1.05rem, 4.6vw, 1.3rem);
  letter-spacing: 0.13em;
  color: rgba(var(--ink), 0.72);
}

.line.spaced { margin-top: 8px; }

.line.strong {
  font-size: clamp(1.3rem, 6vw, 1.7rem);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: rgba(var(--ink), 0.88);
  margin-bottom: 12px;
}

.fine {
  margin: 18px 0 0;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  color: rgba(var(--ink), 0.3);
}

.btn {
  margin-top: 30px;
  min-width: 172px;
  min-height: 56px;
  padding: 16px 28px;
  border: 1px solid rgba(var(--ink), 0.22);
  border-radius: 999px;
  font-size: 0.92rem;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: rgba(var(--ink), 0.78);
  background: rgba(var(--ink), 0.03);
  transition: background 1.2s var(--ease), border-color 1.2s var(--ease);
}

.btn:active { background: rgba(var(--ink), 0.08); }

.link-btn {
  margin-top: 18px;
  min-height: 48px;
  padding: 12px 18px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  color: rgba(var(--ink), 0.4);
  text-transform: lowercase;
}

/* ------------------------------------------------------------ *
   Settings
 * ------------------------------------------------------------ */

.settings-inner {
  align-items: stretch;
  text-align: left;
  gap: 0;
}

.panel-title {
  margin: 0 0 22px;
  font-size: 0.82rem;
  font-weight: 300;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(var(--ink), 0.4);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(var(--ink), 0.07);
}

.row.column {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 0;
}

.row-label {
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  color: rgba(var(--ink), 0.7);
}

.toggle {
  min-width: 84px;
  min-height: 48px;
  padding: 12px 16px;
  text-align: right;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  color: rgba(var(--ink), 0.42);
  transition: color 1s var(--ease);
}

.toggle[aria-pressed="true"] { color: rgba(var(--ink), 0.92); }

.segmented { display: flex; gap: 10px; width: 100%; }

.seg {
  flex: 1;
  min-height: 52px;
  border: 1px solid rgba(var(--ink), 0.14);
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: rgba(var(--ink), 0.42);
  transition: color 0.9s var(--ease), border-color 0.9s var(--ease),
              background 0.9s var(--ease);
}

.seg[aria-pressed="true"] {
  color: rgba(var(--ink), 0.92);
  border-color: rgba(var(--ink), 0.34);
  background: rgba(var(--ink), 0.05);
}

.settings-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6px;
}

.disclaimer {
  margin: 30px 0 0;
  font-size: 0.7rem;
  line-height: 1.8;
  letter-spacing: 0.05em;
  color: rgba(var(--ink), 0.26);
  text-align: center;
}

.feedback-row {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 10px;
}

/* ------------------------------------------------------------ *
   High readability
 * ------------------------------------------------------------ */

body.readable {
  --ink-op: 0.94;
  letter-spacing: 0.04em;
}

body.readable .prompt { color: rgba(var(--ink), 0.96); font-size: clamp(1.2rem, 5.2vw, 1.5rem); }
body.readable .line,
body.readable .row-label { color: rgba(var(--ink), 0.94); }
body.readable .fine,
body.readable .disclaimer { color: rgba(var(--ink), 0.6); }
body.readable .toggle,
body.readable .seg,
body.readable .link-btn { color: rgba(var(--ink), 0.7); }

/* ------------------------------------------------------------ *
   Reduced motion — set by the user, or by the OS
 * ------------------------------------------------------------ */

body.reduced-motion #stars { animation: none; }
body.reduced-motion .moon-body { animation: none; }
body.reduced-motion .moon {
  /* the moon still moves, but only as far as a gentle fade */
  transition: left 0.001s linear, top 0.001s linear, opacity var(--fade) var(--ease);
}
body.reduced-motion .slide { animation: none; }

@media (prefers-reduced-motion: reduce) {
  #stars { animation: none; }
  .moon-body { animation: none; }
  .slide { animation: none; }
}

/* ------------------------------------------------------------ *
   Dormant — after "good night" nothing here asks for anything
 * ------------------------------------------------------------ */

body.dormant .bar { opacity: 0; pointer-events: none; }
body.dormant .haze { opacity: 0.35; transition: opacity 20s linear; }

/* ------------------------------------------------------------ *
   Larger screens: same game, more empty space
 * ------------------------------------------------------------ */

@media (min-width: 768px) {
  :root { --moon-size: 168px; }
  .prompt { bottom: calc(18vh + env(safe-area-inset-bottom)); }
  .ring { width: 280px; height: 280px; margin: -140px 0 0 -140px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .prompt { bottom: calc(8vh + env(safe-area-inset-bottom)); }
  .title { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  .btn { margin-top: 18px; }
}

/* ============================================================
   Nebula Tactic additions — ambient sky, credits, legal screens
   ============================================================ */

:root {
  --neb-op: 1;      /* nebula cloud opacity, fades as the session does */
  --halo-op: 0;     /* the moon's lagging aura, on only while the moon is */
}

/* ------------------------------------------------------------ *
   Nebula — three very slow clouds behind the stars.
   Pure radial gradients: no blur filters, no per-frame JS.
 * ------------------------------------------------------------ */

.nebula {
  position: absolute;
  inset: 0;
  opacity: var(--neb-op);
  transition: opacity 8s var(--ease);
  pointer-events: none;
  overflow: hidden;
}

.neb {
  position: absolute;
  display: block;
  border-radius: 50%;
  will-change: transform;
}

.neb-a {
  width: 150vmin; height: 150vmin;
  left: -46vmin; top: -52vmin;
  background: radial-gradient(circle,
    rgba(46, 74, 150, 0.20) 0%,
    rgba(46, 74, 150, 0.07) 42%,
    rgba(46, 74, 150, 0) 70%);
  animation: neb-a 190s ease-in-out infinite alternate;
}

.neb-b {
  width: 130vmin; height: 130vmin;
  right: -44vmin; top: 12vmin;
  background: radial-gradient(circle,
    rgba(22, 86, 112, 0.17) 0%,
    rgba(22, 86, 112, 0.06) 44%,
    rgba(22, 86, 112, 0) 72%);
  animation: neb-b 245s ease-in-out infinite alternate;
}

.neb-c {
  width: 168vmin; height: 168vmin;
  left: -30vmin; bottom: -78vmin;
  background: radial-gradient(circle,
    rgba(76, 54, 134, 0.15) 0%,
    rgba(76, 54, 134, 0.05) 40%,
    rgba(76, 54, 134, 0) 68%);
  animation: neb-c 310s ease-in-out infinite alternate;
}

@keyframes neb-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(11vmin, 7vmin, 0) scale(1.16); }
}
@keyframes neb-b {
  from { transform: translate3d(0, 0, 0) scale(1.08); }
  to   { transform: translate3d(-9vmin, 12vmin, 0) scale(1); }
}
@keyframes neb-c {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(8vmin, -10vmin, 0) scale(1.13); }
}

body.no-nebula .nebula { display: none; }

body.reduced-motion .neb { animation: none; }
body.reduced-motion .nebula { opacity: calc(var(--neb-op) * 0.55); }

@media (prefers-reduced-motion: reduce) {
  .neb { animation: none; }
}

/* ------------------------------------------------------------ *
   Halo — the moon's aura, trailing it at just under half speed
 * ------------------------------------------------------------ */

.halo {
  position: absolute;
  left: var(--moon-x);
  top: var(--moon-y);
  width: min(80vmin, 540px);
  height: min(80vmin, 540px);
  margin: 0;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(126, 158, 224, 0.17) 0%,
    rgba(96, 124, 190, 0.06) 38%,
    rgba(96, 124, 190, 0) 68%);
  opacity: calc(var(--halo-op) * var(--moon-glow) * 0.9);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: left calc(var(--moon-dur) * 1.7) var(--ease),
              top calc(var(--moon-dur) * 1.7) var(--ease),
              opacity 5s var(--ease);
  animation: halo-pulse 26s ease-in-out infinite;
}

@keyframes halo-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.1); }
}

body.reduced-motion .halo { animation: none; }
@media (prefers-reduced-motion: reduce) { .halo { animation: none; } }

/* ------------------------------------------------------------ *
   Credits + accessibility helper
 * ------------------------------------------------------------ */

.credit {
  margin: 26px 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-align: center;
  color: rgba(var(--ink), 0.26);
}

.credit .heart { color: rgba(190, 150, 170, 0.5); }

.credit .version {
  display: block;
  margin-top: 6px;
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  color: rgba(var(--ink), 0.18);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ *
   Settings extras — save confirmation, install, legal links
 * ------------------------------------------------------------ */

.saved-note {
  margin: 14px 0 0;
  min-height: 1.2em;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(var(--ink), 0.4);
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}

.saved-note.is-visible { opacity: 1; }

.install-hint {
  margin-top: 10px;
  max-width: 30ch;
  line-height: 1.9;
}

.legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.legal-links .dot { color: rgba(var(--ink), 0.2); }

.link-btn.tight { margin-top: 0; padding: 12px 6px; }

/* ------------------------------------------------------------ *
   Legal screens — long text, so they scroll from the top
 * ------------------------------------------------------------ */

#settings, #privacy, #terms { align-items: start; }

.legal-inner {
  align-items: stretch;
  text-align: left;
  max-width: 46ch;
}

.legal-meta {
  margin: -12px 0 22px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: rgba(var(--ink), 0.32);
}

.legal-inner h3 {
  margin: 22px 0 6px;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: rgba(var(--ink), 0.74);
}

.legal-inner p {
  margin: 0 0 10px;
  font-size: 0.82rem;
  line-height: 1.85;
  letter-spacing: 0.02em;
  color: rgba(var(--ink), 0.5);
}

.legal-inner strong {
  font-weight: 400;
  color: rgba(var(--ink), 0.7);
}

.legal-inner .legal-note {
  color: rgba(var(--ink), 0.38);
  font-style: italic;
}

.legal-inner .btn { align-self: center; margin-bottom: 10px; }

body.readable .legal-inner p { color: rgba(var(--ink), 0.84); }
body.readable .legal-inner h3 { color: rgba(var(--ink), 0.96); }
body.readable .credit { color: rgba(var(--ink), 0.6); }

/* the ending takes the sky down with it */
body.dormant .nebula { opacity: calc(var(--neb-op) * 0.4); transition: opacity 20s linear; }

/* a visible message if scripting is off — never a blank screen */
.noscript-note {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
  background: var(--bg-0);
  color: rgba(var(--ink), 0.8);
  letter-spacing: 0.18em;
}

/* ------------------------------------------------------------ *
   Homepage copy — the one place the game explains itself
 * ------------------------------------------------------------ */

.pitch {
  margin: 24px 0 2px;
  max-width: 32ch;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pitch p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.85;
  letter-spacing: 0.05em;
  color: rgba(var(--ink), 0.44);
  text-wrap: pretty;
}

.pitch p:first-child { color: rgba(var(--ink), 0.62); }

body.readable .pitch p { color: rgba(var(--ink), 0.86); }
body.readable .pitch p:first-child { color: rgba(var(--ink), 0.96); }

.legal-inner em { font-style: normal; color: rgba(var(--ink), 0.66); }
body.readable .legal-inner em { color: rgba(var(--ink), 0.92); }

/* short screens: same words, tighter setting */
@media (max-height: 740px) {
  .screen {
    padding: calc(64px + env(safe-area-inset-top)) 22px
             calc(94px + env(safe-area-inset-bottom));
  }
  .title { font-size: clamp(1.5rem, 7.6vw, 2rem); line-height: 1.24; }
  .sub { font-size: 0.78rem; margin-bottom: 10px; }
  .line.strong { font-size: clamp(1.1rem, 5vw, 1.35rem); margin-bottom: 2px; }
  .pitch { margin-top: 14px; gap: 8px; }
  .pitch p { font-size: 0.74rem; line-height: 1.62; }
  .btn { margin-top: 16px; min-height: 50px; padding: 13px 24px; }
  .link-btn { margin-top: 8px; min-height: 40px; padding: 10px 14px; }
  .fine { margin-top: 10px; font-size: 0.68rem; }
  .bar-bottom { padding-top: 6px; }
  .foot-link { min-height: 34px; padding: 6px 7px; font-size: 0.64rem; }
  .credit-line { font-size: 0.6rem; }
}
