/* ============================================================
   fengshui-room.css — the Commanding Position interactive.
   Dark-glow design language (doc 09). The whole tool reads as a
   level-3 "raised" surface: a base gradient, a persistent quiet
   bloom, a moonlit top rim, hairline dividers, editorial spacing.

   Tokens rule everything for color / space / motion. The room and
   the bed use tasteful LITERAL wood / linen / glass tones so the
   plan reads like a warm architectural drawing at dusk, while the
   GLOW and every active state stay on --accent (jade on this page,
   which is scoped .section--fengshui) so the luxury layer re-tints
   with the section. Motion is opacity + transform only; no blur is
   animated; every animation is guarded by prefers-reduced-motion.

   NOTE ON LOCAL TOKENS: doc 09 §1's glow tokens (--surf-2,
   --moonlight, --halo, --hairline-accent) are not declared globally
   in tokens.css, so — exactly as animal-sections.css does — we
   declare self-contained helper tokens scoped to .fsr-tool, derived
   from the real tokens. No global token is renamed or redefined.

   All selectors are prefixed .fsr- so they never collide with the
   .pf-* shell.
   ============================================================ */

/* ============================================================
   0. SCOPED HELPER TOKENS  (self-contained; derived from tokens.css)
   ============================================================ */
.fsr-tool {
  /* --- glow layer, per doc 09, derived locally from --accent --- */
  --fsr-halo:      0 0 18px var(--accent-soft);
  --fsr-ember:     0 0 8px var(--accent-soft);
  --fsr-moonlight: radial-gradient(
                     620px 380px at var(--fsr-bloom-x, 82%) var(--fsr-bloom-y, -12%),
                     var(--accent-soft), transparent 68%);
  --fsr-hairline-accent: linear-gradient(90deg,
                     transparent,
                     oklch(from var(--accent) l c h / 0.42) 30%,
                     oklch(from var(--accent) l c h / 0.42) 70%,
                     transparent);
  --fsr-surf: linear-gradient(168deg,
                color-mix(in oklab, var(--panel-2) 88%, var(--accent) 12%),
                var(--panel) 72%);

  /* --- literal architectural palette (room + bed realism) --- */
  --fsr-floor:    #16181f;   /* deep charcoal timber (board-wrap floor edge) */
  --fsr-floor-2:  #1c1f28;   /* lit floorboard tone (svg floor fill) */
  --fsr-grid:     rgba(214, 193, 140, 0.055);
  --fsr-wall:     #414560;
  --fsr-window:   #93c6ec;
  --fsr-window-2: #bfe0f7;
  --fsr-beam:     #7c5b41;
  --fsr-beam-2:   #916b4c;   /* lit grain edge */
  --fsr-mirror:   #b7dcec;
  --fsr-bed-frame:#2a2723;   /* deep warm walnut frame */
  --fsr-bed-mat:  #cfc2a0;   /* warm linen mattress */
  --fsr-headboard:#b79a63;   /* warm oak headboard */
  --fsr-headboard-2:#d8c090; /* headboard lit edge */
  --fsr-linen:    #ded2b0;   /* linen trim / stitch line */
  --fsr-pillow:   #f4ecd6;

  /* --- feedback tones (calm, never alarming) --- */
  --fsr-good:     var(--jade,   #78c39c);
  --fsr-warn:     var(--brass,  #d6c18c);
  --fsr-bad:      var(--rose-dim,#c07f78);
  --fsr-tip:      var(--silver, #aebfe0);

  margin: var(--s-6, 2rem) 0;
}

/* color-mix / relative-color fallbacks (keeps the ~5% legible) */
@supports not (color: color-mix(in oklab, red, blue)) {
  .fsr-tool { --fsr-surf: linear-gradient(168deg, var(--panel-2), var(--panel) 72%); }
}
@supports not (color: oklch(from white l c h)) {
  .fsr-tool {
    --fsr-hairline-accent: linear-gradient(90deg, transparent,
                             var(--accent-soft) 30%, var(--accent-soft) 70%, transparent);
    --fsr-moonlight: radial-gradient(620px 380px at var(--fsr-bloom-x,82%) var(--fsr-bloom-y,-12%),
                       var(--accent-soft), transparent 68%);
  }
}

/* ============================================================
   1. FALLBACK — server-rendered, crawlable, shown until JS hydrates
   ============================================================ */
.fsr-fallback { display: block; }
#fsr-root.fsr-ready .fsr-fallback { display: none; }

/* the static labeled diagram in the fallback, framed like the live board */
.fsr-static {
  display: block;
  width: 100%;
  max-width: 560px;
  margin: var(--s-5, 1.5rem) auto var(--s-2, 0.5rem);
  border: 1px solid var(--line);
  border-radius: var(--r-2, 14px);
  background:
    radial-gradient(120% 96% at 82% -8%, var(--accent-soft), transparent 60%),
    var(--fsr-floor);
  box-shadow: var(--e-1);
}
.fsr-static-cap {
  text-align: center;
  color: var(--muted);
  font: 400 var(--fs-small, 0.8125rem)/1.55 var(--mono, monospace);
  letter-spacing: 0.06em;
  max-width: 46ch;
  margin: var(--s-3, 0.75rem) auto 0;
}

/* ============================================================
   2. THE TOOL AS A LEVEL-3 RAISED SURFACE
   ------------------------------------------------------------
   #fsr-root becomes the raised panel: gradient base, a persistent
   quiet bloom (pseudo-element opacity, never a shadow loop), a
   moonlit top rim, generous padding, a hairline frame.
   ============================================================ */
#fsr-root.fsr-ready {
  position: relative;
  isolation: isolate;
  background: var(--fsr-surf);
  border: 1px solid var(--line);
  border-radius: var(--r-3, 22px);
  box-shadow: var(--e-2);
  padding: clamp(1rem, 3.2vw, 2.25rem);
  overflow: hidden;                 /* clips the bloom to the rounded panel */
}
/* persistent quiet corner bloom (opacity only; breathes on capable displays) */
#fsr-root.fsr-ready::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--fsr-moonlight);
  opacity: 0.5;
  pointer-events: none;
}
/* moonlit top rim — the raised-surface signature */
#fsr-root.fsr-ready::after {
  content: "";
  position: absolute;
  top: 0; left: 7%; right: 7%;
  height: 1px;
  background: var(--fsr-hairline-accent);
  pointer-events: none;
}

/* ============================================================
   3. STUDIO STAGE — a hero column beside a calm reading rail
   ------------------------------------------------------------
   The board is the hero. The LEFT (hero) column reads top to bottom:
   a status header (tabs + note + brief + score meter) directly above
   the board, then the board, then a slim toolbar. A calm RIGHT rail
   holds the feedback critiques, the Kua pro layer, and the share card.
   On narrow widths everything stacks: header, board, toolbar, rail.
   ============================================================ */
.fsr-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(300px, 0.72fr);
  gap: clamp(1.5rem, 3.4vw, 2.75rem);
  align-items: start;
}
@media (max-width: 820px) {
  .fsr-stage { grid-template-columns: 1fr; gap: var(--s-6, 2rem); }
}

/* the hero column: status header, board, then toolbar */
.fsr-hero {
  display: flex;
  flex-direction: column;
  gap: var(--s-4, 1rem);
  min-width: 0;
}

/* ---- the status header directly above the board ----
   Holds the tabs, the mode note, the puzzle brief, and the score
   meter, stacked, so the live score and the guidance stay in view
   while the bed / beam / mirror are being dragged on the board. */
.fsr-header {
  display: flex;
  flex-direction: column;
  gap: var(--s-4, 1rem);
  min-width: 0;
}

/* ---- the board frame: an inset well, floor-lit, its own quiet bloom ---- */
.fsr-board-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-2, 14px);
  background:
    radial-gradient(130% 100% at 16% -6%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--fsr-floor-2), var(--fsr-floor) 70%);
  padding: clamp(8px, 1.6vw, 16px);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.04), var(--e-1);
  isolation: isolate;
}
.fsr-board {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(var(--r-2, 14px) - 5px);
  outline: none;
  touch-action: none;         /* pointer drag on touch without scrolling */
  -webkit-tap-highlight-color: transparent;
}
.fsr-board:focus-visible {
  box-shadow: 0 0 0 3px var(--sec-soft, rgba(174,191,224,.30)), var(--fsr-halo);
}

/* ============================================================
   3b. THE SLIM TOOLBAR — directly under the board
   ------------------------------------------------------------
   Action pills in a clean row on the left; Reset demoted to a quiet
   ghost link set apart on the far right. A hairline top divider ties
   it to the board above.
   ============================================================ */
/* The toolbar now lives in the right rail, below the critique cards, so it
   stacks in a narrow column: the action pills share a wrapping row, and the
   demoted Reset sits on its own line, right-aligned. */
.fsr-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3, 0.75rem);
  margin-top: var(--s-4, 1rem);
  padding: var(--s-4, 1rem) 0 0;
  border-top: 1px solid transparent;
  border-image: var(--fsr-hairline-accent) 1;
}
.fsr-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2, 0.5rem);
  width: 100%;
  flex-wrap: wrap;
}
.fsr-toolbar-actions .fsr-btn { flex: 1 1 auto; }
/* reset lives apart, on its own line, pushed to the far right */
.fsr-toolbar-reset {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* ============================================================
   4. SVG ROOM  —  a warm plan at dusk
   ============================================================ */
/* --- layer groups (structural). The compass sits beneath the room;
       fixtures and the room carry their parts. Kept light so children
       own the paint, but the groups are addressable per the contract. --- */
.fsr-g-room { pointer-events: none; }        /* room is scenery, not a target */
.fsr-g-fix  { pointer-events: none; }        /* fixtures paint; grips opt back in */
.fsr-g-compass { pointer-events: none; }
.fsr-beam.is-draggable, .fsr-beam.fsr-grip,
.fsr-mirror.is-draggable, .fsr-mirror.fsr-grip { pointer-events: auto; }  /* draggable fixtures reclaim it */

/* floor: a lit floorboard tone; the warm dusk pool is painted by the
   board-wrap frame behind it and the panel bloom above (a single SVG
   rect cannot gradient without <defs>, which only the JS owns) */
.fsr-floor {
  fill: var(--fsr-floor-2);
}
/* refined grid: two-weight hairlines would need JS; a single very low-contrast
   stroke reads as drafting paper without noise */
.fsr-grid { stroke: var(--fsr-grid); stroke-width: 1; }

/* walls: solid frame with a faint inner shadow line for depth (JS draws one
   stroked rect; we thicken + warm it, and let the floor pool imply the depth) */
.fsr-wall {
  fill: none;
  stroke: var(--fsr-wall);
  stroke-width: 7;
  stroke-linejoin: round;
}

/* ---- door: erase the wall, lay a jade sill, a fine luminous swing ---- */
.fsr-door-gap  { stroke: var(--fsr-floor-2); stroke-width: 10; }
.fsr-door-line { stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.fsr-door-leaf { stroke: var(--accent); stroke-width: 2; opacity: 0.7; stroke-linecap: round; }
.fsr-door-arc  {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.1;
  stroke-dasharray: 2.5 4;
  opacity: 0.45;
}

/* ---- window: a cool glassy segment ---- */
.fsr-window {
  stroke: var(--fsr-window);
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.92;
}

/* ---- mirror: a bright reflective sliver ---- */
.fsr-mirror {
  stroke: var(--fsr-mirror);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 1.5 3;
  opacity: 0.95;
}

/* ---- beam: a heavy warm timber band with a grain hint ---- */
.fsr-beam {
  fill: var(--fsr-beam);
  opacity: 0.5;
  stroke: var(--fsr-beam-2);
  stroke-width: 1;
  stroke-opacity: 0.5;
}

/* ---- labels: mono, letterspaced, small, fully inside the frame ---- */
.fsr-fix-label,
.fsr-door-text,
.fsr-window-text,
.fsr-mirror-text {
  font: 400 10px var(--mono, monospace);
  font-weight: 700;
  letter-spacing: 0.16em;
  fill: var(--muted);
}
.fsr-door-text   { fill: var(--accent-bright); }
.fsr-window-text { fill: var(--fsr-window-2); }
.fsr-mirror-text { fill: var(--fsr-mirror); }
.fsr-fix-label   { fill: var(--fsr-headboard-2); opacity: 0.9; }

/* ---- line of sight ---- */
.fsr-sight {
  stroke-width: 2;
  stroke-dasharray: 5 6;
  stroke-linecap: round;
  opacity: 0.85;
}
.fsr-sight.is-clear   { stroke: var(--fsr-good); }
.fsr-sight.is-blocked { stroke: var(--fsr-bad); opacity: 0.7; }

/* ============================================================
   5. THE BED  —  reads as a bed, glows gently in command
   ============================================================ */
.fsr-g-bed { cursor: grab; }
.fsr-g-bed.is-dragging { cursor: grabbing; }

/* soft cast shadow beneath the whole bed */
.fsr-bed-shadow { fill: rgba(0, 0, 0, 0.34); }

/* walnut frame (thin border rail around the mattress) */
.fsr-bed-frame {
  fill: var(--fsr-bed-frame);
  stroke: var(--fsr-linen);
  stroke-width: 1.4;
  stroke-opacity: 0.5;
  transition: stroke var(--dur, 320ms) var(--ease-io, ease),
              stroke-opacity var(--dur, 320ms) var(--ease-io, ease);
}
/* linen mattress */
.fsr-bed-mattress { fill: var(--fsr-bed-mat); }
/* duvet body over the mattress */
.fsr-bed-duvet { fill: #d8ccac; }
/* the turned-down duvet fold — a lighter linen band with a crisp edge */
.fsr-bed-fold { fill: #e7dcc0; }
.fsr-bed-fold-line { stroke: #bcae88; stroke-width: 1; stroke-opacity: 0.7; fill: none; }
/* subtle center seam down the duvet */
.fsr-bed-seam { stroke: #c3b58e; stroke-width: 1; stroke-opacity: 0.45; }

/* headboard: clearly heavier + warmer, with a lit top edge */
.fsr-bed-head {
  fill: var(--fsr-headboard);
  stroke: var(--fsr-headboard-2);
  stroke-width: 1;
  stroke-opacity: 0.75;
}
.fsr-bed-head-hi { fill: var(--fsr-headboard-2); opacity: 0.55; }
/* headboard inner tufting lines */
.fsr-bed-head-line { stroke: #8f7748; stroke-width: 1; stroke-opacity: 0.5; }

/* pillows — soft, rounded, with a faint shading edge and center crease */
.fsr-bed-pillow {
  fill: var(--fsr-pillow);
  opacity: 0.96;
  stroke: #d8cca8;
  stroke-width: 0.8;
  stroke-opacity: 0.6;
}
.fsr-bed-pillow-crease { stroke: #d3c7a2; stroke-width: 0.9; stroke-opacity: 0.55; fill: none; }
.fsr-bed-hit { fill: transparent; }

.fsr-bed-label {
  font: 700 8.5px var(--mono, monospace);
  letter-spacing: 0.14em;
  pointer-events: none;
}
.fsr-bed-label-head { fill: #241d0d; }
.fsr-bed-label-foot { fill: #7d735a; }

/* --- bed in command: when the meter reads high, the frame takes a jade halo.
       We cannot add a class to the bed group without touching the JS, so we
       reveal a glow on the WHOLE board via the meter's state class through a
       shared ancestor. #fsr-bar-fill.is-high is toggled by the JS on a high
       score; we mirror that intent by lighting the bed frame when the board
       is in focus (keyboard command) OR hovered. The elegant resting look is
       preserved; the halo is a reward, never a loop. --- */
.fsr-board:focus-visible .fsr-bed-frame,
.fsr-g-bed.is-bed-hover .fsr-bed-frame,
.fsr-g-bed.is-dragging .fsr-bed-frame {
  stroke: var(--accent);
  stroke-opacity: 1;
}

/* ---- rotate handle: a clean clockwise circular arrow, hidden at rest ---- */
.fsr-rotate {
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--dur, 320ms) var(--ease-io, ease);
  pointer-events: auto;
}
.fsr-g-bed.is-bed-hover .fsr-rotate,
svg.fsr-board:focus .fsr-rotate,
svg.fsr-board:focus-visible .fsr-rotate {
  opacity: 1;
}
.fsr-rotate-hit { fill: transparent; }
.fsr-rotate-bg {
  fill: oklch(from var(--ink) l c h / 0.82);
  stroke: var(--accent);
  stroke-width: 1;
  stroke-opacity: 0.55;
}
@supports not (color: oklch(from white l c h)) {
  .fsr-rotate-bg { fill: rgba(13, 14, 24, 0.82); }
}
.fsr-rotate-arc { stroke: var(--accent-bright); stroke-width: 1.7; stroke-linecap: round; fill: none; }
.fsr-rotate-arrow { fill: var(--accent-bright); stroke: none; }
.fsr-rotate:hover .fsr-rotate-bg { stroke-opacity: 1; }
.fsr-rotate:focus-visible { outline: none; }
.fsr-rotate:focus-visible .fsr-rotate-bg {
  stroke-opacity: 1;
  filter: drop-shadow(0 0 4px var(--accent-soft));
}

/* ---- draggable fixtures (beam / mirror): read as movable ---- */
.fsr-grip,
.is-draggable { cursor: grab; }
.fsr-grip:active,
.is-draggable:active { cursor: grabbing; }
/* a subtle hover highlight so they announce themselves as movable */
.fsr-beam.is-draggable,
.fsr-mirror.is-draggable,
.fsr-beam.fsr-grip,
.fsr-mirror.fsr-grip {
  transition: opacity var(--dur-fast, 180ms) var(--ease-io, ease),
              stroke-opacity var(--dur-fast, 180ms) var(--ease-io, ease),
              stroke-width var(--dur-fast, 180ms) var(--ease-io, ease);
}
.fsr-beam.is-draggable:hover,
.fsr-beam.fsr-grip:hover { opacity: 0.68; stroke-opacity: 0.85; }
.fsr-mirror.is-draggable:hover,
.fsr-mirror.fsr-grip:hover { opacity: 1; stroke-width: 5; }

/* ============================================================
   6. COMPASS RING (Kua layer)
   ============================================================ */
.fsr-ring {
  fill: none;
  stroke: var(--accent-dim);
  stroke-width: 1;
  stroke-dasharray: 1.5 6;
  opacity: 0.5;
}
.fsr-compass-tick {
  font: 700 10px var(--mono, monospace);
  fill: var(--faint);
  letter-spacing: 0.06em;
}
.fsr-compass-tick.is-fav { fill: var(--accent-bright); }
.fsr-compass-dot.is-fav  { fill: var(--accent); }

/* ============================================================
   7. RIGHT RAIL + STATUS-HEADER PARTS
   ------------------------------------------------------------
   The rail (critiques, Kua, share) is a calm column beside the board.
   The tabs, mode note, puzzle brief and score meter live in the
   status header ABOVE the board; their styles follow here.
   ============================================================ */
.fsr-rail {
  display: flex;
  flex-direction: column;
  gap: var(--s-5, 1.5rem);
  min-width: 0;
}

/* ---- tabs: an elegant segmented control ---- */
.fsr-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: var(--field, #0c0e1a);
  border: 1px solid var(--line);
  border-radius: var(--r-pill, 999px);
  align-self: start;
}
.fsr-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 0.84rem/1 var(--sans);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  min-height: 40px;
  border-radius: var(--r-pill, 999px);
  cursor: pointer;
  transition: color var(--dur-fast, 180ms) var(--ease-io, ease),
              background-color var(--dur-fast, 180ms) var(--ease-io, ease);
}
.fsr-tab:hover { color: var(--ivory); }
.fsr-tab.is-active,
.fsr-tab[aria-selected="true"] {
  color: var(--cta-text, #1a160a);
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  box-shadow: 0 2px 10px var(--accent-soft);
}
.fsr-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--sec-soft, rgba(174,191,224,.30));
}

/* ---- mode note: a quiet caption under the tabs ---- */
.fsr-mode-note {
  margin: 0;
  color: var(--muted);
  font: 400 var(--fs-small, 0.8125rem)/1.55 var(--sans);
  max-width: 46ch;
}
/* pull the caption tighter to its tabs than the header's flex rhythm */
.fsr-tabs + .fsr-mode-note { margin-top: calc(var(--s-4, 1rem) * -0.5); }

/* ---- puzzle brief ---- */
.fsr-brief {
  position: relative;
  padding: 2px 0 2px var(--s-5, 1.5rem);
}
.fsr-brief::before {
  content: "";
  position: absolute;
  left: 0; top: 3px; bottom: 3px;
  width: 2px;
  border-radius: var(--r-pill, 999px);
  background: linear-gradient(180deg, var(--accent), transparent);
}
.fsr-brief-name {
  font: italic 500 1.2rem/1.3 var(--serif);
  color: var(--accent-bright);
  margin: 0 0 5px;
  text-wrap: balance;
}
.fsr-brief-note {
  color: var(--body-text);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0;
}

/* ---- score meter: a refined bar, elegant serif number ---- */
.fsr-meter {
  position: relative;
  background:
    radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 52%),
    var(--field, #0c0e1a);
  border: 1px solid var(--line);
  border-radius: var(--r-2, 14px);
  padding: var(--s-4, 1rem) var(--s-5, 1.5rem) var(--s-5, 1.5rem);
  overflow: hidden;
}
.fsr-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3, 0.75rem);
  margin-bottom: var(--s-4, 1rem);
}
.fsr-meter-label {
  font: 400 0.68rem/1.3 var(--mono, monospace);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}
.fsr-score {
  font: 500 2rem/0.9 var(--serif);
  color: var(--moon);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fsr-score small {
  font: 400 0.85rem var(--mono, monospace);
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-left: 2px;
}
.fsr-bar {
  position: relative;
  height: 9px;
  border-radius: var(--r-pill, 999px);
  background: oklch(from var(--ink) l c h / 0.7);
  box-shadow: inset 0 1px 2px oklch(0 0 0 / 0.4);
  overflow: hidden;
}
@supports not (color: oklch(from white l c h)) {
  .fsr-bar { background: rgba(13, 14, 24, 0.7); }
}
.fsr-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent-dim);
  transition: width var(--dur, 320ms) var(--ease-out),
              background-color var(--dur, 320ms) var(--ease-io, ease);
}
/* low = a muted warm brass (never an alarming red) */
.fsr-bar > i.is-low  { background: var(--fsr-warn); }
.fsr-bar > i.is-mid  { background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }
.fsr-bar > i.is-high {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  box-shadow: 0 0 14px var(--accent-soft);
}

/* ---- readout: feedback chips, one leading tone dot ---- */
.fsr-readout {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-3, 0.75rem);
}
.fsr-line {
  position: relative;
  padding: 11px 14px 11px 32px;
  border: 1px solid var(--line);
  border-left-width: 2px;
  border-radius: var(--r-1, 8px);
  background: oklch(from var(--ink-2) l c h / 0.7);
  color: var(--body-text);
  font-size: 0.9rem;
  line-height: 1.55;
}
@supports not (color: oklch(from white l c h)) {
  .fsr-line { background: var(--ink-2); }
}
.fsr-line::before {
  content: "";
  position: absolute;
  left: 13px; top: 16px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
/* good — jade dot, faintly lit; the copy warms to ivory */
.fsr-line-good {
  color: var(--ivory);
  border-left-color: color-mix(in oklab, var(--fsr-good) 55%, var(--line));
}
.fsr-line-good::before { background: var(--fsr-good); box-shadow: var(--fsr-ember); }
/* warn — amber dot */
.fsr-line-warn { border-left-color: color-mix(in oklab, var(--fsr-warn) 50%, var(--line)); }
.fsr-line-warn::before { background: var(--fsr-warn); }
/* bad — muted rose dot */
.fsr-line-bad { border-left-color: color-mix(in oklab, var(--fsr-bad) 50%, var(--line)); }
.fsr-line-bad::before { background: var(--fsr-bad); }
/* tip — soft accent dot */
.fsr-line-tip { border-left-color: color-mix(in oklab, var(--fsr-tip) 45%, var(--line)); }
.fsr-line-tip::before { background: var(--fsr-tip); }
.fsr-line strong { color: var(--moon); font-weight: 600; }

@supports not (color: color-mix(in oklab, red, blue)) {
  .fsr-line-good, .fsr-line-warn, .fsr-line-bad, .fsr-line-tip { border-left-color: var(--line); }
}

/* ---- controls: the primary action pills (live in the toolbar) ---- */
.fsr-btn {
  appearance: none;
  cursor: pointer;
  font: 600 0.85rem/1 var(--sans);
  color: var(--ivory);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-1, 8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  min-height: 44px;              /* comfortable touch target */
  transition: border-color var(--dur-fast, 180ms) var(--ease-io, ease),
              color var(--dur-fast, 180ms) var(--ease-io, ease),
              background-color var(--dur-fast, 180ms) var(--ease-io, ease),
              transform var(--dur-fast, 180ms) var(--ease-io, ease);
}
.fsr-btn:hover {
  border-color: var(--accent);
  color: var(--moon);
  transform: translateY(-1px);
}
.fsr-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--sec-soft, rgba(174,191,224,.30)), var(--fsr-halo);
}
.fsr-btn:active { transform: translateY(0); }
.fsr-btn svg { display: block; }

/* ---- Reset room: a small, quiet ghost/text control, structurally
   distinct from the pills and demoted to the toolbar's right edge ---- */
.fsr-btn-reset {
  appearance: none;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font: 500 0.78rem/1 var(--sans);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  min-height: 32px;              /* smaller than the 44px pills */
  border-radius: 4px;
  transition: color var(--dur-fast, 180ms) var(--ease-io, ease),
              border-color var(--dur-fast, 180ms) var(--ease-io, ease);
}
.fsr-btn-reset svg {
  display: block;
  opacity: 0.7;
  transition: opacity var(--dur-fast, 180ms) var(--ease-io, ease);
}
.fsr-btn-reset:hover {
  color: var(--accent-bright);
  border-bottom-color: color-mix(in oklab, var(--accent) 40%, transparent);
}
.fsr-btn-reset:hover svg { opacity: 1; }
.fsr-btn-reset:focus-visible {
  outline: none;
  color: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--sec-soft, rgba(174,191,224,.30));
  border-radius: 6px;
}
@supports not (color: color-mix(in oklab, red, blue)) {
  .fsr-btn-reset:hover { border-bottom-color: rgba(120, 195, 156, 0.4); }
}

/* toggle on/off state, read cleanly */
.fsr-toggle.is-on {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: var(--accent-soft);
}

/* the primary "Check my placement" is the tool's brightest object.
   It is the one sheening element (per doc 09 the CTA is the only
   hover-sheen object); it carries a resting glow and the sweep. */
@keyframes fsr-sheen {
  from { background-position: -160% 50%, 0% 50%; }
  to   { background-position:  250% 50%, 95% 50%; }
}
.fsr-btn-primary {
  color: var(--cta-text, #1a160a);
  background:
    linear-gradient(105deg,
      rgba(255,255,255,0) 42%,
      rgba(255,255,255,.5) 50%,
      rgba(255,255,255,0) 58%) no-repeat,
    linear-gradient(135deg, var(--accent-bright), var(--accent));
  background-size: 220% 100%, 180% 180%;
  background-position: -160% 50%, 0% 50%;
  border-color: transparent;
  box-shadow: 0 4px 18px var(--accent-soft);
  padding: 0 22px;
}
.fsr-btn-primary:hover,
.fsr-btn-primary:focus-visible {
  color: var(--cta-text, #1a160a);
  animation: fsr-sheen 0.7s ease forwards;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--accent-soft), 0 0 0 3px var(--sec-soft, rgba(174,191,224,.30));
}
.fsr-btn-primary:active { transform: translateY(0) scale(0.98); }

/* ============================================================
   8. KUA PANEL  (progressive "pro layer")
   ============================================================ */
.fsr-kua {
  border-top: 1px solid transparent;
  border-image: var(--fsr-hairline-accent) 1;
  padding-top: var(--s-5, 1.5rem);
}
.fsr-kua-details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--s-3, 0.75rem);
  font: italic 400 1.02rem/1.4 var(--serif);
  color: var(--body-text);
  padding: 4px 0;
  transition: color var(--dur-fast, 180ms) var(--ease-io, ease);
}
.fsr-kua-details > summary::-webkit-details-marker { display: none; }
.fsr-kua-details > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--accent);
  box-shadow: var(--fsr-ember);
}
.fsr-kua-details > summary:hover,
.fsr-kua-details > summary:focus-visible {
  color: var(--accent-bright);
  outline: none;
}
.fsr-kua-intro {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.62;
  margin: var(--s-3, 0.75rem) 0;
  max-width: 60ch;
}
.fsr-kua-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3, 0.75rem) var(--s-4, 1rem);
  align-items: end;
}
.fsr-field { display: block; }
.fsr-field > span {
  display: block;
  font: 400 0.72rem/1 var(--mono, monospace);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.fsr-field input[type="date"] {
  padding: 0 12px;
  min-height: 44px;
  border-radius: var(--r-1, 8px);
  border: 1px solid var(--line);
  background: var(--field, #0c0e1a);
  color: var(--moon);
  font: 400 0.9rem var(--sans);
  color-scheme: dark;
}
.fsr-field input[type="date"]:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--sec-soft, rgba(174,191,224,.30));
}
.fsr-kua-sex {
  display: inline-flex;
  gap: 16px;
  align-items: center;
  color: var(--body-text);
  font-size: 0.9rem;
  min-height: 44px;
}
.fsr-kua-sex label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.fsr-kua-sex input { accent-color: var(--accent); }
.fsr-kua-out { margin-top: var(--s-4, 1rem); }
.fsr-kua-num {
  font: 500 1.08rem var(--serif);
  color: var(--moon);
  margin: 0 0 var(--s-3, 0.75rem);
}
.fsr-kua-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--s-3, 0.75rem);
  display: grid;
  gap: 8px;
}
.fsr-kua-list li {
  background: oklch(from var(--panel) l c h / 0.8);
  border: 1px solid var(--line);
  border-radius: var(--r-1, 8px);
  padding: 11px 15px;
  color: var(--body-text);
  font-size: 0.88rem;
  line-height: 1.5;
}
@supports not (color: oklch(from white l c h)) {
  .fsr-kua-list li { background: var(--panel); }
}
.fsr-kua-list strong { color: var(--moon); font-weight: 600; }

/* ============================================================
   9. SHARE CARD  (a level-4 ceremony moment on solve)
   ============================================================ */
.fsr-share-card {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(560px 340px at 18% -14%, var(--accent-soft), transparent 66%),
    radial-gradient(480px 300px at 92% 6%, var(--season-soft, rgba(174,191,224,.14)), transparent 70%),
    var(--fsr-surf);
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-2, 14px);
  padding: var(--s-5, 1.5rem);
  box-shadow: var(--e-2);
  overflow: hidden;
  outline: none;
}
.fsr-share-card::after {                /* moonlit rim */
  content: "";
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: var(--fsr-hairline-accent);
  pointer-events: none;
}
.fsr-share-eyebrow {
  font: 400 1.5rem/1 var(--serif);
  color: var(--accent-bright);
  margin: 0 0 8px;
  text-shadow: 0 0 26px var(--accent-soft);
}
.fsr-share-title {
  font: 600 1.35rem/1.2 var(--serif);
  color: var(--moon);
  margin: 0 0 8px;
}
.fsr-share-sub {
  color: var(--body-text);
  font-size: 0.92rem;
  line-height: 1.62;
  margin: 0 0 var(--s-4, 1rem);
  max-width: 52ch;
}
.fsr-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2, 0.5rem);
}
.fsr-share-copied {
  color: var(--fsr-good);
  font-size: 0.82rem;
  margin: var(--s-3, 0.75rem) 0 0;
}

/* ============================================================
   10. MOTION  —  entrance + persistent bloom breath.
   Opacity + transform only. All disabled under reduced motion.
   ============================================================ */
@keyframes fsr-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.fsr-rise { animation: fsr-rise var(--dur-slow, 640ms) var(--ease-out) both; }

/* the raised panel's persistent bloom breathes, quietly (opacity of a
   pre-rendered gradient pseudo-element — compositor-friendly, one loop) */
@keyframes fsr-breath {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.62; }
}
@media (prefers-reduced-motion: no-preference) {
  #fsr-root.fsr-ready::before {
    animation: fsr-breath 8s var(--ease-io, ease-in-out) infinite;
  }
}

/* ============================================================
   11. MOBILE  —  everything stacks: header, board, toolbar, rail.
   Matches the .fsr-stage collapse at 820px so the stack + the touch
   refinements arrive together. Nothing clipped; >=44px targets.
   ============================================================ */
@media (max-width: 820px) {
  #fsr-root.fsr-ready { padding: clamp(0.85rem, 4vw, 1.35rem); border-radius: var(--r-2, 14px); }
  .fsr-tabs { align-self: stretch; }
  .fsr-tab { flex: 1; text-align: center; }
}
@media (max-width: 560px) {
  .fsr-toolbar { flex-wrap: wrap; }
  .fsr-toolbar-actions { width: 100%; }
  .fsr-toolbar-actions .fsr-btn { flex: 1 1 auto; }
  .fsr-toolbar-reset { margin-left: 0; width: 100%; justify-content: flex-end; padding-top: 4px; }
  .fsr-meter { padding: var(--s-4, 1rem); }
}
@media (max-width: 420px) {
  .fsr-score { font-size: 1.8rem; }
  .fsr-kua-form { align-items: stretch; }
  .fsr-field, .fsr-field input[type="date"] { width: 100%; }
}

/* ============================================================
   12. REDUCED MOTION  —  neutralize transitions/entrances/loops.
   The tool stays fully legible and glows at rest.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .fsr-rise { animation: none; }
  #fsr-root.fsr-ready::before { animation: none; opacity: 0.5; }
  .fsr-g-bed,
  .fsr-bed-frame,
  .fsr-rotate,
  .fsr-bar > i,
  .fsr-btn,
  .fsr-btn-reset,
  .fsr-btn-reset svg,
  .fsr-tab,
  .fsr-kua-details > summary,
  .fsr-beam,
  .fsr-mirror { transition: none; }
  .fsr-btn:hover,
  .fsr-btn-primary:hover,
  .fsr-btn-primary:focus-visible,
  .fsr-btn-reset:hover { transform: none; animation: none; }
}
