@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('./vendor/dm-sans-regular.ttf') format('truetype');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 550 700;
  font-display: swap;
  src: url('./vendor/dm-sans-semibold.ttf') format('truetype');
}
:root {
  font-family: 'DM Sans', sans-serif;
  color: #434e4b;
  background: #e9e5e3;
  font-synthesis: none;
  --ink: #394b47;
  --muted: #747e78;
  --green: #456353;
  --paper: #faf9f2;
  --line: #d6dad0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  background: radial-gradient(ellipse at 60% 42%, #faf0d9 0%, #eae8e4 43%, #dadfea 100%);
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  border: 0;
  background: none;
}
button:focus-visible,
a:focus-visible,
#scene:focus-visible {
  outline: 3px solid #b88e42;
  outline-offset: 5px;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button {
  transition:
    background 0.18s,
    transform 0.18s,
    opacity 0.18s;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button[hidden],
[hidden] {
  display: none !important;
}
.sky-glow {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 75% 10%, #fff9e296, transparent 50%);
  pointer-events: none;
}
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 115px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 44px;
  z-index: 5;
}
.brand {
  text-decoration: none;
  color: #384c43;
  font:
    500 43px Georgia,
    serif;
  letter-spacing: -2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-star {
  font: 35px Georgia;
  color: #b79c62;
  letter-spacing: 0;
}
.brand-dot {
  color: #bca267;
  margin-left: -11px;
}
.journey-button {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 14px;
  background: #fff9e95e;
  border: 1px solid #fff8;
  box-shadow: 0 4px 20px #5a615507;
  border-radius: 30px;
  padding: 12px 18px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.journey-button:active {
  transform: translateX(-50%) translateY(1px) !important;
}
.tiny-star {
  color: #b99851;
  font-size: 21px;
}
.grid-icon {
  border-left: 1px solid #717c632b;
  padding-left: 12px;
  font-size: 22px;
  color: #63716a;
}
.top-actions {
  display: flex;
  gap: 12px;
}
.icon-button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 25px;
  line-height: 1;
}
.icon-button:hover {
  background: #ffffff70;
}
.icon-button svg,
.block-action-option svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#open-help {
  font-family: Georgia, serif;
  font-size: 23px;
  border: 1px solid #6d796349;
  width: 36px;
  height: 36px;
  margin: 3px;
}
.level-info {
  position: fixed;
  left: 45px;
  top: 25%;
  width: 225px;
  z-index: 3;
}
.eyebrow {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 2px;
  color: #788579;
  display: flex;
  align-items: center;
  gap: 10px;
}
.short-line {
  width: 20px;
  height: 1px;
  background: #8b9888;
}
.level-kicker {
  font-size: 12px;
  letter-spacing: 2.5px;
  margin-top: 34px;
  color: #8b907d;
}
h1 {
  font:
    400 58px/0.99 Georgia,
    serif;
  letter-spacing: -2px;
  margin: 15px 0 22px;
  color: #35493e;
}
#level-description {
  font-size: 15px;
  line-height: 1.8;
  color: #737d72;
  max-width: 220px;
}
.hint-button {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: #607255;
}
.hint-button span {
  font-size: 24px;
  color: #ad935f;
}
#hint-text {
  font-size: 14px;
  line-height: 1.6;
  background: #fff8e6b3;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #c6b57c4d;
  margin: 7px 0;
  max-height: 160px;
  overflow: auto;
}
.height-legend {
  margin-top: 35px;
}
.legend-label {
  font-size: 10px;
  letter-spacing: 1.7px;
  color: #8e9585;
  font-weight: 600;
}
#block-legend {
  height: 37px;
  display: flex;
  gap: 8px;
  align-items: end;
  margin: 14px 0;
}
.legend-block {
  width: 29px;
  min-height: 20px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 650;
  color: #fff8;
  box-shadow:
    inset 0 1px 1px #fff5,
    0 3px 7px #34443810;
}
.height-legend p {
  font-size: 11px;
  color: #939788;
  margin: 10px 0;
}
.level-info.expanded .height-legend {
  display: none;
}
#scene {
  position: fixed;
  left: 255px;
  right: 10px;
  top: 90px;
  bottom: 155px;
  outline: 0;
}
#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #687863;
}
.loading-star {
  font-size: 55px;
  color: #c8a05c;
  animation: spin 3s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.board-tools {
  position: fixed;
  right: 43px;
  bottom: 176px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 4;
}
.board-tools span {
  font-size: 10px;
  letter-spacing: 2px;
  color: #8c968d;
}
.board-tools .icon-button {
  font-size: 23px;
}
.play-dock {
  position: fixed;
  left: 50%;
  bottom: 61px;
  transform: translateX(-50%);
  height: 84px;
  display: flex;
  align-items: center;
  gap: 25px;
  white-space: nowrap;
  padding: 15px 23px;
  background: #fffdf4e8;
  border: 1px solid #fff;
  box-shadow:
    0 12px 40px #4d594b10,
    0 2px 4px #52654b04;
  backdrop-filter: blur(15px);
  border-radius: 20px;
  z-index: 5;
}
.level-navigation {
  display: flex;
  align-items: center;
  gap: 15px;
}
.level-navigation > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.dock-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.6px;
  color: #9a9d8d;
}
.nav-arrow {
  font: 30px Georgia;
  color: #9aa291;
  padding: 8px;
}
#dock-level {
  font-size: 17px;
  color: #52664e;
  font-weight: 600;
}
#dock-level span {
  font-weight: 400;
  color: #a8ad9b;
  font-size: 13px;
}
.dock-divider {
  height: 34px;
  width: 1px;
  background: #dce0d3;
}
.block-actions {
  position: fixed;
  z-index: 8;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  background: #fffdf5;
  border: 1px solid #d5d9c8;
  border-radius: 20px;
  box-shadow: 0 16px 55px #35493e29, 0 3px 10px #35493e0d;
}
.block-action-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.block-action-head > div {
  flex: 1;
}
.block-action-kicker {
  color: #74805f;
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 600;
}
.block-action-head h2 {
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -0.6px;
  margin: 7px 0 0;
}
.block-action-head .icon-button {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: -8px -8px 0 0;
}
.block-actions p {
  font-size: 12px;
  line-height: 1.5;
  color: #6e7968;
  margin: 10px 0 14px;
}
.block-action-options {
  display: grid;
  gap: 9px;
}
.block-action-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 12px;
  border: 1px solid #ccd7c2;
  border-radius: 12px;
  background: #eef3e6;
  text-align: left;
  color: #405d46;
}
.block-action-option:not(:disabled):hover {
  background: #dfead3;
  border-color: #829873;
}
.block-action-option svg {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}
.block-action-option > span {
  flex: 1;
}
.block-action-option strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
}
.block-action-option span span {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: #607454;
}
.block-action-option:disabled {
  opacity: 1;
  background: #f1f0eb;
  border-color: #e4e3da;
  color: #7e8175;
}
.block-action-option:disabled span span {
  color: #74776c;
}
.block-action-option:disabled svg,
.block-action-option:disabled kbd {
  opacity: 0.5;
}
.block-action-cancel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border-radius: 8px;
  font-size: 12px;
  color: #64725a;
}
.block-action-cancel:hover {
  background: #eef0e5;
}
.move-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 44px;
}
.move-counter strong {
  font-size: 23px;
  font-weight: 500;
  color: #5c7057;
  line-height: 1;
}
.history-controls {
  display: flex;
  gap: 5px;
}
.history-controls .icon-button {
  font-size: 27px;
  color: #7d8a71;
}
.keyboard-guide {
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 11px;
  color: #8b9588;
}
.keyboard-guide span {
  display: flex;
  gap: 5px;
  align-items: center;
}
.keyboard-guide b {
  font-weight: 500;
  letter-spacing: 2px;
  margin-left: 4px;
}
kbd {
  font: inherit;
  border: 1px solid #bac1b257;
  border-radius: 4px;
  padding: 2px 4px;
  color: #809078;
  background: #fff4;
}
.message {
  position: fixed;
  left: calc(50% + 100px);
  bottom: 163px;
  transform: translateX(-50%);
  padding: 10px 18px;
  background: #fffdf2f2;
  border: 1px solid #fff;
  border-radius: 24px;
  font-size: 13px;
  box-shadow: 0 3px 20px #51604112;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  max-width: 80%;
  text-align: center;
}
.message.visible {
  opacity: 1;
}
.touch-pad {
  position: fixed;
  right: 20px;
  bottom: 170px;
  display: grid;
  grid-template-columns: repeat(3, 38px);
  grid-template-rows: repeat(2, 38px);
  gap: 4px;
  z-index: 4;
  opacity: 0.9;
}
.touch-pad button {
  border: 1px solid #fff9;
  background: #fffaf27a;
  border-radius: 10px;
  font-size: 22px;
  color: #6c7c64;
  backdrop-filter: blur(8px);
}
.touch-pad button:first-child {
  grid-column: 2;
}
.touch-pad button:nth-child(2) {
  grid-column: 1;
}
.touch-pad button:hover {
  background: #fff;
}
.board-tools {
  bottom: 270px;
  right: 28px;
}
dialog {
  border: 1px solid #fff;
  border-radius: 25px;
  padding: 34px;
  background: #faf9f0;
  color: var(--ink);
  box-shadow: 0 30px 150px #24362633;
  width: min(660px, calc(100vw - 30px));
  max-height: 85dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #46534b38;
  backdrop-filter: blur(9px);
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
h2 {
  font:
    400 36px/1.1 Georgia,
    serif;
  letter-spacing: -1px;
  margin: 13px 0;
}
dialog p {
  font-size: 15px;
  line-height: 1.7;
  color: #808777;
}
#levels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 25px;
}
.level-card {
  text-align: left;
  border: 1px solid #dce1d2;
  border-radius: 13px;
  padding: 15px;
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff7;
}
.level-card:hover {
  background: #e9eddc;
}
.level-card.current {
  border-color: #728965;
  background: #e9efdf;
}
.level-card .number {
  font-size: 14px;
  color: #a3aa96;
  width: 22px;
}
.level-card .name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}
.level-card .star {
  color: #c6a467;
  font-size: 20px;
}
.help-list {
  list-style: none;
  counter-reset: help;
  padding: 0;
  display: grid;
  gap: 20px;
  margin: 26px 0;
}
.help-list li {
  counter-increment: help;
  position: relative;
  padding-left: 43px;
}
.help-list li:before {
  content: counter(help);
  position: absolute;
  left: 0;
  top: 0;
  background: #e8eddf;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #74856d;
  font-size: 14px;
}
.help-list strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
  font-weight: 550;
}
.help-list span {
  font-size: 14px;
  line-height: 1.65;
  color: #7e8876;
  display: block;
}
.help-note {
  font-size: 13px !important;
  background: #edf0e4;
  border-radius: 12px;
  padding: 14px;
}
.primary-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  width: 100%;
  border-radius: 12px;
  padding: 17px 22px;
  background: #536f57;
  color: #fffcf0;
  font-size: 15px;
  margin-top: 22px;
}
.primary-button:hover {
  background: #405c45;
}
.win-dialog {
  width: 430px;
  text-align: center;
  padding: 40px;
}
.win-dialog .eyebrow {
  justify-content: center;
  font-size: 10px;
  letter-spacing: 1.7px;
}
.win-star {
  font-size: 90px;
  color: #d9b65c;
  text-shadow: 0 0 45px #e4c96f80;
  margin: 0 0 18px;
  line-height: 1.1;
}
.win-stats {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin: 26px;
}
.win-stats div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.win-stats strong {
  font: 32px Georgia;
  color: #5d7355;
}
.win-stats span {
  font-size: 12px;
  color: #969e89;
}
.text-button {
  margin-top: 18px;
  font-size: 13px;
  color: #8a9380;
}
@media (min-width: 1500px) {
  #scene {
    left: 290px;
    right: 65px;
    top: 95px;
    bottom: 160px;
  }
  .level-info {
    left: 65px;
    width: 245px;
  }
  h1 {
    font-size: 65px;
  }
  .topbar {
    padding: 0 65px;
  }
}
@media (max-height: 750px) and (min-width: 801px) {
  .level-info {
    top: 22%;
  }
  .level-kicker {
    margin-top: 21px;
  }
  h1 {
    font-size: 47px;
    margin-bottom: 15px;
  }
  #level-description {
    font-size: 14px;
  }
  .height-legend {
    margin-top: 18px;
  }
  .topbar {
    height: 85px;
  }
  #scene {
    top: 65px;
    bottom: 140px;
  }
  .play-dock {
    bottom: 45px;
    height: 76px;
  }
  .keyboard-guide {
    bottom: 15px;
  }
  .message {
    bottom: 128px;
  }
}
@media (max-width: 1050px) {
  .play-dock {
    gap: 14px;
    padding: 13px 17px;
  }
  .level-info {
    left: 28px;
    width: 175px;
  }
  h1 {
    font-size: 49px;
  }
  #scene {
    left: 180px;
    right: 0;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: 1.4px;
  }
  .topbar {
    padding: 0 28px;
  }
  .height-legend p {
    font-size: 10px;
  }
}
@media (max-width: 800px) {
  .block-actions {
    left: 50% !important;
    top: auto !important;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: 420px;
    padding: 16px;
    max-height: calc(100dvh - 32px);
  }
  .block-action-head h2 {
    font-size: 23px;
  }
  .block-action-head .icon-button {
    width: 44px;
    height: 44px;
  }
  .block-action-options {
    grid-template-columns: 1fr 1fr;
  }
  .block-action-option {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
  }
  .block-action-option kbd {
    display: none;
  }
  .block-action-cancel {
    min-height: 44px;
  }
  .choosing-block .touch-pad,
  .choosing-block .play-dock,
  .choosing-block .board-tools {
    visibility: hidden;
  }
  .topbar {
    height: 79px;
    padding: 0 21px;
  }
  .brand {
    font-size: 34px;
  }
  .brand-star {
    font-size: 28px;
  }
  .brand-dot {
    margin-left: -10px;
  }
  .journey-button {
    position: static;
    transform: none;
    font-size: 12px;
    gap: 7px;
    padding: 8px 12px;
    margin-left: auto;
    margin-right: 15px;
  }
  .journey-button:active {
    transform: translateY(1px) !important;
  }
  .grid-icon {
    font-size: 18px;
  }
  .top-actions {
    gap: 5px;
  }
  #sound {
    display: none;
  }
  .level-info {
    top: 98px;
    left: 25px;
    width: calc(100% - 50px);
    pointer-events: none;
  }
  .level-info .eyebrow,
  .level-info .height-legend {
    display: none;
  }
  .level-kicker {
    margin: 0;
    font-size: 10px;
    letter-spacing: 2px;
  }
  h1 {
    font-size: 36px;
    margin: 8px 0 0;
    letter-spacing: -1px;
  }
  h1 br {
    display: none;
  }
  #level-description {
    font-size: 13px;
    line-height: 1.5;
    max-width: 300px;
    margin-top: 10px;
    display: none;
  }
  .hint-button {
    position: absolute;
    right: 0;
    top: 17px;
    pointer-events: auto;
    font-size: 12px;
  }
  #hint-text {
    position: absolute;
    top: 62px;
    right: 0;
    max-width: 300px;
    pointer-events: auto;
    background: #fffcedf5;
  }
  .level-info.expanded {
    z-index: 6;
  }
  #scene {
    left: 0;
    right: 0;
    top: 149px;
    bottom: 225px;
  }
  .play-dock {
    bottom: 34px;
    border-radius: 17px;
    gap: 11px;
    padding: 11px 13px;
    height: 74px;
    max-width: calc(100vw - 24px);
    flex-wrap: nowrap;
  }
  .level-navigation {
    gap: 3px;
  }
  .level-navigation .dock-label {
    display: none;
  }
  .nav-arrow {
    padding: 5px;
  }
  .dock-divider {
    display: none;
  }
  .move-counter {
    min-width: 30px;
  }
  .move-counter strong {
    font-size: 21px;
  }
  .dock-label {
    font-size: 8px;
  }
  .history-controls {
    gap: 0;
  }
  .history-controls .icon-button {
    width: 44px;
    font-size: 25px;
  }
  .keyboard-guide {
    display: none;
  }
  .touch-pad {
    left: 50%;
    right: auto;
    bottom: 121px;
    transform: translateX(-50%);
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(2, 44px);
  }
  .board-tools {
    bottom: 146px;
    right: 20px;
    gap: 0;
  }
  .board-tools span {
    display: none;
  }
  .message {
    left: 50%;
    bottom: 222px;
    font-size: 12px;
    width: max-content;
    max-width: 90%;
  }
  dialog {
    padding: 24px;
  }
  h2 {
    font-size: 31px;
  }
  .dialog-head .eyebrow {
    font-size: 9px;
  }
  #levels-grid {
    gap: 8px;
  }
  .level-card {
    padding: 12px 9px;
    gap: 6px;
  }
  .level-card .name {
    font-size: 12px;
  }
  .level-card .number {
    width: 18px;
    font-size: 12px;
  }
  .win-dialog {
    padding: 30px;
  }
}
@media (max-width: 420px) {
  .topbar {
    padding: 0 17px;
  }
  .journey-button {
    margin-right: 8px;
  }
  .play-dock {
    gap: 7px;
    padding: 9px;
  }
  .level-navigation {
    gap: 0;
  }
  #dock-level {
    font-size: 15px;
  }
  .move-counter .dock-label {
    font-size: 7px;
  }
  #scene {
    top: 150px;
    bottom: 218px;
  }
  .touch-pad {
    bottom: 115px;
  }
  .board-tools {
    bottom: 140px;
    right: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 800px) and (max-height: 650px) {
  .block-actions {
    padding: 12px;
  }
  #block-action-description,
  .block-action-option svg {
    display: none;
  }
  .block-action-options {
    margin-top: 12px;
  }
}

/* Keep secondary labels readable without competing with the play board. */
.eyebrow,
.level-kicker,
.legend-label,
.height-legend p,
.dock-label,
.board-tools span,
.keyboard-guide {
  font-size: 12px;
}
.hint-button {
  font-size: 14px;
}
@media (max-width: 800px) {
  .level-kicker,
  .dock-label {
    font-size: 12px;
  }
  .move-counter .dock-label {
    font-size: 10px;
  }
  .hint-button {
    font-size: 13px;
  }
  .level-card .name {
    font-size: 14px;
  }
  .level-card .number {
    font-size: 12px;
  }
  .dialog-head .eyebrow {
    font-size: 12px;
  }
  .level-info h1 {
    max-width: 70%;
  }
  .help-note {
    font-size: 14px !important;
  }
}
@media (max-width: 420px) {
  .level-navigation {
    gap: 2px;
  }
  .play-dock {
    gap: 10px;
  }
  .level-info h1 {
    font-size: 32px;
  }
  .journey-button {
    font-size: 12px;
  }
  .win-dialog .eyebrow {
    font-size: 12px;
  }
}
