:root {
  color-scheme: light;
  --paper: #f6f3eb;
  --paper-deep: #ece7dc;
  --surface: #fffdf8;
  --surface-soft: #fbf9f3;
  --ink: #30392f;
  --ink-soft: #4f584e;
  --muted: #737a70;
  --line: #ddd8ca;
  --line-strong: #c9c2b2;
  --sage: #657d65;
  --sage-deep: #425d49;
  --sage-pale: #e3eade;
  --clay: #a85f48;
  --clay-deep: #824632;
  --clay-pale: #f3e4dc;
  --gold: #cc9b54;
  --gold-pale: #f4ead6;
  --shadow: 0 5px 16px rgba(58, 53, 43, 0.035);
  --shadow-small: 0 2px 8px rgba(58, 53, 43, 0.035);
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 7px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--paper); }
body {
  position: relative;
  display: flex;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
}
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 3px solid #bb8652;
  outline-offset: 3px;
}
a { color: var(--sage-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--clay-deep); }
::selection { color: var(--ink); background: #e6d7b6; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: 0.75rem;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: relative;
  z-index: 30;
  width: 100%;
  padding: 0.8rem 1rem;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1.3rem;
  width: min(100%, 1030px);
  min-height: 3.4rem;
  margin: 0 auto;
}
.brand-button {
  display: inline-flex;
  align-items: center;
  min-width: 8.6rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.brand-mark { display: block; width: 126px; height: auto; flex: none; }
.header-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.install-button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.82rem 0.45rem 0.58rem;
  border: 1px solid var(--sage-deep);
  border-radius: 7px;
  background: var(--sage-deep);
  box-shadow: 0 4px 12px rgba(50, 72, 58, 0.14);
  color: #fffdf8;
  font-size: 0.82rem;
  font-weight: 760;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.install-button:hover {
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: 0 6px 16px rgba(36, 42, 35, 0.18);
}
.install-icon {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  flex: none;
  place-items: center;
  border: 1px solid rgba(255, 253, 248, 0.38);
  border-radius: 5px;
  background: rgba(255, 253, 248, 0.08);
}
.install-icon svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.5rem 0.82rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 620;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.text-button:hover { border-color: var(--line); background: rgba(255, 253, 248, 0.7); color: var(--ink); }
.menu-button {
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 4px 12px rgba(58, 53, 43, 0.06);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.menu-button:hover { border-color: var(--sage); background: white; box-shadow: var(--shadow-small); }
.hamburger-icon {
  display: grid;
  width: 1.2rem;
  gap: 0.24rem;
}
.hamburger-icon > span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: var(--sage-deep);
}

#main { min-height: 0; flex: 1 1 auto; }
.app-shell { width: min(100% - 2rem, 1160px); margin: 0 auto; padding: 1rem 0 2.4rem; }
body[data-screen="construction"] .site-header,
body[data-screen="play"] .site-header,
body[data-screen="tutorial"] .site-header { padding-block: 0.35rem; }
body[data-screen="construction"] .header-inner,
body[data-screen="play"] .header-inner,
body[data-screen="tutorial"] .header-inner { min-height: 2.7rem; }
body[data-screen="construction"] .brand-mark,
body[data-screen="play"] .brand-mark,
body[data-screen="tutorial"] .brand-mark { width: 100px; }
body[data-screen="construction"] .app-shell,
body[data-screen="play"] .app-shell,
body[data-screen="tutorial"] .app-shell { padding-top: 0.4rem; padding-bottom: 0.5rem; }
.loading-card {
  display: grid;
  place-items: center;
  gap: 0.8rem;
  min-height: 55dvh;
  color: var(--muted);
  text-align: center;
}
.loading-card p { margin: 0; }
.loading-mark {
  display: grid;
  width: 3.3rem;
  height: 3.3rem;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 1.1rem;
  background: var(--surface);
  color: var(--sage-deep);
  font-family: Georgia, serif;
  font-size: 1.5rem;
  box-shadow: var(--shadow-small);
}

h1, h2, h3, p { margin-top: 0; }
h1, h2 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.025em;
}
h1 { margin-bottom: 0.65rem; font-size: clamp(2rem, 4vw, 3.3rem); line-height: 1.05; }
h2 { margin-bottom: 0.65rem; font-size: clamp(1.42rem, 2.8vw, 2rem); line-height: 1.14; }
h3 { font-size: 1rem; }
p { color: var(--ink-soft); line-height: 1.62; }
.eyebrow, .small-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}
.small-label { margin-bottom: 0.2rem; letter-spacing: 0.1em; }
.muted-note { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.button {
  display: inline-flex;
  min-height: 2.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 680;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.button:hover:not(:disabled) { border-color: var(--sage); box-shadow: 0 4px 12px rgba(58, 53, 43, 0.08); }
.button:active:not(:disabled) { background: var(--paper-deep); }
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button--primary { border-color: var(--sage-deep); background: var(--sage-deep); color: white; }
.button--primary:hover:not(:disabled) { border-color: #344c3a; background: #344c3a; color: white; }
.button--secondary { border-color: #c4d0c0; background: #edf2e9; color: #354f3c; }
.button--secondary:hover:not(:disabled) { border-color: var(--sage); background: #e3ecdf; }
.button--quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
.button--quiet:hover:not(:disabled) { border-color: var(--line); background: var(--surface); }
.button--danger { border-color: #923f31; background: #923f31; color: white; }
.button--danger:hover:not(:disabled) { border-color: #783225; background: #783225; }
.button--danger-quiet { border-color: #e4c9bf; background: #fff8f4; color: #834b3b; }
.button--danger-quiet:hover:not(:disabled) { border-color: var(--clay); background: var(--clay-pale); }
.button--large { min-width: 9.5rem; min-height: 3.35rem; padding-inline: 1.3rem; }
.button--small { min-height: 2.45rem; padding: 0.48rem 0.84rem; font-size: 0.82rem; }
.button--wide { width: 100%; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.25rem; }
.modal-actions--stack { display: grid; }
.tool-spacer { flex: 1; }

.home-screen { padding: clamp(1rem, 3dvh, 2rem) 1rem 1rem; }
.home-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 0.85fr); align-items: center; gap: clamp(1.5rem, 4vw, 3rem); max-width: 960px; margin: 0 auto; }
.home-copy { min-width: 0; }
.hero-mark { display: block; width: clamp(190px, 25vw, 270px); height: auto; margin-bottom: clamp(2rem, 5dvh, 3.5rem); }
.home-copy > .eyebrow { margin-bottom: 1.1rem; }
.word-of-day-card { display: grid; gap: 0.45rem; padding-bottom: 0.65rem; border-bottom: 1px solid var(--line-strong); }
.word-of-day-card h1 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.8rem); }
.word-of-day { max-width: 100%; overflow-wrap: anywhere; color: var(--sage-deep); font-family: Georgia, serif; font-size: clamp(2rem, 4.3vw, 3.4rem); font-weight: 500; letter-spacing: 0.115em; line-height: 1.15; }
.home-intro { max-width: 39ch; margin: 1.3rem 0 1.55rem; font-size: 1rem; }
.word-rollover { animation: word-arrive 520ms ease-out both; }
.home-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.home-actions .button { border-radius: 8px; }
.home-understated { display: flex; min-height: 2rem; align-items: center; gap: 1rem; margin-top: 0.65rem; color: var(--muted); font-size: 0.8rem; }
.streak-chip { display: inline-flex; align-items: center; gap: 0.28rem; color: var(--clay-deep); font-weight: 650; }
.home-puzzle { min-width: 0; padding: 1.4rem 0 0.6rem clamp(1.5rem, 4vw, 4rem); border-left: 1px solid var(--line); }
.home-grid { position: relative; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; border: 1px solid var(--line-strong); background: repeating-linear-gradient(90deg, transparent 0, transparent calc(33.333% - 1px), rgba(129, 137, 117, 0.08) calc(33.333% - 1px), rgba(129, 137, 117, 0.08) 33.333%), repeating-linear-gradient(0deg, var(--surface-soft) 0, var(--surface-soft) calc(33.333% - 1px), rgba(129, 137, 117, 0.09) calc(33.333% - 1px), rgba(129, 137, 117, 0.09) 33.333%); }
.home-grid-path { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; overflow: visible; }
.home-grid-path polyline { fill: none; stroke: var(--clay); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 730; animation: trace-arrive 1.8s ease-out both; }
.home-grid-node { position: relative; z-index: 2; display: grid; width: 54%; aspect-ratio: 1; place-self: center; place-items: center; border: 1.5px solid var(--sage); border-radius: 50%; background: var(--surface); box-shadow: 0 2px 5px rgba(58, 53, 43, 0.04); }
.home-grid-caption { display: flex; justify-content: space-between; gap: 0.6rem; width: min(100%, 360px); margin: 0.65rem auto 0; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.055em; }
.home-grid-caption span::before { display: inline-block; width: 0.4rem; height: 0.4rem; margin-right: 0.4rem; border: 1px solid var(--sage); background: var(--sage-pale); content: ''; }
.home-footer { display: flex; align-items: center; justify-content: flex-start; max-width: 1060px; gap: 1rem; margin: 1.8rem auto 0; color: var(--muted); font-size: 0.76rem; }
.home-footer .text-button { min-height: 2rem; padding: 0.3rem 0.45rem; font-size: 0.76rem; }

.screen-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.3rem;
  margin: 0.4rem 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line-strong);
}
.screen-heading > div:first-child { max-width: 730px; }
.screen-heading h1 { margin-bottom: 0.45rem; }
.screen-heading p:not(.eyebrow) { max-width: 640px; margin-bottom: 0; }
.heading-actions { display: flex; gap: 0.5rem; padding-bottom: 0.1rem; }
.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(230px, 1fr);
  align-items: start;
  justify-content: center;
  gap: clamp(0.8rem, 2vw, 1.5rem);
}
.game-screen { max-width: 1030px; margin-inline: auto; }
.game-screen .screen-heading { align-items: center; margin: 0 0 0.65rem; padding-bottom: 0.5rem; }
.game-screen .screen-heading h1 { margin-bottom: 0; font-size: clamp(1.45rem, 2.8vw, 2.1rem); }
.game-screen .screen-heading .eyebrow { margin-bottom: 0.22rem; }
.game-screen .board-panel { padding: 0.75rem clamp(0.7rem, 2vw, 1rem); }
.game-screen .board-topline { align-items: center; margin-bottom: 0.45rem; }
.game-screen .source-word { font-size: clamp(0.88rem, 1.7vw, 1.05rem); letter-spacing: 0.09em; }
.board-panel, .archive-detail, .tutorial-board-panel {
  padding: clamp(1rem, 2.5vw, 1.65rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.board-topline { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.source-word { color: var(--sage-deep); font-family: Georgia, serif; font-size: 1.05rem; letter-spacing: 0.16em; }
.board-frame {
  position: relative;
  isolation: isolate;
  width: min(100%, 490px, max(220px, calc(100dvh - 360px)));
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #e1dccf;
  border-radius: 8px;
  background-color: #f4f1e9;
  background-image: linear-gradient(90deg, transparent calc(33.333% - 1px), rgba(119, 133, 112, 0.12) calc(33.333% - 1px), rgba(119, 133, 112, 0.12) 33.333%, transparent 33.333%, transparent calc(66.666% - 1px), rgba(119, 133, 112, 0.12) calc(66.666% - 1px), rgba(119, 133, 112, 0.12) 66.666%, transparent 66.666%), linear-gradient(transparent calc(33.333% - 1px), rgba(119, 133, 112, 0.12) calc(33.333% - 1px), rgba(119, 133, 112, 0.12) 33.333%, transparent 33.333%, transparent calc(66.666% - 1px), rgba(119, 133, 112, 0.12) calc(66.666% - 1px), rgba(119, 133, 112, 0.12) 66.666%, transparent 66.666%);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.board-grid {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  gap: 0;
}
.trace-layer { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.trace-layer polyline,
.trace-layer line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.88;
  vector-effect: non-scaling-stroke;
}
.trace-layer .trace-live { opacity: 0.72; }
.board-node {
  position: relative;
  display: grid;
  width: min(78%, 96px);
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  border: 2px solid #d3d9ce;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}
.board-node:hover { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(101, 125, 101, 0.12); }
.board-node--static { cursor: default; }
.board-node--static:hover { border-color: #d3d9ce; box-shadow: none; }
.board-node.is-empty { border-style: dashed; background: rgba(255, 253, 248, 0.55); }
.board-node.is-legal { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(204, 155, 84, 0.18); }
.board-node.is-selected { border-color: var(--sage-deep); background: var(--sage-deep); color: white; }
.node-letter { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.55rem, 5vw, 2.55rem); font-weight: 600; line-height: 1; }
.board-hint-row, .current-trace {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: min(100%, 490px);
  min-height: 2.65rem;
  margin: 0.8rem auto 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}
.hint-dot { width: 0.5rem; height: 0.5rem; flex: none; border-radius: 50%; background: var(--gold); }
.path-count { flex: none; margin-left: auto; color: var(--muted); font-size: 0.77rem; font-variant-numeric: tabular-nums; }
.trace-path-display { display: grid; gap: 0.28rem; width: min(100%, 490px); min-height: 2.9rem; margin: 0.2rem auto 0; padding: 0.6rem 0.1rem; border-top: 1px solid var(--line); }
.trace-path-display strong { color: var(--sage-deep); font-size: 0.86rem; font-weight: 650; }
.current-trace { margin-top: 0.4rem; padding: 0.4rem 0.65rem; border: 1px solid #e5dece; border-radius: 7px; background: #fbf8ef; }
.current-trace .small-label { margin: 0; }
.current-trace strong { min-width: 5.5rem; color: var(--clay-deep); font-family: Georgia, serif; font-size: 1rem; letter-spacing: 0.07em; }
.board-tools { display: flex; align-items: center; gap: 0.3rem; width: min(100%, 490px); min-height: 2.5rem; margin: 0.1rem auto 0; }
.board-tools--placeholder { visibility: hidden; }
.board-feedback {
  position: absolute;
  z-index: 4;
  top: 66.667%;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 1.25rem);
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 3px 12px rgba(36, 42, 35, 0.14);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.board-feedback:empty { display: none; }
.board-feedback:not(:empty) { animation: board-feedback-in 180ms ease-out both; }
.board-feedback[data-kind="success"] { border-color: var(--sage); color: var(--sage-deep); }
.board-feedback[data-kind="error"] { border-color: var(--clay); color: var(--clay-deep); }
.board-feedback[data-kind="duplicate"] { border-color: var(--gold); color: #70592d; }
.current-trace--placeholder { visibility: hidden; }
.keyboard-hint { width: min(100%, 490px); margin: 0.65rem auto 0; color: var(--muted); font-size: 0.73rem; line-height: 1.45; }
.game-aside { display: grid; gap: 1rem; }
.instruction-card, .paper-card, .soft-note {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
}
.instruction-card { position: relative; padding-left: 4.8rem; }
.instruction-card h2 { margin-bottom: 0.48rem; font-size: 1.36rem; }
.instruction-card p { margin-bottom: 0; font-size: 0.9rem; }
.step-number {
  position: absolute;
  top: 0.9rem;
  left: 0;
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage-pale);
  color: var(--sage-deep);
  font-family: Georgia, serif;
  font-size: 1.1rem;
}
.step-number small { margin-left: -0.25rem; font-family: inherit; font-size: 0.62rem; }
.letter-strip { display: flex; flex-wrap: wrap; gap: 0.32rem; margin-top: 0.68rem; }
.letter-strip span { display: grid; width: 1.85rem; height: 2rem; place-items: center; border: 1px solid var(--line); border-radius: 0.62rem; background: var(--surface); color: var(--ink-soft); font-family: Georgia, serif; font-size: 0.9rem; }
.letter-strip .letter-used { border-color: var(--sage); background: var(--sage-pale); color: var(--sage-deep); }
.paper-card > .muted-note { font-size: 0.78rem; }
.soft-note { display: flex; align-items: flex-start; gap: 0.7rem; color: var(--clay-deep); }
.soft-note > span { color: var(--clay); font-size: 1.1rem; }
.soft-note p { margin: 0; font-family: Georgia, serif; font-size: 0.92rem; line-height: 1.45; }
.score-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; margin-bottom: 0.35rem; }
.score-box, .timer-box { display: grid; align-content: start; justify-items: start; gap: 0.15rem; min-height: 3.25rem; padding: 0.15rem 0 0.35rem; border-bottom: 1px solid var(--line); }
.score-box .small-label, .timer-box .small-label { margin: 0; }
.score-box strong, .timer-box strong { color: var(--sage-deep); font-family: Georgia, serif; font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.score-box strong small { color: var(--muted); font-family: Inter, sans-serif; font-size: 0.74rem; font-weight: 500; }
.score-progress { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0.3rem; height: 0.35rem; margin-bottom: 0.45rem; }
.score-progress span { display: block; border: 1px solid var(--line-strong); background: #e8e3d8; transition: background-color 260ms ease; }
.score-progress span.is-earned { border-color: var(--sage); background: var(--sage); }
.tutorial-progress { height: 0.35rem; overflow: hidden; border-radius: 999px; background: #e8e3d8; }
.tutorial-progress span { display: block; height: 100%; border-radius: inherit; background: var(--sage); transition: width 260ms ease; }
.completion-inline { min-height: 1.55rem; margin: 0.4rem 0 0.5rem; color: var(--muted); font-size: 0.75rem; text-align: center; }
.completion-inline.is-visible { color: var(--sage-deep); font-weight: 700; }
.play-aside { align-content: start; }
.found-section { padding: 1rem 0; border-top: 1px solid var(--line-strong); }
.found-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.found-heading h2 { margin: 0; font-size: 1.15rem; }
.found-heading > span { display: grid; min-width: 1.8rem; height: 1.8rem; place-items: center; border-radius: 50%; background: var(--paper-deep); color: var(--ink-soft); font-size: 0.78rem; font-weight: 700; }
.found-word-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); gap: 0.35rem; max-height: 345px; overflow-y: auto; margin: 0; padding: 0.2rem 0.25rem 0.2rem 0; list-style: none; overscroll-behavior: contain; }
.found-word-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.35rem; padding: 0.46rem 0.58rem; border: 1px solid #ece6d9; border-radius: 9px; background: #fdfbf6; font-size: 0.78rem; letter-spacing: 0.045em; }
.found-word-list li strong { color: var(--sage-deep); font-size: 0.72rem; }
.empty-found { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.82rem; }
.anagram-banner { margin: -0.15rem 0 0.8rem; padding: 0.62rem 0.7rem; border: 1px solid #e6c98e; border-radius: 10px; background: #fbf0d7; color: #765622; font-size: 0.82rem; font-weight: 760; letter-spacing: 0.07em; text-align: center; }
.construction-layout { grid-template-columns: minmax(0, 560px); }

.archive-screen { padding-bottom: 1.5rem; }
.archive-layout { display: grid; grid-template-columns: minmax(310px, 1fr) minmax(300px, 0.8fr); align-items: start; gap: 1.2rem; }
.calendar-card { padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.calendar-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 1rem; }
.calendar-heading h2 { flex: 1; margin: 0; font-size: 1.35rem; text-align: center; }
.calendar-pickers { display: flex; justify-content: center; gap: 0.35rem; min-width: 0; }
.calendar-pickers select { min-height: 2.5rem; padding: 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--ink); font-weight: 650; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.calendar-nav { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-soft); color: var(--ink); font-size: 1.45rem; line-height: 1; cursor: pointer; }
.calendar-nav:hover:not(:disabled) { border-color: var(--sage); background: var(--sage-pale); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.36rem; }
.calendar-weekdays { margin-bottom: 0.35rem; color: var(--muted); font-size: 0.7rem; font-weight: 750; text-align: center; }
.calendar-weekdays span { padding: 0.35rem 0; }
.calendar-empty { display: block; aspect-ratio: 1; }
.calendar-day { position: relative; display: grid; aspect-ratio: 1; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-soft); font-size: 0.88rem; cursor: pointer; }
.calendar-day:hover { border-color: var(--line-strong); background: var(--paper); }
.calendar-day.is-selected { border-color: var(--sage-deep); background: var(--sage-deep); color: white; font-weight: 750; }
.calendar-day.is-today:not(.is-selected) { border-color: var(--gold); background: #fbf4e4; color: var(--ink); font-weight: 750; }
.calendar-status {
  position: absolute;
  bottom: 11%;
  left: 50%;
  transform: translateX(-50%);
}
.calendar-status--progress {
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--clay);
}
.calendar-status--completed {
  display: grid;
  width: 0.82rem;
  height: 0.82rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage-deep);
  color: white;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}
.calendar-day.is-selected .calendar-status--progress { background: #f4d698; }
.calendar-day.is-selected .calendar-status--completed {
  background: #f4d698;
  color: var(--sage-deep);
}
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 1rem;
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}
.calendar-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-progress {
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--clay);
}
.legend-completed {
  display: grid;
  width: 0.82rem;
  height: 0.82rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage-deep);
  color: white;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}
.legend-today { width: 0.62rem; height: 0.62rem; border: 1px solid var(--gold); border-radius: 50%; background: #fbf4e4; }
.archive-detail { min-height: 16rem; }
.archive-detail h2 { margin-bottom: 0.3rem; }
.archive-word-label { margin: 0.4rem 0 0.15rem; color: var(--muted); font-size: 0.8rem; }
.archive-word { color: var(--sage-deep); font-family: Georgia, serif; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: 0.12em; }
.archive-detail .attempt-list { margin: 0.85rem 0; }
.archive-detail .button--wide { margin-top: 0.8rem; }
.archive-detail--empty { display: grid; min-height: 16rem; align-content: center; justify-items: start; }
.archive-detail--empty p { max-width: 22rem; margin-bottom: 0; }
.attempt-list { display: grid; gap: 0.45rem; }
.attempt-card { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; padding: 0.65rem 0.7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.attempt-card > div { display: grid; gap: 0.14rem; min-width: 0; }
.attempt-card strong { font-size: 0.84rem; }
.attempt-card small { color: var(--muted); font-size: 0.72rem; }
.attempt-kicker { color: var(--muted); font-size: 0.63rem; font-weight: 740; letter-spacing: 0.09em; text-transform: uppercase; }
.attempt-card--draft { background: #faf6eb; }

.tutorial-screen { max-width: 1030px; margin-inline: auto; padding-bottom: 1rem; }
.tutorial-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0.15rem 0 0.45rem; }
.tutorial-header > div:first-child { max-width: 730px; }
.tutorial-header h1 { margin-bottom: 0; font-size: clamp(1.55rem, 2.6vw, 2rem); }
.tutorial-header p:not(.eyebrow) { margin-bottom: 0; }
.tutorial-header-actions { display: flex; align-items: center; gap: 0.25rem; flex: none; }
.tutorial-progress-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.76rem; }
.tutorial-progress-meta strong { color: var(--ink-soft); font-weight: 680; }
.tutorial-progress { height: 0.25rem; margin-bottom: 0.75rem; }

.tutorial-stage {
  display: grid;
  gap: 0.9rem 1.1rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.tutorial-stage.has-board {
  grid-template-columns: minmax(280px, 0.82fr) minmax(360px, 1.18fr);
  grid-template-areas:
    "instruction board"
    "detail board"
    "nav board";
  align-items: start;
}
.tutorial-stage.is-info {
  width: min(100%, 760px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "instruction"
    "detail"
    "nav";
  margin-inline: auto;
}
.tutorial-instruction { grid-area: instruction; padding-bottom: 0.8rem; border-bottom: 1px solid var(--line); }
.tutorial-instruction .eyebrow { margin-bottom: 0.35rem; }
.tutorial-instruction h2 { margin-bottom: 0.45rem; font-size: 1.35rem; }
.tutorial-instruction > p { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.tutorial-detail { grid-area: detail; display: grid; align-content: start; gap: 0.8rem; }
.tutorial-detail > p { margin: 0; }
.tutorial-board-panel {
  grid-area: board;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.tutorial-board-panel .board-topline { margin-bottom: 0.45rem; }
.tutorial-board-panel .board-frame { width: min(100%, 520px); max-width: none; }
.tutorial-board-panel .found-section { margin-top: 0.8rem; }
.tutorial-step-nav {
  grid-area: nav;
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.tutorial-step-nav .button { min-width: 7rem; }
.tutorial-score-badge { margin-left: auto; padding: 0.35rem 0.65rem; border-radius: 999px; background: var(--sage-pale); color: var(--sage-deep); font-size: 0.78rem; font-weight: 700; }
.tutorial-example-summary { display: flex; justify-content: space-between; gap: 0.5rem; margin: 0.2rem 0 0.8rem; padding: 0.6rem 0.75rem; border-radius: 10px; background: var(--sage-pale); color: var(--sage-deep); font-size: 0.82rem; }
.tutorial-example-summary span { color: var(--ink-soft); }
.tutorial-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.tutorial-mini-board { padding: 0.65rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.tutorial-mini-board > strong { display: block; margin-bottom: 0.5rem; color: var(--ink-soft); font-size: 0.76rem; }
.tutorial-mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.15rem; }
.tutorial-mini-grid span { display: grid; aspect-ratio: 1; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--sage-deep); font-family: Georgia, serif; font-size: 1rem; }
.tutorial-mini-board > small { display: block; margin-top: 0.5rem; color: var(--muted); font-size: 0.68rem; line-height: 1.35; }
.tutorial-fact { padding: 0.9rem; border-left: 3px solid var(--gold); border-radius: 0 12px 12px 0; background: #faf4e7; font-size: 0.84rem; }
.tutorial-welcome { display: grid; gap: 0.9rem; }
.tutorial-welcome > p { margin: 0; }
.tutorial-nav-guide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.tutorial-nav-guide > div { display: grid; align-content: start; gap: 0.55rem; padding: 0.85rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.tutorial-nav-guide p { margin: 0; color: var(--ink-soft); font-size: 0.82rem; line-height: 1.5; }
.tutorial-nav-sample { display: inline-flex; width: fit-content; min-width: 6.5rem; min-height: 2.35rem; align-items: center; justify-content: center; padding: 0.45rem 0.8rem; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 0.8rem; font-weight: 700; }
.tutorial-nav-sample--next { border-color: var(--sage-deep); background: var(--sage-deep); color: white; }
.tutorial-nav-sample--previous { border-color: #c4d0c0; background: #edf2e9; color: #354f3c; }
.tutorial-rule-list, .tutorial-finish-list, .help-rules { display: grid; gap: 0.45rem; margin: 0; padding-left: 1.15rem; color: var(--ink-soft); font-size: 0.84rem; line-height: 1.45; }
.route-hint { display: grid; gap: 0.4rem; padding: 0.85rem 0.9rem; border: 1px solid #e4ddce; border-radius: 14px; background: #fbf8ef; }
.route-hint strong { color: var(--sage-deep); font-size: 0.92rem; letter-spacing: 0.04em; }
.tutorial-score-result { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0.8rem; border: 1px solid var(--sage); border-radius: 8px; background: var(--sage-pale); }
.tutorial-score-result strong { color: var(--sage-deep); letter-spacing: 0.08em; }
.tutorial-score-result span { color: var(--sage-deep); font-weight: 700; }
.tutorial-score-table { display: grid; gap: 0.4rem; }
.tutorial-score-table > div { display: flex; justify-content: space-between; gap: 0.7rem; padding: 0.65rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 0.83rem; }
.tutorial-score-table strong { color: var(--sage-deep); }
.tutorial-score-line { display: flex; justify-content: space-between; padding: 0.65rem 0.1rem; color: var(--muted); font-size: 0.82rem; }
.tutorial-score-line strong { color: var(--sage-deep); }
.tutorial-result { display: grid; justify-items: center; gap: 0.55rem; padding: 1.35rem; border: 1px solid #e4d4b5; border-radius: 18px; background: #fbf3e3; text-align: center; }
.tutorial-result strong { color: var(--sage-deep); font-family: Georgia, serif; font-size: 1.7rem; }
.tutorial-result span:not(.result-spark) { color: var(--muted); font-size: 0.84rem; }
.tutorial-result p { margin: 0; font-size: 0.84rem; }
.result-spark { color: var(--gold); font-size: 2rem; }

.home-footer .text-button, .text-button { white-space: nowrap; }
.fatal-screen { display: grid; max-width: 620px; justify-items: start; gap: 0.65rem; margin: 9dvh auto; padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.fatal-screen > p:not(.eyebrow) { margin-bottom: 0.25rem; }
.fatal-screen .text-button { min-height: 2rem; padding-left: 0; }

.app-menu-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: transparent;
}
.app-menu {
  position: absolute;
  top: max(4.4rem, calc(env(safe-area-inset-top) + 3.6rem));
  right: max(1rem, calc((100vw - 1030px) / 2));
  width: min(330px, calc(100vw - 2rem));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(36, 42, 35, 0.18);
  animation: app-menu-desktop-in 190ms cubic-bezier(.2,.75,.25,1) both;
}
.app-menu-backdrop.is-closing .app-menu {
  animation: app-menu-desktop-out 170ms ease-in both;
}
.app-menu-header {
  display: flex;
  min-height: 3.4rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.7rem 0.55rem 1rem;
  border-bottom: 1px solid var(--line);
}
.app-menu-brand { display: block; width: 96px; height: auto; }
.app-menu-header .icon-close {
  width: 2.35rem;
  height: 2.35rem;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.25rem;
}
.app-menu-header .icon-close:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}
.app-menu-list { display: grid; }
.app-menu-item {
  display: flex;
  width: 100%;
  min-height: 3.65rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.95rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
button.app-menu-item { cursor: pointer; }
button.app-menu-item:hover { background: var(--sage-pale); }
.app-menu-install { background: rgba(225, 233, 220, 0.34); }
.app-menu-install > b { font-size: 1rem; }
.app-menu-item > span { display: grid; min-width: 0; gap: 0.12rem; }
.app-menu-item strong { font-size: 0.88rem; }
.app-menu-item small { color: var(--muted); font-size: 0.72rem; line-height: 1.35; }
.app-menu-item > b { color: var(--sage-deep); font-size: 1.25rem; font-weight: 400; }
.app-menu-divider { height: 1px; background: var(--line); }
.app-menu-toggle { cursor: pointer; }
.app-menu-toggle input {
  width: 1.3rem;
  height: 1.3rem;
  flex: none;
  margin: 0;
  accent-color: var(--sage-deep);
}

.modal-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  background: rgba(36, 42, 35, 0.4);
  backdrop-filter: blur(5px);
}
.modal-dialog {
  position: relative;
  width: min(100%, 520px);
  max-height: min(90dvh, 850px);
  overflow: auto;
  padding: 1.4rem clamp(1.15rem, 4vw, 1.8rem) 1.65rem;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(20, 28, 20, 0.22);
  overscroll-behavior: contain;
}
.modal-top { display: flex; align-items: start; justify-content: space-between; min-height: 1.6rem; }
.modal-top .eyebrow { margin-bottom: 0.5rem; }
.icon-close { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-soft); font-size: 1.35rem; cursor: pointer; }
.icon-close:hover { border-color: var(--clay); color: var(--clay-deep); }
.modal-dialog h2 { margin-right: 1.5rem; }
.modal-copy { margin: 0.15rem 0 1rem; font-size: 0.91rem; }
.modal-dialog .attempt-list { margin: 1rem 0; }
.modal-dialog .attempt-card { padding: 0.7rem; }
.modal-dialog .attempt-card .button { flex: none; }
.toggle-row { display: flex; align-items: center; gap: 0.8rem; min-height: 4.2rem; padding: 0.7rem 0.1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; }
.share-options { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.share-options .toggle-row { min-height: 3.55rem; border: 0; padding-inline: 0.1rem; }
.share-options .toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.toggle-row input { width: 1.25rem; height: 1.25rem; flex: none; margin: 0; accent-color: var(--sage-deep); }
.toggle-row span { display: grid; gap: 0.22rem; }
.toggle-row strong { font-size: 0.9rem; }
.toggle-row small { color: var(--muted); font-size: 0.76rem; line-height: 1.35; }
.help-content { display: grid; gap: 0.85rem; }
.help-content > p { margin: 0; font-size: 0.9rem; }
.help-contact { display: flex; align-items: center; justify-content: space-between; margin-top: 0.15rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.help-contact .small-label { margin: 0; }
.help-contact strong { font-size: 0.86rem; }
.license-modal { width: min(100%, 650px); }
.license-content { display: grid; gap: 1rem; }
.license-content section { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.license-content h3 { margin: 0 0 0.55rem; color: var(--ink); font-family: Georgia, serif; font-size: 1.05rem; }
.license-content p { margin: 0.45rem 0 0; font-size: 0.82rem; line-height: 1.55; }
.license-full-link { margin: 0 !important; }
.notice-block { padding: 0.9rem; border: 1px solid var(--line); border-radius: 13px; background: #faf8f1; }
.notice-block h3 { margin: 0 0 0.35rem; color: var(--ink); font-size: 0.84rem; }
.notice-block p { margin: 0; color: var(--ink-soft); font-size: 0.77rem; line-height: 1.55; }
.share-preview-label { display: block; margin: 0.9rem 0 0.35rem; color: var(--muted); font-size: 0.74rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.share-preview { display: block; width: 100%; min-height: 10rem; resize: vertical; padding: 0.85rem; border: 1px solid var(--line-strong); border-radius: 12px; background: #fbf9f3; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.82rem; line-height: 1.5; white-space: pre-wrap; }
.completion-modal { text-align: center; }
.completion-modal .modal-top { text-align: left; }
.completion-modal h2 { margin-right: 0; }
.completion-celebration { display: flex; justify-content: center; gap: 1.4rem; margin: 0.4rem 0 0.7rem; color: var(--gold); font-size: 1.35rem; }
.completion-celebration span { animation: celebration-spark 900ms ease-out both; }
.completion-celebration span:nth-child(2n) { color: var(--clay); font-size: 0.95rem; }
.completion-celebration span:nth-child(2) { animation-delay: 90ms; }
.completion-celebration span:nth-child(3) { animation-delay: 170ms; }
.completion-celebration span:nth-child(4) { animation-delay: 250ms; }
.completion-celebration span:nth-child(5) { animation-delay: 330ms; }
.completion-result { display: grid; gap: 0.35rem; margin: 0 auto 0.75rem; color: var(--muted); font-size: 0.85rem; }
.completion-result strong { color: var(--sage-deep); font-family: Georgia, serif; font-size: 2.3rem; font-weight: 500; animation: celebration-score 540ms 160ms cubic-bezier(.2,1.3,.35,1) both; }
.completion-anagram { margin: 0.75rem 0; color: #775822; font-size: 0.84rem; font-weight: 800; letter-spacing: 0.06em; }
.completion-modal .modal-copy { max-width: 360px; margin-inline: auto; }
.completion-modal .modal-actions { justify-content: center; }
.completion-install-stinger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-top: 1rem;
  padding: 0.8rem 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
}
.completion-install-stinger > div { display: grid; gap: 0.16rem; }
.completion-install-stinger strong { color: var(--sage-deep); font-size: 0.86rem; }
.completion-install-stinger span { color: var(--muted); font-size: 0.74rem; line-height: 1.35; }
.completion-install-stinger .button { min-height: 2.35rem; flex: none; }
.install-help { display: grid; gap: 0.65rem; }
.install-help p { margin: 0; font-size: 0.9rem; line-height: 1.55; }
.install-help--ios { gap: 0.9rem; }
.install-steps {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  counter-reset: install-step;
  list-style: none;
}
.install-steps li {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.45;
  counter-increment: install-step;
}
.install-steps li > span {
  padding-top: 0.2rem;
}
.install-steps li::before {
  display: grid;
  box-sizing: border-box;
  width: 1.7rem;
  height: 1.7rem;
  place-items: center;
  border: 1px solid var(--sage);
  border-radius: 50%;
  background: var(--sage-pale);
  color: var(--sage-deep);
  content: counter(install-step);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}
.install-fallback {
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem !important;
}
.toast-root { position: fixed; z-index: 100; top: max(0.75rem, env(safe-area-inset-top)); right: 1rem; left: 1rem; display: flex; justify-content: center; pointer-events: none; }
.toast:empty { display: none; }
.toast { max-width: min(100%, 560px); padding: 0.78rem 1rem; border: 1px solid #d6d1c4; border-radius: 999px; background: var(--ink); box-shadow: var(--shadow); color: white; font-size: 0.86rem; text-align: center; animation: toast-in 160ms ease-out both; }
.toast--error { border-color: #875042; background: #754637; }
.toast--success { border-color: #49634d; background: #3f5b45; }
.toast--duplicate { border-color: #997b48; background: #6d5b3d; }
.feedback-error { animation: board-shake 280ms ease-in-out; }
.screen-enter { animation: screen-in 240ms ease-out both; }
.lesson-arrive { animation: lesson-arrive 220ms ease-out both; }
@keyframes lesson-arrive { from { opacity: 0.45; } to { opacity: 1; } }
.score-bump { animation: score-pop 260ms ease-out; }
@keyframes score-pop { from { transform: scale(1.16); } to { transform: scale(1); } }

@keyframes app-menu-desktop-in {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes app-menu-desktop-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(18px); }
}
@keyframes app-menu-drawer-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes app-menu-drawer-out {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}
@keyframes app-menu-backdrop-in {
  from { background-color: rgba(36, 42, 35, 0); }
  to { background-color: rgba(36, 42, 35, 0.38); }
}
@keyframes app-menu-backdrop-out {
  from { background-color: rgba(36, 42, 35, 0.38); }
  to { background-color: rgba(36, 42, 35, 0); }
}

@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes word-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes trace-arrive { from { stroke-dashoffset: 730; } to { stroke-dashoffset: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes board-feedback-in { from { opacity: 0; transform: translate(-50%, -40%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes board-shake { 0%, 100% { transform: translateX(0); } 28% { transform: translateX(-5px); } 68% { transform: translateX(4px); } }
@keyframes celebration-spark { from { opacity: 0; transform: translateY(-1.3rem) rotate(-35deg) scale(0.45); } 55% { opacity: 1; } to { opacity: 1; transform: translateY(0) rotate(0) scale(1); } }
@keyframes celebration-score { from { opacity: 0; transform: scale(0.72); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 830px) {
  .home-screen { min-height: 0; }
  .home-hero { grid-template-columns: minmax(0, 1fr) minmax(240px, 0.85fr); gap: 1.8rem; }
  .home-puzzle { padding-left: 1.8rem; }
  .play-layout, .construction-layout { grid-template-columns: minmax(0, 1fr); }
  .tutorial-stage.has-board,
  .tutorial-stage.is-info {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "instruction"
      "detail"
      "board"
      "nav";
    gap: 0.85rem;
    margin-inline: 0;
    padding: 0.95rem;
  }
  .tutorial-stage.is-info {
    grid-template-areas:
      "instruction"
      "detail"
      "nav";
  }
  .tutorial-board-panel .board-frame {
    width: min(100%, 560px);
    max-width: none;
  }
  .lesson-arrive { animation: none; }
  .game-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .play-aside { grid-template-columns: minmax(0, 1fr); }
  .play-aside .found-section { padding: 0.5rem 0; }
  .play-aside .found-heading { margin-bottom: 0.35rem; }
  .play-aside .found-word-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    white-space: normal;
  }
  .play-aside .found-word-list li {
    min-width: 0;
    padding-inline: clamp(0.35rem, 1.5vw, 0.58rem);
    font-size: clamp(0.68rem, 2.8vw, 0.78rem);
  }
  .archive-layout { grid-template-columns: minmax(0, 1fr); }
  .archive-detail { min-height: 0; }
}
@media (max-width: 620px) {
  body[data-screen="construction"] .header-inner,
  body[data-screen="play"] .header-inner,
  body[data-screen="tutorial"] .header-inner { min-height: 2.5rem; }
  .site-header { padding: max(0.55rem, env(safe-area-inset-top)) 0.8rem 0.2rem; }
  .header-inner { min-height: 3rem; gap: 0.3rem; }
  .brand-button { min-width: 0; }
  .brand-mark { width: 98px; }
  .header-actions { gap: 0.35rem; }
  .install-button { min-height: 2.55rem; gap: 0.38rem; padding: 0.38rem 0.62rem 0.38rem 0.45rem; font-size: 0.75rem; }
  .install-icon { width: 1.45rem; height: 1.45rem; }
  .install-icon svg { width: 0.88rem; height: 0.88rem; }
  .menu-button { width: 2.55rem; height: 2.55rem; }
  .app-menu-backdrop {
    display: flex;
    justify-content: flex-end;
    background: rgba(36, 42, 35, 0.38);
    backdrop-filter: blur(3px);
    animation: app-menu-backdrop-in 190ms ease-out both;
  }
  .app-menu-backdrop.is-closing {
    animation: app-menu-backdrop-out 170ms ease-in both;
  }
  .app-menu {
    position: relative;
    top: auto;
    right: auto;
    display: flex;
    width: min(88vw, 360px);
    height: 100dvh;
    max-height: 100dvh;
    flex-direction: column;
    overflow-y: auto;
    border-width: 0 0 0 1px;
    border-radius: 0;
    box-shadow: -18px 0 48px rgba(36, 42, 35, 0.2);
    overscroll-behavior: contain;
    animation: app-menu-drawer-in 190ms cubic-bezier(.2,.75,.25,1) both;
  }
  .app-menu-backdrop.is-closing .app-menu {
    animation: app-menu-drawer-out 170ms ease-in both;
  }
  .app-menu-header {
    min-height: calc(3.6rem + env(safe-area-inset-top));
    padding-top: max(0.65rem, env(safe-area-inset-top));
  }
  .app-menu-divider { margin-top: auto; }
  .app-menu-secondary { flex: none; padding-bottom: max(0.8rem, env(safe-area-inset-bottom)); }
  .app-shell { width: min(100% - 1rem, 1160px); padding-top: 0.8rem; }
  body[data-screen="home"] #main {
    display: flex;
  }
  body[data-screen="home"] .app-shell {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    padding-bottom: 0;
  }
  .home-screen {
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    padding: clamp(1rem, 2dvh, 1.35rem) 0.25rem max(1rem, env(safe-area-inset-bottom));
  }
  .home-hero {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: space-between;
    gap: clamp(1.5rem, 3.5dvh, 2.5rem);
  }
  .home-copy { width: 100%; max-width: 480px; margin-inline: auto; }
  .home-copy > .eyebrow { margin-bottom: 0.95rem; }
  .home-hero h1 { max-width: none; }
  .word-of-day-card { gap: 0.4rem; padding-bottom: 0.65rem; }
  .home-intro { max-width: 38ch; margin: 1.2rem 0 1.35rem; }
  .hero-mark { width: 204px; margin-bottom: 1.8rem; }
  .word-of-day { font-size: clamp(1.95rem, 8.8vw, 3rem); letter-spacing: 0.09em; }
  .home-puzzle { width: min(82vw, 330px); padding: 0; margin: 0 auto; border: 0; }
  .home-grid { width: 100%; }
  .home-grid-caption { width: 100%; margin-top: 0.6rem; font-size: 0.72rem; }
  .home-grid-caption span::before { width: 0.36rem; height: 0.36rem; margin-right: 0.32rem; }
  .home-actions { width: 100%; gap: 0.55rem; }
  .home-actions .button { flex: 1 1 calc(50% - 0.55rem); min-width: 0; padding-inline: 0.8rem; font-size: 0.88rem; }
  .home-actions .button--primary { flex-basis: 100%; }
  .home-actions .button--large { min-height: 3.25rem; }
  .home-understated { min-height: 1.75rem; flex-wrap: wrap; gap: 0.45rem 0.9rem; margin-top: 0.7rem; }
  .home-footer { flex-wrap: wrap; justify-content: center; gap: 0.2rem 0.5rem; margin-top: clamp(1rem, 2dvh, 1.5rem); }
  .screen-heading, .tutorial-header { align-items: flex-start; flex-direction: column; gap: 0.35rem; margin-top: 0.2rem; }
  .screen-heading h1, .tutorial-header h1 { font-size: 1.75rem; }
  .archive-screen .archive-heading {
    flex-direction: row;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }
  .archive-heading > div:first-child { min-width: 0; }
  .archive-home-button {
    min-height: 2.35rem;
    margin-left: auto;
    padding: 0.38rem 0.55rem;
    font-size: 0.76rem;
    white-space: nowrap;
  }
  .tutorial-nav-guide { grid-template-columns: 1fr; }
  .tutorial-header {
    min-height: 0;
    flex-direction: row;
    align-items: flex-end;
    padding-top: 0;
  }
  .tutorial-header > div:first-child { min-width: 0; }
  .tutorial-header-actions { position: static; gap: 0.15rem; }
  .tutorial-header-actions .button,
  .tutorial-header-actions .text-button { min-height: 2.25rem; padding: 0.35rem 0.48rem; font-size: 0.76rem; }
  .tutorial-progress-meta { gap: 0.5rem; font-size: 0.72rem; }
  .tutorial-progress-meta strong { min-width: 0; }
  .tutorial-progress-meta span { flex: none; }
  .tutorial-stage.has-board,
  .tutorial-stage.is-info {
    padding: 0.8rem;
    border-radius: 10px;
  }
  .tutorial-instruction { padding-bottom: 0.65rem; }
  .tutorial-instruction h2 { font-size: 1.3rem; }
  .tutorial-detail { gap: 0.65rem; }
  .tutorial-board-panel .board-frame {
    width: 100%;
    max-width: none;
  }
  .tutorial-board-panel .board-node { width: min(76%, 110px); }
  .tutorial-step-nav { gap: 0.5rem; padding-top: 0.75rem; }
  .tutorial-step-nav .button { min-width: 0; flex: 1 1 0; }
  .board-panel, .archive-detail { padding: 0.85rem; border-radius: 10px; }
  .board-frame { border-radius: 6px; }
  .board-grid { inset: 0; }
  .board-node { width: 78%; border-width: 1.5px; }
  .node-letter { font-size: clamp(1.35rem, 9vw, 2.25rem); }
  .board-tools { flex-wrap: nowrap; gap: 0.2rem; }
  .board-tools .button, .board-tools .text-button { min-height: 2.4rem; padding-inline: 0.42rem; font-size: 0.75rem; white-space: nowrap; }
  .tool-spacer { display: none; }
  .game-aside { grid-template-columns: minmax(0, 1fr); }
  .game-aside .found-section { grid-row: auto; }
  .calendar-card { padding: 0.8rem; }
  .calendar-grid { gap: 0.18rem; }
  .calendar-day { border-radius: 5px; font-size: 0.78rem; }
  .calendar-detail { padding: 1rem; }
  .tutorial-header-actions { align-self: auto; margin-top: 0; }
  .tutorial-score-table > div { font-size: 0.76rem; }
  .attempt-card { align-items: flex-start; }
  .attempt-card .button { min-height: 2.25rem; padding: 0.4rem 0.7rem; }
  .modal-dialog { padding: 1.1rem 1rem 1.3rem; border-radius: 10px; }
  .modal-actions .button { flex: 1 1 auto; }
  .modal-actions--stack .button { width: 100%; }
  .completion-modal .modal-actions { flex-direction: column; }
  .completion-install-stinger { align-items: stretch; flex-direction: column; }
  .completion-install-stinger .button { width: 100%; }
}
@media (max-width: 365px) {
  .hero-mark { width: 210px; }
  .home-actions { gap: 0.3rem; }
  .home-actions .button { font-size: 0.76rem; }
  .current-trace strong { min-width: 4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .feedback-error { animation: none !important; outline: 3px solid var(--clay); outline-offset: 3px; }
}
