:root {
  background: var(--sw-surface);
  color: var(--sw-on-surface);
  font-family: var(--sw-body);
  line-height: 1.4;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .25em; }
button, input { font: inherit; }
button, input {
  min-height: 2.75rem;
  border: 1px solid var(--sw-border);
  border-radius: calc(var(--sw-radius) / 2);
}
button, .button {
  color: var(--sw-on-raised);
  background: var(--sw-raised);
  font-weight: 680;
  padding: .65rem 1rem;
}
button:not(:disabled):not([aria-disabled="true"]) { cursor: pointer; }
button:disabled { opacity: .64; }
button:not(:disabled):not([aria-disabled="true"]):hover { border-color: var(--sw-accent); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--sw-focus);
  outline-offset: 3px;
}
input { width: 100%; min-width: 0; padding: .55rem .7rem; background: var(--sw-surface); color: var(--sw-on-surface); }
input::placeholder { color: var(--sw-muted); }
h1, h2, h3, h4, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: clamp(.6rem, 2.5vw, 1.75rem);
  padding: .4rem max(clamp(.75rem, 2.5vw, 1.75rem), env(safe-area-inset-right)) .4rem max(clamp(.75rem, 2.5vw, 1.75rem), env(safe-area-inset-left));
  border-bottom: 1px solid color-mix(in srgb, var(--sw-border) 55%, transparent);
}
.launcher { font-weight: 800; letter-spacing: -.02em; text-decoration: none; font-size: .9rem; color: var(--sw-muted); }
.title { display: flex; align-items: baseline; gap: .75rem; min-width: 0; }
h1 { font: 800 clamp(1.3rem, 3.2vw, 1.8rem)/1.05 var(--sw-display); letter-spacing: -.035em; white-space: nowrap; }
.bar-actions { display: flex; gap: .45rem; margin-inline-start: auto; }
.bar-actions button { min-height: 2.5rem; padding-block: .4rem; white-space: nowrap; }
#open-how .narrow, #open-new .narrow { display: none; }

/* The table: information, the trellis and the turn buttons. The trellis takes whatever the screen leaves. */
.table {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "info" "well" "pad";
  gap: .4rem;
  padding: .4rem max(.75rem, env(safe-area-inset-right)) max(.6rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
}
.info { grid-area: info; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 .75rem; }
.name { display: flex; align-items: center; gap: .3rem .6rem; min-width: 0; flex-wrap: wrap; }
.info h2 { font: 700 clamp(1rem, 2.2vw, 1.3rem)/1.15 var(--sw-display); }
.small { min-height: 2rem; padding: .2rem .6rem; font-size: .8rem; }
.figures { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0 0; font-variant-numeric: tabular-nums; }
.figures div { display: flex; align-items: baseline; gap: .35rem; padding: .15rem .55rem; border: 1px solid color-mix(in srgb, var(--sw-border) 60%, transparent); border-radius: 999px; }
.figures dt { color: var(--sw-muted); font-size: .78rem; }
.figures dd { margin: 0; font-weight: 750; font-size: .95rem; }
.figures div[data-figure="left"] { border-color: var(--sw-accent); }
.figures div[data-figure="left"] dd { color: var(--sw-accent); }
.figures div[data-figure="room"][data-low="true"] { border-color: var(--sw-danger); }
.figures div[data-figure="room"][data-low="true"] dd { color: var(--sw-danger); }
#board-status { grid-column: 1 / -1; color: var(--sw-muted); font-size: .88rem; min-height: 1.3em; margin-top: .25rem; }
.table[data-status="finished"] #board-status { color: var(--sw-accent); }
.table[data-status="choked"] #board-status { color: var(--sw-danger); }
.growth { grid-column: 1 / -1; margin-top: .25rem; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .6rem; }
.growth-label { font-size: .8rem; color: var(--sw-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
#growth-left { display: inline-block; min-width: 2.6em; font-weight: 750; color: var(--sw-on-surface); }
.growth-track { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--sw-border) 45%, transparent); overflow: hidden; }
.growth-track span { display: block; height: 100%; background: var(--sw-caution); transform-origin: left; transform: scaleX(0); }
.growth[data-soon="true"] .growth-track span { background: var(--sw-danger); }

.well { grid-area: well; min-height: 0; min-width: 0; display: grid; }
/* The board takes all the room the well has; the drawing stretches its spacing to fit (scenes.js geometry). */
.stage {
  position: relative;
  width: 100%;
  height: 100%;
  border: 2px solid var(--sw-board-line);
  border-radius: calc(var(--sw-radius) / 2);
  background: var(--sw-board-inert);
  overflow: hidden;
}
.layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; forced-color-adjust: none; }
.gaps { position: absolute; inset: 0; }
.gap {
  position: absolute;
  top: 0;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  touch-action: none;
}
.gap:not(:disabled):hover { border: 0; background: color-mix(in srgb, var(--sw-focus) 7%, transparent); }
.gap:focus-visible { outline: 3px solid var(--sw-focus); outline-offset: -4px; }

/* Strands: every one has its color, its mark and its stripe. */
.stem { fill: none; stroke: var(--c); stroke-linecap: round; stroke-linejoin: round; stroke-width: 8; }
.halo { fill: none; stroke: var(--sw-surface); stroke-linecap: round; stroke-width: 15; }
.stripe { fill: none; stroke: var(--p); stroke-width: 3; stroke-linecap: round; }
.tag-plate { fill: var(--p); stroke: var(--e); stroke-width: 1.6; }
.tag-mark { fill: var(--c); }
.mark.leaf { fill: var(--c); stroke: var(--p); stroke-width: .12; }
.vein { stroke: var(--c); stroke-width: 2; fill: none; }
.root { fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; }
.tendril { fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; }
.block { fill: var(--p); stroke: var(--e); stroke-width: 1.6; }
.sheave { fill: var(--c); }
.peg { fill: var(--p); stroke: var(--e); stroke-width: 1.6; }
.ring { fill: color-mix(in srgb, var(--sw-focus) 10%, transparent); stroke: var(--sw-focus); stroke-width: 2.4; opacity: .75; stroke-dasharray: 5 4; }
/* Where a turn landed */
.flash-ring { fill: none; stroke-width: 4; transform-box: fill-box; transform-origin: center; animation: flash-out .85s ease-out both; }
.flash-mark { fill: none; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; animation: flash-mark .85s ease-out both; }
.flash.removed .flash-ring, .flash.removed .flash-mark { stroke: var(--sw-positive); }
.flash.added .flash-ring, .flash.added .flash-mark { stroke: var(--sw-danger); }
.flash.added .flash-ring { fill: color-mix(in srgb, var(--sw-danger) 18%, transparent); }
@keyframes flash-out { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.9); opacity: 0; } }
@keyframes flash-mark { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
/* The two balls a turn swapped */
.spin { transform-box: fill-box; transform-origin: center; }
.spin-left { animation: spin-left .45s ease-out 1; }
.spin-right { animation: spin-right .45s ease-out 1; }
@keyframes spin-left { from { transform: rotate(140deg); } }
@keyframes spin-right { from { transform: rotate(-140deg); } }
body[data-setting="garden"] .stem { stroke-width: 7; }
body[data-setting="garden"] .halo { stroke-width: 14; }
body[data-setting="garden"] .stripe { stroke-width: 2.2; }
body[data-setting="ship"] .stem { stroke-width: 10; stroke-linecap: butt; }
body[data-setting="ship"] .halo { stroke-width: 17; stroke-linecap: butt; }
body[data-setting="ship"] .stripe { stroke-width: 10; stroke-linecap: butt; opacity: .6; }
body[data-setting="yarn"] .stem { stroke-width: 11; }
body[data-setting="yarn"] .stripe { stroke-width: 2.6; opacity: .85; }
body[data-setting="yarn"] .halo { stroke-width: 22; }
.ball { fill: var(--c); stroke: color-mix(in srgb, var(--e) 70%, var(--c)); stroke-width: 1.6; }
.wrap { fill: none; stroke: color-mix(in srgb, var(--c) 55%, var(--e)); stroke-width: 1.8; opacity: .75; }
.wrap.light { stroke: color-mix(in srgb, var(--c) 55%, white); opacity: .6; }
.cleat { fill: color-mix(in srgb, var(--sw-caution) 30%, var(--sw-raised)); stroke: var(--sw-border); }
.coil-spot { fill: color-mix(in srgb, var(--sw-on-surface) 8%, transparent); stroke: color-mix(in srgb, var(--sw-border) 70%, transparent); }

/* Behind the strands */
.back-wash { fill: var(--sw-board-cell); }
body[data-setting="garden"] .back-wash { fill: color-mix(in srgb, var(--sw-positive) 7%, var(--sw-board-cell)); }
body[data-setting="ship"] .back-wash { fill: color-mix(in srgb, var(--sw-accent) 9%, var(--sw-board-cell)); }
body[data-setting="yarn"] .back-wash { fill: color-mix(in srgb, var(--sw-caution) 6%, var(--sw-board-cell)); }
.limit { stroke: var(--sw-danger); stroke-width: 2; stroke-dasharray: 8 6; opacity: .8; }
.hill { fill: color-mix(in srgb, var(--sw-positive) 14%, var(--sw-surface)); }
.slat, .lattice { stroke: color-mix(in srgb, var(--sw-board-line) 70%, var(--sw-board-cell)); fill: none; }
.slat { stroke-width: 2.4; }
.lattice { stroke-width: 1.8; }
.post, .rail, .finial { fill: color-mix(in srgb, var(--sw-caution) 34%, var(--sw-raised)); stroke: var(--sw-border); stroke-width: 1; }
.soil { fill: color-mix(in srgb, var(--sw-caution) 22%, var(--sw-surface)); }
.grass { stroke: color-mix(in srgb, var(--sw-positive) 75%, var(--sw-surface)); stroke-width: 2; fill: none; stroke-linecap: round; }
.sea { fill: color-mix(in srgb, var(--sw-accent) 24%, var(--sw-surface)); }
.wave { fill: none; stroke: color-mix(in srgb, var(--sw-accent) 50%, var(--sw-surface)); stroke-width: 2; animation: roll 5s ease-in-out infinite alternate; animation-delay: var(--delay, 0s); }
.horizon { stroke: color-mix(in srgb, var(--sw-accent) 45%, var(--sw-surface)); stroke-width: 1.5; }
.mast, .yard, .davit { stroke: color-mix(in srgb, var(--sw-caution) 45%, var(--sw-on-surface) 18%); stroke-width: 3; stroke-linecap: round; fill: none; }
.yard { stroke-width: 3; stroke: color-mix(in srgb, var(--sw-caution) 55%, var(--sw-on-surface) 25%); }
.davit { stroke: color-mix(in srgb, var(--sw-caution) 40%, var(--sw-on-surface) 12%); stroke-width: 2.6; }
.rigging { stroke: color-mix(in srgb, var(--sw-on-surface) 30%, var(--sw-board-cell)); stroke-width: 1.2; fill: none; }
.ratline { stroke: color-mix(in srgb, var(--sw-on-surface) 22%, var(--sw-board-cell)); stroke-width: 1; }
.sail { fill: color-mix(in srgb, var(--sw-caution) 24%, var(--sw-board-cell)); stroke: color-mix(in srgb, var(--sw-caution) 50%, var(--sw-on-surface) 20%); stroke-width: 1.4; stroke-linejoin: round; }
.seam { stroke: color-mix(in srgb, var(--sw-caution) 45%, var(--sw-on-surface) 12%); stroke-width: 1; opacity: .7; fill: none; }
.furl { fill: color-mix(in srgb, var(--sw-caution) 38%, var(--sw-on-surface) 14%); stroke: color-mix(in srgb, var(--sw-caution) 55%, var(--sw-on-surface) 20%); stroke-width: 1; }
.tie { stroke: color-mix(in srgb, var(--sw-on-surface) 45%, var(--sw-board-cell)); stroke-width: 1.4; }
.pennant { fill: color-mix(in srgb, var(--sw-danger) 55%, var(--sw-board-cell)); }
.barrel { fill: color-mix(in srgb, var(--sw-caution) 32%, var(--sw-board-cell)); stroke: color-mix(in srgb, var(--sw-caution) 50%, var(--sw-on-surface) 20%); stroke-width: 1.2; }
.nest-rail { stroke: color-mix(in srgb, var(--sw-caution) 50%, var(--sw-on-surface) 20%); stroke-width: 1.6; }
.lookout { fill: color-mix(in srgb, var(--sw-on-surface) 55%, var(--sw-board-cell)); }
.deck { fill: color-mix(in srgb, var(--sw-caution) 24%, var(--sw-board-cell)); }
.hull { fill: color-mix(in srgb, var(--sw-caution) 30%, var(--sw-board-inert)); }
.hull-plank { stroke: color-mix(in srgb, var(--sw-caution) 22%, var(--sw-board-line)); stroke-width: 1.2; opacity: .8; }
.wale { fill: color-mix(in srgb, var(--sw-caution) 55%, var(--sw-on-surface) 15%); }
.port { fill: var(--sw-board-inert); stroke: color-mix(in srgb, var(--sw-caution) 50%, var(--sw-on-surface) 20%); stroke-width: 1.2; }
.foam { fill: color-mix(in srgb, var(--sw-accent) 34%, var(--sw-board-cell)); stroke: color-mix(in srgb, var(--sw-on-surface) 30%, var(--sw-board-cell)); stroke-width: 1.4; }
.bulwark { fill: color-mix(in srgb, var(--sw-caution) 42%, var(--sw-board-inert)); stroke: color-mix(in srgb, var(--sw-caution) 55%, var(--sw-on-surface) 18%); stroke-width: 1; }
body[data-setting="ship"] .plank { stroke: color-mix(in srgb, var(--sw-board-line) 55%, transparent); stroke-width: 1.4; }
.boat { fill: color-mix(in srgb, var(--sw-caution) 35%, var(--sw-on-surface) 12%); stroke: color-mix(in srgb, var(--sw-on-surface) 40%, var(--sw-board-inert)); stroke-width: 1.4; }
.oar { stroke: color-mix(in srgb, var(--sw-on-surface) 45%, var(--sw-board-inert)); stroke-width: 2; stroke-linecap: round; }
.chimney { fill: color-mix(in srgb, var(--sw-danger) 25%, var(--sw-raised)); stroke: var(--sw-border); stroke-width: 1.4; }
.firebox { fill: var(--sw-caution); opacity: .8; }
.smoke { fill: color-mix(in srgb, var(--sw-on-surface) 40%, var(--sw-board-cell)); opacity: .5; animation: drift 5s ease-out infinite; animation-delay: var(--delay, 0s); transform-box: fill-box; transform-origin: center; }
.cord { stroke: color-mix(in srgb, var(--sw-on-surface) 45%, var(--sw-board-cell)); stroke-width: 1.4; }
.lantern { fill: var(--sw-caution); stroke: var(--sw-border); }
.lantern-glow { fill: color-mix(in srgb, var(--sw-caution) 40%, transparent); }
.lantern-glow.wide { fill: color-mix(in srgb, var(--sw-caution) 16%, transparent); animation: flicker 3s ease-in-out infinite; }
.whale .spout { fill: none; stroke: color-mix(in srgb, var(--sw-on-surface) 75%, transparent); stroke-width: 2; stroke-linecap: round; }
.whale .fluke { fill: color-mix(in srgb, var(--sw-on-surface) 30%, var(--sw-surface)); stroke: var(--sw-muted); stroke-width: 1; }
.whale .spout, .whale .fluke { animation: surface 13s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.whale.splash .spout, .whale.splash .fluke { animation: surface-now 2.2s ease-out 1; }
.wallstripe { stroke: color-mix(in srgb, var(--sw-on-surface) 5%, transparent); stroke-width: 14; }
.floor { fill: color-mix(in srgb, var(--sw-caution) 16%, var(--sw-surface)); }
body[data-setting="yarn"] .plank { stroke: color-mix(in srgb, var(--sw-border) 45%, transparent); stroke-width: 1.4; }
body[data-setting="yarn"] .rail { fill: color-mix(in srgb, var(--sw-caution) 40%, var(--sw-raised)); }
.knob { fill: color-mix(in srgb, var(--sw-caution) 50%, var(--sw-raised)); stroke: var(--sw-border); }
.basket { fill: color-mix(in srgb, var(--sw-caution) 34%, var(--sw-raised)); stroke: var(--sw-border); stroke-width: 1.4; }
.weave { stroke: color-mix(in srgb, var(--sw-border) 70%, transparent); stroke-width: 1.4; }
.basket-rim { fill: color-mix(in srgb, var(--sw-caution) 46%, var(--sw-raised)); stroke: var(--sw-border); }
@keyframes roll { to { transform: translateX(-22px); } }
@keyframes drift { from { transform: translate(0, 0) scale(.8); opacity: .55; } to { transform: translate(34px, -42px) scale(2); opacity: 0; } }
@keyframes flicker { 50% { opacity: .65; } }
@keyframes rise { from { transform: translateY(0) scale(.8); opacity: .5; } to { transform: translateY(-36px) scale(1.8); opacity: 0; } }
@keyframes surface { 0%, 62%, 100% { transform: translateY(16px); opacity: 0; } 70%, 88% { transform: none; opacity: 1; } }
@keyframes surface-now { 0% { transform: translateY(16px); opacity: 0; } 25%, 75% { transform: none; opacity: 1; } 100% { transform: translateY(16px); opacity: 0; } }

/* A strand that has no twist left leaves: a bloom, a coil, or yarn winding back */
.leaving .body { transform-box: fill-box; transform-origin: 50% 100%; }
body[data-setting="garden"] .leaving .body { animation: cut 1.1s ease-in forwards; }
body[data-setting="ship"] .leaving .body, body[data-setting="yarn"] .leaving .body { animation: wind 1.1s ease-in forwards; }
body[data-setting="ship"] .leaving .base .tag-plate { opacity: 0; }
.flower-grow { animation: open .7s ease-out both; }
.petal { fill: color-mix(in srgb, var(--sw-danger) 55%, var(--sw-on-surface)); stroke: var(--c); stroke-width: 1.5; }
.bloom-heart { fill: var(--sw-caution); stroke: var(--sw-on-surface); stroke-width: 1; }
.coil-grow { animation: open .8s .25s ease-out both; }
.coil-ring { fill: none; stroke: var(--c); stroke-width: 4; }
.ball-pulse { fill: none; stroke: var(--c); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: pulse 1.1s ease-out both; }
@keyframes cut { 0%, 45% { transform: none; opacity: 1; } 100% { transform: translateY(-36px); opacity: 0; } }
@keyframes wind { to { transform: scaleY(0); opacity: .2; } }
@keyframes open { from { transform: scale(.1); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { to { transform: scale(1.7); opacity: 0; } }
#scene-board.sway { animation: sway .9s ease-in-out 1; transform-origin: 50% 100%; }
@keyframes sway { 30% { transform: rotate(.7deg); } 65% { transform: rotate(-.5deg); } }

.pad {
  grid-area: pad;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "note note" "left right" "said said";
  align-items: center;
  gap: .35rem .5rem;
}
.pad button { min-height: clamp(2.9rem, 6.5vh, 3.6rem); font-size: 1.05rem; }
.turn { display: flex; align-items: center; justify-content: center; gap: .5rem; padding-inline: .6rem; white-space: nowrap; }
#turn-left { grid-area: left; }
#turn-right { grid-area: right; }
#pad-new { grid-column: 1 / -1; grid-row: 2; }
.cross { width: 2em; height: 2em; flex: none; }
.cross path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cross-back { stroke: color-mix(in srgb, currentColor 45%, transparent); stroke-width: 3.2; }
.cross-halo { stroke: var(--sw-raised); stroke-width: 7.5; }
.cross-front { stroke: var(--sw-accent); stroke-width: 3.6; }
.turn:disabled .cross-front { stroke: currentColor; }
.turn .shortcut-hint { margin-inline-start: .1em; }
.selected-gap { grid-area: note; color: var(--sw-muted); font-size: .85rem; text-align: center; height: 1.4em; line-height: 1.4; }
.selected-gap strong { color: var(--sw-on-surface); }
.turn-note { grid-area: said; text-align: center; font-size: .9rem; font-weight: 650; height: 1.4em; line-height: 1.4; color: var(--sw-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selected-gap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-note[data-kind="removed"], .turn-note[data-kind="freed"] { color: var(--sw-positive); }
.turn-note[data-kind="added"], .turn-note[data-kind="refused"] { color: var(--sw-danger); }
.turn-note[data-kind="sprout"] { color: var(--sw-caution); }

@media (orientation: landscape) and (min-width: 36rem) {
  .table {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 21rem);
    grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr);
    grid-template-areas: "well ." "well info" "well pad" "well .";
    column-gap: clamp(.75rem, 3vw, 2rem);
    row-gap: .5rem;
  }
  .info { grid-template-columns: minmax(0, 1fr); row-gap: .25rem; }
  .figures { grid-column: 1; }
}
/* A roomy screen: a wider panel beside the trellis, with normal type. */
@media (orientation: landscape) and (min-width: 62rem) and (min-height: 40rem) {
  .table { grid-template-columns: minmax(0, 1fr) 24rem; column-gap: 2rem; }
  .info { row-gap: .5rem; }
  .info h2 { font-size: 1.6rem; }
  .figures { font-size: 1.1rem; }
  #board-status { font-size: 1rem; }
  .small { font-size: .9rem; min-height: 2.25rem; }
  .pad { gap: .75rem; }
  .pad button { font-size: 1.15rem; min-height: 3.4rem; }
  .selected-gap { font-size: 1rem; }
}
@media (orientation: landscape) and (max-height: 32rem) {
  .pad button { min-height: 2.5rem; }
  #board-status { font-size: .8rem; }
  .figures dd { font-size: .85rem; }
  .figures div { padding-block: 0; }
  .turn-note, .selected-gap { font-size: .8rem; }
}

.primary { color: var(--sw-on-action); background: var(--sw-action); border-color: var(--sw-action); }
.primary:not(:disabled):hover { filter: brightness(1.08); border-color: var(--sw-focus); }
.hint { color: var(--sw-muted); font-size: .9rem; }
.hint.error { color: var(--sw-danger); margin-top: .4rem; }
.activity {
  position: fixed;
  inset: auto 0 max(.75rem, env(safe-area-inset-bottom));
  z-index: 4;
  width: fit-content;
  max-width: calc(100vw - 1.5rem);
  margin-inline: auto;
  padding: .45rem .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  border: 1px solid var(--sw-border);
  border-radius: calc(var(--sw-radius) / 2);
  background: var(--sw-raised);
  color: var(--sw-accent);
  font-size: .9rem;
  pointer-events: none;
}
.activity button { pointer-events: auto; }
.activity:has(p:empty):has(button[hidden] + button[hidden]) { display: none; }

dialog {
  width: min(34rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: clamp(1rem, 3vw, 1.5rem);
  color: var(--sw-on-raised);
  background: var(--sw-raised);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  overflow: auto;
}
dialog::backdrop { background: color-mix(in srgb, var(--sw-surface) 72%, transparent); }
dialog header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
dialog h2 { font: 700 1.5rem/1.1 var(--sw-display); }
dialog h3 { font: 700 1.1rem/1.1 var(--sw-display); margin-block: 1.1rem .5rem; }
dialog h4 { font-size: .9rem; margin-block: .8rem .35rem; color: var(--sw-muted); }
.close { min-width: 2.75rem; padding: 0; }
.options { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; min-width: 0; }
.options legend { padding: 0; margin-bottom: .4rem; font-weight: 720; font-size: .9rem; }
.options label { position: relative; display: block; cursor: pointer; }
.options input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.options span { display: block; border: 2px solid color-mix(in srgb, var(--sw-border) 60%, transparent); border-radius: calc(var(--sw-radius) / 2); padding: .5rem .75rem; }
.options small { display: block; color: var(--sw-muted); font-size: .84rem; }
.options input:checked + span { border-color: var(--sw-accent); }
.options input:checked + span strong { color: var(--sw-accent); }
.options input:focus-visible + span { outline: 2px solid var(--sw-focus); outline-offset: 2px; }
.sizes, .settings { grid-template-columns: repeat(auto-fit, minmax(4.2rem, 1fr)); }
.settings { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 1rem; }
.settings small { font-size: .74rem; }
.sizes legend, .settings legend { grid-column: 1 / -1; }
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .3rem; font-weight: 720; font-size: .9rem; }
.field input { max-width: 14rem; }
.field .hint { margin-top: .4rem; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .6rem; }
#new-form .actions { grid-template-columns: 1fr; margin-top: 1rem; }
#result .actions { margin: .9rem 0 0; }
#result p { margin-top: .4rem; color: var(--sw-muted); }
.menu-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.button { display: inline-grid; place-items: center; min-height: 2.75rem; border: 1px solid var(--sw-border); border-radius: calc(var(--sw-radius) / 2); text-decoration: none; }
.menu-tools .button { padding-inline: 1rem; }
#mine-status:empty, #active-list:empty, #done-list:empty { display: none; }
#menu ul { list-style: none; padding: 3px; margin: 0; display: grid; gap: .35rem; max-height: 10rem; overflow: auto; }
#menu li button { width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .15rem .5rem; text-align: left; padding: .45rem .65rem; }
#menu li button[aria-current="true"] { border-color: var(--sw-accent); }
#menu li button span, #menu li.best span { color: var(--sw-muted); font-size: .8rem; font-weight: 500; }
#menu li.best { display: grid; padding: .25rem .1rem; }
.menu-help { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.realm { display: flex; margin-top: 1rem; font-size: .84rem; }
/* How to play */
#how { width: min(40rem, calc(100vw - 1.5rem)); }
.how-goal { font-size: 1.05rem; font-weight: 650; margin-bottom: .8rem; }
.how-body { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.how-figure { margin: 0; display: grid; gap: .3rem; text-align: center; font-size: .78rem; color: var(--sw-muted); }
.how-figure strong { color: var(--sw-on-raised); }
.how-picture { width: 100%; height: auto; border: 1px solid color-mix(in srgb, var(--sw-border) 60%, transparent); border-radius: calc(var(--sw-radius) / 2); background: var(--sw-board-cell); }
.how-strand, .how-halo, .how-arrow { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.how-strand { stroke-width: 9; }
.how-strand.a { stroke: var(--sw-side-1-color, var(--sw-accent)); }
.how-strand.b { stroke: var(--sw-side-0-color, var(--sw-caution)); }
.how-halo { stroke: var(--sw-board-cell); stroke-width: 16; }
.how-ring { fill: none; stroke: var(--sw-focus); stroke-width: 3.5; }
.how-arrow { stroke: var(--sw-on-surface); stroke-width: 3.5; }
.how-steps { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .45rem; font-size: .92rem; }
.how-modes { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .3rem .8rem; margin: 1rem 0; font-size: .9rem; }
.how-modes dt { font-weight: 750; }
.how-modes dd { margin: 0; color: var(--sw-muted); }
#how .actions { margin: 0; }
kbd { font-size: .8em; }
.realm a { color: var(--sw-muted); padding: .45rem .6rem; text-decoration: none; }
.realm a[aria-current] { color: var(--sw-on-raised); font-weight: 720; text-decoration: underline; }

@media (max-width: 40rem) {
  .bar { gap: .55rem; }
  .launcher { font-size: .78rem; }
  .bar-actions button { padding-inline: .7rem; font-size: .9rem; }
  h1 { font-size: 1.2rem; }

  .how-body { grid-template-columns: 4.5rem minmax(0, 1fr); gap: .75rem; }
}
@media (max-width: 26rem) {
  .bar { gap: .4rem; }
  .bar-actions { gap: .3rem; }
  .bar-actions button { padding-inline: .55rem; }
  /* The Menu links to Swoggler too. */
  .bar .launcher { display: none; }
  h1 { font-size: 1.1rem; }
  #open-new .wide { display: none; }
  #open-new .narrow { display: inline; }
}
/* Up to a small laptop, the help and scores buttons are compact. */
@media (max-width: 56rem) {
  #open-how .wide { display: none; }
  #open-how .narrow { display: inline; }
  #open-how { min-width: 2.5rem; padding-inline: .5rem; }
}
/* A narrow screen has no room for key hints in the bar; ? still lists the keys. */
@media (max-width: 40rem) { .bar .shortcut-hint { display: none; } }
@media (max-height: 32rem) {
  .options small, #number-hint { display: none; }
  .options span { padding-block: .3rem; }
  dialog { padding-block: .75rem; }
  dialog header { margin-bottom: .4rem; }
  .options { margin-bottom: .5rem; }
  #new-form .actions { margin-top: .5rem; }
}
@media (forced-colors: active) {
  .growth-track { border: 1px solid CanvasText; }
  .growth-track span { background: Highlight; forced-color-adjust: none; }
}
@media (forced-colors: active), (prefers-contrast: more) {
  .stem { stroke-width: 9; }
  .halo { stroke: Canvas; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .whale .spout, .whale .fluke { opacity: 1; transform: none; }
}

/* The shared keys list, in this game's look */
.shortcut-help .shortcut-toggle input { width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; accent-color: var(--sw-accent); }
.shortcut-help h2 { margin-bottom: .8rem; }
.shortcut-help h3 { font: 700 .95rem/1.2 var(--sw-display); color: var(--sw-muted); }
.shortcut-help p { color: var(--sw-muted); font-size: .88rem; }
.shortcut-hint { color: inherit; }
