* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0b0e14;
  --panel: #141a26;
  --card: #f5f0e6;
  --card-text: #1a1a1a;
  --accent: #c8a24a;
  --danger: #c0392b;
  --ok: #2e8b57;
  --text: #e8e6e0;
  --muted: #8a8fa3;

  /* Severity-driven ambient tokens (see app.js applySeverityTheme). Calm defaults
     here so the page looks right before the first render() call sets them for real.
     Only --ambient-glow and --ambient-accent are meant to shift — functional colors
     above (--text, --card, --danger, etc.) stay fixed so readability never degrades
     exactly when severity is highest. */
  /* Player-controlled text size for the WHOLE game — see .read-size. Multiplies every
     font-size in this file; 1 is the default. The card's max-height scales with it too,
     so bigger type gets a bigger card rather than an immediate internal scroll. */
  --ui-scale: 1;
  --ambient-glow: rgba(24, 32, 52, 0.6);
  --ambient-accent: #3a4460;
}

html, body { height: 100%; overscroll-behavior: none; }
body {
  /* Ambient color-grading: a radial wash that shifts with the world's severity
     (see app.js applySeverityTheme) — the flat --bg underneath is the floor at
     zero severity and the permanent fallback if JS hasn't run yet. */
  background: radial-gradient(ellipse at top, var(--ambient-glow), var(--bg) 75%);
  transition: background 1.2s ease;
  color: var(--text);
  font-family: "Georgia", "Times New Roman", serif;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  position: relative;
  /* clip (not hidden): forbids programmatic scrolling too, so nothing can
     shift the layout and cause taps to land on the wrong controls */
  overflow: clip;
}

/* ---- severity indicator ---- */
/* Deliberately minimal — the ambient background gradient (see body, above) carries
   most of the "how bad is it" signal; this is just a stable, always-legible label
   naming the current severity band and, when relevant, the agency lean. */
#severity {
  display: flex;
  justify-content: center;
  padding: 14px 20px 4px;
}
#severity-label {
  font-size: calc(11px * var(--ui-scale)); letter-spacing: 3px; text-transform: uppercase;
  color: var(--ambient-accent); font-family: ui-monospace, monospace;
  transition: color 1.2s ease;
}
#severity.bump #severity-label { animation: bump 0.5s; }
@keyframes bump { 50% { transform: scale(1.15); } }

#statusline {
  display: flex; justify-content: center; gap: 14px;
  font-size: calc(12px * var(--ui-scale)); color: var(--muted); padding: 2px 0 6px;
  font-family: ui-monospace, monospace;
}

/* ---- stage ---- */
#stage { flex: 1; display: flex; flex-direction: column; padding: 0 16px; min-height: 0; }

.brief {
  background: var(--panel);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  /* Expanded default shows the WHOLE brief (trimmed narratives fit well under this);
     the cap is only a safety ceiling so a pathological brief can't crush the card. */
  max-height: 60vh;
}
/* Centered two-line header: title in accent, the tap-hint below it in a quieter
   colour so the affordance reads as secondary to the title. */
.brief-head { flex-shrink: 0; margin-bottom: 6px; text-align: center; }
.brief-title {
  font-size: calc(11px * var(--ui-scale)); letter-spacing: 2px; color: var(--accent); font-family: ui-monospace, monospace;
}
.brief-hint {
  font-size: calc(9px * var(--ui-scale)); letter-spacing: 1px; color: var(--muted); font-family: ui-monospace, monospace; margin-top: 3px;
}
#brief-text {
  font-size: calc(14px * var(--ui-scale)); line-height: 1.45; color: #cfd3de;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
/* Collapsed: all the way down to the header line, so the card gets the whole rest of the
   screen. Previously kept a ~11vh preview with a fade, which was neither readable enough to
   be useful nor small enough to be out of the way. max-height animates to 0 rather than
   display:none so the open/close still eases. */
.brief.collapsed #brief-text {
  max-height: 0; overflow: hidden; opacity: 0;
}
/* The header's own bottom margin would otherwise leave a gap under a zero-height body. */
.brief.collapsed .brief-head { margin-bottom: 0; }
/* Rare expanded outlier that still exceeds the 60vh cap: same fade cue on the scroll edge. */
.brief:not(.collapsed).overflowing #brief-text {
  -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent);
  mask-image: linear-gradient(to bottom, #000 88%, transparent);
}

#card-zone { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; }

#card {
  width: min(88%, 340px);
  height: 100%;
  max-height: calc(420px * var(--ui-scale));
  background: var(--card);
  color: var(--card-text);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  touch-action: none;
  cursor: grab;
  position: relative;
  border-top: 5px solid transparent; /* colored per-theater on a decision card, or per-kind (ack/*) on an interstitial */
  transition: transform 0.25s ease, opacity 0.25s, border-top-color 0.3s ease;
}
#card.dragging { transition: none; cursor: grabbing; }
#card.dealt { animation: deal 0.4s ease; }
@keyframes deal { from { transform: translateY(30px) scale(0.94); opacity: 0; } }

#card-theater {
  font-size: calc(10px * var(--ui-scale)); letter-spacing: 2px; text-transform: uppercase;
  color: #8a6d2f; font-family: ui-monospace, monospace; margin-bottom: 8px;
}
#card-title { font-size: calc(20px * var(--ui-scale)); font-weight: bold; margin-bottom: 10px; line-height: 1.2; }
/* touch-action: pan-y (not the card's own `none`) so a vertical drag inside the body
   scrolls it natively while a horizontal drag still reaches the swipe handler. Without
   this, at the largest text size the body overflows on a phone and the card's
   touch-action: none makes the overflowing text physically unreachable. */
#card-body {
  font-size: calc(15px * var(--ui-scale)); line-height: 1.45; flex: 1;
  overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain;
}
.swipe-cue { text-align: center; font-size: calc(11px * var(--ui-scale)); color: #9a8f78; letter-spacing: 3px; }

/* Interstitial card: an acknowledge-only beat announcing a new collapse condition. */
#card.ack { border-top: 5px solid var(--danger); }
#card.ack #card-theater { color: var(--danger); }
.ack-btn {
  margin-top: auto; width: 100%; padding: 13px;
  background: var(--danger); color: #fff; border: none; border-radius: 10px;
  font-family: inherit; font-size: calc(15px * var(--ui-scale)); font-weight: bold; letter-spacing: 1px; cursor: pointer;
}
.ack-btn:active { transform: scale(0.98); }
/* Relationship-threshold interstitial (entanglement exposed / coalition fracturing) —
   amber instead of red, so it reads as a different kind of beat than a collapse scar. */
#card.ack-relationship { border-top-color: var(--accent); }
#card.ack-relationship #card-theater { color: var(--accent); }
#card.ack-relationship .ack-btn { background: var(--accent); color: #14100a; }
/* Stabilization interstitial — a theater crossed its stabilization threshold. Green,
   distinct from both the red collapse and amber relationship beats, so it reads as good news. */
#card.ack-stabilized { border-top-color: var(--ok); }
#card.ack-stabilized #card-theater { color: var(--ok); }
#card.ack-stabilized .ack-btn { background: var(--ok); color: #fff; }

/* World panel marker for a theater that has durably stabilized. */
.theater.stabilized { border-left-color: var(--ok); }

.choice-hint {
  position: absolute; top: 12%;
  /* Widens with the text so a scaled-up label needs breaking less often. Only one hint is
     ever visible at a time (opacity follows the drag direction), so they can overlap. */
  max-width: calc(38% * var(--ui-scale));
  padding: 8px 12px;
  font-size: calc(14px * var(--ui-scale)); font-weight: bold;
  /* A single long word ("counter-proliferation") is wider than the box at the largest text
     size and, with the default wrapping, simply bled past the edge. hyphens breaks it at a
     sensible point where the language allows; overflow-wrap is the guarantee that it is
     broken SOMEWHERE even when no hyphenation point exists (a URL, a long proper noun). */
  hyphens: auto;
  overflow-wrap: break-word;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 2;
  font-family: ui-monospace, monospace;
}
/* Both hints identical, neutral parchment — no red/green valence: neither choice
   should read as the "right" one; the whole point is that both are hard. */
.choice-hint.left,
.choice-hint.right { background: rgba(245,240,230,0.96); color: var(--card-text); border: 1px solid rgba(0,0,0,0.2); box-shadow: 0 2px 10px rgba(0,0,0,0.35); }
.choice-hint.left  { left: 4px; }
.choice-hint.right { right: 4px; }

#thinking { text-align: center; padding: 8px; color: var(--muted); font-size: calc(13px * var(--ui-scale)); }
#thinking .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin: 0 2px; animation: pulse 1s infinite; }
#thinking .dot:nth-child(2) { animation-delay: 0.2s; }
#thinking .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 50% { opacity: 0.2; } }

/* ---- toolbar ---- */
#toolbar { display: flex; justify-content: space-around; padding: 10px 8px 14px; }
#toolbar button {
  background: var(--panel); color: var(--text);
  border: 1px solid #2a3347; border-radius: 20px;
  padding: 8px 16px; font-size: calc(13px * var(--ui-scale)); cursor: pointer;
}
#toolbar button:active { transform: scale(0.96); }

/* ---- toast & confirm (in-DOM replacements for alert/confirm) ---- */
/* z-index above the splash (30) — an error about starting a game has to be visible over
   the splash that's still showing when it fails. */
.toast {
  position: absolute;
  left: 50%; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  max-width: min(88%, 420px);
  padding: 11px 15px;
  background: #2a1214;
  color: #ffd9d2;
  border: 1px solid #6d2a26;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.55);
  font-size: calc(13px * var(--ui-scale));
  line-height: 1.4;
  text-align: center;
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none; /* never blocks a swipe — it's a notice, not a control */
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.confirm-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.62);
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm-box {
  width: 100%; max-width: 320px;
  background: var(--panel);
  border: 1px solid #2b3550;
  border-radius: 14px;
  padding: 20px 18px 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
}
.confirm-text {
  font-size: calc(15px * var(--ui-scale));
  line-height: 1.45;
  margin-bottom: 18px;
  text-align: center;
}
.confirm-actions { display: flex; gap: 10px; }
.confirm-btn {
  flex: 1;
  padding: 11px 12px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #14100a;
  font-family: inherit;
  font-size: calc(14px * var(--ui-scale));
  font-weight: 700;
  cursor: pointer;
}
.confirm-btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid #3a4560;
  font-weight: 500;
}

/* ---- sheets & overlays ---- */
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 15;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 78dvh;
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  z-index: 20;
  transition: transform 0.3s ease, visibility 0.3s;
  display: flex;
  flex-direction: column;
}
.sheet.hidden { transform: translateY(110%); visibility: hidden; display: flex; }
/* While the user is dragging the sheet down, follow the finger 1:1 (no easing);
   the transition is restored on release so the snap-back / close animates. */
.sheet.dragging { transition: none; }
.sheet-header {
  flex-shrink: 0;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 12px 18px 4px;
  cursor: grab; touch-action: none; /* claim the vertical drag so the browser doesn't scroll instead */
}
.sheet-handle { width: 44px; height: 4px; background: #3a4460; border-radius: 2px; }
.sheet-scroll {
  overflow-y: auto; overflow-x: hidden;
  min-height: 0;
  padding: 0 18px calc(20px + env(safe-area-inset-bottom));
}
.sheet h2 { font-size: calc(13px * var(--ui-scale)); letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin: 14px 0 8px; font-family: ui-monospace, monospace; }
.sheet .hint { font-size: calc(13px * var(--ui-scale)); color: var(--muted); margin-bottom: 10px; }
.sheet button {
  margin-top: 10px; width: 100%;
  background: var(--accent); color: #14100a; font-weight: bold;
  border: none; border-radius: 10px; padding: 12px; font-size: calc(14px * var(--ui-scale)); cursor: pointer;
}

.theater {
  background: #0e1420; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  border-left: 3px solid transparent; padding-left: 9px;
}
.theater-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; cursor: pointer; }
.theater.collapsed .theater-head { margin-bottom: 0; }
.theater-name { font-size: calc(15px * var(--ui-scale)); font-weight: bold; min-width: 0; overflow-wrap: break-word; }
.tension-badge { font-size: calc(11px * var(--ui-scale)); font-family: ui-monospace, monospace; padding: 2px 8px; border-radius: 10px; background: #22304a; flex-shrink: 0; }
.tension-badge.hot { background: #5c1f18; color: #ff9d8f; }
.tension-track { height: 5px; background: #232a3a; border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.tension-fill { height: 100%; background: linear-gradient(90deg, var(--ok), var(--accent), var(--danger)); }
/* Reading text in the World panel. 12px was too small to read comfortably on a phone
   (reported); iOS body copy sits around 17px. Sized off --ui-scale so the player can
   push it further from the panel's own control. */
.theater-summary {
  font-size: calc(15px * var(--ui-scale)); line-height: 1.55;
  color: #b6bbcd; overflow-wrap: break-word;
}
/* Section headers inside an expanded theater. Small, uppercase and quiet — they separate
   the live summary from the static background without competing with either. */
/* The decision card's theater label doubles as the way into the World panel. Kept
   deliberately understated — a dotted underline reads as "there's more here" without
   turning the label into a button competing with the swipe. */
#card-theater.tappable { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
#card-theater.tappable:active { opacity: 0.6; }

/* Several beats combined into one acknowledge card. Each keeps its own heading so the
   batch reads as a list of developments, not one run-on paragraph. */
.digest-item { margin-bottom: 14px; }
.digest-item:last-child { margin-bottom: 0; }
.digest-item-theater {
  font-size: calc(9px * var(--ui-scale)); letter-spacing: 0.12em; text-transform: uppercase;
  opacity: 0.6; margin-bottom: 2px;
}
.digest-item-title { font-weight: 700; font-size: calc(14px * var(--ui-scale)); line-height: 1.25; margin-bottom: 3px; }
.digest-item-body { font-size: calc(13px * var(--ui-scale)); line-height: 1.4; opacity: 0.9; }

.theater-section-label {
  font-size: calc(10px * var(--ui-scale)); letter-spacing: 0.14em; text-transform: uppercase;
  color: #8f96ab; margin: 14px 0 4px;
}
.theater-section-label:first-of-type { margin-top: 6px; }
/* Background is reference material, not news. It used to be dimmed with opacity: 0.82 on
   top of --muted, which dropped it under the 4.5:1 AA floor for body text. Distinguished by
   a slightly cooler color instead, holding contrast on the panel. */
.theater-background {
  font-size: calc(15px * var(--ui-scale)); line-height: 1.55;
  color: #a3a9bd; overflow-wrap: break-word;
}
.theater-links { font-size: calc(11px * var(--ui-scale)); color: #7c85a4; margin-top: 6px; font-family: ui-monospace, monospace; line-height: 1.5; overflow-wrap: break-word; }
/* Reading-size control, in the World panel header. Three steps rather than a slider —
   a slider invites fiddling with a value nobody wants to tune precisely. */
.read-size { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.read-size-label {
  font-size: calc(10px * var(--ui-scale)); letter-spacing: 0.12em; text-transform: uppercase;
  color: #8f96ab; font-family: ui-monospace, monospace; margin-right: auto;
}
.read-size button {
  min-width: 34px; padding: 6px 8px; margin: 0;
  background: transparent; color: var(--muted);
  border: 1px solid #2a3347; border-radius: 8px;
  font-family: Georgia, serif; cursor: pointer; line-height: 1;
}
.read-size button[aria-pressed="true"] { background: #22304a; color: var(--text); border-color: #3a4761; }
.read-size button:active { transform: scale(0.95); }
.read-size .rs-s { font-size: 12px; }
.read-size .rs-m { font-size: 15px; }
.read-size .rs-l { font-size: 18px; }

.show-all-theaters {
  width: 100%; margin: 4px 0 6px; padding: 10px;
  background: transparent; color: var(--accent);
  border: 1px solid #2a3347; border-radius: 10px;
  font-family: ui-monospace, monospace; font-size: calc(12px * var(--ui-scale)); letter-spacing: 1px; cursor: pointer;
}
.show-all-theaters:active { transform: scale(0.99); }

.log-entry { font-size: calc(14px * var(--ui-scale)); line-height: 1.5; color: #b6bbcd; padding: 6px 0; border-bottom: 1px solid #1d2536; overflow-wrap: break-word; }
.log-entry b { color: var(--text); font-family: ui-monospace, monospace; font-weight: normal; }
.log-entry.ending { border-left: 2px solid var(--danger); padding-left: 8px; background: #1a0f10; }
.log-entry .ending-tag { display: block; color: var(--danger); font-family: ui-monospace, monospace; font-size: calc(10px * var(--ui-scale)); letter-spacing: 0.5px; margin-top: 4px; }
.log-entry.world-update { border-left: 2px solid #3a8fd6; padding-left: 8px; background: #0e1a24; }
.log-entry .world-update-tag { display: block; color: #3a8fd6; font-family: ui-monospace, monospace; font-size: calc(10px * var(--ui-scale)); letter-spacing: 0.5px; margin-top: 4px; }

.bandwidth-line {
  font-size: calc(11px * var(--ui-scale)); color: var(--accent); font-family: ui-monospace, monospace;
  letter-spacing: 0.5px; margin-bottom: 10px; padding: 6px 10px;
  background: #1d1706; border: 1px solid #3a2f10; border-radius: 8px;
}

.overlay {
  position: absolute; inset: 0; z-index: 30;
  background: radial-gradient(ellipse at top, #182034, var(--bg) 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px;
  transition: opacity 0.4s;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.overlay h1 { font-size: calc(34px * var(--ui-scale)); letter-spacing: 4px; margin-bottom: 12px; color: var(--accent); }
.overlay p { font-size: calc(15px * var(--ui-scale)); line-height: 1.5; color: #cfd3de; max-width: 320px; margin-bottom: 10px; }
.overlay .tagline { color: var(--muted); font-style: italic; }
.overlay button {
  margin-top: 18px; background: var(--accent); color: #14100a;
  border: none; border-radius: 12px; padding: 14px 34px;
  font-size: calc(16px * var(--ui-scale)); font-weight: bold; cursor: pointer; font-family: inherit;
}
.overlay button.secondary { background: transparent; color: var(--text); border: 1px solid #3a4460; margin-top: 10px; }
.overlay button:disabled { opacity: 0.55; cursor: default; }

/* When a saved game exists, "Continue" is the hero and starting fresh is a quiet,
   demoted secondary path — so resuming is unmistakably the obvious action. */
#splash.has-save #new-game-block {
  margin-top: 26px; padding-top: 18px; opacity: 0.8;
  border-top: 1px solid #232a3d;
  display: flex; flex-direction: column; align-items: center;
}
#splash.has-save #splash-start {
  background: transparent; color: var(--muted);
  border: 1px solid #3a4460; padding: 9px 22px; font-size: calc(13px * var(--ui-scale)); font-weight: normal;
}
.hidden { display: none; }

/* ---- sign-in ---- */
.signin-intro {
  margin-top: 22px;
  font-size: calc(13px * var(--ui-scale));
  color: var(--muted);
  max-width: 34ch;
  line-height: 1.5;
}
.signin-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; width: min(100%, 300px); }
.signin-form input {
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid #3a4560;
  background: #10141f;
  color: var(--text);
  font-family: inherit;
  font-size: calc(15px * var(--ui-scale)); /* >=16px effective avoids iOS zoom-on-focus */
}
.signin-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.signin-form button {
  padding: 11px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #14100a;
  font-family: inherit;
  font-size: calc(14px * var(--ui-scale));
  font-weight: 700;
  cursor: pointer;
}
.signin-form button:disabled { opacity: 0.6; cursor: default; }
.signin-status {
  margin-top: 10px;
  min-height: 1.4em;
  max-width: 34ch;
  font-size: calc(12px * var(--ui-scale));
  line-height: 1.45;
  color: var(--muted);
}
/* Visually hidden but read by screen readers — the input has a placeholder, which is not a label. */
.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;
}

.signin-note {
  margin-top: 8px;
  max-width: 34ch;
  font-size: calc(11px * var(--ui-scale));
  line-height: 1.5;
  color: var(--muted);
  opacity: 0.85;
}

/* Secondary action: the code path is equal in importance to the link but shouldn't compete
   visually with the primary "Send my link" button above it. */
.ghost-btn {
  background: transparent !important;
  color: var(--text) !important;
  border: 1px solid #3a4560 !important;
  font-weight: 500 !important;
}
#signin-code { text-transform: uppercase; letter-spacing: 2px; text-align: center; }
#signin-code::placeholder { text-transform: none; letter-spacing: 0; text-align: center; }

/* ---- first-run tutorial ---- */
/* A bottom panel plus a highlight ring on the real element, rather than a dimming overlay with a
   cut-out. Cut-outs need per-element geometry that breaks on every screen size the game supports;
   a ring is positional-math-free and survives the card resizing with --ui-scale. */
.tutorial {
  position: absolute;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(92%, 400px);
  background: var(--panel);
  border: 1px solid #2b3550;
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 14px 16px 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  z-index: 25; /* above the game, below sheets (30) so the World panel still covers it */
}
.tut-text {
  font-size: calc(14px * var(--ui-scale));
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 12px;
}
.tut-text em { color: var(--accent); font-style: normal; }
.tut-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tut-dots { display: flex; gap: 6px; }
.tut-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #3a4560; display: block;
}
.tut-dots i.on { background: var(--accent); }
.tut-next {
  background: var(--accent); color: #14100a; border: 0; border-radius: 8px;
  padding: 9px 18px; font-family: inherit; font-size: calc(13px * var(--ui-scale));
  font-weight: 700; cursor: pointer;
}
.tut-skip {
  background: transparent; color: var(--muted); border: 0;
  font-family: inherit; font-size: calc(12px * var(--ui-scale)); cursor: pointer;
  text-decoration: underline; padding: 4px;
}

/* The highlight itself. outline (not border) so it never changes layout — a border would resize
   the card mid-tutorial and shift everything under it. */
.tut-spot {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
  animation: tut-pulse 1.8s ease-in-out infinite;
}
@keyframes tut-pulse {
  0%, 100% { outline-color: var(--accent); }
  50%      { outline-color: rgba(200, 162, 74, 0.35); }
}
@media (prefers-reduced-motion: reduce) {
  .tut-spot { animation: none; }
}

/* Panel flips above the card when it would otherwise cover the element it is highlighting. */
.tutorial.top {
  bottom: auto;
  top: calc(12px + env(safe-area-inset-top, 0px));
}
