:root {
  --app-height: 100vh;
  --ink: #35594c;
  --muted: #879b88;
  --accent: #77b89e;
  --line: #d8e2d0;
  --cream: #fffdf5;
  font-family:
    ui-rounded, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #f7f5ea;
  font-synthesis: none;
  color-scheme: light;
}
@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: var(--app-height);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 5% 10%, #dfebd7 0, transparent 48%),
    radial-gradient(ellipse at 100% 95%, #f9dfcd 0, transparent 40%), #f7f5ea;
}
button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: inherit;
}
button:disabled {
  cursor: default;
  opacity: 0.4;
}
button:focus-visible,
canvas:focus-visible {
  outline: 3px solid #d3a577;
  outline-offset: 2px;
}
button:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}
#app {
  height: 100%;
  max-width: 480px;
  margin: auto;
  padding: max(6px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toolbar {
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: #ffffff85;
  border: 1px solid #dce5d6;
  border-radius: 15px;
  font-size: 24px;
  display: grid;
  place-items: center;
  line-height: 1;
}
.level-label {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex: 1;
  min-width: 0;
}
.level-label b {
  font-size: 15px;
  white-space: nowrap;
}
.level-label span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.mission {
  display: flex;
  flex: none;
  min-height: 84px;
  border: 1px solid #fffef8;
  background: #fffdf2d9;
  border-radius: 22px;
  box-shadow: 0 4px 0 #e2e8d66b;
  padding: 11px;
  gap: 13px;
}
.moves {
  width: 62px;
  flex: none;
  align-self: stretch;
  border-radius: 14px;
  background: #e2eddc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.moves strong {
  font-family: Georgia, serif;
  font-size: 35px;
  font-weight: normal;
  line-height: 1;
}
.moves span {
  font-size: 9px;
  color: #78927c;
}
.moves.urgent {
  background: #ffe0d5;
  color: #b36b59;
}
.mission-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.mission-heading {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #8e9c80;
  gap: 5px;
}
.mission-heading #score {
  color: #bd9670;
  font-variant-numeric: tabular-nums;
}
.goals {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.goal {
  background: #f1f3e7;
  border: 1px solid #e4e9d7;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.goal small {
  font-size: 10px;
  color: #8a987c;
  font-weight: 400;
}
.goal.done {
  background: #dfefdb;
  color: #66986e;
}
.goal-mark {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #fff;
  box-shadow: inset 0 2px 3px #ffffff70;
  font-size: 15px;
}
.goal-mark.collect {
  background: var(--fruit);
}
.goal-mark.score {
  background: #dab973;
}
.goal-mark.ice {
  background: #9ecdda;
}
.goal-mark.box {
  background: #cdab72;
}
.goal-mark.vine {
  background: #8cb47c;
}
.mood-line {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  min-height: 20px;
  font-size: 11px;
  color: #8a9f89;
  padding: 0 5px;
}
.mood-line > span:first-child {
  color: #92b78e;
  font-size: 17px;
}
.mood-line #status {
  flex: 1;
}
.mood-dot {
  width: 4px;
  height: 4px;
  border-radius: 100%;
  background: #b5c9a7;
}
.board-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 27px;
  background: linear-gradient(145deg, #e0ede2ee, #d6e5d9f0);
  border: 2px solid #fdfbf0;
  box-shadow:
    0 7px 0 #d8dfcb,
    0 11px 25px #6f8c6720,
    inset 0 0 25px #bad1bc35;
  padding: 9px;
  margin-bottom: 5px;
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 1;
}
.board-decoration {
  position: absolute;
  pointer-events: none;
  color: #e5bc77;
  font-size: 23px;
  z-index: 2;
  text-shadow: 0 1px #fff;
}
.deco-a {
  top: -9px;
  right: 19px;
}
.deco-b {
  bottom: 15px;
  left: -10px;
  font-size: 18px;
}
.tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: none;
}
.tools button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 56px;
  border: 1px solid #dedfc9;
  background: #fffaf0;
  border-radius: 16px;
  box-shadow: 0 3px 0 #e1ddca;
  padding: 7px 5px;
  text-align: left;
}
.tools button[aria-pressed="true"] {
  border-color: #da9f78;
  background: #fff0d8;
}
.tool-icon {
  color: #bc9c6f;
  background: #f2ead5;
  border-radius: 11px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 25px;
}
.tools b {
  display: block;
  font-size: 12px;
  font-weight: 600;
}
.tools small {
  display: block;
  font-size: 9px;
  color: #a3a58f;
  margin-top: 3px;
}
.bottom-note {
  flex: none;
  text-align: center;
  font-size: 9px;
  letter-spacing: 1px;
  color: #b4b39c;
  height: 13px;
}
.bottom-note span {
  color: #d6bc89;
  margin-left: 5px;
}
dialog {
  width: min(92vw, 420px);
  max-height: calc(var(--app-height) - 24px);
  border: 1px solid #dce1cc;
  border-radius: 28px;
  padding: 22px;
  background: #fffaf0;
  color: var(--ink);
  box-shadow: 0 20px 80px #324a3c45;
  overflow: hidden;
}
dialog::backdrop {
  background: #344d464d;
  backdrop-filter: blur(6px);
}
.dialog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.dialog-head h2 {
  font-size: 23px;
  margin: 0;
  flex: 1;
  line-height: 1.3;
}
.dialog-head .icon-button {
  background: transparent;
  border: 0;
  width: 44px;
}
.dialog-kicker {
  margin: 0 0 5px;
  color: #a3af91;
  font-size: 10px;
  letter-spacing: 2px;
}
.dialog-copy {
  font-size: 13px;
  line-height: 1.7;
  color: #89967f;
  margin: 9px 0 16px;
}
.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  width: 100%;
  border: 1px solid #5f9e82;
  background: linear-gradient(#91c7a6, #78b493);
  color: #fffef1;
  border-radius: 16px;
  box-shadow: 0 4px 0 #619c7e;
  font-size: 15px;
  font-weight: 600;
  padding: 12px;
  margin-top: 15px;
}
.secondary {
  min-height: 44px;
  border: 1px solid #d8dfc8;
  border-radius: 13px;
  padding: 9px 12px;
  background: #f2f3e6;
  font-size: 12px;
}
.button-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.button-row > * {
  flex: 1;
}
.start-badge {
  margin: 5px auto 12px;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 27px;
  background: #e7efdb;
  color: #719e7f;
  box-shadow:
    inset 0 3px #fff,
    0 5px #d5e2c7;
  font:
    44px Georgia,
    serif;
}
.centered {
  text-align: center;
}
.intro-goals {
  justify-content: center;
  margin: 14px 0;
}
.star-row {
  font-size: 37px;
  letter-spacing: 9px;
  color: #d8b46b;
  text-align: center;
  text-shadow: 0 2px #fff0b6;
  margin: 10px 0;
}
.result-score {
  font:
    45px Georgia,
    serif;
  text-align: center;
  color: #6d9a7c;
}
.result-score small {
  display: block;
  font: 10px system-ui;
  color: #9ca487;
  margin-top: 5px;
}
.result-note {
  text-align: center;
  font-size: 13px;
  color: #8e9e81;
}
.chapter-card {
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(125deg, #e6efda, #f4f0dc);
  position: relative;
  margin-bottom: 16px;
}
.chapter-card h3 {
  margin: 0 0 5px;
  font-size: 21px;
}
.chapter-card p {
  margin: 0;
  font-size: 11px;
  color: #8c9d80;
}
.chapter-card > span {
  position: absolute;
  right: 16px;
  top: 7px;
  font-size: 45px;
  color: #aac4a0;
  opacity: 0.65;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 9px;
}
.level-node {
  aspect-ratio: 1;
  min-height: 55px;
  border: 1px solid #dce4ce;
  border-radius: 18px;
  background: #eff2e3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font:
    22px Georgia,
    serif;
}
.level-node small {
  font: 10px system-ui;
  color: #ceab66;
  letter-spacing: 1px;
}
.level-node.current {
  background: #8cbe9d;
  color: #fffdf1;
  border-color: #77ad88;
  box-shadow: 0 4px 0 #71a17c;
}
.level-node:disabled {
  opacity: 0.48;
}
.map-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: #91a080;
  font-size: 11px;
}
.map-pager button {
  width: 48px;
  height: 44px;
  border: 1px solid #dce2ce;
  border-radius: 13px;
  background: #f2f3e8;
}
.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.legend > div {
  padding: 10px;
  background: #f0f2e5;
  border: 1px solid #e4e7d8;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.6;
}
.legend b {
  display: block;
  font-size: 12px;
  color: #65957c;
}
.legend em {
  font-style: normal;
  color: #c19569;
}
.sound-state {
  color: #c19e6c !important;
}
.toast {
  animation: fade-in 0.22s ease-out;
}
@keyframes fade-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@media (max-height: 650px) {
  #app {
    gap: 6px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .mission {
    min-height: 68px;
    padding: 8px;
    border-radius: 17px;
  }
  .moves {
    width: 51px;
  }
  .moves strong {
    font-size: 29px;
  }
  .mission-main {
    gap: 5px;
  }
  .goal {
    padding: 3px 6px;
    font-size: 11px;
    gap: 4px;
  }
  .goal-mark {
    width: 19px;
    height: 19px;
    font-size: 12px;
  }
  .board-wrap {
    padding: 6px;
    border-radius: 22px;
  }
  .tools button {
    min-height: 48px;
    gap: 5px;
  }
  .tool-icon {
    width: 25px;
    height: 27px;
    font-size: 22px;
  }
  .tools b {
    font-size: 11px;
  }
  .bottom-note {
    display: none;
  }
  .mood-line {
    font-size: 10px;
    min-height: 17px;
  }
  .toolbar {
    height: 44px;
  }
  .level-label span {
    font-size: 10px;
  }
  dialog {
    padding: 16px;
  }
  .dialog-head {
    margin-bottom: 8px;
  }
  .start-badge {
    height: 60px;
    width: 60px;
    font-size: 34px;
    margin: 4px auto 8px;
  }
  .dialog-copy {
    font-size: 11px;
    margin: 8px 0;
  }
  .level-grid {
    gap: 8px;
  }
  .chapter-card {
    margin-bottom: 10px;
    padding: 10px;
  }
  .primary {
    margin-top: 12px;
  }
  .legend > div {
    padding: 7px;
  }
}
@media (max-width: 350px) {
  #app {
    padding-left: 9px;
    padding-right: 9px;
  }
  .toolbar {
    gap: 5px;
  }
  .level-label {
    gap: 5px;
  }
  .level-label b {
    font-size: 13px;
  }
  .mission {
    gap: 8px;
  }
  .mission-heading {
    font-size: 9px;
  }
  .tool-icon {
    display: none;
  }
  .tools button {
    justify-content: center;
    text-align: center;
  }
  .goals {
    gap: 4px;
  }
  .goal {
    padding: 4px 5px;
  }
  .mood-line {
    padding: 0;
    font-size: 10px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #app {
    max-width: 900px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    grid-template-rows: 44px 86px 1fr 54px;
    gap: 8px 15px;
    padding: 9px max(12px, env(safe-area-inset-right)) 12px
      max(12px, env(safe-area-inset-left));
  }
  .board-wrap {
    grid-column: 1;
    grid-row: 1/5;
    margin: 0;
  }
  .toolbar {
    grid-column: 2;
    grid-row: 1;
  }
  .level-label {
    display: block;
  }
  .level-label span {
    display: block;
    font-size: 9px;
  }
  .mission {
    grid-column: 2;
    grid-row: 2;
    padding: 7px;
    gap: 7px;
  }
  .mission-heading {
    font-size: 8px;
    display: block;
  }
  .mission-heading #score {
    float: right;
  }
  .goal {
    font-size: 10px;
  }
  .mood-line {
    grid-column: 2;
    grid-row: 3;
    align-self: center;
  }
  .tools {
    grid-column: 2;
    grid-row: 4;
    gap: 6px;
  }
  .tools button {
    min-height: 48px;
    text-align: center;
  }
  .tools .tool-icon {
    display: none;
  }
  .tools b {
    font-size: 11px;
  }
  .tools small {
    font-size: 8px;
  }
  .bottom-note {
    display: none;
  }
  dialog {
    width: min(92vw, 600px);
    padding: 14px;
    max-height: calc(var(--app-height) - 18px);
  }
  .start-badge {
    float: left;
    margin: 3px 18px 5px 8px;
    width: 60px;
    height: 60px;
  }
  .dialog-head {
    margin-bottom: 4px;
  }
  .dialog-head h2 {
    font-size: 20px;
  }
  .dialog-copy {
    margin: 6px 0;
    font-size: 11px;
  }
  .intro-goals {
    margin: 6px 0;
  }
  .primary {
    min-height: 44px;
    margin-top: 9px;
    padding: 8px;
  }
  .chapter-card {
    display: none;
  }
  .level-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
  }
  .level-node {
    min-height: 48px;
    border-radius: 12px;
  }
  .map-pager {
    margin-top: 8px;
  }
  .legend {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .legend > div {
    font-size: 10px;
    padding: 6px;
  }
  .star-row {
    float: left;
    font-size: 28px;
    margin: 2px 10px;
  }
  .result-score {
    font-size: 30px;
  }
  .button-row {
    margin-top: 8px;
  }
  .dialog-kicker {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}
