/* ============================================================================
   MIGHTY PLAY — stylesheet
   A MightyJoe Project · part of the Mighty ecosystem
   ----------------------------------------------------------------------------
   1.  Design tokens            7.  Play view
   2.  Base & resets            8.  Discoveries
   3.  Shell, nav, headers      9.  About
   4.  Type & utilities        10.  Sheets, toast
   5.  Buttons & controls      11.  Responsive & motion
   6.  Stage, garden, HUD

   Changing the accent: edit --pl, --pl-hi, --pl-deep and --lav in section 1,
   then update `theme_color` in manifest.webmanifest and the <meta
   name="theme-color"> tag to match --bg.
   ========================================================================= */

/* ───────────────────────────────────────────────── 1. DESIGN TOKENS ────── */
:root {
  /* Frost blue — the thread that ties Mighty Play to the wider family —
     over a twilight-purple night rather than Reset's clinical calm. */
  --pl: #7FE3FF;              /* primary accent                             */
  --pl-hi: #C8F2FF;           /* bright text-on-dark variant                */
  --pl-deep: #2A7E9B;         /* pressed / deep states                      */
  --lav: #B39CFF;             /* twilight purple secondary                  */
  --lav-hi: #DCD1FF;
  --mint: #8FF2C4;
  --gold: #FFD68A;
  --coral: #FF9C8A;

  /* Foundation — deep navy with a violet cast, dark across the whole page. */
  --bg: #070A18;
  --bg-2: #0B0F23;
  --panel: #11162E;
  --panel-2: #171D39;
  --panel-3: #212949;
  --line: rgba(180, 200, 255, 0.14);
  --line-strong: rgba(127, 227, 255, 0.36);
  --line-soft: rgba(255, 255, 255, 0.06);

  /* Type — every value below is AA or better on --bg and --panel. */
  --text: #EEF2FF;            /* ~16.5:1 on --bg */
  --muted: #B6BEDC;           /* ~9.2:1          */
  --dim: #949CC2;             /* ~6.2:1 — the quietest text allowed */
  --danger: #FFA3A3;
  --ok: #8FF2C4;
  --on-accent: #04202B;

  /* Glow, used sparingly — soft light, never neon. */
  --glow-btn: 0 0 26px rgba(127, 227, 255, 0.26);
  --glow-lav: 0 0 22px rgba(179, 156, 255, 0.22);

  --r-xs: 10px;
  --r-sm: 13px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --pad: 18px;
  --tap: 48px;
  --shell: 560px;
  --rail: 244px;
  --navh: 66px;   /* matches the real height of the mobile bar below */

  --shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 18px 44px rgba(0,0,0,0.55);

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 130ms;
  --t: 220ms;
  --t-slow: 520ms;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ─────────────────────────────────────────────── 2. BASE & RESETS ─────── */
*, *::before, *::after { box-sizing: border-box; }

/* Screens and sheets toggle with [hidden]; several are display:flex or grid,
   which would otherwise win. This rule must stay. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  /* The page itself is dark edge to edge, on every viewport size. */
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

img { max-width: 100%; }
svg { width: 18px; height: 18px; flex: none; }
svg[data-sprite] { width: 0; height: 0; position: absolute; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--pl);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }
::selection { background: rgba(127, 227, 255, 0.3); color: #fff; }

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

.skip {
  position: absolute; left: 50%; top: 8px; transform: translate(-50%, -220%);
  background: var(--pl); color: var(--on-accent); padding: 10px 16px;
  border-radius: var(--r-pill); font-weight: 700; z-index: 300;
  text-decoration: none;
}
.skip:focus { transform: translate(-50%, 0); }

a { color: var(--pl-hi); text-underline-offset: 3px; }
a:hover { color: var(--pl); }

/* ────────────────────────────────── 3. SHELL, NAV, HEADERS ────────────── */
#app { position: relative; min-height: 100%; }

main {
  position: relative;
  z-index: 2;
  min-height: 100%;
  padding-bottom: calc(var(--navh) + env(safe-area-inset-bottom));
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.screen {
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: 40px;
  animation: screen-in var(--t) var(--ease-out) both;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.head { margin: 4px 0 22px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pl);
  font-weight: 700;
  margin: 0 0 8px;
}
.head h1 {
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 700;
}
.head p { margin: 10px 0 0; color: var(--muted); font-size: 14.5px; }

/* Bottom bar on phones, left rail from 860px up. */
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: rgba(9, 12, 28, 0.9);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.nav-inner {
  max-width: var(--shell);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
}
.nav-btn {
  appearance: none;
  background: none;
  border: 0;
  min-height: var(--tap);
  padding: 6px 2px;
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  position: relative;
}
.nav-btn svg { width: 21px; height: 21px; stroke-width: 1.7; }
.nav-btn:hover { color: var(--muted); }
.nav-btn[aria-current="page"] { color: var(--pl); }
.nav-btn[aria-current="page"]::after {
  content: "";
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 2px; border-radius: 2px;
  background: var(--pl);
  box-shadow: var(--glow-btn);
}
.nav-badge {
  position: absolute;
  top: 4px;
  margin-left: 46px;
  min-width: 17px; height: 17px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--lav);
  color: #150A2E;
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
}
.nav-rail-foot { display: none; }

/* While a round is running the shell steps out of the way entirely. */
body.playing .nav { opacity: 0; pointer-events: none; transform: translateY(100%); }
body.playing main { padding-bottom: 0; }

/* ────────────────────────────────── 4. TYPE & UTILITIES ───────────────── */
h1, h2, h3 { letter-spacing: -0.015em; }
h2 { font-size: 18px; margin: 0 0 10px; font-weight: 680; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 650; }
p  { margin: 0 0 12px; }

.label {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  margin: 0 0 10px;
}
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13.5px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 26px; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.panel-flat {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.tag-pl { color: var(--pl-hi); border-color: var(--line-strong); background: rgba(127,227,255,0.09); }

.field-hint { font-size: 12.5px; color: var(--dim); margin: 10px 0 0; }

/* ──────────────────────────────── 5. BUTTONS & CONTROLS ───────────────── */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text);
  font-size: 15px;
  font-weight: 630;
  letter-spacing: -0.005em;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), opacity var(--t-fast);
}
.btn:hover { background: #2A3357; border-color: var(--line-strong); }
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.42; cursor: not-allowed; }
.btn:disabled:hover { background: var(--panel-3); border-color: var(--line); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  background: linear-gradient(180deg, #A9EEFF, var(--pl));
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 730;
  box-shadow: var(--glow-btn);
}
.btn-primary:hover { background: linear-gradient(180deg, #C0F4FF, #63DCFF); border-color: transparent; }

.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: rgba(255,255,255,0.06); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(255,163,163,0.30); background: rgba(255,163,163,0.07); }
.btn-danger:hover { background: rgba(255,163,163,0.14); border-color: rgba(255,163,163,0.5); }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 10px 16px; font-size: 13.5px; }
.btn-lg { min-height: 58px; font-size: 17px; padding: 16px 22px; }

.icon-btn {
  appearance: none;
  width: var(--tap); height: var(--tap);
  min-width: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(12, 16, 36, 0.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.09); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn-quiet { border-color: transparent; }
.icon-btn[aria-pressed="true"] { color: var(--pl); border-color: var(--line-strong); }

/* Chips — used for the settings rows. Selection never relies on colour
   alone: a check mark and a filled background carry it too. */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  appearance: none;
  min-height: var(--tap);
  padding: 11px 17px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 640;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip:active { transform: scale(0.98); }
.chip svg { width: 16px; height: 16px; color: var(--dim); }
.chip[aria-pressed="true"] {
  background: rgba(127,227,255,0.13);
  border-color: var(--pl);
  color: var(--pl-hi);
  box-shadow: 0 0 0 1px rgba(127,227,255,0.28);
}
.chip[aria-pressed="true"] svg { color: var(--pl); }
.chip-grow { flex: 1 1 0; min-width: 108px; justify-content: center; }

.pref-row + .pref-row { margin-top: 20px; }

/* ─────────────────────────────── 6. STAGE, GARDEN, HUD ────────────────── */
/* The canvas is a fixed layer behind the interface. It keeps the same box as
   the content area, so the garden never slides under the rail or the bar. */
.stage {
  position: fixed;
  left: 0; right: 0; top: 0;
  bottom: calc(var(--navh) + env(safe-area-inset-bottom));
  z-index: 0;
  background:
    radial-gradient(120% 80% at 50% 100%, #141033 0%, #0A0C22 55%, var(--bg) 100%);
  transition: bottom var(--t) var(--ease), left var(--t) var(--ease);
}
body.playing .stage { bottom: 0; }

.garden-canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* Stops the page from scrolling or rubber-banding mid-drag. Navigation
     elsewhere is untouched, because this only applies to the canvas. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: crosshair;
}
.garden-canvas:focus-visible { outline: 2px solid var(--pl); outline-offset: -4px; }

/* Behind the reading views the garden dims so text stays comfortable. */
.stage-veil {
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(7,10,24,0.86), rgba(7,10,24,0.94));
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}
body.view-text .stage-veil { opacity: 1; }

/* The garden screen is an overlay on the canvas rather than a document flow
   column, so the scene keeps the whole area to itself. */
.screen-garden {
  position: fixed;
  left: 0; right: 0; top: 0;
  bottom: calc(var(--navh) + env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  pointer-events: none;
}
.screen-garden > * { pointer-events: auto; }

.garden-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 2px 14px rgba(0,0,0,0.8);
}
.wordmark .mark {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: rgba(127,227,255,0.14);
  border: 1px solid var(--line-strong);
  color: var(--pl);
}
.wordmark .mark svg { width: 15px; height: 15px; }

.garden-panel {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}
.panel-soft {
  background: linear-gradient(180deg, rgba(23,29,57,0.82), rgba(11,15,35,0.92));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  backdrop-filter: blur(16px) saturate(130%);
  animation: rise var(--t-slow) var(--ease-out) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.panel-soft h1 {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0;
  font-weight: 720;
}
.welcome { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.bloom { margin: 20px 0 18px; }
.bloom-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 0 0 8px;
}
.bloom-label {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim); font-weight: 700;
}
.bloom-next { font-size: 12.5px; color: var(--pl-hi); text-align: right; }
.meter {
  height: 8px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.meter-fill {
  display: block; height: 100%; width: 0%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--lav), var(--pl));
  box-shadow: 0 0 16px rgba(127,227,255,0.5);
  transition: width var(--t-slow) var(--ease-out);
}
.meter-hud { height: 6px; background: rgba(255,255,255,0.14); }

/* When a threshold lands the fill brightens for a beat, so progress registers
   even while the player is watching the garden rather than the bar. */
.meter.is-full .meter-fill { box-shadow: 0 0 22px rgba(127,227,255,0.85); }
.meter-fill.is-lit { animation: meter-lit 900ms var(--ease-out) 1; }
@keyframes meter-lit {
  0%   { filter: brightness(1); }
  22%  { filter: brightness(1.75); }
  100% { filter: brightness(1); }
}

.garden-actions { display: grid; gap: 10px; }
.garden-foot {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--dim);
}

/* HUD — the only interface visible while playing. */
.hud {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  animation: fade-in var(--t) var(--ease-out) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.hud > * { pointer-events: none; }
.hud button { pointer-events: auto; }

.hud-timer {
  height: 2px;
  width: 100%;
  background: rgba(255,255,255,0.07);
}
.hud-timer span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--lav), var(--pl));
  transform-origin: left center;
}
.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 14px 0;
}
.hud-right { display: flex; align-items: center; gap: 8px; }
.hud-clock {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  min-width: 34px;
  text-align: right;
}
.hud-chain {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--pl-hi);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}
.hud-chain.is-on { opacity: 1; }
/* The single line of in-round instruction. It sits above the bloom meter, out
   of the way of the gesture, and leaves after the first successful chain. */
.hud-hint {
  margin: auto auto 14px;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  background: rgba(11,15,35,0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.01em;
  text-align: center;
  max-width: min(88vw, 320px);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: hint-in 620ms var(--ease-out) both;
}
@keyframes hint-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.hud-hint.is-out { animation: hint-out 480ms var(--ease) both; }
@keyframes hint-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-6px); }
}

.hud-bloom {
  margin-top: auto;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}
/* When the hint is showing it already pushes from the top, so the meter keeps
   its own margin only when the hint is gone. */
.hud-hint:not([hidden]) ~ .hud-bloom { margin-top: 0; }

/* While Lumi is demonstrating, the interface quietly gets out of her way. */
body.is-demo .hud-hint,
body.is-demo .hud-bloom { opacity: 0.55; transition: opacity var(--t) var(--ease); }
.hud-bloom-label {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
}

/* The end-of-round message. Quiet, centred, never a "Time's up" slap. */
.finish {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: radial-gradient(80% 60% at 50% 50%, rgba(9,12,28,0.72), rgba(7,10,24,0.92));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in var(--t-slow) var(--ease-out) both;
}
.finish-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  background: linear-gradient(180deg, rgba(23,29,57,0.92), rgba(11,15,35,0.96));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px 22px 22px;
  box-shadow: var(--shadow);
}
.finish-card h2 { font-size: 20px; margin: 0 0 10px; font-weight: 700; }
.finish-card p { color: var(--muted); font-size: 14.5px; margin: 0 0 18px; }
.finish-card .btn + .btn { margin-top: 10px; }
/* Session results: real numbers, kept quiet and secondary. */
.finish-stats {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 0 18px;
  flex-wrap: wrap;
}
.finish-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.03);
  min-width: 96px;
}
.finish-stat b { font-size: 16px; font-weight: 700; color: var(--pl-hi); }
.finish-stat span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }

.finish-gain {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 16px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: rgba(127,227,255,0.1);
  color: var(--pl-hi);
  font-size: 12.5px;
  font-weight: 650;
}

/* A newly awakened element announces itself once, gently. */
.discovery-note {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 55;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 17px;
  border-radius: var(--r-pill);
  background: rgba(17,22,46,0.92);
  border: 1px solid var(--line-strong);
  color: var(--pl-hi);
  font-size: 13.5px;
  font-weight: 640;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  animation: note-in 460ms var(--ease-out) both;
  max-width: min(92vw, 420px);
  pointer-events: none;
}
.discovery-note svg { width: 16px; height: 16px; color: var(--pl); }
@keyframes note-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.discovery-note.is-out { animation: note-out 420ms var(--ease) both; }
@keyframes note-out {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, -10px); }
}

/* ──────────────────────────────────────── 7. PLAY VIEW ────────────────── */
.mode-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.mode-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 0 0 8px;
}
.mode-head h2 { margin: 0; font-size: 17px; }
.mode-card p { margin: 0 0 16px; }

.how { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.how li { margin: 0 0 8px; }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.legend li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.02);
}
.legend .swatch {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.legend .swatch svg { width: 15px; height: 15px; }
.legend b { font-size: 14px; font-weight: 650; }
.legend span { display: block; font-size: 12.5px; color: var(--dim); }

/* ─────────────────────────────────────── 8. DISCOVERIES ───────────────── */
.disc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.disc {
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(23,29,57,0.6), rgba(11,15,35,0.7));
  padding: 16px 14px;
  text-align: center;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.disc-art {
  width: 54px; height: 54px;
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-soft);
}
.disc-art svg { width: 30px; height: 30px; }
.disc b { display: block; font-size: 13.5px; font-weight: 650; margin: 0 0 4px; }
.disc p { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.4; }
.disc-state {
  display: inline-block;
  margin: 10px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--dim);
}
.disc.is-on { border-color: var(--line-strong); background: linear-gradient(180deg, rgba(127,227,255,0.09), rgba(11,15,35,0.7)); }
.disc.is-on .disc-art { background: rgba(127,227,255,0.1); border-color: var(--line-strong); }
.disc.is-on .disc-state { color: var(--pl); }
.disc.is-off { border-style: dashed; border-color: rgba(180,200,255,0.10); background: rgba(255,255,255,0.012); }
.disc.is-off .disc-art { opacity: 0.5; }
.disc.is-off .disc-art svg { color: var(--dim); opacity: 0.34; }
.disc.is-off b { color: var(--muted); font-style: italic; font-weight: 550; }
.disc.is-off p { color: rgba(148,156,194,0.85); }

/* Everything further off stays as one quiet group — present, unnamed, and
   not a checklist. */
.disc-hidden {
  margin: 26px 0 0;
  padding: 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.015);
  text-align: center;
}
.disc-hidden h2 { font-size: 14px; margin: 0 0 6px; color: var(--muted); font-weight: 650; }
.disc-hidden p { margin: 0; }
.disc-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 2px;
  flex-wrap: wrap;
}
.disc-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(180,200,255,0.22);
  box-shadow: 0 0 10px rgba(127,227,255,0.14);
}

/* ────────────────────────────────────────────── 9. ABOUT ──────────────── */
.about-block { margin: 0 0 30px; }
.about-block p:last-child { margin-bottom: 0; }

.eco-links { display: grid; gap: 10px; }
.eco-link {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  text-decoration: none;
  min-height: var(--tap);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.eco-link:hover { border-color: var(--line-strong); background: rgba(127,227,255,0.06); color: var(--text); }
.eco-link > svg:first-child { color: var(--pl); }
.eco-link .eco-note { display: block; font-size: 12.5px; color: var(--dim); }
.eco-go { color: var(--dim); display: inline-flex; }

.byline {
  margin: 34px 0 0;
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.04em;
}
.byline strong { color: var(--muted); font-weight: 700; }

/* ─────────────────────────────────────── 10. SHEETS & TOAST ───────────── */
.scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 6, 16, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in var(--t) var(--ease) both;
}
.sheet {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding: 14px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  max-height: 88vh;
  overflow-y: auto;
  animation: sheet-in var(--t) var(--ease-out) both;
}
@keyframes sheet-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.sheet-grip {
  width: 40px; height: 4px; border-radius: 4px;
  background: rgba(255,255,255,0.18);
  margin: 0 auto 16px;
}
.sheet h2 { font-size: 18px; margin: 0 0 8px; }
.sheet > p { color: var(--muted); font-size: 14.5px; }
.sheet-actions { display: grid; gap: 10px; margin-top: 18px; }

#toast-host { position: fixed; inset: 0; z-index: 250; pointer-events: none; }
.toast {
  position: absolute;
  left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(17,22,46,0.96);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: note-in 300ms var(--ease-out) both;
  max-width: min(92vw, 420px);
  text-align: center;
}

/* ─────────────────────────────────── 11. RESPONSIVE & MOTION ──────────── */
/* Tablet and desktop: the bottom bar becomes a left rail, and the garden
   takes the whole remaining viewport rather than sitting in a column. */
@media (min-width: 860px) {
  .nav {
    top: 0; bottom: 0; right: auto; left: 0;
    width: var(--rail);
    border-top: 0;
    border-right: 1px solid var(--line);
    padding: 28px 16px;
    display: flex; flex-direction: column;
    background: rgba(9, 12, 28, 0.78);
  }
  .nav::before {
    content: "MIGHTY PLAY";
    display: block; order: 0;
    font-size: 12px; font-weight: 800; letter-spacing: 0.18em;
    color: var(--text);
    padding: 0 12px 4px;
  }
  .nav::after {
    content: "Connect the light.";
    display: block; order: 1;
    font-size: 12px; color: var(--dim);
    padding: 0 12px 24px;
  }
  .nav-inner { grid-template-columns: 1fr; gap: 4px; order: 2; }
  .nav-rail-foot {
    display: block; order: 3; margin-top: auto; padding: 0 12px;
    font-size: 11px; letter-spacing: 0.1em; color: var(--dim);
  }
  .nav-btn {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 12px; font-size: 14px; font-weight: 570;
  }
  .nav-btn[aria-current="page"] { background: rgba(127,227,255,0.1); }
  .nav-btn[aria-current="page"]::after {
    top: 50%; left: 0; transform: translateY(-50%);
    width: 3px; height: 22px;
  }
  .nav-badge { position: static; margin-left: auto; }

  body.playing .nav { transform: translateX(-100%); }

  main { padding-left: var(--rail); padding-bottom: 0; }
  body.playing main { padding-left: 0; }
  .screen { padding-top: 48px; padding-bottom: 72px; }

  .stage { left: var(--rail); bottom: 0; }
  body.playing .stage { left: 0; }

  .screen-garden { left: var(--rail); bottom: 0; }
  body.playing .screen-garden { left: 0; }
  .garden-top { padding: 22px 26px 0; }
  .garden-panel { max-width: 480px; margin: 0 0 0 auto; padding: 0 26px 26px; }

  .hud-top { padding: 20px 24px 0; }
  .hud-bloom { padding: 0 24px 24px; }

  .scrim { align-items: center; padding: 24px; }
  .sheet { border-radius: 26px; border-bottom: 1px solid var(--line); max-height: 84vh; }
  .toast { bottom: 34px; }

  .disc-grid { grid-template-columns: repeat(3, 1fr); }
  .discovery-note { bottom: 92px; left: calc(50% + var(--rail) / 2); }
  body.playing .discovery-note { left: 50%; }
}

@media (min-width: 1280px) {
  :root { --shell: 620px; --rail: 256px; }
  /* Centring in the leftover space alone pushes the column right of centre;
     shifting back by half the rail puts it on the viewport's optical centre. */
  .shell { margin-left: max(0px, calc((100% - var(--shell)) / 2 - var(--rail) / 2)); margin-right: auto; }
  .garden-panel { max-width: 520px; }
}
@media (min-width: 1600px) { :root { --shell: 660px; --rail: 268px; } }

/* Very narrow phones. */
@media (max-width: 359px) {
  :root { --pad: 14px; }
  .panel-soft h1 { font-size: 26px; }
  .disc-grid { gap: 10px; }
}

/* Short landscape phones: the panel must not eat the whole garden. */
@media (max-height: 520px) and (orientation: landscape) {
  .panel-soft { padding: 14px 16px; }
  .panel-soft h1 { font-size: 22px; }
  .bloom { margin: 12px 0 12px; }
  .btn-lg { min-height: 50px; font-size: 15.5px; }
  .garden-foot { display: none; }
}

/* Reduced motion — honoured from the OS and from the in-app toggle. The game
   itself also reads this and calms the scene down; see js/garden.js. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

@media print { .nav, .scrim, .toast, .hud, .stage { display: none !important; } }
