:root {
  color-scheme: light;
  --paper: #f8f6ee;
  --sheet: #fbfaf3;
  --ink: #253e34;
  --soft: #59695d;
  --lake-depth: #83ac9f;
  --line: #c8cbbd;
  --faint: #e5e6d9;
  --orange: #a44828;
  --sans: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Baskerville', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: default;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent, #756187);
  outline-offset: 3px;
}
button svg,
.chart-bar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
[hidden] {
  display: none !important;
}
.page {
  max-width: 1104px;
  padding: 0 42px;
  margin: auto;
}
.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 86px;
  border-bottom: 2px solid var(--ink);
}
.identity,
nav,
nav button,
.chart-bar,
.cap,
footer,
.actions button {
  display: flex;
  align-items: center;
}
.identity {
  gap: 9px;
  font: 700 clamp(1.38rem, 3vw, 1.85rem) / 1 var(--serif);
  letter-spacing: -0.065em;
  white-space: nowrap;
}
#deadpan {
  width: 65px;
  height: 50px;
  display: grid;
  place-items: center;
}
#deadpan svg {
  width: 100%;
  height: 100%;
  stroke: none;
}
#pebble {
  transform-box: fill-box;
  transform-origin: center;
}
.wink .skippy-neutral { animation:wink-open .24s steps(1,end); }
.wink .skippy-wink { animation:wink .24s steps(1,end); }
.flip #pebble {
  animation: flip 0.48s ease-in-out;
}
.tip #pebble {
  animation: tip 0.32s ease;
}
@keyframes wink { 0%,100% { opacity:0; } 35%,70% { opacity:1; } }
@keyframes wink-open { 0%,100% { opacity:1; } 35%,70% { opacity:0; } }
@keyframes flip {
  50% {
    transform: translateY(-4px) rotate(-180deg);
  }
  to {
    transform: rotate(-360deg);
  }
}
@keyframes tip {
  45% {
    transform: rotate(-12deg) translateY(-2px);
  }
}
nav {
  gap: 14px;
}
nav button {
  min-height: 44px;
  gap: 6px;
  font-size: 0.91rem;
  font-weight: 550;
}
nav button:hover,
footer button:hover,
.actions button:hover:not(:disabled) {
  color: var(--orange);
}
.icon-btn {
  min-width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
}
nav .icon-btn {
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding-right: 15px;
}
.edition-meta {
  display: grid;
  justify-items: end;
  gap: 8px;
}
.edition-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 30px 0 23px;
  gap: 10px;
}
.cap,
.eyebrow {
  font: 700 0.75rem/1.3 var(--mono);
  letter-spacing: 0.105em;
  text-transform: uppercase;
}
.issue {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--orange);
}
.issue i {
  width: 17px;
  height: 2px;
  background: currentColor;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font: normal clamp(3rem, 6vw, 4.6rem) / 1.07 var(--serif);
  letter-spacing: -0.065em;
  margin: 5px 0;
}
h1 em {
  font-weight: normal;
}
.result-arc svg {
  width: 100%;
  height: auto;
}
.game {
  display: grid;
  grid-template-columns: minmax(0, 1.82fr) minmax(260px, 1fr);
  gap: clamp(20px, 3.3vw, 43px);
  align-items: start;
}
.chart {
  background: #f7f7eb;
  border: 1px solid #9da896;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 3px 0 -1px #e0e0d2;
}
.chart-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  border-bottom: 1px solid #adb7a4;
  background: var(--sheet);
}
.chart-readouts, .progress-value {
  display: flex;
  align-items: center;
}
.chart-readouts { gap: clamp(12px, 2vw, 24px); }
.reading + .reading {
  border-left: 1px solid var(--line);
  padding-left: clamp(12px, 2vw, 24px);
}
.reading .cap {
  gap: 5px;
  margin-bottom: 3px;
  color: var(--soft);
  white-space: nowrap;
}
.progress-value { gap: 8px; }
.switch {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f0f0e6;
}
.switch button {
  min-width: 46px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: .875rem;
  font-weight: 600;
}
.switch button[aria-pressed='true'] { background: var(--ink); color: var(--sheet); }
.map-frame {
  position: relative;
  background: #eeeedf;
  aspect-ratio: 440/362;
  overflow: hidden;
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#board .hit {
  fill: transparent;
}
.lake {
  cursor: pointer;
}
.shore {
  fill: #9bbbb0;
  stroke: #648b7f;
  stroke-width: 0.95;
}
.depth {
  fill: var(--lake-depth);
  stroke: #769e91;
  stroke-width: 0.65;
}
.shallows {
  fill: none;
  stroke: #c9d8c3;
  stroke-width: 0.9;
  stroke-linecap: round;
}
.lake-name {
  text-anchor: middle;
  paint-order: stroke;
  stroke: #eeeedf;
  stroke-width: 3.2;
  stroke-linejoin: round;
  fill: #243f33;
}
.map-ink {
  fill: #526654;
  color: #526654;
  font: 8px var(--mono);
}
.lake-name {
  font: 600 14px var(--serif);
  letter-spacing: -0.2px;
}
.pennant { stroke-linejoin:round; stroke-linecap:round; }
.pennant .staff, .pennant .moor { fill:none; }
.pennant .staff { stroke:#293e36; stroke-width:1.65; }
.pennant .moor { stroke:#e4ead9; stroke-width:1.2; }
.bunting { transform-origin:-5px -12px; }
.bunting path:first-child { fill:#335650; stroke:#203e38; stroke-width:1; }
.bunting .hoist { fill:none; stroke:#f6efce; stroke-width:2.2; }
.finish-pennant .bunting .finish-cloth { fill:#f5f0db; stroke:#294c42; stroke-width:1.2; }
.finish-pennant .bunting .finish-lower { fill:#335650; stroke:#203e38; stroke-width:1; }
.lake.selected .shore { stroke:#32574d; stroke-width:1.7; }
.lake.unavailable .shore { stroke-dasharray:2.5 2; }
.lake:focus { outline: none; }
.lake:focus-visible .shore {
  stroke: var(--ink);
  stroke-width: 2.7;
  stroke-dasharray: 4 2;
  vector-effect: non-scaling-stroke;
}
.visited:not(.current) .depth {
  fill: #95aca1;
}
.check-bg {
  fill: var(--ink);
}
.check {
  fill: none;
  stroke: white;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.reach-circle {
  fill: #71958212;
  stroke: #3e5c4d;
  stroke-width: 2.25;
  stroke-dasharray: 7 5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.route {
  stroke: #657665;
  stroke-width: 1.7;
  pointer-events: none;
}
.direction { fill:none; stroke:#415a50; stroke-width:1.25; stroke-linecap:round; stroke-linejoin:round; vector-effect:non-scaling-stroke; pointer-events:none; }
.dimension { color:#415a50; }
.dimension path { vector-effect:non-scaling-stroke; stroke:currentColor; fill:none; }
.dimension .bearing { stroke-width:1.15; }
.dimension.unavailable .bearing { stroke-dasharray:3 4; }
.dimension-value { font-family:var(--mono); font-weight:600; fill:currentColor; text-anchor:middle; dominant-baseline:central; paint-order:stroke; stroke:#eeeedf; stroke-width:4; stroke-linejoin:round; }
.landed .bunting { animation:pennant-flutter .32s ease-out; }
@keyframes pennant-flutter {
  25% { transform:skewY(-6deg) scaleX(.9); }
  58% { transform:skewY(4deg) scaleX(.96); }
  82% { transform:skewY(-2deg); }
}
#beads {
  display: flex;
  gap: 2px;
}
#beads i {
  width: 4px;
  height: 8px;
  background: #d9decd;
  border-radius: 1px;
}
#beads .filled { background: var(--orange); }
#count {
  font: 600 1rem/1.2 var(--mono);
  white-space: nowrap;
}
#lake-list {
  height: 100%;
  overflow: auto;
  background: var(--sheet);
  padding: 4px 12px;
}
#lake-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  width: 100%;
  font-size: 0.93rem;
  border-bottom: 1px solid var(--faint);
  text-align: left;
  padding: 5px;
}
#lake-list span {
  font-size: 0.78rem;
  color: var(--soft);
}
#lake-list [aria-pressed='true'] {
  background: #e7e9d9;
}
.scope {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px dashed currentColor;
  border-radius: 50%;
  position: relative;
}
.scope:after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: currentColor;
}
#reach {
  display: block;
  font: 600 1.15rem/1.2 var(--serif);
  letter-spacing: -.035em;
  white-space: nowrap;
}
.move-panel {
  padding: 20px 0 0;
  border-top: 3px solid var(--ink);
}
.move-head {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
}
.move-head:has(#measurement:not([hidden])) {
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
#measurement {
  flex: none;
  font: 500 1.55rem/1 var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.04em;
  color: #784127;
  white-space: nowrap;
}
#measurement small {
  font: .81rem var(--sans);
  letter-spacing: 0;
}
.move-panel .cap {
  color: var(--orange);
}
.move-panel h2,
dialog h2,
.empty h2 {
  font: normal clamp(1.95rem, 3.4vw, 2.65rem) / 1.1 var(--serif);
  letter-spacing: -0.05em;
  margin: 8px 0 10px;
}
.move-panel p,
dialog p,
.empty p {
  color: var(--soft);
  font-size: 1rem;
  line-height: 1.55;
}
.primary,
.secondary,
.empty button {
  border-radius: 4px;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-weight: 650;
  border: 1px solid var(--ink);
}
.primary,
.empty button {
  color: #fffdf2;
  background: var(--ink);
  box-shadow: 0 2px 0 #152b22;
}
.primary:disabled {
  background: #dce1d3;
  border-color: #cdd4c5;
  color: #5d6c5f;
  box-shadow: none;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 19px;
}
.actions button {
  min-height: 48px;
  justify-content: center;
  gap: 7px;
  border-radius: 4px;
}
.actions button:not(.primary), .secondary {
  border: 1px solid var(--line);
  background: var(--sheet);
}
.actions button:disabled:not(.primary) { color: #788176; }
#skip-button { grid-column: 1 / -1; }
.actions .skip-icon { width: 27px; height: 19px; }
footer {
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--ink);
  margin: 24px 0 0;
  padding: 10px 0 20px;
  color: var(--soft);
}
footer button {
  min-height: 44px;
  font-size: 0.85rem;
  margin-left: 15px;
}
footer [aria-current='page'] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
footer button:disabled {
  opacity: 0.55;
}
.notice {
  background: #ececdd;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  line-height: 1.5;
}
.notice button {
  font-weight: 650;
  text-decoration: underline;
  padding: 3px 6px;
}
.empty {
  padding: 28px 0;
  max-width: 440px;
}
.empty button {
  margin-top: 18px;
}
dialog {
  border: 1px solid var(--ink);
  border-top: 4px solid var(--orange);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  padding: 32px;
  width: min(430px, calc(100% - 28px));
  max-height: 88svh;
  box-shadow: 0 14px 60px #18322538;
}
dialog::backdrop {
  background: #1d322c60;
}
#close {
  position: absolute;
  top: 3px;
  right: 5px;
  font: 1.6rem var(--sans);
}
dialog h2 {
  padding-right: 12px;
  margin-top: 7px;
}
dialog p {
  margin: 14px 0;
}
dialog .cap {
  color: var(--orange);
  margin: 6px 0 12px;
}
dialog .primary {
  margin-top: 20px;
}
.secondary {
  margin-top: 10px;
}
.history li,
.result-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 12px 0;
  margin-top: 14px;
}
.result-arc {
  width: 126px;
  color: var(--orange);
  margin: 8px 0;
}
.result-stats {
  justify-content: flex-start;
  gap: 20px;
  border-block: 1px solid var(--line);
}
.history {
  padding: 0;
  list-style: none;
}
.history li {
  margin: 0;
  font-size: 0.9rem;
}
textarea {
  width: 100%;
  height: 8em;
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 10px;
}
.sr-only {
  position: absolute;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
#toast {
  opacity: 0;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  border-radius: 5px;
  padding: 8px 16px;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
}
@media (min-width: 1050px) {
  .page {
    padding-inline: 48px;
  }
  .map-frame {
    aspect-ratio: 440/340;
  }
}
/* One phone-shaped layout on every screen. Its map takes the flexible row,
   so the inspection text and action buttons can keep their natural size. */
@media all {
  .page {
    max-width: 620px;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
  }
  .play-screen:has(#game:not([hidden])) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100svh;
    padding-block: env(safe-area-inset-top) max(8px, env(safe-area-inset-bottom));
  }
  .play-screen main {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
  }
  .mast {
    flex: none;
    min-height: 49px;
    gap: 4px;
    border-bottom-width: 1px;
  }
  .identity { gap: 4px; font-size: 1.35rem; }
  #deadpan { width: 45px; height: 44px; }
  nav { gap: 0; }
  nav button { min-width: 44px; min-height: 44px; justify-content: center; }
  nav .icon-btn { border: 0; padding: 0; }
  nav span {
    position: absolute;
    clip-path: inset(50%);
    width: 1px; height: 1px;
    overflow: hidden;
  }
  .edition-heading {
    flex: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 8px;
    align-items: center;
    padding: 11px 0;
  }
  .edition-title { display: contents; }
  #title { grid-area: 1/1; }
  h1 {
    margin: 0;
    font-size: clamp(1.85rem, 8.4vw, 2.6rem);
    line-height: 1.05;
  }
  .edition-meta {
    grid-area: 1/2;
    gap: 2px;
    padding-top: 2px;
    text-align: right;
  }
  .issue { gap: 0; font-size: .72rem; }
  .issue i { display: none; }
  .game {
    flex: 1 1 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(190px, 1fr) auto;
    align-items: stretch;
    gap: 0;
    min-height: 0;
  }
  .chart {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    border-radius: 5px 5px 0 0;
    box-shadow: none;
  }
  .chart-bar { gap: 6px; padding: 4px 9px; }
  .chart-readouts { gap: 12px; }
  .reading + .reading { padding-left: 12px; }
  .reading .cap { font-size: .68rem; margin-bottom: 2px; letter-spacing: .055em; }
  #reach, #count { font-size: 1.02rem; }
  .scope { width: 11px; height: 11px; }
  .scope:after { inset: 3px; }
  .switch button { min-width: 44px; }
  .map-frame { min-height: 0; aspect-ratio: auto; }
  .lake-name { font-size: var(--map-label-size, 16px); }
  .controls {
    background: var(--sheet);
    border: 1px solid #9da896;
    border-top: 0;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 0 -1px #d9dcce;
  }
  .move-panel { padding: 10px; border: none; }
  .move-head {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
  }
  .move-head h2 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.1;
  }
  #measurement { font-size: 1.28rem; }
  .move-head .cap {
    text-align: right;
    font-size: .67rem;
    letter-spacing: .065em;
  }
  .move-feedback p {
    margin-top: 4px;
    min-height: 2.68em;
    font-size: .93rem;
    line-height: 1.34;
  }
  .actions {
    margin-top: 9px;
    grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  #skip-button { grid-column: auto; }
  .actions button { min-height: 46px; padding: 4px; font-size: .94rem; }
  .actions svg { width: 16px; height: 16px; }
  footer {
    margin: 0;
    border-top: none;
    padding-block: 0 max(8px,env(safe-area-inset-bottom));
    gap: 6px;
    flex-wrap: wrap;
  }
  footer button { margin-left: 8px; }
}
/* Tall screens can carry secondary navigation as well. */
@media (min-height: 740px) and (max-width: 760px) and (orientation: portrait), (min-width: 761px) and (min-height: 501px) {
  .page:has(#game:not([hidden])) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100svh;
  }
  .page .play-screen:has(#game:not([hidden])) {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    padding-bottom: 4px;
  }
  footer { flex: none; }
}
@media (max-width: 400px) {
  #beads { display: none; }
  .edition-heading { padding-block: 10px; }
}
@media (max-width: 360px) {
  .page { padding-inline: max(8px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-right)); }
  .chart-readouts { gap: 8px; }
  .reading + .reading { padding-left: 8px; }
  .move-panel { padding: 8px; }
}
/* A turned phone puts the masthead and actions in the same column and gives
   the map the full height. Access notices get their own row above both. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 960px) {
  .page { max-width: none; }
  .play-screen:has(#game:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 1.38fr) minmax(208px, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 0 12px;
    padding-top: max(5px, env(safe-area-inset-top));
  }
  .play-screen:has(#game:not([hidden])) main, .game { display: contents; }
  .notices { grid-area: 1/1/auto/-1; }
  .mast { grid-area: 2/2; margin-bottom: 4px; }
  .chart { grid-area: 2/1/5/2; border-radius: 5px; }
  .edition-heading {
    grid-area: 3/2;
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
    padding: 0 0 5px;
    border-bottom: 1px solid var(--line);
  }
  .edition-meta {
    grid-area: 1/1;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 0;
  }
  .issue { font-size: .64rem; white-space: nowrap; }
  #title { grid-area: 2/1; font-size: 1.55rem; }
  .controls {
    grid-area: 4/2;
    align-self: end;
    border: none; background: none; box-shadow: none;
  }
  .move-panel { padding: 4px 0 0; }
  .move-head { align-items: start; flex-direction: column-reverse; gap: 2px; }
  .actions { gap: 4px; }
  #beads { display: none; }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 700px) {
  .identity > span {
    position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden;
  }
  .actions .skip-icon { display: none; }
  .actions button { gap: 3px; }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 540px) {
  .switch button[aria-pressed='true'] { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

#sync-note { margin: .35rem 0; font-size: .76rem; line-height: 1.35; color: var(--ink, #294237); }
#rollover:not([hidden]) { animation: edition-arrives 220ms ease-out; }
@keyframes edition-arrives { from { opacity: 0; transform: translateY(-.4rem); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { #rollover:not([hidden]) { animation: none; } }

/* A paper keyline separates reach from the finer contour ink. */
.reach-halo { fill:none; stroke:#fffdf3; stroke-width:5.5; vector-effect:non-scaling-stroke; pointer-events:none; }
.welcome-note { font-size:.9rem; color:var(--soft); }
