/* Anagram Flow pages (templates/anagram_game/challenges.html, #350).
   The puzzle screen: one accent, the logo's teal, for progress, the cursor
   and the main button; gold marks tips; coral means a wrong step. Tiles are
   the shared maple tile (.gt.maple in shared/css/game-ui.css); the states
   below are Flow's slot, caret, have, to-add, tip and reached. Nothing is
   red or green, and every state also reads without color.
   Contrast (#138, WCAG AA): white text sits on --fl-teal-dark (5.5:1; the
   brand teal is 4.3:1) and grey text is at least 4.5:1 on the page; the
   table is in flutter/anagram_flow/DESIGN.md. */
:root {
  --fl-teal: #1f8a70;
  --fl-teal-dark: #17765f;
  --fl-ground: #f2f6f4;
  --fl-card: #ffffff;
  --fl-line: #dbe5e1;
  --fl-ink: #1c2333;
  --fl-muted: #5f6f6a;
  --fl-quiet: #33504a;
  --fl-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

/* ── The puzzle list (#353, art board C2) ── */
.fl-list {
  max-width: 720px; margin: 16px auto 0; display: grid; gap: 12px; color: var(--fl-ink);
  font-family: "Manrope", system-ui, sans-serif; container-type: inline-size;
}
.fl-lh { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.fl-logo { margin: 0; line-height: 0; }
.fl-logo img { width: 128px; height: auto; max-width: 100%; margin: 0; box-shadow: none; }
/* L3: a segmented control that names each language. */
.fl-langs { display: inline-flex; flex: 0 0 auto; border: 1px solid #d5e0dc; border-radius: 99px; background: #fff; padding: 2px; }
.fl-langs a {
  font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 99px; color: #56635f; text-decoration: none; white-space: nowrap;
}
.fl-langs a:hover { color: var(--fl-teal-dark); }
.fl-langs a[aria-current] { background: var(--fl-teal-dark); color: #fff; }
.fl-langs a:focus-visible, .fl-prow:focus-visible, .fl-today a:focus-visible, .fl-pages a:focus-visible, .fl-lintro .fl-link:focus-visible {
  outline: 2px solid var(--fl-teal); outline-offset: 2px;
}
.fl-lintro { margin: 0; font-size: 13.5px; color: #56635f; line-height: 1.45; }
.fl-lintro .fl-link { margin-left: 0; color: var(--fl-teal-dark); }
.fl-today { background: #fff; border: 1px solid var(--fl-line); border-radius: 14px; padding: 14px; display: grid; gap: 12px; position: relative; }
/* The card's link covers the whole card (#839). */
.fl-today .fl-stretch::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.fl-today:has(.fl-stretch:hover) { border-color: #b9d3cb; }
.fl-tk {
  font-family: var(--fl-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fl-muted);
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
}
.fl-tk .fl-diff { font-family: "Manrope", system-ui, sans-serif; letter-spacing: 0; text-transform: none; }
.fl-pair { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fl-pair .fl-pw { gap: 2px; }
.fl-pair .fl-pw .gt { --t: clamp(20px, calc((100cqi - 60px) / 13), 26px); }
.fl-par { color: var(--fl-teal); font-weight: 800; font-size: 18px; }
.fl-tacts { display: flex; }
.fl-tacts .fl-pri { flex: 0 1 auto; padding: 0 18px; }
.fl-tdone {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px; border-radius: 12px;
  background: #e9f5f1; color: var(--fl-teal-dark); font-weight: 800; font-size: 15px; text-decoration: none;
}
.fl-tdone .ws-icon { width: 18px; height: 18px; }
.fl-tdone:hover { background: #dcefe8; }
.fl-sk2 { margin: 4px 2px 0; font-family: var(--fl-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: #63726e; }
.fl-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fl-prow {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px 8px 8px;
  background: #fff; border: 1px solid #e3ebe8; border-radius: 12px; color: var(--fl-ink); text-decoration: none;
}
.fl-prow:hover { border-color: #b9d3cb; }
.fl-d {
  display: grid; text-align: center; line-height: 1.05; font-size: 10px; color: var(--fl-muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.fl-d b { font-size: 17px; color: var(--fl-ink); letter-spacing: 0; }
.fl-pm { display: grid; gap: 2px; min-width: 0; }
.fl-wp { font-weight: 800; font-size: 14px; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-wp .fl-ar { color: var(--fl-teal); }
.fl-sub { font-size: 11.5px; color: var(--fl-muted); display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.fl-diff { display: inline-flex; gap: 5px; align-items: center; font-size: 11.5px; color: var(--fl-muted); font-weight: 600; }
.fl-dots { display: inline-flex; gap: 2px; }
.fl-dots i { width: 6px; height: 6px; border-radius: 50%; background: #d5e0dc; }
.fl-dots i.on { background: #c58a0c; }
.fl-st { font-size: 12px; font-weight: 700; color: var(--fl-teal-dark); display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.fl-st .ws-icon { width: 14px; height: 14px; }
/* A solve's time, with its hints under it (#839). */
.fl-st:has(.fl-sth) { flex-direction: column; align-items: flex-end; gap: 1px; }
.fl-stt { display: inline-flex; gap: 4px; align-items: center; }
.fl-sth { font-size: 11px; font-weight: 600; color: var(--fl-muted); }
.fl-st.no, .fl-st.rev { color: #63726e; font-weight: 600; }
.fl-pages { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--fl-muted); padding-top: 4px; }
.fl-pbtns { display: flex; gap: 8px; }
.fl-pages .fl-sec { height: 38px; font-size: 13px; }
/* The narrowest phones: tighter rows, and a long pair wraps at the arrow
   rather than losing the end of the goal. */
@media (max-width: 359px) {
  .fl-prow { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; padding-right: 10px; }
  .fl-wp { font-size: 13px; letter-spacing: 0.01em; white-space: normal; overflow-wrap: anywhere; }
  .fl-st { font-size: 11.5px; }
}
@media (min-width: 640px) {
  .fl-list { margin-top: 24px; gap: 14px; }
  .fl-logo img { width: 168px; }
  .fl-today { padding: 18px; }
}

/* ── Puzzle screen ── */
.fl-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  /* The goal docks at the bottom of the screen even on a short ladder: the
     screen fills the window below the site's 60px header. */
  min-height: calc(100dvh - 60px - var(--fl-dock-h, 0px));
  color: var(--fl-ink);
  font-family: "Manrope", system-ui, sans-serif;
  outline: none;
}
.fl-screen button { font-family: inherit; }
.fl-screen .ws-icon { width: 18px; height: 18px; }

/* Top bar (D8) */
.fl-top { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 8px; position: relative; }
.fl-ttl { display: grid; line-height: 1.15; min-width: 0; text-align: center; }
.fl-ttl { container-type: inline-size; }
.fl-kicker {
  font-family: var(--fl-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fl-muted); white-space: nowrap; display: flex; justify-content: center; align-items: center; gap: 8px; min-width: 0;
}
.fl-kt { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* The difficulty after the date (#839): teal dots and the word, or only the
   dots where the word doesn't fit (it stays for screen readers). */
.fl-kdiff { flex: none; font-family: "Manrope", system-ui, sans-serif; letter-spacing: 0; text-transform: none; font-size: 11px; }
.fl-kdiff .fl-dots i.on { background: var(--fl-teal); }
@container (max-width: 250px) {
  .fl-kdw { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}
/* The narrowest phones: the weekday goes too, so the date and dots stay whole. */
@container (max-width: 180px) {
  .fl-kicker:has(.fl-kdiff) .fl-kwd { display: none; }
}
.fl-title {
  margin: 0; font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: clamp(16px, 5vw, 20px);
  line-height: 1.1; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: anywhere; color: var(--fl-ink);
}
.fl-ar { color: var(--fl-teal); font-family: "Manrope", system-ui, sans-serif; font-weight: 800; }
.fl-r { display: flex; align-items: center; gap: 6px; }
.fl-rb {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid #d5e0dc; background: #fff;
  display: grid; place-items: center; color: var(--fl-quiet); cursor: pointer; padding: 0; flex: 0 0 auto;
}
.fl-rb:hover { border-color: var(--fl-teal); color: var(--fl-teal); }
.fl-rb:focus-visible, .fl-menu :focus-visible, .fl-hint:focus-visible, .fl-ib:focus-visible, .fl-reopen:focus-visible {
  outline: 2px solid var(--fl-teal); outline-offset: 2px;
}
.fl-clock {
  font-family: var(--fl-mono); font-size: 12.5px; font-variant-numeric: tabular-nums;
  color: #3d4f4a; min-width: 38px; text-align: right;
}
.fl-clock.idle { color: #63726e; }
.fl-menu {
  position: absolute; right: 0; top: 44px; z-index: 30; min-width: 190px; padding: 6px;
  display: grid; background: #fff; border: 1px solid #d5e0dc; border-radius: 12px;
  box-shadow: 0 10px 24px rgba(20, 40, 35, 0.18);
}
.fl-menu[hidden] { display: none; }
.fl-menu button, .fl-menu a {
  border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--fl-ink); cursor: pointer;
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.fl-menu button:hover, .fl-menu a:hover { background: var(--fl-ground); }
.fl-menu .ws-icon { width: 17px; height: 17px; color: var(--fl-quiet); }

.fl-body { flex: 1 0 auto; display: flex; flex-direction: column; gap: 10px; position: relative; }

/* Reopening a solved puzzle (#839): a card over the empty board; the goal
   bank waits behind it. */
.fl-again {
  position: absolute; inset: 0; z-index: 22; display: flex; justify-content: center; align-items: flex-start;
  padding-top: 28px; background: rgba(242, 246, 244, 0.6);
}
.fl-again[hidden] { display: none; }
.fl-againcard {
  width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--fl-line); border-radius: 18px; padding: 20px 18px 18px;
  display: grid; gap: 10px; justify-items: stretch; text-align: center; box-shadow: 0 12px 30px rgba(20, 40, 35, 0.18);
}
.fl-againcard h2 { margin: 0 0 6px; font: 700 21px/1.2 "Fraunces", Georgia, serif; color: var(--fl-ink); text-wrap: balance; }
.fl-screen .fl-againic { justify-self: center; width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: #e9f5f1; color: var(--fl-teal-dark); }
.fl-againcard .fl-pri, .fl-againcard .fl-sec { height: 48px; font-size: 15px; }
.fl-againcard :focus-visible { outline: 2px solid var(--fl-teal); outline-offset: 2px; }
.fl-screen.fl-againing .fl-side { pointer-events: none; }
.fl-screen.fl-againing .fl-dock { opacity: 0.5; }

/* Ladder (D2): a white card with a teal rail down the left. */
.fl-ladder {
  --n: 7;
  flex: 1 0 auto;
  container-type: inline-size;
  background: var(--fl-card); border: 1px solid var(--fl-line); border-radius: 14px;
  padding: 10px 8px 12px 0;
  display: grid; align-content: start;
}
.fl-ladder .gt {
  --t: clamp(20px, calc((100cqi - 44px - (var(--n) - 1) * 3px) / var(--n)), 34px);
}
.fl-rung { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; min-height: 56px; scroll-margin: 16px 0 calc(var(--fl-dock-h, 180px) + 12px); }
.fl-rail { position: relative; align-self: stretch; display: grid; place-items: center; }
.fl-rail::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--fl-line);
}
.fl-rung:first-child .fl-rail::before { top: 50%; }
.fl-rung.lit .fl-rail::before { background: var(--fl-teal); }
/* A step locks in (S2, #351): the rail fills down to the next node. */
.fl-rung.fl-fill .fl-rail::before { transform-origin: top; animation: fl-rail-fill 0.32s ease-out both; }
@keyframes fl-rail-fill { from { transform: scaleY(0); } to { transform: none; } }
.fl-node {
  position: relative; z-index: 1; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: inset 0 0 0 2px #c3d0cb; display: grid; place-items: center; color: #fff;
}
.fl-node .ws-icon { width: 11px; height: 11px; }
.fl-rung.done .fl-node, .fl-rung.start .fl-node { background: var(--fl-teal); box-shadow: none; }
.fl-rung.active .fl-node { box-shadow: inset 0 0 0 3px var(--fl-teal); }
.fl-rung.badrow .fl-node { box-shadow: inset 0 0 0 3px var(--ws-coral); }
.fl-rbody { display: grid; gap: 5px; min-width: 0; padding: 6px 0; }
.fl-lab {
  font-family: var(--fl-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: #63726e;
  display: flex; align-items: center; gap: 8px; min-height: 16px;
}
.fl-aside { margin-left: auto; display: flex; gap: 6px; align-items: center; letter-spacing: 0; text-transform: none; font-family: "Manrope", system-ui, sans-serif; }
.fl-fits { font-size: 11.5px; font-weight: 700; color: var(--fl-quiet); background: #eef4f2; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.fl-hint {
  height: 30px; border-radius: 99px; border: 1px solid #d5e0dc; background: #fff;
  display: inline-flex; align-items: center; gap: 5px; padding: 0 11px 0 8px;
  font-weight: 700; font-size: 12px; color: var(--fl-quiet); cursor: pointer; white-space: nowrap;
}
.fl-screen .fl-hint .ws-icon { width: 15px; height: 15px; color: #c58a0c; }
.fl-hint:hover { border-color: var(--ws-gold); }
.fl-tiles { display: flex; gap: 3px; flex-wrap: nowrap; min-width: 0; }
button.fl-tiles { border: 0; background: none; padding: 0; margin: 0; cursor: pointer; justify-self: start; }
.fl-rung.done { cursor: pointer; }
.fl-rung.done:hover .gt { transform: translateY(-1px); }
.fl-rung.todo .fl-tiles { opacity: 0.55; }
.fl-msg { margin: 0; font-size: 12.5px; font-weight: 600; line-height: 1.35; color: #3d4f4a; }
.fl-msg.bad { color: #a3321f; display: flex; gap: 6px; align-items: center; }
.fl-msg.tip { color: #7a5506; }
.fl-msg.tip strong { font-weight: 800; }
.fl-msg.done { color: var(--fl-teal-dark); display: flex; gap: 6px; align-items: center; font-size: 13px; }
.fl-screen .fl-msg .ws-icon { width: 14px; height: 14px; }

/* Flow's tile states, on the shared maple tile */
.gt { transition: transform 0.18s, opacity 0.18s, filter 0.18s; }
.gt.fl-slot { background: transparent; box-shadow: none; outline: 1.5px dashed #77928a; outline-offset: -1.5px; }
.gt.fl-slot.fl-cur { outline: 0; box-shadow: inset 0 0 0 2px var(--fl-teal); background: rgba(31, 138, 112, 0.07); }
.gt.fl-slot.fl-cur::after {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: 16%; height: 2px; border-radius: 2px;
  background: var(--fl-teal); animation: fl-caret 1s steps(2) infinite;
}
@keyframes fl-caret { 50% { opacity: 0; } }
/* A wrong step: a coral outline, and the message line under the row. */
.gt.maple.fl-bad { box-shadow: inset 0 calc(var(--t) * -0.09) 0 #c99a55, 0 0 0 2px #fff, 0 0 0 3.5px var(--ws-coral); }
/* A goal letter you still need to add: a teal outline. */
.gt.maple.fl-ghost { background: rgba(31, 138, 112, 0.06); box-shadow: inset 0 0 0 1.5px rgba(31, 138, 112, 0.55); color: #17604e; }
/* A goal letter a tip says fits: a gold ring and a gentle bob. */
.gt.maple.fl-hl { box-shadow: inset 0 calc(var(--t) * -0.09) 0 #c99a55, 0 0 0 2px #fff, 0 0 0 4px var(--ws-gold), 0 2px 10px rgba(224, 165, 38, 0.55); animation: fl-bob 0.9s ease-in-out infinite; }
.gt.maple.fl-ghost.fl-hl { box-shadow: inset 0 0 0 1.5px rgba(31, 138, 112, 0.55), 0 0 0 2px #fff, 0 0 0 4px var(--ws-gold), 0 2px 10px rgba(224, 165, 38, 0.55); }
@keyframes fl-bob { 50% { transform: translateY(-3px); } }
/* The goal reached. */
.gt.maple.fl-teal { background: linear-gradient(var(--fl-teal), var(--fl-teal-dark)); box-shadow: inset 0 calc(var(--t) * -0.09) 0 #146b56, 0 1px 2px rgba(10, 60, 45, 0.3); color: #fff; }

/* Goal bank (D3), docked at the bottom of the screen on phones. flow.js
   keeps --fl-dock-h at the dock's height, and the page leaves that much room
   below everything so the dock never covers the ladder or the footer. */
.fl-side {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(rgba(241, 245, 249, 0), rgb(241, 245, 249) 10px);
}
body.fl-page { padding-bottom: var(--fl-dock-h, 0px); }
.fl-dock {
  --g: 8;
  background: var(--fl-card); border: 1px solid var(--fl-line); border-radius: 14px;
  padding: 8px 6px 10px 8px; display: grid; gap: 6px;
  box-shadow: 0 6px 18px -8px rgba(20, 40, 35, 0.25);
}
.fl-dh {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-family: var(--fl-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fl-muted);
}
.fl-lg { display: inline-flex; gap: 10px; letter-spacing: 0.02em; text-transform: none; font-family: "Manrope", system-ui, sans-serif; font-size: 11px; font-weight: 600; }
.fl-lg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.fl-lg i.h { background: linear-gradient(#f9e6bd, #efd095); box-shadow: inset 0 -2px 0 #c99a55; }
.fl-lg i.g { background: rgba(31, 138, 112, 0.06); box-shadow: inset 0 0 0 1.5px rgba(31, 138, 112, 0.6); }
/* #837: the goal letters use the card's whole width (up to 52px each), with
   Delete and Clear in a row underneath, on the right. */
.fl-bank { min-width: 0; container-type: inline-size; display: flex; flex-wrap: nowrap; gap: 4px; justify-content: center; padding-top: 2px; }
.fl-bank .gt {
  --t: min(52px, calc((100cqi - (var(--g) - 1) * 4px) / var(--g)));
  border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.fl-bank .gt:hover:not(.used):not(:disabled) { transform: translateY(-2px); }
.fl-bank .gt:disabled { cursor: default; }
.fl-dfoot { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.fl-dfoot .fl-lg, .fl-gdef { flex: 1; min-width: 0; }
.fl-ctl { display: flex; gap: 6px; margin-left: auto; }
.fl-ib {
  height: 40px; display: inline-flex; align-items: center; gap: 6px; border-radius: 12px; background: #fff;
  border: 1px solid #d5e0dc; color: var(--fl-quiet); cursor: pointer; padding: 0 13px; touch-action: manipulation;
  font: 700 13px "Manrope", system-ui, sans-serif;
}
.fl-ib .ws-icon { width: 17px; height: 17px; }

/* The dictionary button after an entered word (#837): 30px drawn, 44px to tap. */
.fl-wrow { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fl-wrow > .fl-tiles { min-width: 0; }
.fl-dict {
  position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center; border: 1px solid #cfe6de; background: #e9f5f1; color: var(--fl-teal-dark);
  touch-action: manipulation;
}
.fl-dict::after { content: ""; position: absolute; inset: -7px; }
.fl-dict .ws-icon { width: 15px; height: 15px; }
.fl-dict:hover { border-color: var(--fl-teal); }
.fl-dict:focus-visible { outline: 2px solid var(--fl-teal); outline-offset: 2px; }
/* The last letter placed: tap it to take it back (#837). Looks like any tile. */
.fl-ladder button.gt.fl-last { border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.fl-ladder button.gt.fl-last:focus-visible { outline: 2px solid var(--fl-teal); outline-offset: 2px; }

/* The dictionary panel (#837). */
.fl-dchips { display: flex; flex-wrap: wrap; gap: 8px; padding-right: 40px; }
.fl-dchip {
  height: 34px; border-radius: 99px; padding: 0 14px; border: 1px solid #d5e0dc; background: #fff; color: var(--fl-quiet);
  font: 800 13px "Manrope", system-ui, sans-serif; letter-spacing: 0.06em; cursor: pointer;
}
.fl-dchip.on { background: var(--fl-teal); border-color: var(--fl-teal); color: #fff; }
.fl-dword { font: 700 34px/1.05 "Fraunces", Georgia, serif; letter-spacing: 0.03em; margin: 2px 0 0; color: var(--fl-ink); }
.fl-dlist { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid #e4ece9; display: grid; gap: 12px; }
.fl-dlist li { display: flex; gap: 12px; }
.fl-dn { flex: none; width: 14px; font-weight: 800; font-size: 13px; color: var(--fl-teal); padding-top: 1px; }
.fl-dpos { font-size: 11.5px; font-weight: 600; font-style: italic; color: #63726e; }
.fl-dtext { font-size: 15.5px; line-height: 1.45; color: #3d4f4a; }
.fl-dback { height: 48px; border-radius: 14px; margin-top: 4px; cursor: pointer; }
.fl-ib:hover:not(:disabled) { border-color: var(--fl-teal); color: var(--fl-teal); }
.fl-ib:disabled { opacity: 0.4; cursor: default; }

/* "How to climb": desktop only (D9). */
.fl-help { display: none; }
.fl-help h2 { margin: 0; font: 700 16px "Fraunces", Georgia, serif; color: var(--fl-ink); }
.fl-help ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; list-style: decimal; }
.fl-kb {
  font-family: var(--fl-mono); font-size: 11px; border: 1px solid #d5e0dc; border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; color: var(--fl-ink); background: #f8faf9;
}

/* The narrowest phones: the speaker (#351) shares the top bar, so its
   buttons and the kicker tighten to keep "No. 44 · Fri 27 Mar" whole. */
@media (max-width: 359px) {
  .fl-top { gap: 6px; grid-template-columns: 32px minmax(0, 1fr) auto; }
  .fl-r { gap: 4px; }
  .fl-rb { width: 32px; height: 32px; }
  .fl-clock { min-width: 0; }
  .fl-kicker { letter-spacing: 0.04em; }
}

@media (min-width: 640px) {
  .fl-side { padding-left: 24px; padding-right: 24px; }
}

/* Desktop (D9): ladder left; goal bank, buttons and "How to climb" right. */
@media (min-width: 900px) {
  .fl-screen { min-height: 0; padding-top: 24px; gap: 16px; }
  .fl-title { font-size: 24px; }
  .fl-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .fl-ladder { padding: 14px 14px 16px 4px; }
  .fl-rung { scroll-margin: 24px; }
  body.fl-page { padding-bottom: 0; }
  .fl-side { position: sticky; top: 16px; bottom: auto; left: auto; right: auto; padding: 0; background: none; display: grid; gap: 12px; }
  .fl-dock { padding: 12px; box-shadow: none; }
  .fl-help {
    display: grid; gap: 8px; background: var(--fl-card); border: 1px solid var(--fl-line); border-radius: 14px;
    padding: 14px; font-size: 13px; color: #3d4f4a; line-height: 1.45;
  }
}

/* A letter backspaced out lifts away from its slot (S1, #351). */
.gt.fl-lifted { position: fixed; z-index: 40; pointer-events: none; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .gt.fl-slot.fl-cur::after, .gt.maple.fl-hl, .fl-rung.fl-fill .fl-rail::before { animation: none; }
  .gt { transition: none; }
}

/* ── The ending (#352, E1–E5): a sheet that slides up over the ladder ── */
.fl-link {
  margin-left: auto; border: 0; background: none; padding: 0; font: inherit; font-weight: 800;
  color: var(--fl-teal-dark); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.fl-end { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.fl-end[hidden] { display: none; }
.fl-scrim { position: absolute; inset: 0; background: rgba(20, 40, 35, 0.32); }
.fl-sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(20, 40, 35, 0.25);
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px)); color: var(--fl-ink);
  font-family: "Manrope", system-ui, sans-serif;
  transform: translateY(105%); transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.fl-end.on .fl-sheet { transform: none; }
.fl-grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: #d5e0dc; margin: -6px auto 8px; }
.fl-x {
  position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: var(--fl-ground); color: var(--fl-quiet); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.fl-x .ws-icon { width: 16px; height: 16px; }
.fl-ebody { display: grid; gap: 14px; }
.fl-eyebrow { font-family: var(--fl-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fl-muted); }
.fl-ehead h2 { font-family: "Fraunces", Georgia, serif; font-size: 32px; line-height: 1.05; margin: 2px 0 0; font-weight: 700; letter-spacing: -0.01em; color: var(--fl-ink); }
.fl-esub { margin: 4px 0 0; color: #56635f; font-size: 13.5px; font-weight: 600; }
.fl-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fl-stat { background: var(--fl-ground); border-radius: 12px; padding: 8px 10px; display: grid; gap: 2px; min-width: 0; }
.fl-stat .k { font-size: 11px; color: #56635f; font-weight: 600; }
.fl-stat .v { font-weight: 800; font-size: 19px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fl-esec { display: grid; gap: 6px; }
.fl-sk {
  font-family: var(--fl-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #63726e;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.fl-sk b { font-family: "Manrope", system-ui, sans-serif; letter-spacing: 0; text-transform: none; font-size: 12px; color: var(--fl-ink); text-align: right; }
.fl-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; }
.fl-pw { display: inline-flex; gap: 2px; }
.fl-pw .gt { --t: 18px; }
.fl-parr { color: var(--fl-teal); font-weight: 800; font-size: 13px; }
.fl-path + .fl-path { padding-top: 6px; border-top: 1px dashed var(--fl-line); }
.fl-enote { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--fl-teal-dark); }
.fl-eacts2 { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-eacts2 .fl-sec { height: 36px; font-size: 13px; }
.fl-tree {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(max-content, 1fr); gap: 16px;
  align-items: center; padding: 6px 2px; overflow-x: auto;
}
.fl-edges { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.fl-edges path { fill: none; stroke: #c7d4cf; stroke-width: 1.2; }
.fl-edges path.mine { stroke: var(--fl-teal); stroke-width: 2.5; }
.fl-tcol { display: grid; gap: 8px; align-content: center; position: relative; z-index: 1; }
.fl-tnode {
  justify-self: center; display: grid; justify-items: center; gap: 1px; background: #fff; border: 1px solid #d5e0dc;
  border-radius: 8px; padding: 3px 6px 2px; font-weight: 800; font-size: 10.5px; letter-spacing: 0.04em; color: var(--fl-quiet); white-space: nowrap;
}
.fl-tnode small { font-weight: 600; font-size: 9px; letter-spacing: 0; color: #63726e; }
.fl-tnode.mine { background: var(--fl-teal-dark); border-color: var(--fl-teal-dark); color: #fff; }
.fl-tnode.mine small { color: #d5f1e8; }
.fl-tnode.more { opacity: 0.65; font-weight: 700; }
.fl-streak { display: flex; align-items: center; gap: 10px; background: var(--fl-ground); border-radius: 12px; padding: 8px 10px; font-size: 12.5px; color: var(--fl-quiet); }
.fl-days { display: flex; gap: 4px; }
.fl-days i { width: 14px; height: 14px; border-radius: 4px; background: #dbe5e1; }
.fl-days i.on { background: var(--fl-teal); }
.fl-streak b { color: var(--fl-ink); }
.fl-eacts { display: flex; gap: 8px; }
.fl-sec, .fl-pri {
  height: 44px; border-radius: 12px; font: inherit; font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; cursor: pointer; text-decoration: none;
}
.fl-sec { padding: 0 14px; border: 1px solid #d5e0dc; background: #fff; color: var(--fl-ink); }
.fl-sec:hover { border-color: var(--fl-teal); }
.fl-pri { flex: 1; min-width: 0; padding: 0 14px; border: 0; background: var(--fl-teal-dark); color: #fff; font-weight: 800; font-size: 15px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18); }
.fl-pri:hover { background: #146b56; color: #fff; }
.fl-sec .ws-icon { width: 16px; height: 16px; }
.fl-pri .ws-icon { width: 18px; height: 18px; }
.fl-sheet :focus-visible, .fl-confirm :focus-visible, .fl-link:focus-visible { outline: 2px solid var(--fl-teal); outline-offset: 2px; }

/* Show a path's confirm (E4): in the page, never the browser's confirm(). */
.fl-confirm-wrap { align-items: center; padding: 16px; }
.fl-confirm {
  position: relative; width: 100%; max-width: 340px; background: #fff; border-radius: 18px; padding: 18px;
  display: grid; gap: 10px; box-shadow: 0 12px 30px rgba(20, 40, 35, 0.3); color: var(--fl-ink); font-family: "Manrope", system-ui, sans-serif;
}
.fl-confirm h2 { margin: 0; font: 700 22px "Fraunces", Georgia, serif; }
.fl-confirm p { margin: 0 0 4px; color: #56635f; font-size: 14px; }

/* The "Copied" toast (E3). */
.fl-toast {
  position: fixed; left: 50%; top: 72px; z-index: 70; transform: translate(-50%, -12px); opacity: 0; visibility: hidden;
  background: #173f36; color: #fff; font: 700 13px "Manrope", system-ui, sans-serif; padding: 8px 16px; border-radius: 99px;
  transition: transform 0.3s, opacity 0.3s, visibility 0s 0.3s; pointer-events: none;
}
.fl-toast.on { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform 0.3s, opacity 0.3s; }

@media (min-width: 900px) {
  .fl-end { align-items: center; padding: 24px; }
  .fl-sheet { border-radius: 18px; max-height: calc(100dvh - 48px); transform: translateY(40px); opacity: 0; transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1), opacity 0.25s; }
  .fl-end.on .fl-sheet { opacity: 1; }
  .fl-sheet.wide { max-width: 800px; }
  .fl-grab { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fl-sheet, .fl-toast { transition: opacity 0.15s; transform: none; }
}

/* ── The tutorial you play (#353, L4): the real board over the page ── */
body.fl-tut-open { overflow: hidden; }
.fl-tut {
  position: fixed; inset: 0; z-index: 55; overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9); padding: 0 16px var(--fl-dock-h, 0px);
}
.fl-tut[hidden] { display: none; }
.fl-tut .fl-screen { max-width: 960px; margin: 0 auto; min-height: 0; padding-bottom: 16px; }
.fl-coach {
  display: grid; gap: 10px; background: #e9f5f1; border: 1px solid #cfe6de; border-radius: 12px; padding: 10px 12px;
}
.fl-coach p { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--fl-ink); }
.fl-coach strong { color: var(--fl-teal-dark); font-weight: 800; letter-spacing: 0.03em; }
.fl-coach .fl-pri[hidden] { display: none; }
.fl-coach :focus-visible { outline: 2px solid var(--fl-teal); outline-offset: 2px; }
/* The coach lights the clear button when a wrong step is in the way. */
.fl-ib.fl-hl { border-color: var(--ws-gold); box-shadow: 0 0 0 3px rgba(224, 165, 38, 0.45); color: #7a5506; }
@media (min-width: 640px) {
  .fl-tut { padding-left: 24px; padding-right: 24px; }
}

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