:root {
  color-scheme: light;
  --ink: #18372d;
  --ink-soft: #4d655d;
  --forest: #173d32;
  --forest-deep: #0d2a23;
  --moss: #567448;
  --moss-light: #acc27b;
  --fern: #dce5c2;
  --paper: #fffaf0;
  --paper-deep: #f1e6cd;
  --amber: #e7a83e;
  --amber-deep: #9b5f18;
  --berry: #9c3f43;
  --line: rgba(24, 55, 45, .18);
  --shadow: 0 22px 60px rgba(11, 43, 34, .13);
  --cell: clamp(2.75rem, 5.2vw, 3.65rem);
  --radius: 1.4rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(5.5rem + var(--safe-top));
}

body {
  min-width: 0;
  margin: 0;
  overflow-x: clip;
  padding-bottom: var(--safe-bottom);
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 12%, rgba(172, 194, 123, .18), transparent 22rem),
    linear-gradient(180deg, #f8f0dd 0, #fbf7eb 38rem, #f4ecd9 100%);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: .2rem solid #e7a83e;
  outline-offset: .18rem;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: .75rem;
  left: .75rem;
  padding: .7rem 1rem;
  color: #fff;
  background: var(--forest-deep);
  border-radius: .7rem;
  transform: translateY(-180%);
  transition: transform .15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.site-header,
main,
footer {
  width: min(112rem, calc(100% - clamp(1.25rem, 4vw, 4rem)));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  min-height: calc(5.35rem + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: var(--safe-top);
  background: rgba(248, 240, 221, .86);
  border-bottom: 1px solid rgba(24, 55, 45, .09);
  backdrop-filter: blur(1rem) saturate(1.1);
}

.brand,
.player-chip {
  display: flex;
  align-items: center;
}

.brand {
  gap: .85rem;
}

.brand-mark,
.dialog-mark {
  display: grid;
  place-items: center;
  width: 2.9rem;
  aspect-ratio: 1;
  color: #f9e3a4;
  background: var(--forest);
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50% 46% 52% 44%;
  box-shadow: inset 0 0 0 .25rem rgba(255,255,255,.06);
}

.brand p {
  margin: 0;
}

.brand-name {
  font: 700 clamp(1.25rem, 2vw, 1.65rem)/1 var(--serif);
  letter-spacing: -.025em;
}

.eyebrow {
  margin: 0 0 .35rem;
  color: var(--moss);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .15em;
  line-height: 1.2;
  text-transform: uppercase;
}

.player-chip {
  gap: .65rem;
  padding: .45rem .75rem .45rem .45rem;
  text-align: left;
  background: rgba(255,250,240,.66);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}

.player-chip:hover {
  background: #fffaf0;
  transform: translateY(-1px);
}

.player-chip small,
.player-chip strong {
  display: block;
  line-height: 1.25;
}

.player-chip small {
  color: var(--ink-soft);
  font-size: .68rem;
}

.player-chip strong {
  max-width: 12rem;
  overflow: hidden;
  font-size: .88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-avatar {
  display: grid;
  place-items: center;
  width: 2.15rem;
  aspect-ratio: 1;
  color: #fff7df;
  background: var(--berry);
  border-radius: 50%;
  font: 700 1rem var(--serif);
}

.hero {
  position: relative;
  min-height: clamp(19rem, 31vw, 27rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, .92fr);
  align-items: center;
  overflow: hidden;
  padding: clamp(2.25rem, 5vw, 4.5rem);
  color: #fffaf0;
  isolation: isolate;
  background:
    linear-gradient(112deg, rgba(7,32,26,.98) 6%, rgba(23,61,50,.95) 55%, rgba(52,85,61,.82)),
    #173d32;
  border-radius: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 5vw, 5rem) clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: var(--shadow);
}

.hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 75% 29%, rgba(246,217,143,.18) 0 1.5rem, transparent 1.6rem),
    radial-gradient(circle at 68% 18%, rgba(255,255,255,.45) 0 .08rem, transparent .12rem),
    radial-gradient(circle at 90% 13%, rgba(255,255,255,.28) 0 .07rem, transparent .11rem),
    radial-gradient(circle at 82% 45%, rgba(180,203,130,.1), transparent 15rem);
  content: "";
}

.hero::after {
  position: absolute;
  z-index: -1;
  right: -7%;
  bottom: -19%;
  width: 65%;
  height: 55%;
  background: #0e3027;
  border-radius: 50% 0 0;
  content: "";
  transform: rotate(-5deg);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 45rem;
}

.hero .eyebrow {
  color: #c6d99e;
}

.hero h1 {
  max-width: 12ch;
  margin: .65rem 0 1.4rem;
  font: 500 clamp(2.8rem, 5.4vw, 5.8rem)/.9 var(--serif);
  letter-spacing: -.055em;
}

.hero h1 em {
  color: #f0c36c;
  font-weight: 400;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 36rem;
  margin: 0;
  color: rgba(255,250,240,.76);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
}

.hero-game-link {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  margin-top: 1.45rem;
  padding: .65rem 1rem;
  color: #fffaf0;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
}

.hero-game-link:hover {
  background: rgba(255, 255, 255, .16);
}

.forest-scene {
  position: relative;
  align-self: stretch;
  min-height: 22rem;
}

.moon {
  position: absolute;
  top: 20%;
  right: 17%;
  display: grid;
  place-items: center;
  width: 5.6rem;
  aspect-ratio: 1;
  color: #fff0ba;
  background: rgba(239,195,108,.13);
  border: 1px solid rgba(255,239,181,.35);
  border-radius: 50%;
  box-shadow: 0 0 4rem rgba(240,195,108,.26);
  font-size: 1.2rem;
}

.fir {
  position: absolute;
  bottom: 8%;
  width: 0;
  height: 0;
  filter: drop-shadow(0 1rem 1rem rgba(0,0,0,.18));
}

.fir::before,
.fir::after {
  position: absolute;
  left: 50%;
  border-right: solid transparent;
  border-bottom: solid #6f8b5d;
  border-left: solid transparent;
  content: "";
  transform: translateX(-50%);
}

.fir::before {
  bottom: 0;
  border-right-width: 5.8rem;
  border-bottom-width: 13rem;
  border-left-width: 5.8rem;
}

.fir::after {
  bottom: 6rem;
  border-right-width: 4.25rem;
  border-bottom-width: 9rem;
  border-left-width: 4.25rem;
}

.fir-one { right: 38%; transform: scale(.78); }
.fir-two { right: 8%; bottom: -1%; transform: scale(1.15); }
.fir-three { right: 66%; bottom: 0; transform: scale(.5); opacity: .75; }
.fir-two::before, .fir-two::after { border-bottom-color: #476d52; }

.stone {
  position: absolute;
  right: 25%;
  bottom: 3%;
  width: 9rem;
  height: 4rem;
  background: #315445;
  border-radius: 70% 50% 20% 20%;
}

.world-section,
.game-section,
.leaderboard-section {
  padding-block: clamp(3rem, 6vw, 6rem) 0;
}

.section-heading,
.area-heading,
.key-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

.section-heading h2,
.area-heading h2,
.leaderboard-section h2 {
  margin: 0;
  font: 500 clamp(2rem, 4vw, 3.7rem)/1 var(--serif);
  letter-spacing: -.04em;
}

.world-hint,
.section-heading > p {
  max-width: 34rem;
  margin: 0;
  color: var(--ink-soft);
}

.world-scroll {
  overflow-x: auto;
  margin-top: 2rem;
  padding: 1rem .25rem 2.25rem;
  scrollbar-color: var(--moss) transparent;
}

.world-path {
  min-width: max-content;
}

.world-tree,
.world-tree ol {
  display: flex;
  align-items: flex-start;
  gap: 1.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.world-tree li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.3rem;
}

.world-tree li::after {
  width: 1.3rem;
  height: 1px;
  order: 1;
  background: rgba(24,55,45,.26);
  content: "";
}

.world-tree li:last-child:not(:has(ol))::after {
  display: none;
}

.world-tree ol {
  position: relative;
  order: 2;
  flex-direction: column;
}

.world-tree ol::before {
  position: absolute;
  top: 2.65rem;
  bottom: 2.65rem;
  left: -.65rem;
  width: 1px;
  background: rgba(24,55,45,.26);
  content: "";
}

.world-node {
  position: relative;
  width: 14rem;
  min-height: 5.35rem;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  align-items: center;
  gap: .8rem;
  padding: .85rem;
  text-align: left;
  background: rgba(255,250,240,.8);
  border: 1px solid var(--line);
  border-radius: 1.25rem 1.1rem 1.4rem .9rem;
  box-shadow: 0 .6rem 1.8rem rgba(20,54,43,.07);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.world-node:hover:not(:disabled),
.world-node[aria-current="true"] {
  border-color: var(--moss);
  box-shadow: 0 .75rem 2rem rgba(20,54,43,.13);
  transform: translateY(-3px);
}

.world-node[aria-current="true"]::before {
  position: absolute;
  right: .75rem;
  bottom: -.45rem;
  left: .75rem;
  height: .25rem;
  background: var(--amber);
  border-radius: 50%;
  content: "";
}

.world-node:disabled {
  opacity: .56;
  cursor: not-allowed;
}

.world-node-icon {
  display: grid;
  place-items: center;
  width: 2.45rem;
  aspect-ratio: 1;
  color: #fff8e7;
  background: var(--moss);
  border-radius: 55% 45% 50% 42%;
}

.world-node.locked .world-node-icon { color: var(--ink-soft); background: var(--paper-deep); }
.world-node.archived .world-node-icon { background: var(--amber-deep); }
.world-node strong,
.world-node small { display: block; }
.world-node strong { font: 700 1rem/1.15 var(--serif); }
.world-node small { margin-top: .28rem; color: var(--ink-soft); font-size: .7rem; }

.loading-line {
  color: var(--ink-soft);
}

.area-heading {
  margin-bottom: 2rem;
}

.area-heading > div:first-child {
  min-width: 0;
}

.area-actions {
  width: min(24rem, 100%);
  display: grid;
  justify-items: end;
  gap: .8rem;
}

.area-map-link {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .85rem;
  color: var(--forest);
  background: rgba(255, 250, 240, .7);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 800;
  text-decoration: none;
}

.area-map-link:hover {
  border-color: var(--moss);
  background: var(--paper);
}

.area-status {
  margin: .65rem 0 0;
  color: var(--ink-soft);
}

.area-progress {
  width: min(22rem, 100%);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .5rem;
  color: var(--ink-soft);
  font-size: .82rem;
}

.progress-copy strong {
  color: var(--ink);
}

progress {
  width: 100%;
  height: .62rem;
  overflow: hidden;
  background: var(--paper-deep);
  border: 0;
  border-radius: 99px;
}

progress::-webkit-progress-bar { background: var(--paper-deep); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--moss), var(--moss-light)); border-radius: 99px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--moss), var(--moss-light)); border-radius: 99px; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}

.board-card {
  min-width: 0;
  overflow: clip;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7)),
    repeating-linear-gradient(35deg, transparent 0 8px, rgba(76,86,58,.04) 9px 10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.board-toolbar {
  min-height: 3.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem clamp(.85rem, 2vw, 1.35rem);
  border-bottom: 1px solid var(--line);
}

.sector-navigation {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-left: auto;
  padding: .3rem .35rem .3rem .65rem;
  color: var(--ink-soft);
  background: rgba(255, 250, 240, .82);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .74rem;
  line-height: 1.2;
}

.sector-navigation[hidden] {
  display: none;
}

.sector-navigation-status {
  white-space: nowrap;
}

.sector-navigation-next {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .38rem .62rem;
  color: #fffaf0;
  background: var(--forest);
  border: 1px solid rgba(24, 55, 45, .35);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.15;
}

.sector-navigation-next:hover:not(:disabled) {
  background: var(--moss);
}

.sector-navigation-next:disabled {
  cursor: wait;
  opacity: .62;
}

.board-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  margin: 0;
  padding: 0;
  color: var(--ink-soft);
  font-size: .72rem;
  list-style: none;
}

.board-legend li {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.legend-swatch {
  width: .72rem;
  aspect-ratio: 1;
  border: 1px solid rgba(24,55,45,.35);
  border-radius: .16rem;
}

.legend-swatch.confirmed { background: var(--fern); }
.legend-swatch.key { background: #f6d68e; }
.development-help-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: .22rem .55rem;
  margin-left: auto;
  color: #5c625e;
  background: rgba(255, 255, 255, .52);
  border: 1px dashed rgba(77, 101, 93, .45);
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .025em;
  line-height: 1.2;
}

body.has-development-help .board-toolbar {
  flex-wrap: wrap;
}

.board-scroll {
  height: clamp(29rem, 64dvh, 49rem);
  min-height: 0;
  overflow: auto;
  padding: clamp(1rem, 3vw, 2.5rem);
  background:
    radial-gradient(circle at 48% 45%, rgba(173,194,123,.15), transparent 48%),
    #e8e4ce;
  scrollbar-color: var(--moss) rgba(255,255,255,.4);
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scroll-padding: clamp(1rem, 3vw, 2.5rem);
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

.crossword-grid {
  position: relative;
  width: max-content;
  min-width: 100%;
  min-height: 26rem;
  display: grid;
  grid-auto-columns: var(--cell);
  grid-auto-rows: var(--cell);
  align-content: center;
  justify-content: center;
  gap: 2px;
  padding: 1.1rem;
  isolation: isolate;
}

/* The sector viewport keeps a stable world-sized canvas while only loaded
   sectors contribute cells to the DOM. */
.crossword-grid.sector-grid {
  min-width: 0;
  min-height: 0;
  align-content: start;
  justify-content: start;
}

.sector-grid-extent {
  width: var(--cell);
  height: var(--cell);
  visibility: hidden;
  pointer-events: none;
}

.crossword-grid.sector-grid .grid-skeleton {
  position: sticky;
  z-index: 3;
  left: 1rem;
  width: min(18rem, calc(100vw - 3rem));
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  justify-self: start;
  padding: .7rem .85rem;
  background: rgba(255, 250, 240, .9);
  border-radius: .75rem;
}

.grid-row {
  display: contents;
}

/* CSP-safe sparse grid placement for the planned maximum 200 × 200 area. */
.grid-x-1 { grid-column: 1; }
.grid-x-2 { grid-column: 2; }
.grid-x-3 { grid-column: 3; }
.grid-x-4 { grid-column: 4; }
.grid-x-5 { grid-column: 5; }
.grid-x-6 { grid-column: 6; }
.grid-x-7 { grid-column: 7; }
.grid-x-8 { grid-column: 8; }
.grid-x-9 { grid-column: 9; }
.grid-x-10 { grid-column: 10; }
.grid-x-11 { grid-column: 11; }
.grid-x-12 { grid-column: 12; }
.grid-x-13 { grid-column: 13; }
.grid-x-14 { grid-column: 14; }
.grid-x-15 { grid-column: 15; }
.grid-x-16 { grid-column: 16; }
.grid-x-17 { grid-column: 17; }
.grid-x-18 { grid-column: 18; }
.grid-x-19 { grid-column: 19; }
.grid-x-20 { grid-column: 20; }
.grid-x-21 { grid-column: 21; }
.grid-x-22 { grid-column: 22; }
.grid-x-23 { grid-column: 23; }
.grid-x-24 { grid-column: 24; }
.grid-x-25 { grid-column: 25; }
.grid-x-26 { grid-column: 26; }
.grid-x-27 { grid-column: 27; }
.grid-x-28 { grid-column: 28; }
.grid-x-29 { grid-column: 29; }
.grid-x-30 { grid-column: 30; }
.grid-x-31 { grid-column: 31; }
.grid-x-32 { grid-column: 32; }
.grid-x-33 { grid-column: 33; }
.grid-x-34 { grid-column: 34; }
.grid-x-35 { grid-column: 35; }
.grid-x-36 { grid-column: 36; }
.grid-x-37 { grid-column: 37; }
.grid-x-38 { grid-column: 38; }
.grid-x-39 { grid-column: 39; }
.grid-x-40 { grid-column: 40; }
.grid-x-41 { grid-column: 41; }
.grid-x-42 { grid-column: 42; }
.grid-x-43 { grid-column: 43; }
.grid-x-44 { grid-column: 44; }
.grid-x-45 { grid-column: 45; }
.grid-x-46 { grid-column: 46; }
.grid-x-47 { grid-column: 47; }
.grid-x-48 { grid-column: 48; }
.grid-x-49 { grid-column: 49; }
.grid-x-50 { grid-column: 50; }
.grid-x-51 { grid-column: 51; }
.grid-x-52 { grid-column: 52; }
.grid-x-53 { grid-column: 53; }
.grid-x-54 { grid-column: 54; }
.grid-x-55 { grid-column: 55; }
.grid-x-56 { grid-column: 56; }
.grid-x-57 { grid-column: 57; }
.grid-x-58 { grid-column: 58; }
.grid-x-59 { grid-column: 59; }
.grid-x-60 { grid-column: 60; }
.grid-x-61 { grid-column: 61; }
.grid-x-62 { grid-column: 62; }
.grid-x-63 { grid-column: 63; }
.grid-x-64 { grid-column: 64; }
.grid-x-65 { grid-column: 65; }
.grid-x-66 { grid-column: 66; }
.grid-x-67 { grid-column: 67; }
.grid-x-68 { grid-column: 68; }
.grid-x-69 { grid-column: 69; }
.grid-x-70 { grid-column: 70; }
.grid-x-71 { grid-column: 71; }
.grid-x-72 { grid-column: 72; }
.grid-x-73 { grid-column: 73; }
.grid-x-74 { grid-column: 74; }
.grid-x-75 { grid-column: 75; }
.grid-x-76 { grid-column: 76; }
.grid-x-77 { grid-column: 77; }
.grid-x-78 { grid-column: 78; }
.grid-x-79 { grid-column: 79; }
.grid-x-80 { grid-column: 80; }
.grid-x-81 { grid-column: 81; }
.grid-x-82 { grid-column: 82; }
.grid-x-83 { grid-column: 83; }
.grid-x-84 { grid-column: 84; }
.grid-x-85 { grid-column: 85; }
.grid-x-86 { grid-column: 86; }
.grid-x-87 { grid-column: 87; }
.grid-x-88 { grid-column: 88; }
.grid-x-89 { grid-column: 89; }
.grid-x-90 { grid-column: 90; }
.grid-x-91 { grid-column: 91; }
.grid-x-92 { grid-column: 92; }
.grid-x-93 { grid-column: 93; }
.grid-x-94 { grid-column: 94; }
.grid-x-95 { grid-column: 95; }
.grid-x-96 { grid-column: 96; }
.grid-x-97 { grid-column: 97; }
.grid-x-98 { grid-column: 98; }
.grid-x-99 { grid-column: 99; }
.grid-x-100 { grid-column: 100; }
.grid-x-101 { grid-column: 101; }
.grid-x-102 { grid-column: 102; }
.grid-x-103 { grid-column: 103; }
.grid-x-104 { grid-column: 104; }
.grid-x-105 { grid-column: 105; }
.grid-x-106 { grid-column: 106; }
.grid-x-107 { grid-column: 107; }
.grid-x-108 { grid-column: 108; }
.grid-x-109 { grid-column: 109; }
.grid-x-110 { grid-column: 110; }
.grid-x-111 { grid-column: 111; }
.grid-x-112 { grid-column: 112; }
.grid-x-113 { grid-column: 113; }
.grid-x-114 { grid-column: 114; }
.grid-x-115 { grid-column: 115; }
.grid-x-116 { grid-column: 116; }
.grid-x-117 { grid-column: 117; }
.grid-x-118 { grid-column: 118; }
.grid-x-119 { grid-column: 119; }
.grid-x-120 { grid-column: 120; }
.grid-x-121 { grid-column: 121; }
.grid-x-122 { grid-column: 122; }
.grid-x-123 { grid-column: 123; }
.grid-x-124 { grid-column: 124; }
.grid-x-125 { grid-column: 125; }
.grid-x-126 { grid-column: 126; }
.grid-x-127 { grid-column: 127; }
.grid-x-128 { grid-column: 128; }
.grid-x-129 { grid-column: 129; }
.grid-x-130 { grid-column: 130; }
.grid-x-131 { grid-column: 131; }
.grid-x-132 { grid-column: 132; }
.grid-x-133 { grid-column: 133; }
.grid-x-134 { grid-column: 134; }
.grid-x-135 { grid-column: 135; }
.grid-x-136 { grid-column: 136; }
.grid-x-137 { grid-column: 137; }
.grid-x-138 { grid-column: 138; }
.grid-x-139 { grid-column: 139; }
.grid-x-140 { grid-column: 140; }
.grid-x-141 { grid-column: 141; }
.grid-x-142 { grid-column: 142; }
.grid-x-143 { grid-column: 143; }
.grid-x-144 { grid-column: 144; }
.grid-x-145 { grid-column: 145; }
.grid-x-146 { grid-column: 146; }
.grid-x-147 { grid-column: 147; }
.grid-x-148 { grid-column: 148; }
.grid-x-149 { grid-column: 149; }
.grid-x-150 { grid-column: 150; }
.grid-x-151 { grid-column: 151; }
.grid-x-152 { grid-column: 152; }
.grid-x-153 { grid-column: 153; }
.grid-x-154 { grid-column: 154; }
.grid-x-155 { grid-column: 155; }
.grid-x-156 { grid-column: 156; }
.grid-x-157 { grid-column: 157; }
.grid-x-158 { grid-column: 158; }
.grid-x-159 { grid-column: 159; }
.grid-x-160 { grid-column: 160; }
.grid-x-161 { grid-column: 161; }
.grid-x-162 { grid-column: 162; }
.grid-x-163 { grid-column: 163; }
.grid-x-164 { grid-column: 164; }
.grid-x-165 { grid-column: 165; }
.grid-x-166 { grid-column: 166; }
.grid-x-167 { grid-column: 167; }
.grid-x-168 { grid-column: 168; }
.grid-x-169 { grid-column: 169; }
.grid-x-170 { grid-column: 170; }
.grid-x-171 { grid-column: 171; }
.grid-x-172 { grid-column: 172; }
.grid-x-173 { grid-column: 173; }
.grid-x-174 { grid-column: 174; }
.grid-x-175 { grid-column: 175; }
.grid-x-176 { grid-column: 176; }
.grid-x-177 { grid-column: 177; }
.grid-x-178 { grid-column: 178; }
.grid-x-179 { grid-column: 179; }
.grid-x-180 { grid-column: 180; }
.grid-x-181 { grid-column: 181; }
.grid-x-182 { grid-column: 182; }
.grid-x-183 { grid-column: 183; }
.grid-x-184 { grid-column: 184; }
.grid-x-185 { grid-column: 185; }
.grid-x-186 { grid-column: 186; }
.grid-x-187 { grid-column: 187; }
.grid-x-188 { grid-column: 188; }
.grid-x-189 { grid-column: 189; }
.grid-x-190 { grid-column: 190; }
.grid-x-191 { grid-column: 191; }
.grid-x-192 { grid-column: 192; }
.grid-x-193 { grid-column: 193; }
.grid-x-194 { grid-column: 194; }
.grid-x-195 { grid-column: 195; }
.grid-x-196 { grid-column: 196; }
.grid-x-197 { grid-column: 197; }
.grid-x-198 { grid-column: 198; }
.grid-x-199 { grid-column: 199; }
.grid-x-200 { grid-column: 200; }
.grid-y-1 { grid-row: 1; }
.grid-y-2 { grid-row: 2; }
.grid-y-3 { grid-row: 3; }
.grid-y-4 { grid-row: 4; }
.grid-y-5 { grid-row: 5; }
.grid-y-6 { grid-row: 6; }
.grid-y-7 { grid-row: 7; }
.grid-y-8 { grid-row: 8; }
.grid-y-9 { grid-row: 9; }
.grid-y-10 { grid-row: 10; }
.grid-y-11 { grid-row: 11; }
.grid-y-12 { grid-row: 12; }
.grid-y-13 { grid-row: 13; }
.grid-y-14 { grid-row: 14; }
.grid-y-15 { grid-row: 15; }
.grid-y-16 { grid-row: 16; }
.grid-y-17 { grid-row: 17; }
.grid-y-18 { grid-row: 18; }
.grid-y-19 { grid-row: 19; }
.grid-y-20 { grid-row: 20; }
.grid-y-21 { grid-row: 21; }
.grid-y-22 { grid-row: 22; }
.grid-y-23 { grid-row: 23; }
.grid-y-24 { grid-row: 24; }
.grid-y-25 { grid-row: 25; }
.grid-y-26 { grid-row: 26; }
.grid-y-27 { grid-row: 27; }
.grid-y-28 { grid-row: 28; }
.grid-y-29 { grid-row: 29; }
.grid-y-30 { grid-row: 30; }
.grid-y-31 { grid-row: 31; }
.grid-y-32 { grid-row: 32; }
.grid-y-33 { grid-row: 33; }
.grid-y-34 { grid-row: 34; }
.grid-y-35 { grid-row: 35; }
.grid-y-36 { grid-row: 36; }
.grid-y-37 { grid-row: 37; }
.grid-y-38 { grid-row: 38; }
.grid-y-39 { grid-row: 39; }
.grid-y-40 { grid-row: 40; }
.grid-y-41 { grid-row: 41; }
.grid-y-42 { grid-row: 42; }
.grid-y-43 { grid-row: 43; }
.grid-y-44 { grid-row: 44; }
.grid-y-45 { grid-row: 45; }
.grid-y-46 { grid-row: 46; }
.grid-y-47 { grid-row: 47; }
.grid-y-48 { grid-row: 48; }
.grid-y-49 { grid-row: 49; }
.grid-y-50 { grid-row: 50; }
.grid-y-51 { grid-row: 51; }
.grid-y-52 { grid-row: 52; }
.grid-y-53 { grid-row: 53; }
.grid-y-54 { grid-row: 54; }
.grid-y-55 { grid-row: 55; }
.grid-y-56 { grid-row: 56; }
.grid-y-57 { grid-row: 57; }
.grid-y-58 { grid-row: 58; }
.grid-y-59 { grid-row: 59; }
.grid-y-60 { grid-row: 60; }
.grid-y-61 { grid-row: 61; }
.grid-y-62 { grid-row: 62; }
.grid-y-63 { grid-row: 63; }
.grid-y-64 { grid-row: 64; }
.grid-y-65 { grid-row: 65; }
.grid-y-66 { grid-row: 66; }
.grid-y-67 { grid-row: 67; }
.grid-y-68 { grid-row: 68; }
.grid-y-69 { grid-row: 69; }
.grid-y-70 { grid-row: 70; }
.grid-y-71 { grid-row: 71; }
.grid-y-72 { grid-row: 72; }
.grid-y-73 { grid-row: 73; }
.grid-y-74 { grid-row: 74; }
.grid-y-75 { grid-row: 75; }
.grid-y-76 { grid-row: 76; }
.grid-y-77 { grid-row: 77; }
.grid-y-78 { grid-row: 78; }
.grid-y-79 { grid-row: 79; }
.grid-y-80 { grid-row: 80; }
.grid-y-81 { grid-row: 81; }
.grid-y-82 { grid-row: 82; }
.grid-y-83 { grid-row: 83; }
.grid-y-84 { grid-row: 84; }
.grid-y-85 { grid-row: 85; }
.grid-y-86 { grid-row: 86; }
.grid-y-87 { grid-row: 87; }
.grid-y-88 { grid-row: 88; }
.grid-y-89 { grid-row: 89; }
.grid-y-90 { grid-row: 90; }
.grid-y-91 { grid-row: 91; }
.grid-y-92 { grid-row: 92; }
.grid-y-93 { grid-row: 93; }
.grid-y-94 { grid-row: 94; }
.grid-y-95 { grid-row: 95; }
.grid-y-96 { grid-row: 96; }
.grid-y-97 { grid-row: 97; }
.grid-y-98 { grid-row: 98; }
.grid-y-99 { grid-row: 99; }
.grid-y-100 { grid-row: 100; }
.grid-y-101 { grid-row: 101; }
.grid-y-102 { grid-row: 102; }
.grid-y-103 { grid-row: 103; }
.grid-y-104 { grid-row: 104; }
.grid-y-105 { grid-row: 105; }
.grid-y-106 { grid-row: 106; }
.grid-y-107 { grid-row: 107; }
.grid-y-108 { grid-row: 108; }
.grid-y-109 { grid-row: 109; }
.grid-y-110 { grid-row: 110; }
.grid-y-111 { grid-row: 111; }
.grid-y-112 { grid-row: 112; }
.grid-y-113 { grid-row: 113; }
.grid-y-114 { grid-row: 114; }
.grid-y-115 { grid-row: 115; }
.grid-y-116 { grid-row: 116; }
.grid-y-117 { grid-row: 117; }
.grid-y-118 { grid-row: 118; }
.grid-y-119 { grid-row: 119; }
.grid-y-120 { grid-row: 120; }
.grid-y-121 { grid-row: 121; }
.grid-y-122 { grid-row: 122; }
.grid-y-123 { grid-row: 123; }
.grid-y-124 { grid-row: 124; }
.grid-y-125 { grid-row: 125; }
.grid-y-126 { grid-row: 126; }
.grid-y-127 { grid-row: 127; }
.grid-y-128 { grid-row: 128; }
.grid-y-129 { grid-row: 129; }
.grid-y-130 { grid-row: 130; }
.grid-y-131 { grid-row: 131; }
.grid-y-132 { grid-row: 132; }
.grid-y-133 { grid-row: 133; }
.grid-y-134 { grid-row: 134; }
.grid-y-135 { grid-row: 135; }
.grid-y-136 { grid-row: 136; }
.grid-y-137 { grid-row: 137; }
.grid-y-138 { grid-row: 138; }
.grid-y-139 { grid-row: 139; }
.grid-y-140 { grid-row: 140; }
.grid-y-141 { grid-row: 141; }
.grid-y-142 { grid-row: 142; }
.grid-y-143 { grid-row: 143; }
.grid-y-144 { grid-row: 144; }
.grid-y-145 { grid-row: 145; }
.grid-y-146 { grid-row: 146; }
.grid-y-147 { grid-row: 147; }
.grid-y-148 { grid-row: 148; }
.grid-y-149 { grid-row: 149; }
.grid-y-150 { grid-row: 150; }
.grid-y-151 { grid-row: 151; }
.grid-y-152 { grid-row: 152; }
.grid-y-153 { grid-row: 153; }
.grid-y-154 { grid-row: 154; }
.grid-y-155 { grid-row: 155; }
.grid-y-156 { grid-row: 156; }
.grid-y-157 { grid-row: 157; }
.grid-y-158 { grid-row: 158; }
.grid-y-159 { grid-row: 159; }
.grid-y-160 { grid-row: 160; }
.grid-y-161 { grid-row: 161; }
.grid-y-162 { grid-row: 162; }
.grid-y-163 { grid-row: 163; }
.grid-y-164 { grid-row: 164; }
.grid-y-165 { grid-row: 165; }
.grid-y-166 { grid-row: 166; }
.grid-y-167 { grid-row: 167; }
.grid-y-168 { grid-row: 168; }
.grid-y-169 { grid-row: 169; }
.grid-y-170 { grid-row: 170; }
.grid-y-171 { grid-row: 171; }
.grid-y-172 { grid-row: 172; }
.grid-y-173 { grid-row: 173; }
.grid-y-174 { grid-row: 174; }
.grid-y-175 { grid-row: 175; }
.grid-y-176 { grid-row: 176; }
.grid-y-177 { grid-row: 177; }
.grid-y-178 { grid-row: 178; }
.grid-y-179 { grid-row: 179; }
.grid-y-180 { grid-row: 180; }
.grid-y-181 { grid-row: 181; }
.grid-y-182 { grid-row: 182; }
.grid-y-183 { grid-row: 183; }
.grid-y-184 { grid-row: 184; }
.grid-y-185 { grid-row: 185; }
.grid-y-186 { grid-row: 186; }
.grid-y-187 { grid-row: 187; }
.grid-y-188 { grid-row: 188; }
.grid-y-189 { grid-row: 189; }
.grid-y-190 { grid-row: 190; }
.grid-y-191 { grid-row: 191; }
.grid-y-192 { grid-row: 192; }
.grid-y-193 { grid-row: 193; }
.grid-y-194 { grid-row: 194; }
.grid-y-195 { grid-row: 195; }
.grid-y-196 { grid-row: 196; }
.grid-y-197 { grid-row: 197; }
.grid-y-198 { grid-row: 198; }
.grid-y-199 { grid-row: 199; }
.grid-y-200 { grid-row: 200; }

.crossword-grid::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 46% 54% 48% 52% / 8% 7% 9% 8%;
  content: "";
}

.grid-cell {
  width: var(--cell);
  height: var(--cell);
}

.letter-cell,
.clue-cell {
  width: 100%;
  height: 100%;
  display: grid;
  padding: 0;
  border: 1px solid rgba(26,55,45,.48);
  cursor: pointer;
}

.letter-cell {
  position: relative;
  place-items: center;
  color: var(--forest-deep);
  background: #fffdf6;
  border-radius: .18rem;
  box-shadow: inset 0 -2px 0 rgba(24,55,45,.08);
  font: 700 clamp(1.1rem, 2.8vw, 1.65rem)/1 var(--serif);
  text-transform: uppercase;
}

.letter-cell:hover,
.letter-cell.selected {
  z-index: 2;
  background: #fff4ce;
  border-color: var(--amber-deep);
  box-shadow: 0 0 0 2px var(--amber), inset 0 -2px 0 rgba(24,55,45,.08);
}

.letter-cell.confirmed {
  background: #e7efd2;
}

.letter-cell .development-letter {
  color: #858b87;
  font-weight: 500;
}

.letter-cell.key-cell::after {
  position: absolute;
  right: .14rem;
  bottom: .1rem;
  color: var(--amber-deep);
  content: "✦";
  font: 700 .55rem/1 var(--sans);
}

.letter-cell .key-index {
  position: absolute;
  top: .12rem;
  left: .18rem;
  color: var(--amber-deep);
  font: 800 .5rem/1 var(--sans);
}

.clue-cell {
  position: relative;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .12rem;
  overflow: hidden;
  padding: .22rem;
  text-align: left;
  color: #fdf8e9;
  background: var(--forest);
  border-color: var(--forest-deep);
  border-radius: .32rem;
}

.clue-cell.has-party-help {
  outline: 2px dashed #ffe3a2;
  outline-offset: -3px;
}

.clue-cell.has-party-help .clue-copy {
  padding-inline-end: .55rem;
}

.clue-help-badge {
  min-width: 1.15rem;
  height: 1.15rem;
  display: inline-grid;
  place-items: center;
  color: #fffaf0;
  background: var(--berry);
  border: 1px solid currentColor;
  border-radius: 999px;
  font: 900 .72rem/1 var(--sans);
}

.clue-cell .clue-help-badge {
  position: absolute;
  z-index: 3;
  top: .1rem;
  right: .1rem;
  min-width: .9rem;
  width: .9rem;
  height: .9rem;
  font-size: .6rem;
  pointer-events: none;
}

.clue-cell:hover,
.clue-cell.selected {
  z-index: 2;
  background: #275b47;
  box-shadow: 0 0 0 2px var(--amber);
}

.clue-copy {
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(.4rem, .7vw, .54rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.08;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.clue-arrow {
  color: #f3c66d;
  font-size: .85rem;
}

.grid-skeleton {
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  color: var(--ink-soft);
}

.board-help {
  margin: 0;
  padding: .55rem clamp(.85rem, 2vw, 1.35rem);
  color: var(--ink-soft);
  background: rgba(255, 250, 240, .92);
  border-top: 1px solid var(--line);
  font-size: .75rem;
}

.board-footer {
  position: relative;
  z-index: 20;
  min-width: 0;
  background: rgba(255, 250, 240, .98);
  box-shadow: 0 -.8rem 2.2rem rgba(13, 42, 35, .09);
}

.solve-column {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(20rem, .8fr);
  gap: 1.25rem;
}

.solve-dock {
  display: grid;
  grid-template-columns: minmax(15rem, 1fr) minmax(21rem, 1.15fr) auto;
  align-items: end;
  gap: 1rem clamp(1rem, 2.5vw, 2.25rem);
  padding: 1rem clamp(1rem, 2.5vw, 1.75rem) calc(1rem + var(--safe-bottom));
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 250, 240, .98), rgba(250, 244, 227, .98)),
    repeating-linear-gradient(#fffaf0 0 1.75rem, rgba(81,105,83,.13) 1.8rem);
}

.solve-dock-clue {
  min-width: 0;
}

.solve-dock .eyebrow {
  margin-bottom: .22rem;
}

.solve-dock h3 {
  overflow: hidden;
  margin: 0;
  font: 600 clamp(1.3rem, 2.1vw, 1.85rem)/1.08 var(--serif);
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.solve-dock .selected-clue {
  min-height: 0;
  display: -webkit-box;
  overflow: hidden;
  margin: .35rem 0 0;
  color: var(--ink-soft);
  font-size: .86rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.solve-dock .word-meta {
  margin: .32rem 0 0;
}

.solve-dock-form {
  min-width: 0;
  margin: 0;
}

.solve-dock-form label {
  margin-bottom: .3rem;
}

.solve-dock .solve-dock-drawer {
  align-self: end;
  margin: 0;
  border: 0;
}

.solve-dock .solve-dock-drawer summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  padding: .65rem .8rem;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: .75rem;
  white-space: nowrap;
}

.solve-dock .solve-dock-drawer[open] {
  grid-column: 1 / -1;
}

.solve-dock .solve-dock-drawer[open] summary {
  width: max-content;
  margin-left: auto;
}

.solve-dock .solve-dock-drawer .clue-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.25rem;
  margin-top: .55rem;
}

.paper-card,
.key-card {
  position: relative;
  padding: clamp(1.3rem, 3vw, 2rem);
  border-radius: var(--radius);
}

.paper-card {
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 1.65rem, rgba(156,63,67,.12) 1.7rem, transparent 1.75rem),
    repeating-linear-gradient(#fffaf0 0 1.75rem, rgba(81,105,83,.13) 1.8rem);
  border: 1px solid var(--line);
  box-shadow: 0 1.1rem 2.5rem rgba(20,54,43,.08);
}

.paper-card::after {
  position: absolute;
  right: -.5rem;
  bottom: -.5rem;
  width: 3rem;
  height: 3rem;
  background: linear-gradient(135deg, rgba(0,0,0,.08), #f5e9cd 52%);
  content: "";
  transform: rotate(8deg);
}

.card-number {
  position: absolute;
  top: 1.25rem;
  right: 1.4rem;
  color: rgba(24,55,45,.18);
  font: 700 2.7rem/1 var(--serif);
}

.paper-card h3,
.key-card h3 {
  margin: 0;
  font: 600 clamp(1.45rem, 2.5vw, 2rem)/1.1 var(--serif);
  letter-spacing: -.025em;
}

.selected-clue {
  min-height: 3rem;
  margin: 1rem 0 .35rem;
  color: var(--ink-soft);
}

.word-meta {
  margin: .25rem 0 1rem;
  color: var(--moss);
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
}

.answer-form,
.compact-form {
  margin-top: 1rem;
}

label {
  display: block;
  margin-bottom: .42rem;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 750;
}

.input-action {
  display: flex;
  gap: .55rem;
}

input {
  min-width: 0;
  width: 100%;
  min-height: 2.85rem;
  padding: .78rem .85rem;
  color: var(--ink);
  background: rgba(255,255,255,.84);
  border: 1px solid rgba(24,55,45,.28);
  border-radius: .75rem;
}

input::placeholder {
  color: #74837d;
}

input:disabled {
  color: #75837d;
  background: rgba(240,236,221,.7);
  cursor: not-allowed;
}

.button {
  min-height: 2.85rem;
  padding: .68rem 1rem;
  border: 1px solid transparent;
  border-radius: .75rem .75rem .9rem .65rem;
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: filter .16s ease, transform .16s ease;
}

.button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.button.primary { color: #fffaf0; background: var(--forest); }
.button.secondary { color: var(--forest); background: var(--fern); border-color: rgba(24,55,45,.18); }
.button.amber { color: #3a2812; background: var(--amber); }
.button.ghost { color: var(--ink); background: transparent; border-color: var(--line); }
.button.danger { color: #7d292e; background: #f3d8d4; }

.clue-drawer {
  position: relative;
  z-index: 1;
  margin-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.clue-drawer summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  padding: .85rem 0 .15rem;
  font-size: .8rem;
  font-weight: 800;
  cursor: pointer;
}

.clue-list {
  max-height: 15rem;
  overflow-y: auto;
  margin: .65rem 0 0;
  padding: 0;
  list-style: none;
}

.clue-list li + li {
  border-top: 1px solid rgba(24,55,45,.1);
}

.clue-list button {
  width: 100%;
  min-height: 2.75rem;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: .5rem;
  padding: .65rem .15rem;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.clue-list button.has-party-help {
  box-shadow: inset .22rem 0 0 var(--berry);
}

.clue-list button .clue-help-badge {
  align-self: center;
  margin-inline: .25rem .35rem;
}

.clue-list button:hover,
.clue-list button[aria-current="true"] {
  color: var(--amber-deep);
}

.clue-list .clue-list-arrow {
  color: var(--moss);
  font-weight: 800;
}

.clue-list .clue-list-copy {
  line-height: 1.3;
}

.clue-list .solved-mark {
  color: var(--moss);
  font-size: .68rem;
  font-weight: 800;
}

.key-card {
  color: #fffaf0;
  background:
    radial-gradient(circle at 90% 10%, rgba(242,196,108,.17), transparent 8rem),
    var(--forest-deep);
  box-shadow: 0 1.1rem 2.5rem rgba(8,36,29,.17);
}

.key-card .eyebrow { color: #acc784; }
.key-heading { align-items: center; }
.key-count { padding: .32rem .58rem; color: #f8d992; background: rgba(255,255,255,.08); border-radius: 99px; font-size: .73rem; font-weight: 800; }

.key-mask {
  min-height: 4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .28rem;
  margin: 1.1rem 0;
}

.key-char {
  min-width: 1.65rem;
  padding: .22rem .18rem .35rem;
  text-align: center;
  color: #f7dfa4;
  border-bottom: 2px solid rgba(247,223,164,.52);
  font: 700 1.35rem/1 var(--serif);
  text-transform: uppercase;
}

.key-space {
  width: .85rem;
}

.key-card label { color: #fffaf0; }
.key-card input { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.21); color: #fff; }
.key-card input::placeholder { color: rgba(255,255,255,.49); }
.key-card input:disabled { color: rgba(255,255,255,.48); background: rgba(255,255,255,.05); }
.fine-print { margin: .8rem 0 0; color: rgba(255,250,240,.58); font-size: .7rem; }

.party-card > #party-content > p,
.party-summary p {
  color: var(--ink-soft);
}

.party-actions {
  position: relative;
  z-index: 1;
  display: grid;
  gap: .75rem;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--ink-soft);
  font-size: .68rem;
  text-transform: uppercase;
}

.or-divider::before,
.or-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.party-summary {
  position: relative;
  z-index: 1;
}

.party-code {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: .65rem 0;
  padding: .5rem .7rem;
  color: var(--forest);
  background: var(--fern);
  border: 1px dashed var(--moss);
  border-radius: .65rem;
  font-weight: 850;
  letter-spacing: .12em;
}

.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .75rem 0 1rem;
  padding: 0;
  list-style: none;
}

.member-list li {
  padding: .27rem .55rem;
  background: rgba(220,229,194,.65);
  border-radius: 99px;
  font-size: .72rem;
}

.section-heading.compact {
  align-items: center;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 2rem;
  background: rgba(255,250,240,.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 .8rem 2.5rem rgba(20,54,43,.06);
}

.leaderboard {
  width: 100%;
  min-width: 31rem;
  border-collapse: collapse;
}

.leaderboard th,
.leaderboard td {
  padding: 1rem clamp(1rem, 3vw, 2rem);
  text-align: left;
  border-bottom: 1px solid rgba(24,55,45,.1);
}

.leaderboard th {
  color: var(--ink-soft);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.leaderboard th:first-child,
.leaderboard td:first-child {
  width: 5rem;
  color: var(--moss);
  font-weight: 850;
}

.leaderboard th:last-child,
.leaderboard td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.leaderboard tbody tr:last-child td {
  border-bottom: 0;
}

.leaderboard tr.is-me {
  background: rgba(231,168,62,.11);
}

.player-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.rank-avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  aspect-ratio: 1;
  color: #fffaf0;
  background: var(--moss);
  border-radius: 50%;
  font: 700 .78rem var(--serif);
}

.empty-cell {
  padding-block: 2.5rem !important;
  color: var(--ink-soft);
  text-align: center !important;
  font-weight: 400 !important;
}

footer {
  padding-block: 5rem 2rem;
  color: var(--ink-soft);
  text-align: center;
  font-size: .75rem;
}

.nickname-dialog,
.registration-dialog {
  width: min(31rem, calc(100% - 2rem));
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1.75rem 1.5rem 2rem 1.4rem;
  box-shadow: 0 2rem 7rem rgba(6,31,24,.4);
}

.nickname-dialog::backdrop,
.registration-dialog::backdrop {
  background: rgba(7,32,26,.78);
  backdrop-filter: blur(5px);
}

.nickname-dialog form,
.registration-dialog form {
  padding: clamp(1.5rem, 5vw, 2.75rem);
}

.nickname-dialog h2,
.registration-dialog h2 {
  margin: .65rem 0 .75rem;
  font: 600 clamp(2rem, 6vw, 3rem)/1 var(--serif);
  letter-spacing: -.04em;
}

.nickname-dialog form > p:not(.eyebrow):not(.field-help),
.registration-dialog form > p:not(.eyebrow):not(.field-help) {
  color: var(--ink-soft);
}

.nickname-dialog label {
  margin-top: 1.3rem;
}

.registration-dialog {
  width: min(38rem, calc(100% - 1.25rem));
  max-height: min(52rem, calc(100dvh - var(--safe-top) - var(--safe-bottom) - 1rem));
  overflow: hidden;
}

.registration-dialog form {
  max-height: inherit;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
}

.registration-dialog .panel-heading {
  padding: clamp(1rem, 4vw, 1.65rem) clamp(1rem, 4vw, 1.75rem) .75rem;
}

.registration-dialog h2 {
  margin-block: .25rem 0;
  font-size: clamp(1.65rem, 6vw, 2.6rem);
}

.registration-content {
  display: grid;
  gap: .9rem;
  padding: .45rem clamp(1rem, 4vw, 1.75rem) calc(1.2rem + var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.registration-content > p,
.registration-content ul,
.registration-content details,
.registration-content aside {
  margin-block: 0;
}

.registration-hero {
  min-height: 3.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  color: var(--amber-deep);
}

.registration-hero span:nth-child(2) {
  width: 3.25rem;
  height: 3.25rem;
  display: grid;
  place-items: center;
  color: #fffaf0;
  background: var(--forest);
  border-radius: 50%;
  box-shadow: 0 .45rem 1.4rem rgba(13, 42, 35, .2);
  font: 700 1.45rem/1 var(--serif);
}

.registration-benefits {
  display: grid;
  gap: .45rem;
  padding: 0;
  list-style: none;
}

.registration-benefits li {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: .5rem;
  align-items: start;
  color: var(--ink-soft);
  font-size: .86rem;
}

.registration-benefits li > span:first-child {
  width: 1.25rem;
  height: 1.25rem;
  display: grid;
  place-items: center;
  margin-top: .08rem;
  color: var(--forest);
  background: var(--fern);
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 800;
}

.local-progress-note {
  padding: .8rem .9rem;
  color: var(--ink);
  background: rgba(231, 168, 62, .12);
  border: 1px solid rgba(155, 95, 24, .23);
  border-radius: .9rem;
}

.local-progress-note strong {
  display: block;
  font-size: .82rem;
}

.local-progress-note p {
  margin: .25rem 0 0;
  color: var(--ink-soft);
  font-size: .74rem;
  line-height: 1.45;
}

.registration-terms {
  color: var(--ink);
  background: rgba(255, 255, 255, .5);
  border: 1px solid var(--line);
  border-radius: .9rem;
}

.registration-terms summary {
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem .85rem;
  cursor: pointer;
  font-weight: 750;
  list-style: none;
}

.registration-terms summary::-webkit-details-marker {
  display: none;
}

.registration-terms summary::after {
  content: "+";
  color: var(--amber-deep);
  font-size: 1.25rem;
  line-height: 1;
}

.registration-terms[open] summary::after {
  content: "−";
}

.registration-terms-copy {
  display: grid;
  gap: .65rem;
  max-height: 16rem;
  padding: 0 .85rem .9rem;
  overflow-y: auto;
  color: var(--ink-soft);
  font-size: .73rem;
  line-height: 1.5;
}

.registration-terms-copy p {
  margin: 0;
}

.registration-terms-copy .terms-draft-warning {
  padding: .65rem;
  color: #6b3e13;
  background: rgba(231, 168, 62, .16);
  border-radius: .55rem;
  font-weight: 650;
}

.terms-consent {
  min-height: 3rem;
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: .65rem;
  align-items: start;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 650;
}

.terms-consent input {
  width: 1.25rem;
  height: 1.25rem;
  margin: .12rem 0 0;
  accent-color: var(--forest);
}

.google-signin-stage {
  min-height: 4.75rem;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: .55rem;
  padding: .8rem;
  text-align: center;
  background: rgba(220, 229, 194, .35);
  border: 1px solid var(--line);
  border-radius: .9rem;
}

.google-signin-stage[data-state="error"] {
  background: rgba(156, 63, 67, .08);
  border-color: rgba(156, 63, 67, .3);
}

.google-signin-mount {
  width: min(100%, 22rem);
  min-height: 2.75rem;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.google-signin-status {
  margin: 0;
  color: var(--ink-soft);
  font-size: .74rem;
}

.party-registration-callout {
  display: grid;
  gap: .7rem;
  padding: 1rem;
  text-align: center;
  background: rgba(220, 229, 194, .35);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.party-registration-callout h4,
.party-registration-callout p {
  margin: 0;
}

.party-registration-callout p {
  color: var(--ink-soft);
  font-size: .82rem;
}

.party-registration-callout .button {
  justify-self: center;
}

.field-error {
  min-height: 1.2rem;
  margin: .35rem 0 0;
  color: var(--berry);
  font-size: .75rem;
  font-weight: 650;
}

.field-help {
  margin: .4rem 0 0;
  color: var(--ink-soft);
  font-size: .7rem;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1.35rem;
}

.toast-region {
  position: fixed;
  z-index: 1200;
  right: 1rem;
  bottom: calc(1rem + var(--safe-bottom));
  width: min(24rem, calc(100% - 2rem));
  display: grid;
  gap: .65rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .9rem 1rem;
  color: #fffaf0;
  background: var(--forest-deep);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: .85rem;
  box-shadow: 0 .8rem 2rem rgba(6,31,24,.26);
  animation: toast-in .24s ease both;
}

.toast.error {
  background: #6f292d;
}

.toast.success::before { color: #d8e9a7; content: "✓"; font-weight: 900; }
.toast.error::before { color: #ffd1bd; content: "!"; font-weight: 900; }
.toast.info::before { color: #f4ce80; content: "✦"; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(.7rem); }
}

.noscript {
  position: fixed;
  z-index: 2000;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  padding: 1rem;
  color: white;
  background: #6f292d;
  border-radius: .7rem;
  text-align: center;
}

@media (max-width: 68rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(13rem, .55fr);
  }

  .solve-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 46rem) {
  :root {
    --cell: 3rem;
  }

  .site-header,
  main,
  footer {
    width: auto;
    margin-left: max(.5rem, var(--safe-left));
    margin-right: max(.5rem, var(--safe-right));
  }

  .site-header {
    min-height: calc(4.65rem + var(--safe-top));
    gap: .5rem;
  }

  .brand .eyebrow,
  .player-chip small {
    display: none;
  }

  .brand-mark {
    width: 2.4rem;
  }

  .brand {
    gap: .55rem;
  }

  .player-chip strong {
    max-width: 6.25rem;
  }

  .hero {
    min-height: 17rem;
    grid-template-columns: 1fr;
    align-items: center;
    padding: 1.5rem 1.25rem;
    border-radius: 1.35rem 2.2rem 1.35rem;
  }

  .hero h1 {
    max-width: 11ch;
    margin-block: .45rem .8rem;
    font-size: clamp(2.55rem, 12vw, 3.8rem);
  }

  .hero-copy > p:not(.eyebrow) {
    max-width: 26rem;
    font-size: .9rem;
  }

  .hero-game-link {
    min-height: 2.75rem;
    margin-top: 1rem;
  }

  .forest-scene {
    position: absolute;
    z-index: -1;
    inset: 22% -10% -38% 46%;
    min-height: 14rem;
    opacity: .48;
  }

  .section-heading,
  .area-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }

  .world-section,
  .game-section,
  .leaderboard-section {
    padding-top: 3.25rem;
  }

  .world-section {
    padding-top: 2.4rem;
  }

  .world-section .section-heading {
    gap: .55rem;
  }

  .world-section .section-heading h2 {
    font-size: 2rem;
  }

  .world-hint {
    font-size: .82rem;
  }

  .world-scroll {
    margin-top: .75rem;
    padding-block: .5rem 1rem;
  }

  .world-node {
    width: 12.5rem;
  }

  .area-heading {
    margin-bottom: 1.15rem;
  }

  .area-heading h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .area-actions {
    width: 100%;
    justify-items: stretch;
  }

  .area-map-link {
    justify-self: start;
  }

  .area-progress {
    width: 100%;
  }

  .board-card {
    margin-inline: -.5rem;
    border-right: 0;
    border-left: 0;
    border-radius: 1rem 1rem .4rem .4rem;
    box-shadow: 0 1rem 3rem rgba(11, 43, 34, .14);
  }

  .board-toolbar {
    min-height: 3.2rem;
    padding: .62rem .85rem;
  }

  .sector-navigation {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
    border-radius: .8rem;
  }

  .sector-navigation-next {
    min-height: 2.35rem;
  }

  .board-scroll {
    height: clamp(23rem, 62dvh, 36rem);
    min-height: 0;
    max-height: none;
    padding: .85rem .35rem;
    scroll-padding: .85rem;
  }

  .crossword-grid {
    min-width: max-content;
    min-height: 22rem;
    justify-content: start;
    padding-inline: 1rem;
  }

  .clue-copy {
    font-size: .43rem;
  }

  .board-help {
    display: block;
    padding: .42rem .85rem;
    font-size: .68rem;
    line-height: 1.35;
  }

  .board-footer {
    position: sticky;
    bottom: 0;
  }

  .solve-dock {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: .55rem .75rem;
    padding: .75rem max(.85rem, var(--safe-right)) max(.75rem, var(--safe-bottom)) max(.85rem, var(--safe-left));
  }

  .solve-dock-clue {
    grid-column: 1;
    grid-row: 1;
  }

  .solve-dock h3 {
    font-size: 1.22rem;
  }

  .solve-dock .selected-clue {
    font-size: .78rem;
    -webkit-line-clamp: 1;
  }

  .solve-dock-form {
    grid-column: 1 / -1;
    grid-row: 2;
  }

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

  .solve-dock .solve-dock-drawer,
  .solve-dock .solve-dock-drawer[open] {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .solve-dock .solve-dock-drawer[open] {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .solve-dock .solve-dock-drawer[open] summary {
    margin-left: auto;
  }

  .solve-dock .solve-dock-drawer .clue-list {
    grid-template-columns: 1fr;
    max-height: min(34dvh, 15rem);
  }

  body.has-word-selection .solve-dock {
    box-shadow: inset 0 3px 0 var(--amber);
  }

  body:not(.has-word-selection) .solve-dock-form {
    opacity: .72;
  }

  body.is-keyboard-open .board-scroll {
    height: min(38dvh, 20rem);
  }

  body.is-keyboard-open .board-help,
  body.is-keyboard-open .solve-dock .solve-dock-drawer {
    display: none;
  }

  body.returning-player .hero {
    min-height: 8.5rem;
    padding-block: 1.05rem;
  }

  body.returning-player .hero h1 {
    max-width: none;
    margin: .25rem 0;
    font-size: clamp(1.85rem, 8vw, 2.4rem);
    line-height: 1;
  }

  body.returning-player .hero h1 br {
    display: none;
  }

  body.returning-player .hero h1 em {
    margin-left: .24em;
  }

  body.returning-player .hero-copy > p:not(.eyebrow),
  body.returning-player .forest-scene {
    display: none;
  }

  body.returning-player .hero-game-link {
    min-height: 2.75rem;
    margin-top: .65rem;
    padding-block: .45rem;
  }

  body.returning-player .world-section {
    padding-top: 1.25rem;
  }

  body.returning-player .world-hint {
    display: none;
  }

  body.returning-player .world-node {
    width: 10.75rem;
    min-height: 4.5rem;
  }

  .solve-column {
    grid-template-columns: 1fr;
  }

  .party-card {
    grid-column: auto;
  }

  .input-action {
    align-items: stretch;
  }

  input {
    font-size: 1rem;
  }

  .button {
    min-height: 3rem;
  }

  .key-form .input-action,
  .compact-form .input-action {
    flex-direction: column;
  }

  .section-heading.compact {
    align-items: flex-start;
  }
}

@media (max-height: 36rem) {
  .world-echo-status {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
}

@media (max-width: 22rem) {
  .brand-name { font-size: 1.1rem; }
  .player-chip { padding-right: .45rem; }
  .player-chip strong { max-width: 5.2rem; font-size: .78rem; }
  .input-action { flex-direction: column; }
}

/* Keep the word-entry loop above the visual keyboard, including short landscape viewports. */
@media (max-width: 46rem), (max-height: 35rem) and (pointer: coarse) {
  body.is-keyboard-open.is-word-entry-active .board-scroll {
    height: clamp(4.75rem, 22dvh, 8rem);
    scroll-padding: .5rem;
  }

  body.is-keyboard-open.is-word-entry-active .board-footer {
    position: relative;
    bottom: auto;
  }

  body.is-keyboard-open.is-word-entry-active .board-help,
  body.is-keyboard-open.is-word-entry-active .solve-dock .eyebrow,
  body.is-keyboard-open.is-word-entry-active .solve-dock h3,
  body.is-keyboard-open.is-word-entry-active .solve-dock .solve-dock-drawer {
    display: none;
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: .35rem;
    padding: .45rem max(.65rem, var(--safe-right)) max(.5rem, var(--safe-bottom)) max(.65rem, var(--safe-left));
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock-clue {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .25rem .6rem;
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock .selected-clue {
    grid-column: 1;
    min-width: 0;
    margin: 0;
    font-size: .75rem;
    line-height: 1.2;
    -webkit-line-clamp: 1;
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock .word-meta {
    grid-column: 2;
    margin: 0;
    font-size: .64rem;
    line-height: 1.2;
    white-space: nowrap;
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock-form {
    grid-column: 1;
    grid-row: 2;
    scroll-margin-bottom: calc(.5rem + var(--safe-bottom));
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock-form .input-action {
    flex-direction: row;
    align-items: stretch;
    gap: .4rem;
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock-form input,
  body.is-keyboard-open.is-word-entry-active .solve-dock-form .button {
    min-height: 2.75rem;
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock-form input {
    min-width: 0;
    padding-block: .55rem;
  }

  body.is-keyboard-open.is-word-entry-active .solve-dock-form .button {
    flex: 0 0 auto;
    padding: .55rem .75rem;
  }
}

/* Aukeaman hengitys is a compact, derived presentation state. It stays in the
   existing heading and ambience layers, so it cannot move or intercept the grid. */
.area-heading > div:first-child {
  width: 100%;
}

.area-title-row {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .6rem;
}

.area-title-row h2 {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.area-breath-badge {
  max-width: 100%;
  min-height: 1.55rem;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .3rem;
  padding: .2rem .5rem;
  color: var(--forest);
  background: rgba(255, 250, 240, .78);
  border: 1px solid rgba(24, 55, 45, .24);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
}

.area-breath-badge[hidden] {
  display: none;
}

.area-breath-icon {
  width: 1em;
  flex: 0 0 1em;
  font-size: 1.05em;
  line-height: 1;
  text-align: center;
}

.area-breath-badge[data-state="sleeping"] {
  color: #4f625c;
  background: rgba(222, 228, 220, .72);
}

.area-breath-badge[data-state="listening"] {
  color: #315f52;
  background: rgba(218, 235, 222, .76);
}

.area-breath-badge[data-state="waking"] {
  color: #75500f;
  background: rgba(255, 239, 188, .82);
  border-color: rgba(151, 104, 28, .34);
}

.area-breath-badge[data-state="flourishing"] {
  color: #245c35;
  background: rgba(218, 239, 198, .84);
  border-color: rgba(52, 111, 63, .34);
}

.area-breath-badge[data-state="whispering"] {
  color: #5e486d;
  background: rgba(235, 224, 239, .82);
  border-color: rgba(94, 72, 109, .34);
}

.area-ambience[data-breath="inactive"] {
  opacity: 1;
  filter: none;
}

.area-ambience[data-breath="sleeping"] {
  opacity: .54;
  filter: saturate(.72) brightness(.94);
}

.area-ambience[data-breath="listening"] {
  opacity: .72;
  filter: saturate(.86) brightness(.98);
}

.area-ambience[data-breath="waking"] {
  opacity: .88;
  filter: saturate(1.02) brightness(1.01);
}

.area-ambience[data-breath="flourishing"] {
  opacity: 1;
  filter: saturate(1.1) brightness(1.03);
}

.area-ambience[data-breath="whispering"] {
  opacity: .8;
  filter: saturate(.92) brightness(1.04);
}

@media (max-width: 46rem) {
  .area-title-row {
    gap: .3rem .45rem;
  }

  .area-breath-badge {
    min-height: 1.4rem;
    padding: .18rem .42rem;
    font-size: .68rem;
  }
}

@media (max-height: 36rem) {
  .area-title-row {
    gap: .25rem .4rem;
  }

  .area-breath-badge {
    min-height: 1.25rem;
    padding: .12rem .35rem;
    font-size: .62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .area-ambience,
  .area-ambience * {
    animation: none !important;
    transition: none !important;
  }
}

html.motion-calm .area-ambience *,
body.system-reduced-motion .area-ambience * {
  animation: none !important;
  transition: none !important;
}

@media (forced-colors: active) {
  #area-breath-badge:not([hidden]) {
    color: CanvasText;
    background: Canvas;
    border-color: CanvasText;
    border-style: solid;
    border-width: 2px !important;
    forced-color-adjust: auto;
  }
}

/* Runtime values are written to this same-origin stylesheet rule via CSSOM.
   Keeping them out of style attributes preserves the strict style-src CSP. */
body.has-runtime-keyboard-viewport {
  --keyboard-viewport-height: 100dvh;
  --keyboard-viewport-offset-top: 0px;
}

.board-scroll.is-programmatic-jump {
  scroll-behavior: auto;
}

/* Fine-pointer grab-to-pan augments native touch scrolling. Pointer Events
   deliberately leave touch and pen gestures to the browser. */
@media (any-hover: hover) and (any-pointer: fine) {
  .board-scroll {
    cursor: grab;
  }
}

.board-scroll.is-pointer-panning,
.board-scroll.is-pointer-panning * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.board-scroll.is-pointer-panning {
  scroll-behavior: auto;
}

/* Risteysketju is shared, non-interactive board status. It stays in the board
   chrome and never overlays a clue, the writing proxy or the fixed nav. */
.crossword-chain-status {
  min-width: min(17rem, 100%);
  max-width: 25rem;
  flex: 1 1 17rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .5rem;
  padding: .4rem .58rem;
  color: #25453a;
  background: linear-gradient(120deg, rgba(242, 246, 221, .96), rgba(255, 241, 194, .9));
  border: 1px solid rgba(82, 111, 66, .48);
  border-radius: .8rem;
  line-height: 1.15;
  pointer-events: none;
}

.board-scroll {
  overflow-anchor: none;
}

.crossword-chain-status[hidden] {
  display: none;
}

.crossword-chain-mark {
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  color: #fffaf0;
  background: #466c46;
  border-radius: 50%;
  font: 850 1.05rem/1 var(--serif);
}

.crossword-chain-copy {
  min-width: 0;
}

.crossword-chain-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
}

.crossword-chain-heading strong {
  min-width: 0;
  overflow: hidden;
  font: 750 .76rem/1.1 var(--serif);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crossword-chain-badge {
  flex: 0 0 auto;
  padding: .16rem .4rem;
  color: #fffaf0;
  background: #315c48;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 850;
  letter-spacing: .015em;
  white-space: nowrap;
}

#crossword-chain-message {
  overflow: hidden;
  margin: .16rem 0 0;
  color: #3e5c51;
  font-size: .63rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crossword-chain-status[data-level="5"] {
  color: #5c3d0e;
  background: linear-gradient(120deg, rgba(255, 241, 194, .98), rgba(255, 219, 137, .94));
  border-color: rgba(117, 74, 17, .58);
}

.crossword-chain-status[data-level="5"] .crossword-chain-mark,
.crossword-chain-status[data-level="5"] .crossword-chain-badge {
  background: #765019;
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.motion-calm):not(.system-reduced-motion) .crossword-chain-status:not([hidden]) {
    animation: crossword-chain-status-in .28s ease-out both;
  }

  body:not(.motion-calm):not(.system-reduced-motion) .letter-cell.crossword-chain-cell-reaction {
    animation: crossword-chain-cell .9s ease-out both;
  }

  body:not(.motion-calm):not(.system-reduced-motion) .board-card.crossword-chain-level-2-reaction,
  body:not(.motion-calm):not(.system-reduced-motion) .board-card.crossword-chain-level-3-reaction {
    animation: crossword-chain-board .9s ease-out both;
  }

  body:not(.motion-calm):not(.system-reduced-motion) .board-card.crossword-chain-level-5-reaction {
    animation: crossword-chain-celebration 1.5s ease-out both;
  }

  body:not(.motion-calm):not(.system-reduced-motion) .area-ambience.crossword-chain-ambience-reaction .ambient-firefly {
    animation: forest-firefly-gather .9s ease-out both;
  }
}

@keyframes crossword-chain-status-in {
  from { opacity: 0; transform: translateY(-.18rem); }
}

@keyframes crossword-chain-cell {
  0%, 100% { box-shadow: inset 0 -2px 0 rgba(24, 55, 45, .08); }
  45% { box-shadow: 0 0 0 .2rem rgba(82, 126, 75, .48), 0 0 1rem rgba(231, 168, 62, .42); }
}

@keyframes crossword-chain-board {
  0%, 100% { box-shadow: var(--shadow); }
  45% { box-shadow: 0 0 0 .2rem rgba(82, 126, 75, .35), var(--shadow); }
}

@keyframes crossword-chain-celebration {
  0%, 100% { box-shadow: var(--shadow); }
  40% { box-shadow: 0 0 0 .3rem rgba(231, 168, 62, .5), 0 1rem 4rem rgba(86, 116, 72, .42); }
}

@media (max-width: 46rem) {
  body.has-crossword-chain .board-legend-group {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .crossword-chain-status {
    min-width: 0;
    max-width: none;
    flex: 1 1 8.5rem;
    order: 1;
    padding: .34rem .45rem;
  }

  .board-progress {
    order: 2;
  }

  .crossword-chain-mark {
    width: 1.5rem;
    height: 1.5rem;
    font-size: .9rem;
  }

  .crossword-chain-heading strong {
    font-size: .69rem;
  }

  #crossword-chain-message {
    font-size: .59rem;
  }
}

@media (max-width: 22rem) {
  .crossword-chain-status {
    gap: .35rem;
    padding-block: .28rem;
  }

  #crossword-chain-message {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .crossword-chain-heading {
    gap: .28rem;
  }

  .crossword-chain-heading strong {
    font-size: .64rem;
  }

  .crossword-chain-badge {
    padding-inline: .3rem;
    font-size: .6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crossword-chain-status,
  .crossword-chain-cell-reaction,
  .crossword-chain-level-2-reaction,
  .crossword-chain-level-3-reaction,
  .crossword-chain-level-5-reaction,
  .crossword-chain-ambience-reaction {
    animation: none !important;
    transition: none !important;
  }
}

html.motion-calm .crossword-chain-status,
html.motion-calm .crossword-chain-cell-reaction,
html.motion-calm .crossword-chain-level-2-reaction,
html.motion-calm .crossword-chain-level-3-reaction,
html.motion-calm .crossword-chain-level-5-reaction,
html.motion-calm .crossword-chain-ambience-reaction,
body.system-reduced-motion .crossword-chain-status,
body.system-reduced-motion .crossword-chain-cell-reaction,
body.system-reduced-motion .crossword-chain-level-2-reaction,
body.system-reduced-motion .crossword-chain-level-3-reaction,
body.system-reduced-motion .crossword-chain-level-5-reaction,
body.system-reduced-motion .crossword-chain-ambience-reaction {
  animation: none !important;
  transition: none !important;
}

@media (prefers-contrast: more) {
  .crossword-chain-status {
    color: #102d24;
    background: #fff8df;
    border-width: 2px;
    border-color: #25453a;
  }

  .crossword-chain-badge {
    color: #fff;
    background: #173d32;
  }
}

@media (max-height: 36rem) {
  .bottom-nav {
    height: var(--bottom-nav-reserve);
    min-height: var(--bottom-nav-reserve);
    padding: .15rem max(.25rem, var(--safe-right)) max(.15rem, var(--safe-bottom)) max(.25rem, var(--safe-left));
  }

  .bottom-nav-item {
    min-height: 2.75rem;
    gap: .15rem;
    padding-block: .1rem;
  }

  .profile-menu {
    bottom: calc(var(--bottom-nav-reserve) + .4rem);
  }
}

@media (forced-colors: active) {
  .crossword-chain-status {
    color: CanvasText;
    background: Canvas;
    border: 2px solid CanvasText;
  }

  .crossword-chain-mark,
  .crossword-chain-badge {
    color: HighlightText;
    background: Highlight;
    forced-color-adjust: none;
  }

  .letter-cell.crossword-chain-cell-reaction,
  .board-card.crossword-chain-level-2-reaction,
  .board-card.crossword-chain-level-3-reaction,
  .board-card.crossword-chain-level-5-reaction {
    outline: 3px solid Highlight;
    outline-offset: -3px;
  }
}

/* Retkueen lyijykynä: private, explicitly shared proposal layer. */
.legend-swatch.own-draft,
.letter-cell.draft-letter:not(.confirmed) {
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(66, 74, 71, .18) 6px 7px);
}

.legend-swatch.party-draft,
.letter-cell.party-draft-letter:not(.confirmed):not(.draft-letter) {
  background-color: #eef0e8;
  background-image:
    repeating-linear-gradient(135deg, transparent 0 7px, rgba(69, 82, 76, .16) 7px 8px),
    repeating-linear-gradient(45deg, transparent 0 13px, rgba(69, 82, 76, .08) 13px 14px);
  border-style: dashed;
}

.letter-cell.party-draft-letter:not(.confirmed):not(.draft-letter) .cell-letter {
  color: #46514d;
  font-weight: 560;
  text-decoration: underline dotted .08em;
  text-underline-offset: .16em;
}

.letter-cell.party-draft-conflict:not(.confirmed):not(.draft-letter) {
  outline: 2px dotted #754a11;
  outline-offset: -4px;
}

.party-pencil-workbench {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.party-pencil-title,
.party-help-requests h4,
.party-pencil-current h4,
.party-pencil-shared h4,
.party-pencil-word h5 {
  margin: 0;
}

.party-pencil-title {
  font: 650 clamp(1.4rem, 4vw, 1.9rem)/1 var(--serif);
}

.party-pencil-intro,
.party-pencil-empty,
.party-pencil-share-hint,
.party-pencil-sync-status,
.party-pencil-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: .76rem;
  line-height: 1.45;
}

.party-help-requests,
.party-pencil-current,
.party-pencil-shared {
  min-width: 0;
  padding: 1rem;
  background: rgba(255, 250, 240, .72);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.party-help-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}

.party-help-count {
  flex: 0 0 auto;
  padding: .26rem .52rem;
  color: var(--forest-deep);
  background: rgba(220, 229, 194, .65);
  border: 1px solid rgba(24, 55, 45, .2);
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 850;
}

.party-help-list {
  display: grid;
  gap: .65rem;
}

.party-help-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  padding: .75rem;
  background: rgba(255, 255, 255, .58);
  border: 1px dashed rgba(156, 63, 67, .55);
  border-radius: .8rem;
}

.party-help-card.is-selected {
  border-style: solid;
  box-shadow: inset .22rem 0 0 var(--berry);
}

.party-help-card-copy {
  min-width: 0;
  display: grid;
  gap: .12rem;
}

.party-help-card h5,
.party-help-card p {
  margin: 0;
}

.party-help-card h5 {
  overflow-wrap: anywhere;
  font-size: .84rem;
}

.party-help-meta,
.party-help-author,
.party-help-expiry {
  color: var(--ink-soft);
  font-size: .7rem;
  line-height: 1.35;
}

.party-help-navigate {
  min-height: 44px;
}

.party-help-current {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  margin-top: .7rem;
  padding: .7rem .75rem;
  background: rgba(231, 168, 62, .1);
  border: 1px dashed rgba(117, 74, 17, .4);
  border-radius: .8rem;
}

.party-help-current.is-requested {
  background: rgba(156, 63, 67, .08);
  border-color: rgba(156, 63, 67, .5);
  border-style: solid;
}

.party-help-current-copy {
  min-width: 0;
  display: grid;
  gap: .14rem;
}

.party-help-current-copy .field-help,
.party-help-current-copy .party-help-expiry {
  margin: 0;
}

.party-help-current .button {
  min-height: 44px;
}

.party-pencil-clue {
  margin: .55rem 0 .1rem;
  font-weight: 750;
}

.party-pencil-own-preview {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: .75rem;
  margin-top: .8rem;
  padding: .65rem .75rem;
  background: rgba(220, 229, 194, .42);
  border: 1px dashed rgba(24, 55, 45, .28);
  border-radius: .75rem;
}

.party-pencil-own-preview span,
.party-pencil-author,
.party-pencil-expiry {
  color: var(--ink-soft);
  font-size: .7rem;
}

.party-pencil-own-preview strong,
.party-pencil-value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--serif);
  letter-spacing: .08em;
}

.party-pencil-focus-control {
  min-height: 3.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-top: .65rem;
  padding-block: .55rem;
}

.party-pencil-focus-control label {
  display: block;
  font-weight: 800;
}

.party-pencil-focus-control .field-help {
  margin: .15rem 0 0;
}

#party-pencil-focus {
  width: 3.25rem;
  min-width: 44px;
  height: 2.75rem;
  min-height: 44px;
  margin: 0;
  appearance: none;
  background:
    radial-gradient(circle at .92rem 50%, #fffaf0 0 .58rem, transparent .62rem),
    #8a9a94;
  border: 1px solid rgba(24, 55, 45, .3);
  border-radius: 999px;
  box-shadow: inset 0 .1rem .25rem rgba(13, 42, 35, .18);
  cursor: pointer;
  transition: background-color .16s ease, background-position .16s ease;
}

#party-pencil-focus:checked {
  background:
    radial-gradient(circle at calc(100% - .92rem) 50%, #fffaf0 0 .58rem, transparent .62rem),
    var(--forest);
}

.party-pencil-current-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: .65rem;
}

.party-pencil-current-actions .button,
.party-pencil-proposal .button {
  min-height: 44px;
}

.party-pencil-remove {
  color: var(--berry);
  border-color: rgba(156, 63, 67, .35);
}

.party-pencil-shared-heading {
  display: grid;
  gap: .3rem;
  margin-bottom: .75rem;
}

.party-pencil-list {
  display: grid;
  gap: .75rem;
}

.party-pencil-word {
  min-width: 0;
  padding: .8rem;
  background: rgba(255, 255, 255, .56);
  border: 1px dashed rgba(24, 55, 45, .25);
  border-radius: .8rem;
}

.party-pencil-word h5 {
  font-size: .82rem;
}

.party-pencil-thinkers {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: .5rem 0 0;
  padding: 0;
  list-style: none;
}

.party-pencil-thinkers li {
  padding: .25rem .5rem;
  color: var(--ink-soft);
  background: rgba(220, 229, 194, .48);
  border: 1px dotted rgba(24, 55, 45, .32);
  border-radius: 999px;
  font-size: .68rem;
}

.party-pencil-thinkers li.is-mine {
  color: var(--forest-deep);
  border-style: solid;
}

.party-pencil-proposal {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  margin-top: .65rem;
  padding-top: .65rem;
  border-top: 1px solid var(--line);
}

.party-pencil-proposal-copy {
  min-width: 0;
  display: grid;
  gap: .12rem;
}

.party-pencil-expiry {
  display: block;
}

@media (max-width: 28rem) {
  .party-help-requests,
  .party-pencil-current,
  .party-pencil-shared {
    padding: .8rem;
  }

  .party-help-card,
  .party-help-current,
  .party-pencil-proposal {
    grid-template-columns: minmax(0, 1fr);
  }

  .party-help-card .button,
  .party-help-current .button,
  .party-pencil-proposal .button,
  .party-pencil-current-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #party-pencil-focus {
    transition: none !important;
  }
}

html.motion-calm #party-pencil-focus,
body.system-reduced-motion #party-pencil-focus {
  transition: none !important;
}

@media (forced-colors: active) {
  .legend-swatch.own-draft,
  .letter-cell.draft-letter:not(.confirmed) {
    outline: 2px dotted CanvasText;
    outline-offset: -3px;
  }

  .legend-swatch.party-draft,
  .letter-cell.party-draft-letter:not(.confirmed):not(.draft-letter),
  .party-pencil-word {
    border-style: dashed;
  }

  .letter-cell.party-draft-letter:not(.confirmed):not(.draft-letter) .cell-letter {
    text-decoration-style: dotted;
  }

  #party-pencil-focus:checked {
    outline: 3px solid Highlight;
  }

  .clue-cell.has-party-help,
  .party-help-card,
  .party-help-current {
    border: 2px dashed CanvasText;
  }

  .clue-help-badge,
  .bottom-nav-badge {
    color: HighlightText;
    background: Highlight;
  }
}

/* Aukeaman kaiku stays inside the board chrome so the playfield remains the
   primary surface. The level and symbol make the state readable without
   relying on colour alone. */
.board-toolbar {
  flex-wrap: wrap;
}

.legend-swatch.world-echo {
  background:
    repeating-linear-gradient(135deg, rgba(39, 91, 71, .24) 0 2px, transparent 2px 5px),
    #eef1e4;
  border-style: dashed;
}

.world-echo-status {
  min-width: min(19rem, 100%);
  flex: 1 1 19rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
  padding: .42rem .6rem;
  color: #294b40;
  background: rgba(238, 241, 228, .84);
  border: 1px dashed rgba(39, 91, 71, .36);
  border-radius: .8rem;
  line-height: 1.15;
}

.world-echo-status[hidden] {
  display: none;
}

.world-echo-mark {
  display: grid;
  place-items: center;
  width: 1.7rem;
  aspect-ratio: 1;
  color: #fffaf0;
  background: #476d5e;
  border-radius: 45% 55% 48% 52%;
  font: 800 1rem/1 var(--serif);
}

.world-echo-copy {
  min-width: 0;
}

.world-echo-heading {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  margin: 0;
  font-size: .7rem;
}

.world-echo-heading strong {
  font: 750 .76rem/1 var(--serif);
  letter-spacing: .01em;
}

#world-echo-level {
  color: var(--ink-soft);
  font-size: .66rem;
  font-weight: 800;
  white-space: nowrap;
}

#world-echo-message,
#world-echo-next {
  display: block;
  margin: .16rem 0 0;
  color: var(--ink-soft);
  font-size: .64rem;
  line-height: 1.22;
}

#world-echo-next {
  color: #375c50;
  font-weight: 700;
}

#world-echo-next[hidden] {
  display: none;
}

.world-echo-meter {
  display: grid;
  grid-template-columns: repeat(6, .46rem);
  gap: .18rem;
}

.world-echo-meter i {
  width: .46rem;
  aspect-ratio: 1;
  background: rgba(39, 91, 71, .12);
  border: 1px solid rgba(39, 91, 71, .35);
  border-radius: 50%;
}

.world-echo-meter i.is-filled {
  background: #476d5e;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 240, .45);
}

.world-echo-status[data-state="ready"] .world-echo-mark {
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(71, 109, 94, .14);
}

.world-echo-status[data-state="key_moment"] {
  color: #5b4219;
  background: rgba(255, 239, 198, .9);
  border-style: solid;
  border-color: rgba(117, 74, 17, .42);
}

.world-echo-status[data-state="key_moment"] .world-echo-mark {
  background: var(--amber-deep);
}

.world-echo-status[data-state="advice_pending"],
.world-echo-status[data-state="complete"] {
  background: rgba(242, 238, 222, .86);
}

.letter-cell.confirmed.world-echo-letter {
  background-color: #e8eee6;
  background-image: repeating-linear-gradient(135deg, transparent 0 8px, rgba(39, 91, 71, .09) 8px 10px);
  border-style: dashed;
}

.letter-cell.confirmed.local-play-letter {
  background-color: #f4ead3;
  background-image: repeating-linear-gradient(135deg, transparent 0 7px, rgba(155, 95, 24, .1) 7px 9px);
  border-color: rgba(155, 95, 24, .55);
  border-style: dotted;
}

.clue-list .solved-mark.local-play-solved {
  color: var(--amber-deep);
}

@media (max-width: 46rem) {
  .world-echo-status {
    order: 4;
    min-width: 0;
    flex-basis: 100%;
    padding: .36rem .5rem;
  }

  .board-legend {
    gap: .48rem;
    font-size: .64rem;
  }

  .world-echo-heading strong {
    font-size: .72rem;
  }
}

@media (max-height: 36rem) {
  .world-echo-status {
    order: 0;
    min-width: 0;
    flex: 1 1 12rem;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: .24rem .42rem;
  }

  .world-echo-mark,
  #world-echo-message,
  #world-echo-next {
    display: none;
  }

  .world-echo-status[data-state="waiting"] {
    order: 4;
    flex-basis: 100%;
  }

  .world-echo-status[data-state="waiting"] #world-echo-next:not([hidden]) {
    display: block;
    margin-top: .08rem;
    font-size: .56rem;
    line-height: 1.12;
  }

  .world-echo-status[data-state="ready"],
  .world-echo-status[data-state="key_moment"],
  .world-echo-status[data-state="advice_pending"],
  .world-echo-status[data-state="complete"] {
    order: 4;
    flex-basis: 100%;
  }

  .world-echo-status[data-state="ready"] #world-echo-message,
  .world-echo-status[data-state="key_moment"] #world-echo-message,
  .world-echo-status[data-state="advice_pending"] #world-echo-message,
  .world-echo-status[data-state="complete"] #world-echo-message {
    display: block;
    font-size: .58rem;
    line-height: 1.12;
  }
}

@media (prefers-contrast: more) {
  .world-echo-status,
  .letter-cell.confirmed.world-echo-letter {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  .world-echo-status,
  .letter-cell.confirmed.world-echo-letter {
    border-style: dashed;
  }

  .world-echo-meter i.is-filled {
    background: Highlight;
  }
}

/* Theme-family ambience reuses a tiny, clipped DOM budget. The objects never
   receive input and disappear in calm, reduced-motion and forced-color modes. */
body[data-theme-family="candy-settlement"]:not(.motion-calm):not(.system-reduced-motion) .area-ambience,
body[data-theme-family="chocolate-depths"]:not(.motion-calm):not(.system-reduced-motion) .area-ambience,
body[data-theme-family="sugar-sky"]:not(.motion-calm):not(.system-reduced-motion) .area-ambience,
body[data-theme-family="celebrity-circuit"]:not(.motion-calm):not(.system-reduced-motion) .area-ambience,
body[data-theme-family="backstage-craft"]:not(.motion-calm):not(.system-reduced-motion) .area-ambience {
  display: block;
}

body[data-theme-family="candy-settlement"] .ambient-leaf,
body[data-theme-family="chocolate-depths"] .ambient-leaf,
body[data-theme-family="sugar-sky"] .ambient-leaf {
  width: .72rem;
  height: .72rem;
  opacity: .28;
  background: linear-gradient(135deg, #f5d98c, #d86283);
  border: 1px solid rgba(111, 49, 91, .22);
  border-radius: 50% 50% 46% 54%;
  box-shadow: inset -.12rem -.12rem rgba(111, 49, 91, .12);
}

body[data-theme-family="candy-settlement"] .ambient-firefly,
body[data-theme-family="chocolate-depths"] .ambient-firefly,
body[data-theme-family="sugar-sky"] .ambient-firefly {
  background: #fff2b8;
  box-shadow: 0 0 .8rem .18rem rgba(216, 98, 131, .42);
}

body[data-theme-family="celebrity-circuit"] .ambient-leaf,
body[data-theme-family="backstage-craft"] .ambient-leaf {
  width: .82rem;
  height: .42rem;
  opacity: .2;
  background: linear-gradient(90deg, #d8b56b, #f2d28b);
  border: 1px solid rgba(44, 25, 56, .2);
  border-radius: .12rem;
  box-shadow: none;
}

body[data-theme-family="celebrity-circuit"] .ambient-firefly,
body[data-theme-family="backstage-craft"] .ambient-firefly {
  width: .42rem;
  height: .42rem;
  background: #fff8da;
  box-shadow: 0 0 1rem .32rem rgba(242, 210, 139, .56);
}

@media (prefers-reduced-motion: no-preference) {
  body[data-theme-family="candy-settlement"]:not(.motion-calm):not(.system-reduced-motion) .ambient-leaf,
  body[data-theme-family="chocolate-depths"]:not(.motion-calm):not(.system-reduced-motion) .ambient-leaf,
  body[data-theme-family="sugar-sky"]:not(.motion-calm):not(.system-reduced-motion) .ambient-leaf {
    animation: theme-sweet-drift 18s linear infinite;
  }

  body[data-theme-family="candy-settlement"]:not(.motion-calm):not(.system-reduced-motion) .ambient-firefly,
  body[data-theme-family="chocolate-depths"]:not(.motion-calm):not(.system-reduced-motion) .ambient-firefly,
  body[data-theme-family="sugar-sky"]:not(.motion-calm):not(.system-reduced-motion) .ambient-firefly {
    animation: theme-sugar-sparkle 7s ease-in-out infinite;
  }

  body[data-theme-family="celebrity-circuit"]:not(.motion-calm):not(.system-reduced-motion) .ambient-leaf,
  body[data-theme-family="backstage-craft"]:not(.motion-calm):not(.system-reduced-motion) .ambient-leaf {
    animation: theme-ticket-drift 22s linear infinite;
  }

  body[data-theme-family="celebrity-circuit"]:not(.motion-calm):not(.system-reduced-motion) .ambient-firefly,
  body[data-theme-family="backstage-craft"]:not(.motion-calm):not(.system-reduced-motion) .ambient-firefly {
    animation: theme-camera-glow 9s ease-in-out infinite;
  }

  body[data-theme-family="candy-settlement"] .area-ambience.theme-word-reaction .ambient-leaf,
  body[data-theme-family="chocolate-depths"] .area-ambience.theme-word-reaction .ambient-leaf,
  body[data-theme-family="sugar-sky"] .area-ambience.theme-word-reaction .ambient-leaf {
    animation: theme-sweet-answer .9s ease-out both;
  }

  body[data-theme-family="celebrity-circuit"] .area-ambience.theme-word-reaction .ambient-firefly,
  body[data-theme-family="backstage-craft"] .area-ambience.theme-word-reaction .ambient-firefly,
  body[data-theme-family="celebrity-circuit"] .area-ambience.theme-key-reaction .ambient-firefly,
  body[data-theme-family="backstage-craft"] .area-ambience.theme-key-reaction .ambient-firefly {
    animation: theme-camera-answer .72s ease-out both;
  }

  @keyframes theme-sweet-drift {
    0% { transform: translate3d(0, -2rem, 0) rotate(0); }
    52% { transform: translate3d(3vw, 36dvh, 0) rotate(190deg); }
    100% { transform: translate3d(var(--leaf-drift), min(68dvh, 48rem), 0) rotate(var(--leaf-turn)); }
  }

  @keyframes theme-sugar-sparkle {
    0%, 100% { opacity: .08; transform: scale(.72); }
    48% { opacity: .56; transform: translate3d(.5rem, -.65rem, 0) scale(1.18); }
  }

  @keyframes theme-ticket-drift {
    0% { transform: translate3d(0, -2rem, 0) rotate(12deg); }
    100% { transform: translate3d(var(--leaf-drift), min(68dvh, 48rem), 0) rotate(var(--leaf-turn)); }
  }

  @keyframes theme-camera-glow {
    0%, 86%, 100% { opacity: .06; transform: scale(.72); }
    90% { opacity: .68; transform: scale(1.55); }
    94% { opacity: .12; transform: scale(.82); }
  }

  @keyframes theme-sweet-answer {
    0% { opacity: .2; transform: scale(.75) rotate(0); }
    50% { opacity: .72; transform: translate3d(0, 1.2rem, 0) scale(1.45) rotate(120deg); }
    100% { opacity: .16; transform: translate3d(0, 2rem, 0) scale(.82) rotate(220deg); }
  }

  @keyframes theme-camera-answer {
    0%, 100% { opacity: .08; transform: scale(.65); }
    38% { opacity: .82; transform: scale(2.1); }
  }
}

/* Aukeama presentation is selected only through the frontend theme allowlist. */
body[data-theme-id="forest"] {
  --theme-page-background:
    radial-gradient(circle at 7% 12%, rgba(172, 194, 123, .2), transparent 22rem),
    linear-gradient(180deg, #f8f0dd 0, #fbf7eb 38rem, #f4ecd9 100%);
  --theme-header-background: rgba(248, 240, 221, .86);
  --theme-board-background:
    radial-gradient(circle at 48% 45%, rgba(173, 194, 123, .18), transparent 48%),
    #e8e4ce;
  --theme-board-art: url("/assets/images/themes/forest-board.54e84ae2e256.webp");
  --theme-board-scrim: linear-gradient(rgba(245, 239, 213, .22), rgba(225, 224, 196, .34));
  --theme-accent: #567448;
}

body[data-theme-id="windy-island"] {
  --theme-page-background:
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, .52), transparent 19rem),
    linear-gradient(180deg, #e8f3f2 0, #f5f0df 58%, #e8dfc8 100%);
  --theme-header-background: rgba(232, 243, 242, .88);
  --theme-board-background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, .5), transparent 48%),
    #dbe8e4;
  --theme-board-art: url("/assets/images/themes/windy-island-board.a1cb20f7c03f.webp");
  --theme-board-scrim: linear-gradient(rgba(239, 246, 239, .14), rgba(225, 235, 224, .26));
  --theme-accent: #487583;
}

body[data-theme-id="story-tree"] {
  --theme-page-background:
    radial-gradient(circle at 12% 10%, rgba(224, 187, 107, .2), transparent 20rem),
    linear-gradient(180deg, #eee5d7 0, #f8f1df 48%, #e6dbc9 100%);
  --theme-header-background: rgba(238, 229, 215, .88);
  --theme-board-background:
    radial-gradient(circle at 50% 45%, rgba(174, 139, 91, .15), transparent 50%),
    #e6ddcc;
  --theme-board-art: url("/assets/images/themes/story-tree-board.fe2da2e28440.webp");
  --theme-board-scrim: linear-gradient(rgba(248, 237, 204, .16), rgba(225, 210, 185, .28));
  --theme-accent: #745f7b;
}

body[data-theme-id] {
  background: var(--theme-page-background);
}

body[data-theme-id] .site-header {
  background: var(--theme-header-background);
}

body[data-theme-id] .board-scroll {
  background: var(--theme-board-background);
  scrollbar-color: var(--theme-accent) rgba(255, 255, 255, .4);
}

body.has-area[data-theme-id] .board-scroll {
  background:
    var(--theme-board-scrim),
    var(--theme-board-art) center / cover no-repeat,
    var(--theme-board-background);
}

.world-node[data-theme-id] {
  background-color: rgba(255, 250, 240, .92);
  background-image:
    linear-gradient(90deg, rgba(255, 250, 240, .97), rgba(255, 250, 240, .82)),
    var(--world-node-art);
  background-position: center;
  background-size: cover;
}

.world-node[data-theme-id="forest"] {
  --world-node-art: url("/assets/images/themes/forest-board.54e84ae2e256.webp");
}

.world-node[data-theme-id="windy-island"] {
  --world-node-art: url("/assets/images/themes/windy-island-board.a1cb20f7c03f.webp");
}

.world-node[data-theme-id="story-tree"] {
  --world-node-art: url("/assets/images/themes/story-tree-board.fe2da2e28440.webp");
}

body[data-theme-id] progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--theme-accent), var(--moss-light));
}

body[data-theme-id] progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--theme-accent), var(--moss-light));
}

/* The ambient layer is clipped, non-interactive and always below the puzzle. */
.board-scroll {
  position: relative;
  isolation: isolate;
}

.area-ambience {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: none;
  overflow: clip;
  contain: strict;
  pointer-events: none;
  user-select: none;
}

.crossword-grid {
  z-index: 1;
}

body[data-theme-id="forest"]:not(.motion-calm):not(.system-reduced-motion) .area-ambience {
  display: block;
}

body.document-hidden .area-ambience *,
body.document-hidden .theme-word-reaction,
body.document-hidden .theme-key-reaction,
body.document-hidden .theme-area-reaction {
  animation-play-state: paused !important;
}

.ambient-leaf,
.ambient-firefly {
  position: absolute;
  display: block;
  pointer-events: none;
}

.ambient-leaf {
  top: -1.25rem;
  width: .95rem;
  height: .58rem;
  opacity: .24;
  background: #557649;
  border-radius: 100% 0 100% 0;
  box-shadow: inset -.14rem -.1rem rgba(24, 55, 45, .22);
  transform-origin: 80% 50%;
}

.ambient-leaf-one { left: 7%; --leaf-drift: 18vw; --leaf-turn: 510deg; animation-delay: -9s; }
.ambient-leaf-two { left: 34%; --leaf-drift: -12vw; --leaf-turn: -430deg; animation-delay: -2s; }
.ambient-leaf-three { left: 67%; --leaf-drift: 9vw; --leaf-turn: 390deg; animation-delay: -14s; }
.ambient-leaf-four { left: 88%; --leaf-drift: -18vw; --leaf-turn: -540deg; animation-delay: -6s; }

.ambient-firefly {
  width: .32rem;
  height: .32rem;
  opacity: 0;
  background: #f3cf69;
  border-radius: 50%;
  box-shadow: 0 0 .75rem .18rem rgba(243, 207, 105, .46);
}

.ambient-firefly-one { top: 18%; left: 12%; animation-delay: -1s; }
.ambient-firefly-two { top: 66%; left: 82%; animation-delay: -4s; }
.ambient-firefly-three { top: 42%; left: 52%; animation-delay: -7s; }

.preference-control {
  min-height: 3.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-top: .25rem;
  padding: .75rem 0;
  border-top: 1px solid var(--line);
}

.preference-control label {
  display: block;
  font-weight: 750;
}

.preference-control .field-help {
  margin: .18rem 0 0;
}

#calm-motion {
  width: 3.25rem;
  min-width: 44px;
  height: 2.75rem;
  min-height: 44px;
  margin: 0;
  appearance: none;
  background:
    radial-gradient(circle at .92rem 50%, #fffaf0 0 .58rem, transparent .62rem),
    #8a9a94;
  border: 1px solid rgba(24, 55, 45, .3);
  border-radius: 999px;
  box-shadow: inset 0 .1rem .25rem rgba(13, 42, 35, .18);
  cursor: pointer;
  transition: background-color .16s ease, background-position .16s ease;
}

#calm-motion:checked {
  background:
    radial-gradient(circle at calc(100% - .92rem) 50%, #fffaf0 0 .58rem, transparent .62rem),
    var(--forest);
}

html.motion-calm,
body.motion-calm .board-scroll {
  scroll-behavior: auto;
}

html.motion-calm *,
html.motion-calm *::before,
html.motion-calm *::after {
  scroll-behavior: auto !important;
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}

@media (prefers-reduced-motion: no-preference) {
  body[data-theme-id="forest"]:not(.motion-calm):not(.system-reduced-motion) .ambient-leaf {
    animation-name: forest-leaf-drift;
    animation-duration: 19s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
  }

  body[data-theme-id="forest"]:not(.motion-calm):not(.system-reduced-motion) .ambient-firefly {
    animation-name: forest-firefly-wander;
    animation-duration: 8s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
  }

  body:not(.motion-calm):not(.system-reduced-motion) .letter-cell.theme-word-reaction {
    animation: theme-word-confirmed .9s ease-out both;
  }

  body:not(.motion-calm):not(.system-reduced-motion) .letter-cell.theme-key-reaction {
    animation: theme-key-revealed 1.1s ease-out both;
  }

  body:not(.motion-calm):not(.system-reduced-motion) .board-card.theme-area-reaction {
    animation: theme-area-completed 1.5s ease-out both;
  }

  body[data-theme-id="forest"]:not(.motion-calm):not(.system-reduced-motion) .area-ambience.theme-word-reaction .ambient-firefly,
  body[data-theme-id="forest"]:not(.motion-calm):not(.system-reduced-motion) .area-ambience.theme-key-reaction .ambient-firefly {
    animation: forest-firefly-gather .9s ease-out both;
  }

  @keyframes forest-leaf-drift {
    0% { transform: translate3d(0, -2rem, 0) rotate(0); }
    38% { transform: translate3d(4vw, 23dvh, 0) rotate(170deg); }
    72% { transform: translate3d(-2vw, 46dvh, 0) rotate(310deg); }
    100% { transform: translate3d(var(--leaf-drift), min(68dvh, 48rem), 0) rotate(var(--leaf-turn)); }
  }

  @keyframes forest-firefly-wander {
    0%, 100% { opacity: .1; transform: translate3d(0, 0, 0); }
    30% { opacity: .72; transform: translate3d(1.2rem, -.8rem, 0); }
    65% { opacity: .28; transform: translate3d(-.7rem, 1rem, 0); }
  }

  @keyframes forest-firefly-gather {
    0% { opacity: .15; transform: scale(.7); }
    48% { opacity: .9; transform: scale(1.9); }
    100% { opacity: .18; transform: scale(.8); }
  }

  @keyframes theme-word-confirmed {
    0% { box-shadow: inset 0 -2px 0 rgba(24, 55, 45, .08); }
    45% { background: #f0f5cf; box-shadow: 0 0 0 .18rem rgba(112, 151, 75, .42), 0 0 1.1rem rgba(112, 151, 75, .5); }
    100% { box-shadow: inset 0 -2px 0 rgba(24, 55, 45, .08); }
  }

  @keyframes theme-key-revealed {
    0%, 100% { box-shadow: inset 0 -2px 0 rgba(24, 55, 45, .08); }
    45% { background: #fff1bc; box-shadow: 0 0 0 .22rem rgba(231, 168, 62, .5), 0 0 1.35rem rgba(231, 168, 62, .58); }
  }

  @keyframes theme-area-completed {
    0%, 100% { box-shadow: var(--shadow); }
    45% { box-shadow: 0 0 0 .28rem rgba(231, 168, 62, .42), 0 1rem 4rem rgba(86, 116, 72, .38); }
  }
}

@media (max-width: 46rem), (max-height: 35rem) {
  .ambient-leaf-four,
  .ambient-firefly-three {
    display: none;
  }

  .preference-control {
    gap: .65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html,
  .board-scroll {
    scroll-behavior: auto;
  }

  .area-ambience {
    display: none !important;
  }

  #calm-motion {
    transition: none;
  }
}

@media (forced-colors: active) {
  body.has-area[data-theme-id] .board-scroll,
  .world-node[data-theme-id] {
    background-image: none !important;
  }
}

@media (max-height: 27rem) and (pointer: coarse) {
  body.is-keyboard-open.is-word-entry-active .board-toolbar {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(10,38,29,.45); }
  .letter-cell, .clue-cell, input { border-width: 2px; }
}

/* Board-first application shell. The fixed action bar owns this viewport reserve. */
:root {
  --bottom-nav-bar: 4.55rem;
  --bottom-nav-reserve: calc(var(--bottom-nav-bar) + var(--safe-bottom));
}

html {
  scroll-padding-bottom: calc(var(--bottom-nav-reserve) + 1rem);
}

body {
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-nav-reserve) + 1rem);
}

body.modal-open {
  overflow: hidden;
}

.site-header {
  min-height: calc(4.15rem + var(--safe-top));
  padding-block: var(--safe-top) .35rem;
}

.site-header .brand-mark {
  width: 2.45rem;
}

.site-header .brand-name {
  font-size: clamp(1.2rem, 1.7vw, 1.45rem);
}

.header-motto {
  margin: 0;
  color: var(--ink-soft);
  font: italic 500 .86rem/1.2 var(--serif);
}

.header-context {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
}

.connection-status {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  padding: .2rem .45rem;
  color: var(--ink-soft);
  background: rgba(255, 250, 240, .5);
  border: 1px solid rgba(24, 55, 45, .1);
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.connection-status-dot {
  width: .42rem;
  height: .42rem;
  flex: 0 0 auto;
  background: #8a765c;
  border-radius: 50%;
}

.connection-status[data-state="live"] .connection-status-dot {
  background: #3d7b4a;
}

.connection-status[data-state="fallback"] .connection-status-dot,
.connection-status[data-state="connecting"] .connection-status-dot {
  background: var(--amber-deep);
}

.connection-status[data-state="offline"] .connection-status-dot {
  background: var(--berry);
}

.game-section {
  min-height: calc(100dvh - 4.15rem - var(--safe-top) - var(--bottom-nav-reserve));
  padding-block: clamp(.8rem, 2vw, 1.4rem) .5rem;
}

.area-heading {
  align-items: center;
  margin-bottom: clamp(.75rem, 1.8vw, 1.25rem);
}

.area-heading h2 {
  font-size: clamp(1.65rem, 3vw, 2.65rem);
}

.area-status {
  margin-top: .35rem;
  font-size: .84rem;
}

.area-progress {
  width: min(20rem, 34vw);
  flex: 0 0 auto;
}

.board-card {
  scroll-margin-block-end: calc(var(--bottom-nav-reserve) + 1rem);
}

.board-scroll {
  height: clamp(25rem, calc(100dvh - 20rem - var(--bottom-nav-reserve)), 52rem);
}

.board-footer {
  position: sticky;
  bottom: var(--bottom-nav-reserve);
}

.bottom-nav {
  position: fixed;
  z-index: 700;
  right: max(1rem, var(--safe-right));
  bottom: 0;
  left: max(1rem, var(--safe-left));
  width: min(46rem, calc(100% - max(2rem, var(--safe-right) + var(--safe-left))));
  min-height: var(--bottom-nav-reserve);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-inline: auto;
  padding: .4rem .45rem max(.4rem, var(--safe-bottom));
  color: rgba(255, 250, 240, .75);
  background: rgba(13, 42, 35, .97);
  border: 1px solid rgba(255, 255, 255, .15);
  border-bottom: 0;
  border-radius: 1.35rem 1.35rem 0 0;
  box-shadow: 0 -1rem 3rem rgba(6, 31, 24, .22);
  backdrop-filter: blur(1rem) saturate(1.2);
}

.bottom-nav-item {
  position: relative;
  min-width: 0;
  min-height: 3.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .28rem .2rem;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: .85rem;
  font-size: .68rem;
  font-weight: 750;
  line-height: 1.05;
  white-space: nowrap;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}

.bottom-nav-badge {
  position: absolute;
  z-index: 2;
  top: .18rem;
  left: calc(50% + .3rem);
  min-width: 1.2rem;
  height: 1.2rem;
  display: inline-grid;
  place-items: center;
  padding-inline: .22rem;
  color: #fffaf0;
  background: var(--berry);
  border: 2px solid #0d2a23;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.bottom-nav-badge[hidden] {
  display: none;
}

.bottom-nav-item:hover {
  color: #fffaf0;
  background: rgba(255, 255, 255, .08);
}

.bottom-nav-item[aria-current="true"],
.bottom-nav-item[aria-expanded="true"] {
  color: #ffe3a2;
  background: rgba(231, 168, 62, .16);
}

.bottom-nav-item:active {
  transform: translateY(1px);
}

.bottom-nav-icon {
  width: 1.45rem;
  height: 1.45rem;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg.bottom-nav-icon path[fill] {
  fill: currentColor;
}

.bottom-nav-item:nth-child(2) .bottom-nav-icon,
.bottom-nav-item:nth-child(3) .bottom-nav-icon,
.bottom-nav-item:nth-child(4) .bottom-nav-icon {
  fill: currentColor;
  stroke: none;
}

.bottom-nav .player-avatar {
  width: 1.45rem;
  height: 1.45rem;
  color: #fff7df;
  border: 1px solid rgba(255, 255, 255, .24);
  font-size: .7rem;
  line-height: 1;
}

.app-panel {
  width: min(43rem, calc(100% - 2rem));
  max-width: none;
  max-height: min(48rem, calc(100dvh - 2rem - var(--safe-top) - var(--safe-bottom)));
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(24, 55, 45, .2);
  border-radius: 1.65rem 1.5rem 1.85rem 1.4rem;
  box-shadow: 0 2rem 7rem rgba(6, 31, 24, .4);
}

.app-panel::backdrop {
  background: rgba(7, 32, 26, .72);
  backdrop-filter: blur(5px);
}

.app-panel[open] {
  animation: panel-in .2s ease-out both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(.8rem) scale(.985); }
}

.panel-shell,
.nickname-dialog > form {
  max-height: inherit;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
}

.panel-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem) clamp(1rem, 3.5vw, 1.75rem);
  background: rgba(255, 250, 240, .98);
  border-bottom: 1px solid var(--line);
}

.panel-heading > div {
  min-width: 0;
}

.panel-heading h2,
.nickname-dialog .panel-heading h2 {
  overflow: hidden;
  margin: 0;
  font: 600 clamp(1.7rem, 4vw, 2.5rem)/1 var(--serif);
  letter-spacing: -.035em;
  text-overflow: ellipsis;
}

.panel-heading .eyebrow {
  margin-bottom: .28rem;
}

.panel-close {
  width: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  background: rgba(24, 55, 45, .06);
  border: 1px solid var(--line);
  border-radius: 50%;
  font: 400 1.65rem/1 var(--sans);
  cursor: pointer;
}

.panel-close:hover {
  color: var(--ink);
  background: var(--fern);
}

.panel-content {
  min-height: 0;
  overflow: auto;
  padding: clamp(1rem, 3.5vw, 1.75rem);
  overscroll-behavior: contain;
  scrollbar-color: var(--moss) transparent;
}

.world-panel {
  width: min(72rem, calc(100% - 2rem));
}

.app-panel .world-section,
.app-panel .leaderboard-section {
  padding-block: clamp(1rem, 3.5vw, 1.75rem);
}

.app-panel .world-hint,
.app-panel .leaderboard-section > p {
  margin: 0;
  color: var(--ink-soft);
}

.app-panel .world-scroll {
  margin-top: 1rem;
  padding-block: .5rem 1rem;
}

.chronicle-entry {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .85rem;
  margin: 0 0 1rem;
  padding: .9rem 1rem;
  color: var(--ink);
  text-align: left;
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 255, 255, .62), transparent 28%),
    linear-gradient(135deg, rgba(237, 225, 187, .88), rgba(210, 228, 196, .82));
  border: 1px solid rgba(58, 86, 66, .2);
  border-radius: 1rem;
  box-shadow: 0 .45rem 1.2rem rgba(27, 58, 46, .08);
  font: inherit;
  cursor: pointer;
}

.chronicle-entry:hover {
  border-color: rgba(58, 86, 66, .42);
  transform: translateY(-1px);
}

.chronicle-entry:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.chronicle-entry-mark,
.chronicle-card-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fffaf0;
  background: var(--forest-deep);
  border: 1px solid rgba(255, 255, 255, .26);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .08);
}

.chronicle-entry-mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: .75rem .75rem .75rem .25rem;
  font: 800 1.1rem/1 var(--serif);
}

.chronicle-entry-copy {
  min-width: 0;
  display: grid;
  gap: .1rem;
}

.chronicle-entry-copy strong {
  font: 750 1.05rem/1.2 var(--serif);
}

.chronicle-entry-copy small {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chronicle-entry-arrow {
  color: var(--moss);
  font-size: 1.8rem;
  line-height: 1;
}

.chronicle-panel {
  width: min(62rem, calc(100% - 2rem));
}

.chronicle-section {
  background:
    linear-gradient(rgba(255, 253, 245, .9), rgba(255, 253, 245, .96)),
    repeating-linear-gradient(0deg, transparent 0 1.65rem, rgba(58, 86, 66, .06) 1.65rem calc(1.65rem + 1px));
}

.chronicle-intro,
.chronicle-status {
  max-width: 48rem;
  margin: 0 auto;
  color: var(--ink-soft);
}

.chronicle-status {
  padding: 1.4rem 0;
  text-align: center;
}

.chronicle-list {
  max-width: 56rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.2rem auto 0;
  padding: 0;
  list-style: none;
}

.chronicle-list-item {
  min-width: 0;
}

.chronicle-card {
  min-height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: rgba(255, 253, 246, .96);
  border: 1px solid rgba(58, 86, 66, .2);
  border-radius: 1rem;
  box-shadow: 0 .65rem 1.6rem rgba(27, 58, 46, .09);
  content-visibility: auto;
  contain-intrinsic-size: auto 24rem;
}

.chronicle-card-heading {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 90% 0, rgba(255, 255, 255, .68), transparent 42%),
    linear-gradient(135deg, rgba(217, 231, 199, .82), rgba(240, 226, 187, .74));
  border-bottom: 1px solid rgba(58, 86, 66, .14);
}

.chronicle-card-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  font-size: .8rem;
}

.chronicle-card-heading-copy {
  min-width: 0;
}

.chronicle-card-heading h3 {
  margin: 0;
  font: 750 clamp(1.08rem, 2.2vw, 1.3rem)/1.15 var(--serif);
}

.chronicle-card-heading time {
  display: block;
  margin-top: .22rem;
  color: var(--ink-soft);
  font-size: .73rem;
}

.chronicle-key-phrase {
  padding: 1rem 1rem .75rem;
}

.chronicle-key-phrase .eyebrow {
  margin: 0 0 .3rem;
  color: var(--moss);
}

.chronicle-key-phrase-value {
  margin: 0;
  color: var(--forest-deep);
  font: 750 1.05rem/1.35 var(--serif);
  overflow-wrap: anywhere;
}

.chronicle-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: .5rem;
  padding: .25rem 1rem 1rem;
}

.chronicle-meta-item {
  min-width: 0;
  display: grid;
  gap: .08rem;
  padding: .55rem .65rem;
  background: rgba(47, 92, 67, .07);
  border-radius: .65rem;
}

.chronicle-meta-item small {
  color: var(--ink-soft);
  font-size: .65rem;
}

.chronicle-meta-item strong {
  overflow: hidden;
  font-size: .8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chronicle-contributions {
  border-top: 1px solid rgba(58, 86, 66, .14);
}

.chronicle-contributions summary {
  padding: .8rem 1rem;
  color: var(--moss);
  font-size: .78rem;
  font-weight: 750;
  cursor: pointer;
}

.chronicle-contributions summary:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: -3px;
}

.chronicle-contribution-list {
  margin: 0;
  padding: 0 1rem 1rem;
  list-style: none;
}

.chronicle-contribution-item {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: .35rem;
  padding: .42rem 0;
  border-bottom: 1px dashed rgba(58, 86, 66, .15);
  font-size: .75rem;
}

.chronicle-contribution-item:last-child {
  border-bottom: 0;
}

.chronicle-contribution-rank,
.chronicle-contribution-score {
  color: var(--ink-soft);
}

.chronicle-contribution-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chronicle-contribution-score {
  text-align: right;
  white-space: nowrap;
}

.key-panel .panel-shell,
.panel-heading-inverse,
.key-panel .key-card {
  color: #fffaf0;
  background-color: var(--forest-deep);
}

.panel-heading-inverse {
  border-bottom-color: rgba(255, 255, 255, .13);
}

.panel-heading-inverse .eyebrow {
  color: #acc784;
}

.panel-heading-inverse .panel-close {
  color: #fffaf0;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .18);
}

.key-panel .key-card {
  border-radius: 0;
  box-shadow: none;
}

.key-panel .key-heading {
  align-items: center;
}

.key-panel .key-heading > p {
  margin: 0;
  color: rgba(255, 250, 240, .7);
  font-size: .78rem;
  font-weight: 750;
}

.party-panel .party-card {
  margin: clamp(1rem, 3vw, 1.5rem);
  padding: clamp(1.15rem, 3.5vw, 1.75rem);
}

.leaderboard-panel {
  width: min(54rem, calc(100% - 2rem));
}

.app-panel .table-scroll {
  margin-top: 1rem;
  box-shadow: none;
}

.nickname-dialog {
  width: min(31rem, calc(100% - 2rem));
}

.nickname-content {
  padding: clamp(1.25rem, 5vw, 2.25rem);
}

.nickname-content > p:not(.field-help) {
  color: var(--ink-soft);
}

.nickname-content .dialog-mark {
  margin-bottom: 1rem;
}

.toast-region {
  bottom: calc(var(--bottom-nav-reserve) + .75rem);
}

@media (max-width: 46rem) {
  :root {
    --bottom-nav-bar: 4.25rem;
  }

  body {
    padding-bottom: calc(var(--bottom-nav-reserve) + .5rem);
  }

  .site-header {
    min-height: calc(3.9rem + var(--safe-top));
  }

  .site-header .brand-mark {
    width: 2.2rem;
  }

  .site-header .brand-name {
    font-size: 1.2rem;
  }

  .header-motto {
    max-width: 11rem;
    overflow: hidden;
    font-size: .72rem;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-context {
    max-width: min(12rem, 48vw);
    flex-direction: column;
    align-items: flex-end;
    gap: .22rem;
  }

  .connection-status {
    padding: .17rem .38rem;
    font-size: .62rem;
  }

  .game-section {
    min-height: calc(100dvh - 3.9rem - var(--safe-top) - var(--bottom-nav-reserve));
    padding-top: .65rem;
  }

  .area-heading {
    gap: .65rem;
    margin-bottom: .7rem;
  }

  .area-heading h2 {
    font-size: clamp(1.55rem, 7.5vw, 2.1rem);
  }

  .area-status {
    display: -webkit-box;
    overflow: hidden;
    font-size: .76rem;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .area-progress {
    width: 100%;
  }

  .progress-copy {
    margin-bottom: .3rem;
    font-size: .72rem;
  }

  .board-scroll {
    height: clamp(19rem, calc(100dvh - 19rem - var(--bottom-nav-reserve)), 36rem);
  }

  .board-footer {
    bottom: var(--bottom-nav-reserve);
  }

  .solve-dock {
    padding-bottom: .75rem;
  }

  .bottom-nav {
    right: 0;
    left: 0;
    width: 100%;
    padding-inline: max(.25rem, var(--safe-left)) max(.25rem, var(--safe-right));
    border-right: 0;
    border-left: 0;
    border-radius: 1rem 1rem 0 0;
  }

  .bottom-nav-item {
    min-height: 3.55rem;
    padding-inline: .1rem;
    font-size: clamp(.58rem, 2.5vw, .67rem);
    letter-spacing: -.01em;
  }

  .bottom-nav-icon,
  .bottom-nav .player-avatar {
    width: 1.35rem;
    height: 1.35rem;
  }

  .app-panel {
    inset: auto 0 0;
    width: 100%;
    max-height: min(86dvh, calc(100dvh - var(--safe-top) - .5rem));
    margin: 0;
    padding-bottom: var(--safe-bottom);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 1.35rem 1.35rem 0 0;
  }

  .app-panel[open] {
    animation-name: panel-sheet-in;
  }

  @keyframes panel-sheet-in {
    from { opacity: 0; transform: translateY(1.5rem); }
  }

  .panel-heading {
    padding: .85rem max(1rem, var(--safe-right)) .85rem max(1rem, var(--safe-left));
  }

  .panel-heading h2,
  .nickname-dialog .panel-heading h2 {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  .panel-content {
    padding: 1rem max(1rem, var(--safe-right)) max(1rem, var(--safe-bottom)) max(1rem, var(--safe-left));
  }

  .app-panel .world-section,
  .app-panel .leaderboard-section {
    padding-block: 1rem max(1rem, var(--safe-bottom));
  }

  .world-panel .world-scroll {
    margin-inline: calc(max(1rem, var(--safe-left)) * -1) calc(max(1rem, var(--safe-right)) * -1);
    padding-inline: max(1rem, var(--safe-left)) max(1rem, var(--safe-right));
  }

  .world-panel .world-node {
    width: 12rem;
  }

  .chronicle-entry {
    gap: .7rem;
    padding: .8rem;
  }

  .chronicle-list {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 1rem;
  }

  .chronicle-card {
    contain-intrinsic-size: auto 21rem;
  }

  .party-panel .party-card {
    margin: 1rem;
  }

  .leaderboard-panel .leaderboard {
    min-width: 26rem;
  }

  .toast-region {
    right: max(.65rem, var(--safe-right));
    bottom: calc(var(--bottom-nav-reserve) + .55rem);
    width: auto;
    left: max(.65rem, var(--safe-left));
  }
}

@media (max-width: 22rem) {
  .header-motto {
    display: none;
  }

  .header-context {
    max-width: none;
  }

  .bottom-nav-item {
    font-size: .56rem;
  }

  .chronicle-entry-mark {
    width: 2.3rem;
    height: 2.3rem;
  }

  .chronicle-entry-copy small {
    white-space: normal;
  }

  .chronicle-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .chronicle-contribution-item {
    grid-template-columns: 1.4rem minmax(0, 1fr);
  }

  .chronicle-contribution-score {
    grid-column: 2;
    text-align: left;
  }

  .bottom-nav-icon,
  .bottom-nav .player-avatar {
    width: 1.25rem;
    height: 1.25rem;
  }
}

@media (max-height: 35rem) and (pointer: coarse) and (hover: none) {
  :root {
    --bottom-nav-bar: 3.8rem;
  }

  .bottom-nav-item {
    min-height: 3.1rem;
    flex-direction: row;
    gap: .3rem;
  }

  .app-panel {
    max-height: calc(100dvh - var(--safe-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-panel[open] {
    animation: none;
  }
}

/* Keep the whole play surface in the viewport space above the fixed action bar. */
:root {
  --shell-header-height: calc(4.15rem + var(--safe-top));
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows:
    var(--shell-header-height)
    calc(100dvh - var(--shell-header-height) - var(--bottom-nav-reserve));
  padding-bottom: 0;
}

.site-header {
  position: relative;
  top: auto;
  min-height: 0;
  height: var(--shell-header-height);
}

main {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.game-section {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.game-layout,
.board-card {
  min-height: 0;
  height: 100%;
}

.board-card {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.board-scroll {
  min-height: 0;
  height: auto;
  max-height: none;
}

.board-footer {
  position: relative;
  bottom: auto;
}

body.is-keyboard-open {
  --bottom-nav-reserve: 0px;
  --shell-header-height: 0px;
  grid-template-rows: 0 minmax(0, var(--keyboard-viewport-height, 100dvh));
}

body.is-keyboard-open .site-header,
body.is-keyboard-open .bottom-nav {
  display: none;
}

body.is-keyboard-open .game-section {
  padding-top: .25rem;
}

@media (max-width: 46rem) {
  :root {
    --shell-header-height: calc(3.9rem + var(--safe-top));
  }

  .solve-dock-form .input-action {
    flex-direction: row;
    align-items: stretch;
  }

  .solve-dock-form input {
    min-width: 0;
  }

  .solve-dock-form .button {
    flex: 0 0 auto;
    padding-inline: .8rem;
  }
}

@media (max-height: 36rem) and (pointer: coarse) and (hover: none) {
  :root {
    --shell-header-height: calc(2.75rem + var(--safe-top));
    /* --bottom-nav-reserve adds the device inset once for every viewport. */
    --bottom-nav-bar: 3.1rem;
  }

  .site-header {
    padding-block: var(--safe-top) 0;
  }

  .site-header .brand-mark {
    width: 2rem;
  }

  .site-header .brand-name {
    font-size: 1.05rem;
  }

  .header-motto,
  .area-heading .eyebrow {
    display: none;
  }

  .game-section {
    padding-top: .35rem;
  }

  .area-heading {
    margin-bottom: 5px;
  }

  .area-heading h2 {
    font-size: 1.3rem;
    line-height: 1;
  }

  .area-status,
  .board-legend-group,
  .board-help {
    display: none;
  }

  .solve-dock {
    align-items: center;
    gap: .25rem .65rem;
    padding: .35rem .7rem;
  }

  .solve-dock .eyebrow,
  .solve-dock h3,
  .solve-dock-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .solve-dock .selected-clue {
    margin: 0;
    -webkit-line-clamp: 1;
  }

  .solve-dock .word-meta {
    margin: .2rem 0 0;
  }

  .board-toolbar {
    min-height: 2.5rem;
    padding-block: .35rem;
  }

  .board-scroll {
    padding-block: .3rem;
  }

  .bottom-nav {
    min-height: var(--bottom-nav-reserve);
    padding-block: .15rem max(.15rem, var(--safe-bottom));
  }

  .bottom-nav-item {
    min-height: 2.75rem;
  }
}

/* Suora ristikkokynä: the native field only brokers mobile keyboards and IME. */
.grid-entry-proxy,
body.is-keyboard-open.is-word-entry-active .solve-dock-form .grid-entry-proxy {
  position: fixed !important;
  left: 0 !important;
  bottom: 0 !important;
  z-index: 1 !important;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  opacity: .01 !important;
  border: 0 !important;
  border-radius: 0 !important;
  pointer-events: none !important;
  white-space: nowrap !important;
}

.solve-dock-form {
  width: max-content;
  max-width: 100%;
  justify-self: end;
}

.grid-entry-actions {
  display: flex;
  align-items: center;
}

.grid-entry-submit {
  min-width: 7.4rem;
  min-height: 2.75rem;
  white-space: nowrap;
}

.letter-cell .cell-letter {
  position: relative;
  z-index: 1;
  color: inherit;
}

.letter-cell.draft-letter:not(.confirmed) {
  color: #424a47;
  font-weight: 620;
  text-shadow: 0 .04em 0 rgba(255, 255, 255, .65);
}

.letter-cell.development-answer:not(.confirmed):not(.draft-letter) .cell-letter {
  color: #858b87;
  font-weight: 500;
}

.letter-cell.draft-conflict:not(.confirmed) {
  background-image: linear-gradient(135deg, transparent 0 82%, rgba(156, 63, 67, .3) 82% 87%, transparent 87%);
}

.letter-cell.draft-invalid:not(.confirmed) {
  color: #783b3f;
  background-color: #fff0e8;
  border-color: #a54d51;
  box-shadow: 0 0 0 2px rgba(165, 77, 81, .34), inset 0 -2px 0 rgba(120, 59, 63, .1);
}

.letter-cell.active-letter {
  z-index: 4;
  border-color: #754a11;
  box-shadow: 0 0 0 3px #f3c66d, 0 .2rem .8rem rgba(58, 39, 13, .22), inset 0 -2px 0 rgba(24, 55, 45, .08);
}

body.is-word-entry-active .letter-cell.active-letter::before {
  position: absolute;
  z-index: 2;
  left: calc(50% + .42em);
  top: 22%;
  width: 2px;
  height: 56%;
  background: #754a11;
  border-radius: 2px;
  content: "";
  animation: grid-entry-caret 1.05s steps(1, end) infinite;
}

body.is-word-entry-active .letter-cell.active-letter.empty-entry::before {
  left: calc(50% - 1px);
}

@keyframes grid-entry-caret {
  0%, 52% { opacity: 1; }
  53%, 100% { opacity: .15; }
}

@media (max-width: 46rem) {
  .solve-dock-form {
    width: auto;
    justify-self: stretch;
  }

  .grid-entry-submit {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.is-word-entry-active .letter-cell.active-letter::before {
    animation: none;
  }
}

html.motion-calm body.is-word-entry-active .letter-cell.active-letter::before {
  animation: none;
}

body.system-reduced-motion.is-word-entry-active .letter-cell.active-letter::before {
  animation: none;
}

@media (forced-colors: active) {
  .letter-cell.active-letter {
    outline: 3px solid Highlight;
    outline-offset: 1px;
  }

  .letter-cell.draft-invalid:not(.confirmed) {
    outline: 3px solid LinkText;
  }
}

/* Progress now belongs to the board chrome; the freed heading space grows the puzzle. */
.area-heading {
  margin-bottom: 5px;
}

.board-progress {
  width: min(14rem, 44vw);
  flex: 0 1 14rem;
  margin-left: auto;
}

.board-progress .progress-copy {
  margin-bottom: .2rem;
  font-size: .72rem;
  line-height: 1.1;
}

.board-progress progress {
  height: .38rem;
  display: block;
}

@media (max-width: 46rem) {
  .board-progress {
    width: min(10rem, 45vw);
    flex-basis: 10rem;
  }

  .board-progress .progress-copy {
    gap: .4rem;
    font-size: .65rem;
  }
}

@media (max-width: 22rem) {
  .board-progress {
    width: min(8.75rem, 47vw);
  }

  .board-progress .progress-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Board-first mobile shell: area context lives in the banner and secondary
   guidance lives behind Profile, leaving the viewport to the crossword. */
body {
  width: 100%;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "header"
    "game";
}

.site-header {
  grid-area: header;
}

main {
  grid-area: game;
}

.site-header .area-heading {
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: 0;
  margin: 0;
  text-align: right;
}

.site-header .area-heading > div:first-child {
  min-width: 0;
  width: auto;
  max-width: min(42rem, 100%);
}

.site-header .area-heading .eyebrow {
  margin: 0 0 .1rem;
  color: var(--ink-soft);
  font-size: .62rem;
  line-height: 1;
}

.site-header .area-title-row {
  width: auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: .4rem;
}

.site-header .area-title-row h2 {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  margin: 0;
  font: 650 clamp(.95rem, 1.7vw, 1.25rem)/1.05 var(--serif);
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header .area-breath-badge {
  min-height: 1.35rem;
  padding: .16rem .42rem;
  font-size: .64rem;
}

.site-header .area-status {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.game-section {
  grid-template-rows: minmax(0, 1fr);
  padding-block: 0;
}

.profile-menu {
  position: fixed;
  z-index: 720;
  right: max(1rem, calc((100vw - min(46rem, calc(100vw - 2rem))) / 2));
  bottom: calc(var(--bottom-nav-reserve) + .5rem);
  width: min(18rem, calc(100vw - max(2rem, var(--safe-left) + var(--safe-right))));
  max-height: min(23rem, calc(100dvh - var(--bottom-nav-reserve) - var(--safe-top) - 1.5rem));
  display: grid;
  gap: .2rem;
  padding: .45rem;
  overflow: auto;
  color: var(--ink);
  background: rgba(255, 250, 240, .98);
  border: 1px solid rgba(24, 55, 45, .2);
  border-radius: 1rem;
  box-shadow: 0 1rem 3rem rgba(6, 31, 24, .28);
  overscroll-behavior: contain;
}

.profile-menu::after {
  position: absolute;
  right: 2.2rem;
  bottom: -.42rem;
  width: .8rem;
  height: .8rem;
  background: var(--paper);
  border-right: 1px solid rgba(24, 55, 45, .2);
  border-bottom: 1px solid rgba(24, 55, 45, .2);
  content: "";
  transform: rotate(45deg);
}

.profile-menu > button {
  min-width: 0;
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .75rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: .7rem;
  cursor: pointer;
}

.profile-menu > button:hover,
.profile-menu > button:focus-visible {
  background: var(--fern);
}

.profile-menu > button > span:first-child,
.profile-menu strong,
.profile-menu small {
  min-width: 0;
  display: block;
}

.profile-menu strong {
  font-size: .86rem;
}

.profile-menu small {
  overflow: hidden;
  margin-top: .12rem;
  color: var(--ink-soft);
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu-check {
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: .72rem;
}

#profile-menu-motion[aria-checked="true"] .profile-menu-check {
  color: #fffaf0;
  background: var(--forest);
  border-color: var(--forest);
}

.profile-menu > button[aria-disabled="true"] {
  cursor: default;
}

.profile-menu > button[aria-disabled="true"]:hover,
.profile-menu > button[aria-disabled="true"]:focus-visible {
  background: transparent;
}

.profile-menu .profile-menu-logout {
  color: #7d292e;
}

body[data-auth-state="anonymous"] #party-nav-button::after {
  content: "Tili";
  position: absolute;
  top: .2rem;
  right: .2rem;
  padding: .05rem .25rem;
  color: #3a2812;
  background: var(--amber);
  border-radius: .45rem;
  font-size: .48rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

@media (max-width: 30rem) {
  .registration-dialog,
  .nickname-dialog {
    width: calc(100% - .75rem);
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - .5rem);
    border-radius: 1.15rem 1rem 1.2rem .95rem;
  }

  .registration-content {
    gap: .7rem;
    padding-inline: .85rem;
  }

  .registration-hero {
    min-height: 2.7rem;
  }

  .registration-hero span:nth-child(2) {
    width: 2.7rem;
    height: 2.7rem;
    font-size: 1.2rem;
  }

  .registration-benefits li,
  .terms-consent {
    font-size: .78rem;
  }
}

@media (max-height: 38rem) {
  .registration-hero {
    display: none;
  }

  .registration-content {
    gap: .55rem;
  }

  .registration-benefits {
    gap: .25rem;
  }

  .local-progress-note {
    padding: .6rem .7rem;
  }
}

@media (forced-colors: active) {
  .google-signin-stage,
  .local-progress-note,
  .registration-terms,
  .profile-menu-check {
    color: CanvasText;
    background: Canvas;
    border: 1px solid CanvasText;
  }
}

.help-panel {
  width: min(40rem, calc(100% - 2rem));
}

.help-content {
  display: grid;
  gap: 1.4rem;
}

.help-content section + section {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.help-content h3 {
  margin: 0 0 .75rem;
  font: 650 clamp(1.2rem, 3vw, 1.55rem)/1.1 var(--serif);
}

.help-steps {
  display: grid;
  gap: .55rem;
  margin: 0;
  padding-left: 1.5rem;
}

.keyboard-help {
  margin: 1rem 0 0;
  padding: .75rem .85rem;
  color: var(--ink-soft);
  background: rgba(220, 229, 194, .52);
  border-radius: .75rem;
  font-size: .82rem;
}

.help-legend {
  display: grid;
  gap: .65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-legend li {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  align-items: start;
  gap: .6rem;
  color: var(--ink-soft);
  font-size: .84rem;
}

.help-legend strong {
  color: var(--ink);
}

.help-legend .legend-swatch {
  width: .9rem;
  margin-top: .22rem;
}

body.is-keyboard-open {
  grid-template-areas:
    "header"
    "game";
  grid-template-rows: 0 minmax(0, var(--keyboard-viewport-height, 100dvh));
}

body.is-keyboard-open .site-header {
  display: flex;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
}

body.is-keyboard-open .bottom-nav {
  display: none;
}

body.is-keyboard-open main {
  grid-area: game;
  padding-top: var(--keyboard-viewport-offset-top, 0px);
}

body.is-keyboard-open .board-scroll,
body.is-keyboard-open.is-word-entry-active .board-scroll {
  min-height: 0;
  height: auto;
  max-height: none;
  scroll-padding: .5rem;
}

body.is-keyboard-open.is-word-entry-active .board-toolbar {
  display: none;
}

.grid-entry-proxy,
body.is-keyboard-open.is-word-entry-active .solve-dock-form .grid-entry-proxy {
  top: max(1px, var(--safe-top)) !important;
  right: auto !important;
  bottom: auto !important;
  left: max(1px, var(--safe-left)) !important;
  font-size: 16px !important;
}

body.is-keyboard-open.is-word-entry-active .solve-dock-form .grid-entry-proxy {
  top: max(calc(var(--keyboard-viewport-offset-top, 0px) + 1px), var(--safe-top)) !important;
}

@media (max-width: 46rem),
  (max-width: 58.25rem) and (max-height: 36rem) and (pointer: coarse) and (hover: none) {
  :root {
    --shell-header-height: calc(2.75rem + var(--safe-top));
    --bottom-nav-bar: 3.15rem;
  }

  .site-header,
  main {
    width: 100%;
    max-width: 100vw;
    margin-inline: 0;
  }

  .site-header {
    gap: .5rem;
    padding-right: max(.5rem, var(--safe-right));
    padding-left: max(.5rem, var(--safe-left));
  }

  .site-header .brand {
    min-width: 0;
    flex: 0 1 auto;
    gap: .42rem;
  }

  .site-header .brand-mark {
    width: 1.8rem;
  }

  .site-header .brand .eyebrow {
    display: none;
  }

  .site-header .brand-name {
    font-size: 1rem;
  }

  .site-header .area-heading {
    max-width: 62%;
  }

  .site-header .area-heading .eyebrow {
    font-size: .54rem;
  }

  .site-header .area-title-row h2 {
    flex: 1 1 auto;
    font-size: .86rem;
  }

  .site-header .area-breath-badge {
    min-height: 1.15rem;
    padding: .12rem .3rem;
    font-size: .56rem;
  }

  .game-layout,
  .board-card {
    width: 100%;
  }

  .board-scroll {
    scroll-behavior: auto;
  }

  .board-card {
    margin-inline: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .board-toolbar {
    min-height: 2.55rem;
    gap: .35rem;
    padding: .3rem .5rem;
  }

  .world-echo-status {
    order: 0;
    min-width: 0;
    flex: 1 1 7.5rem;
    grid-template-columns: minmax(0, 1fr);
    padding: .25rem .4rem;
  }

  .board-toolbar .world-echo-status[data-state="waiting"] {
    order: 0;
    flex-basis: 7.5rem;
  }

  .world-echo-mark,
  .world-echo-meter,
  #world-echo-message {
    display: none;
  }

  #world-echo-next:not([hidden]) {
    display: block;
    overflow: hidden;
    margin: .08rem 0 0;
    font-size: .54rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #crossword-chain-message {
    display: none;
  }

  .board-progress {
    width: min(9rem, 43vw);
    flex-basis: 9rem;
  }

  .solve-dock {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .3rem .5rem;
    padding: .2rem max(.5rem, var(--safe-right)) max(.2rem, var(--safe-bottom)) max(.5rem, var(--safe-left));
  }

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

  .solve-dock .selected-clue {
    margin: 0;
    font-size: .72rem;
    line-height: 1.15;
    -webkit-line-clamp: 2;
  }

  .solve-dock .word-meta {
    margin: .15rem 0 0;
    font-size: .61rem;
  }

  .solve-dock-form {
    width: auto;
    grid-column: 2;
    grid-row: 1;
    justify-self: auto;
    margin: 0;
  }

  .grid-entry-submit {
    width: auto;
    min-width: 5.4rem;
    min-height: 2.75rem;
    padding: .45rem .6rem;
  }

  .solve-dock-drawer {
    align-self: center;
  }

  .solve-dock .solve-dock-drawer:not([open]) {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
  }

  .solve-dock-drawer summary {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    padding: .35rem .45rem;
    font-size: .66rem;
  }

  .solve-dock .solve-dock-drawer[open] {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .bottom-nav {
    right: 0;
    left: 0;
    width: 100%;
    height: var(--bottom-nav-reserve);
    min-height: var(--bottom-nav-reserve);
    padding: .15rem max(.25rem, var(--safe-right)) max(.15rem, var(--safe-bottom)) max(.25rem, var(--safe-left));
    border-radius: .9rem .9rem 0 0;
  }

  .bottom-nav-item {
    min-height: 2.75rem;
    gap: .1rem;
    padding-block: .1rem;
    font-size: .58rem;
  }

  .bottom-nav-icon,
  .bottom-nav .player-avatar {
    width: 1.15rem;
    height: 1.15rem;
  }

  .profile-menu {
    right: max(.5rem, var(--safe-right));
    bottom: calc(var(--bottom-nav-reserve) + .4rem);
    width: min(18rem, calc(100vw - max(1rem, var(--safe-left) + var(--safe-right))));
  }
}

@media (min-width: 46.01rem) and (max-width: 58.25rem)
  and (max-height: 36rem) and (pointer: coarse) and (hover: none) {
  .board-toolbar {
    min-height: 0;
    gap: .2rem;
    padding: .08rem .4rem;
  }

  .world-echo-status {
    padding: .08rem .3rem;
  }

  .world-echo-heading,
  .world-echo-heading strong {
    font-size: .6rem;
    line-height: 1;
  }

  #world-echo-next:not([hidden]) {
    margin-top: .03rem;
    font-size: .49rem;
  }

  .board-progress .progress-copy {
    margin-bottom: .08rem;
    font-size: .58rem;
  }

  .board-progress progress {
    height: .28rem;
  }
}

@media (max-width: 22rem) {
  .site-header .area-heading {
    max-width: 58%;
  }

  .site-header .area-breath-badge {
    max-width: 4.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .solve-dock {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .solve-dock-drawer {
    display: none;
  }
}

@media (forced-colors: active) {
  .profile-menu,
  .profile-menu > button,
  .help-legend .legend-swatch {
    border: 1px solid CanvasText;
  }
}

/* Kuudennen kaiun lisävihjeet käyttävät olemassa olevaa dialogikerrosta.
   Pelialueelle jää vain kaikukortin kompakti toimintopainike, joten lista ei
   pienennä 200 × 200 -ruudukon pysyvää katselualaa. */
.world-echo-status {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.world-echo-advice-open {
  min-width: 4.25rem;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .28rem;
  padding: .34rem .52rem;
  color: #fffaf0;
  background: #365f51;
  border: 1px solid rgba(26, 72, 58, .35);
  border-radius: .68rem;
  font: 800 .66rem/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}

.world-echo-advice-open:hover {
  background: #274b40;
}

.world-echo-advice-open:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.world-echo-advice-open[hidden] {
  display: none;
}

.world-echo-advice-panel {
  width: min(48rem, calc(100% - 2rem));
}

.world-echo-advice-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.world-echo-advice-intro,
.world-echo-advice-status,
.world-echo-advice-next {
  margin: 0;
  overflow-wrap: anywhere;
}

.world-echo-advice-intro {
  color: var(--ink-soft);
  font-size: .92rem;
  line-height: 1.5;
}

.world-echo-advice-tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.world-echo-advice-tiers li {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .42rem;
  padding: .55rem .62rem;
  color: var(--ink-soft);
  background: rgba(24, 55, 45, .045);
  border: 1px solid var(--line);
  border-radius: .75rem;
  font-size: .74rem;
}

.world-echo-advice-tiers li > span {
  width: 1.45rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: rgba(24, 55, 45, .08);
  border-radius: 50%;
  font-weight: 850;
}

.world-echo-advice-tiers strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.world-echo-advice-tiers li.is-available {
  color: #315649;
  background: rgba(205, 225, 195, .55);
  border-color: rgba(49, 86, 73, .28);
}

.world-echo-advice-tiers li.is-current {
  color: #fffaf0;
  background: #365f51;
  border-color: #365f51;
}

.world-echo-advice-tiers li.is-current > span {
  color: #365f51;
  background: #fff7df;
}

.world-echo-advice-status {
  padding: .72rem .82rem;
  color: #315649;
  background: rgba(238, 241, 228, .76);
  border-left: .24rem solid #587b6e;
  border-radius: .28rem .75rem .75rem .28rem;
  font-size: .86rem;
  line-height: 1.4;
}

.world-echo-advice-next {
  color: var(--ink-soft);
  font-size: .78rem;
  font-weight: 700;
}

.world-echo-advice-next[hidden] {
  display: none;
}

.world-echo-advice-list {
  display: grid;
  gap: .75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.world-echo-advice-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .7rem 1rem;
  padding: .9rem;
  background: radial-gradient(circle at 96% 0, rgba(255, 255, 255, .75), transparent 30%), rgba(255, 250, 240, .88);
  border: 1px solid rgba(49, 86, 73, .2);
  border-radius: 1rem;
  box-shadow: 0 .35rem 1rem rgba(27, 58, 46, .06);
}

.world-echo-advice-card-heading {
  min-width: 0;
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.world-echo-advice-card-copy {
  min-width: 0;
}

.world-echo-advice-card .eyebrow {
  margin: 0 0 .2rem;
}

.world-echo-advice-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font: 650 1.12rem/1.2 var(--serif);
}

.world-echo-advice-meta {
  margin: .28rem 0 0;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 750;
}

.world-echo-advice-kind {
  flex: 0 0 auto;
  padding: .3rem .5rem;
  color: #315649;
  background: rgba(205, 225, 195, .62);
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}

.world-echo-advice-text {
  min-width: 0;
  align-self: center;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font: 600 1rem/1.42 var(--serif);
}

.world-echo-advice-navigate,
.world-echo-advice-retry {
  min-height: 2.75rem;
  align-self: center;
}

.clue-cell.world-echo-advice-target,
.clue-list [data-word-id].world-echo-advice-target {
  outline: 2px dashed rgba(71, 109, 94, .72);
  outline-offset: -3px;
}

@media (max-width: 46rem) {
  .world-echo-status {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .world-echo-advice-open {
    min-width: 3.55rem;
    min-height: 2.75rem;
    padding-inline: .4rem;
    font-size: .6rem;
  }

  .world-echo-advice-panel {
    width: min(48rem, calc(100% - 1rem));
    max-height: calc(100dvh - 1rem - var(--safe-top) - var(--safe-bottom));
    border-radius: 1.15rem 1.05rem 1.25rem 1rem;
  }

  .world-echo-advice-content {
    gap: .75rem;
    padding: .8rem;
  }

  .world-echo-advice-intro {
    font-size: .8rem;
    line-height: 1.38;
  }

  .world-echo-advice-tiers {
    gap: .25rem;
  }

  .world-echo-advice-tiers li {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: .22rem;
    padding: .42rem .2rem;
    font-size: .62rem;
    text-align: center;
  }

  .world-echo-advice-tiers li > span {
    width: 1.25rem;
  }

  .world-echo-advice-status {
    padding: .58rem .65rem;
    font-size: .75rem;
  }

  .world-echo-advice-card {
    gap: .55rem;
    padding: .72rem;
  }

  .world-echo-advice-card h3 {
    font-size: .98rem;
  }

  .world-echo-advice-kind {
    font-size: .58rem;
  }

  .world-echo-advice-text {
    font-size: .9rem;
  }

  .world-echo-advice-navigate {
    padding-inline: .65rem;
    font-size: .72rem;
  }
}

@media (max-width: 22rem) {
  .world-echo-advice-card {
    grid-template-columns: 1fr;
  }

  .world-echo-advice-card-heading {
    display: grid;
    gap: .4rem;
  }

  .world-echo-advice-kind {
    width: fit-content;
  }

  .world-echo-advice-navigate {
    width: 100%;
  }
}

@media (prefers-contrast: more) {
  .world-echo-advice-card,
  .world-echo-advice-tiers li,
  .world-echo-advice-status {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  .world-echo-advice-open,
  .world-echo-advice-tiers li.is-current,
  .world-echo-advice-card,
  .world-echo-advice-status {
    color: CanvasText;
    background: Canvas;
    border: 2px solid CanvasText;
  }

  .clue-cell.world-echo-advice-target,
  .clue-list [data-word-id].world-echo-advice-target {
    outline: 2px dashed Highlight;
  }
}
