* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  font-family:
    ui-rounded,
    system-ui,
    -apple-system,
    sans-serif;
  color: #243b36;
  background: #f7faf5;
  font-size: 17px;
  --accent: #27694e;
  --soft: #e7f2df;
  --edge: #b5c6b1;
}
body {
  margin: 0;
}
button,
select {
  font: inherit;
  color: inherit;
  min-height: 48px;
  border: 2px solid var(--edge);
  border-radius: 12px;
  background: #fff;
  padding: 9px 15px;
  cursor: pointer;
}
/* Native WebKit select chrome can ignore the shared minimum height. */
#range {
  -webkit-appearance: none;
  appearance: none;
  height: 48px;
  min-height: 48px;
  max-width: 100%;
  padding: 10px 44px 10px 16px;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 20px) center,
    calc(100% - 14px) center;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
button {
  font-weight: 700;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:hover:not(:disabled) {
  background: var(--soft);
}
button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--soft);
}
.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.primary:hover:not(:disabled) {
  color: #243b36;
}
:focus-visible {
  outline: 3px solid #aa4305;
  outline-offset: 3px;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  line-height: 1.13;
}
h2 {
  font-size: 1.4rem;
}
p {
  line-height: 1.45;
}
.game-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  padding: 8px 18px;
  margin: auto;
  min-height: 60px;
}
.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #345744;
  text-decoration: underline;
}
.game-bar > strong {
  font-size: 0.9rem;
}
[data-player-profile-slot] {
  max-width: 190px;
}
main {
  min-height: calc(100svh - 60px);
  max-width: 1000px;
  padding: 12px 24px 32px;
  margin: auto;
  display: grid;
  align-content: center;
}
.welcome,
.ending,
.recovery {
  max-width: 650px;
  width: 100%;
  margin: auto;
  text-align: center;
  background: #fff;
  border: 2px solid var(--edge);
  border-radius: 24px;
  padding: 28px;
  display: grid;
  gap: 18px;
  justify-items: center;
}
.welcome p {
  max-width: 48ch;
}
.eyebrow {
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #4d6456;
}
.settings {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
label {
  display: grid;
  gap: 5px;
  text-align: left;
  font-weight: 650;
  font-size: 0.9rem;
}
.intro-art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--accent);
  font-size: 2rem;
  font-weight: 800;
}
.intro-art i {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #81ad67;
  display: block;
}
.play-area {
  width: 100%;
  display: grid;
  gap: 14px;
}
.round-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.round-head p {
  font-weight: 650;
  font-size: 0.9rem;
  white-space: nowrap;
}
#prompt {
  scroll-margin-top: 12px;
}
.task {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: center;
}
.board {
  background: #fff;
  border: 2px solid var(--edge);
  border-radius: 22px;
  min-height: 220px;
  padding: 20px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
}
.controls {
  display: grid;
  gap: 10px;
}
.button-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.button-row > button {
  flex: 1;
  min-width: 65px;
}
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid #cad7c7;
  padding-top: 12px;
}
.toolbar button {
  font-size: 0.85rem;
  padding: 8px 12px;
}
.toolbar #help {
  margin-right: auto;
}
.feedback {
  min-height: 52px;
  border-radius: 10px;
  background: var(--soft);
  padding: 10px 14px;
  font-weight: 600;
  grid-column: 1/-1;
}
.next {
  grid-column: 1/-1;
  justify-self: center;
  min-width: 180px;
}
.help-panel {
  background: #fff;
  border: 2px solid var(--edge);
  border-radius: 18px;
  padding: 20px;
  display: grid;
  gap: 12px;
}
.help-model {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 1.7rem;
  font-weight: 750;
}
.help-panel > button {
  justify-self: start;
}
#help-content {
  display: grid;
  gap: 10px;
}
.hop-first-points {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  max-width: 340px;
  margin: auto;
  padding: 6px 0;
  text-align: center;
}
.hop-first-point,
.hop-first-arrow {
  display: grid;
  gap: 3px;
}
.hop-first-point > span,
.hop-first-arrow small {
  font-size: 0.85rem;
}
.hop-first-point strong,
.hop-first-arrow {
  font-size: 2rem;
  line-height: 1.1;
  color: var(--accent);
}
.hop-first-note {
  font-size: 0.9rem;
}
.equation {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 780;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.answer {
  min-width: 90px;
  min-height: 64px;
  border-bottom: 3px solid var(--accent);
  font-size: 2.5rem;
  font-weight: 800;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}
.keypad button {
  padding: 6px;
  min-width: 0;
  font-size: 1.2rem;
}
.frame {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  width: min(100%, 270px);
}
.stone {
  aspect-ratio: 1;
  background: #edf2e9;
  border: 2px dashed #72896a;
  border-radius: 8px;
}
.stone.filled {
  background: #659750;
  border: 2px solid #3d6830;
}
.stone.new {
  background: #ebba54;
  border: 2px solid #9b701a;
}
.beds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}
.bed {
  min-height: 90px;
  background: #f7f1e6;
  border: 2px solid #b79764;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-content: center;
  justify-content: center;
}
.seed {
  height: 19px;
  width: 19px;
  border-radius: 50%;
  background: #527b3b;
  border: 2px solid #365e25;
  display: block;
}
.line {
  position: relative;
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 0;
  width: 100%;
}
.line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 20px;
  height: 3px;
  background: #496241;
}
.tick {
  position: relative;
  min-width: 0;
  height: 50px;
  font-size: 0.78rem;
}
.tick::before {
  content: "";
  position: absolute;
  top: 17px;
  left: 50%;
  height: 10px;
  width: 2px;
  background: #496241;
}
.tick.start::before {
  top: 15px;
  height: 14px;
  width: 4px;
  background: #a56810;
}
.tick-label {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
}
.position-marker {
  position: absolute;
  z-index: 1;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 25px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-size: 0.85rem;
}
.line.long {
  grid-template-columns: repeat(21, 1fr);
}
.line.long .tick:not(.major) .tick-label {
  visibility: hidden;
}
.guide {
  max-width: 850px;
  margin: 24px auto;
  padding: 24px;
  line-height: 1.6;
  border-top: 1px solid #ccd7c7;
}
.guide h2 {
  margin-bottom: 12px;
}
.guide p {
  margin-bottom: 10px;
}
.paused {
  background: var(--soft);
  padding: 25px;
  text-align: center;
  border-radius: 20px;
  display: grid;
  gap: 16px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 600px) {
  main {
    padding: 10px 14px 25px;
  }
  .game-bar {
    padding: 6px 14px;
    gap: 6px;
  }
  .game-bar > strong {
    display: none;
  }
  .welcome,
  .ending {
    padding: 23px 15px;
  }
  .task {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .board {
    min-height: 150px;
    padding: 14px;
  }
  .play-area {
    gap: 10px;
  }
  .round-head {
    align-items: start;
  }
  .round-head h1 {
    font-size: 1.6rem;
  }
  .round-head p {
    font-size: 0.78rem;
  }
  .feedback {
    min-height: 48px;
  }
  .toolbar {
    gap: 7px;
  }
  .toolbar button {
    padding: 6px 10px;
  }
  .frame {
    max-width: 220px;
  }
  .stone {
    max-height: 33px;
  }
  .help-panel {
    padding: 15px;
  }
  .next {
    width: 100%;
  }
}
@media (max-height: 500px) and (min-width: 601px) {
  :root {
    font-size: 15px;
  }
  .game-bar {
    min-height: 44px;
    padding: 0 18px;
  }
  .game-bar > strong {
    font-size: 0.9rem;
  }
  main {
    min-height: calc(100svh - 44px);
    padding: 4px 18px 10px;
    align-content: start;
  }
  .welcome,
  .ending,
  .recovery {
    padding: 12px;
    gap: 9px;
    max-width: 850px;
  }
  .welcome .intro-art {
    display: none;
  }
  .welcome h1 {
    font-size: 1.7rem;
  }
  .welcome p {
    max-width: none;
  }
  .welcome .settings {
    display: inline-flex;
    gap: 12px;
  }
  .welcome {
    grid-template-columns: 1fr 1fr;
  }
  .welcome h1,
  .welcome .eyebrow,
  .welcome > p {
    grid-column: 1/-1;
  }
  .welcome .eyebrow {
    display: none;
  }
  .welcome label {
    grid-template-columns: auto auto;
    align-items: center;
  }
  .play-area {
    gap: 5px;
  }
  .round-head h1 {
    font-size: 1.45rem;
  }
  .task {
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    align-items: center;
  }
  .board {
    min-height: 102px;
    padding: 8px;
    gap: 3px;
    grid-row: 1/3;
  }
  .controls {
    gap: 5px;
  }
  .keypad {
    gap: 4px;
  }
  .keypad button {
    min-height: 48px;
  }
  .equation {
    font-size: 1.7rem;
  }
  .answer {
    font-size: 1.7rem;
    min-height: 34px;
  }
  .feedback {
    grid-column: 1;
    grid-row: 3;
    min-height: 0;
    padding: 5px 8px;
    font-size: 0.85rem;
  }
  .next {
    grid-column: 2;
    grid-row: 3;
    min-height: 48px;
    justify-self: stretch;
  }
  .toolbar {
    padding-top: 4px;
    gap: 5px;
  }
  .toolbar button {
    min-height: 44px;
    padding: 5px 9px;
  }
  .board .frame {
    max-width: 200px;
    gap: 3px;
  }
  .stone {
    max-height: 20px;
    border-radius: 4px;
  }
  .beds {
    gap: 8px;
  }
  .bed {
    min-height: 48px;
    padding: 5px;
    gap: 3px;
  }
  .seed {
    height: 13px;
    width: 13px;
  }
  .board p {
    font-size: 0.85rem;
  }
  .help-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 8px;
    gap: 6px 12px;
  }
  #help-title {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.2rem;
  }
  #close-help {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  #help-content {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4px 14px;
    align-items: center;
  }
  .hop-first-instruction,
  .hop-first-remaining,
  .hop-first-note {
    grid-column: 1;
  }
  .hop-first-diagram {
    grid-column: 2;
    grid-row: 1 / 4;
  }
  .help-model {
    font-size: 1.2rem;
  }
  .line .tick {
    min-height: 25px;
  }
  .ending {
    gap: 10px;
  }
  .button-row {
    gap: 5px;
  }
  .button-row > button {
    padding: 6px 10px;
  }
  .task:has(.keypad) .controls {
    grid-row: 1/3;
  }
  .task:has(.keypad) .feedback {
    grid-column: 1;
  }
  .help-panel p {
    font-size: 0.9rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
.guide a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
@media (max-height: 500px) and (min-width: 601px) {
  .ending h1 {
    font-size: 1.7rem;
  }
  .ending .intro-art {
    display: none;
  }
}

@media (max-height: 500px) and (min-width: 601px) {
  .task .board {
    grid-row: 1;
  }
  .task .controls,
  .task:has(.keypad) .controls {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .task .feedback,
  .task:has(.keypad) .feedback {
    grid-column: 1;
    grid-row: 2;
  }
  .task .controls > p {
    display: none;
  }
  .task:has(#next:not([hidden])) .controls {
    display: none;
  }
  .task:has(#next:not([hidden])) .board {
    grid-row: 1 / 3;
  }
  .task:has(#next:not([hidden])) .feedback {
    grid-column: 2;
    grid-row: 1;
  }
  .task:has(#next:not([hidden])) .next {
    grid-column: 2;
    grid-row: 2;
  }
}
