:root {
  color-scheme: light;
  --ink: #24364a;
  --muted: #58634f;
  --sun: #f8df82;
  --chalk: #fff9e8;
  --tomato: #ba3929;
  --leaf: #24583f;
  --edge: #dac891;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--sun);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  min-width: 300px;
  min-height: 100dvh;
  margin: 0;
  background:
    repeating-linear-gradient(0deg, #fffbe027 0 28px, transparent 28px 56px),
    repeating-linear-gradient(90deg, #fffbe028 0 28px, transparent 28px 56px),
    var(--sun);
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #1b5b9a; outline-offset: 3px; z-index: 120 !important; }
img { display: block; max-width: 100%; object-fit: contain; user-select: none; pointer-events: none; }
.topbar {
  max-width: 1182px;
  padding: 23px 32px 0;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wordmark { display: flex; align-items: center; gap: 10px; font-size: .79rem; font-weight: 850; letter-spacing: .18em; }
.check-mark {
  width: 24px;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  transform: rotate(-9deg);
  background: conic-gradient(var(--ink) 25%, #fff3bf 0 50%, var(--ink) 0 75%, #fff3bf 0);
  background-size: 12px 12px;
}
.top-actions { display: flex; gap: 8px; }
.small-button {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid #998044;
  border-radius: 10px;
  background: #fff4c5;
  font-weight: 750;
  font-size: .82rem;
}
.question-icon {
  width: 17px;
  height: 17px;
  line-height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font: 800 .76rem/14px system-ui;
  text-align: center;
}
.speaker {
  display: block;
  width: 16px;
  height: 17px;
  background: currentColor;
  clip-path: polygon(5% 33%, 30% 33%, 68% 9%, 68% 91%, 30% 67%, 5% 67%);
}
[aria-pressed="true"] .speaker { clip-path: polygon(5% 33%, 30% 33%, 58% 9%, 58% 91%, 30% 67%, 5% 67%, 5% 33%, 75% 20%, 100% 37%, 100% 63%, 75% 80%, 75% 65%, 87% 56%, 87% 44%, 75% 35%, 75% 20%); }
.layout {
  width: min(100%, 1182px);
  min-height: calc(100dvh - 66px);
  display: grid;
  grid-template-columns: minmax(288px, .76fr) minmax(450px, 1.15fr);
  align-items: center;
  gap: clamp(29px, 5.2vw, 86px);
  margin: auto;
  padding: 31px 32px 33px;
}
.intro { min-width: 0; }
h1 {
  margin: 0;
  font-size: clamp(4.35rem, 7.1vw, 6.65rem);
  line-height: .98;
  font-weight: 950;
  letter-spacing: -.08em;
}
h1 span { display: block; width: max-content; }
h1 .title-accent { color: var(--tomato); margin-top: 2px; transform: rotate(-4deg); transform-origin: left center; }
.intro-copy p { margin: 21px 0 0; font-size: clamp(.95rem, 1.5vw, 1.1rem); line-height: 1.45; font-weight: 700; }
.hero {
  position: relative;
  width: min(100%, 375px);
  height: 219px;
  margin: 13px 0 13px;
  isolation: isolate;
}
.hero-cloth {
  position: absolute;
  inset: 44% 17% 11% 8%;
  transform: rotate(-9deg) skewX(-18deg);
  border-radius: 11px;
  border: 2px solid #bc1f247a;
  background:
    repeating-linear-gradient(90deg, #d53c3563 0 16px, transparent 16px 32px),
    repeating-linear-gradient(0deg, #d53c3563 0 16px, transparent 16px 32px),
    #ffe1a8;
  box-shadow: 4px 6px #84231b29;
}
.hero-card {
  position: absolute;
  display: grid;
  place-items: center;
  width: 35%;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 17%;
  box-shadow: inset 0 0 0 4px #fffef591, 2px 5px 0 var(--ink);
}
.hero-card img { width: 78%; height: 76%; }
.hero-pear { left: 7%; top: 19%; transform: rotate(-20deg); background: #fff9d6; }
.hero-melon { left: 54%; top: 32%; transform: rotate(16deg); background: #ffdfdc; z-index: 1; }
.hero-tomato { left: 29%; top: 12%; transform: rotate(-5deg); background: #dceccf; z-index: 2; }
.hero-rose {
  position: absolute;
  z-index: 4;
  width: 18%;
  height: 35%;
  top: 58%;
  left: 69%;
  filter: drop-shadow(2px 4px 0 #4d3a2d35);
  transform: rotate(14deg);
}
.sparkle {
  display: block;
  position: absolute;
  aspect-ratio: 1;
  background: var(--tomato);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
}
.sparkle-one { width: 29px; top: 6%; left: 87%; }
.sparkle-two { width: 18px; top: 22%; left: 96%; background: var(--leaf); }
.sparkle-three { width: 20px; top: 72%; left: 0%; background: var(--leaf); }

.stations {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  max-width: 410px;
}
.station {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: flex-start;
  column-gap: 9px;
  padding: 10px 11px;
  min-height: 58px;
  border-radius: 11px;
  border: 1px solid #a89254;
  background: #fff3bf;
  text-align: left;
  font-size: .84rem;
  white-space: nowrap;
}
.station img { width: 24px; height: 28px; grid-row: span 2; }
.station strong { align-self: end; font-size: .83rem; font-weight: 800; line-height: 1.2; }
.station small { align-self: start; font-size: .7rem; margin-top: 3px; font-weight: 700; color: #66562d; }
.station[aria-current="step"] { background: #fff9e7; border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); transform: translateY(-2px); }
.station:disabled { color: #4b4638; background: #eed080; border-color: #af9552; }
.station:disabled img { opacity: .68; }

.game {
  min-width: 0;
  padding: clamp(13px, 2.1vw, 24px);
  border: 2px solid var(--ink);
  border-radius: 25px;
  background: var(--chalk);
  box-shadow: 5px 7px 0 var(--ink);
}
.stage-heading { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.stage-name { display: flex; gap: 9px; align-items: center; }
.level-number {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 30px;
  border-radius: 8px;
  background: var(--leaf);
  color: #fff9e6;
  font: 800 .85rem/1 system-ui;
  font-variant-numeric: tabular-nums;
}
.stage-name h2 { margin: 0; font-size: clamp(1.12rem, 2vw, 1.46rem); line-height: 1.3; letter-spacing: -.045em; font-weight: 850; }
.stage-stat { color: var(--muted); display: flex; align-items: baseline; gap: 4px; font-size: .82rem; white-space: nowrap; }
.stage-stat strong { color: var(--ink); font-size: 1.12rem; font-variant-numeric: tabular-nums; font-weight: 850; }
progress {
  display: block;
  width: 100%;
  height: 5px;
  margin: 11px 0 12px;
  overflow: hidden;
  appearance: none;
  border: 0;
  background: #e9dfc0;
  border-radius: 10px;
  color: var(--leaf);
}
progress::-webkit-progress-bar { background: #e9dfc0; }
progress::-webkit-progress-value { background: var(--leaf); border-radius: 10px; transition: width 200ms ease; }
progress::-moz-progress-bar { background: var(--leaf); border-radius: 10px; }
.play-area {
  display: grid;
  place-items: center;
  position: relative;
  padding: 9px 10px 12px;
  border: 1px solid #c3caa1;
  border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, #8aa8711b 0 18px, transparent 18px 36px),
    repeating-linear-gradient(0deg, #8aa8711b 0 18px, transparent 18px 36px),
    #e8eed0;
}
.board {
  position: relative;
  width: min(100%, 475px, 58dvh);
  aspect-ratio: var(--board-ratio, 6.7 / 5.5);
  isolation: isolate;
}
.tile,
.slot-card {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #846a45;
  border-radius: 16%;
  background: #fff9e4;
  box-shadow: inset 0 1px 0 #fffef6, 0 3px 0 #94744c, 0 4px 4px #50442f38;
}
.tile {
  position: absolute;
  width: var(--tile-w);
  height: var(--tile-h);
  transition: background 160ms, box-shadow 160ms;
}
.tile[hidden] { display: none; }
.tile img, .slot-card img { position: absolute; width: 83%; height: 83%; }
.tile[data-type="pear"], .slot-card[data-type="pear"] { background: #f2f3ca; }
.tile[data-type="banana"], .slot-card[data-type="banana"] { background: #fff0c0; }
.tile[data-type="pea"], .slot-card[data-type="pea"] { background: #e7f3cd; }
.tile[data-type="carrot"], .slot-card[data-type="carrot"] { background: #ffead2; }
.tile[data-type="melon"], .slot-card[data-type="melon"] { background: #fff0e6; }
.tile[data-type="apple"], .slot-card[data-type="apple"] { background: #e7f2d2; }
.tile[data-type="tomato"], .slot-card[data-type="tomato"] { background: #fff1d9; }
.tile[data-type="yakult"], .slot-card[data-type="yakult"] { background: #f9eee1; }
.tile[data-type="cherry"], .slot-card[data-type="cherry"] { background: #fdebf3; }
.tile[data-type="rose"], .slot-card[data-type="rose"] { background: #ffe6e1; }
.tile[data-type="lemon"], .slot-card[data-type="lemon"] { background: #fff4c4; }
.tile:disabled {
  border-color: #777d60;
  box-shadow: inset 0 0 0 50px #35492e40, 0 2px 0 #7c815d;
}
.tile:disabled img { filter: saturate(.66) brightness(.77); }
.tile:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #94744c; }
.tile.hinted {
  outline: 3px solid #b63928;
  outline-offset: 1px;
  animation: hint-bounce 620ms ease-in-out 3;
}
.tile.appeared { animation: reveal 225ms ease-out both; }
.basket {
  padding: 8px 10px 10px;
  margin-top: 10px;
  border-radius: 13px;
  border: 1px solid #d4a963;
  background: #f4d690;
  transition: background 150ms;
}
.basket[data-danger] { background: #ffd1bb; border-color: #c44f3c; }
.basket-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; font-size: .83rem; font-weight: 820; }
#occupancy { font: 800 .83rem/1 system-ui; font-variant-numeric: tabular-nums; }
.basket-name { display: flex; align-items: center; gap: 7px; }
.basket-icon {
  display: block;
  position: relative;
  width: 17px;
  height: 11px;
  border-radius: 2px 2px 5px 5px;
  border: 1.5px solid currentColor;
  background: repeating-linear-gradient(90deg, transparent 0 3px, #7e613335 3px 5px);
  margin-top: 5px;
}
.basket-icon::before {
  content: "";
  position: absolute;
  width: 9px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  left: 2px;
  top: -7px;
}
.slots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(4px, 1vw, 8px); }
.slot {
  position: relative;
  aspect-ratio: 1.20;
  border: 1px solid #c49858;
  border-radius: 12%;
  background: #e7bd71;
  box-shadow: inset 0 2px 0 #9d662220;
}
.slot-card { position: absolute; inset: 0; }
.slot-card.matched { animation: stamp 220ms ease-out both; }
.toolbar { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 11px; }
.tool-button {
  min-height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid #c9b580;
  border-radius: 9px;
  background: #fff4d3;
  font-size: .84rem;
  font-weight: 760;
  white-space: nowrap;
}
.tool-button:disabled { color: #6c6555; background: #f5ecd0; border-color: #ded0a8; }
.tool-icon { font: 750 1.22rem/1 system-ui; color: var(--leaf); }
.tool-button:disabled .tool-icon { color: #726d5a; }
.tool-sparkle { font-size: .98rem; }
.tool-count {
  border-radius: 5px;
  background: #e9dfbd;
  min-width: 19px;
  padding: 3px 2px;
  font: 750 .71rem/1 system-ui;
  text-align: center;
}
.game-note { margin: 10px 0 0; min-height: 1.25em; color: var(--muted); font-size: .79rem; text-align: center; line-height: 1.4; }
.game-note[data-kind="danger"] { color: #932d22; font-weight: 730; }
.feedback {
  position: absolute;
  z-index: 250;
  top: 47%;
  left: 50%;
  pointer-events: none;
  white-space: nowrap;
  color: var(--leaf);
  font-size: clamp(1.1rem, 4vw, 1.65rem);
  font-weight: 900;
  text-shadow: 1px 2px 0 #fff8d3, -1px -1px 0 #fff8d3, 0 0 8px #fff8d3;
  opacity: 0;
}
.feedback.visible { animation: pop-up 670ms ease-out both; }
.flying-tile { position: fixed; z-index: 300; pointer-events: none; margin: 0; }
@keyframes pop-up {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.7); }
  22% { opacity: 1; transform: translate(-50%, -16px) scale(1.08); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -43px) scale(1); }
}
@keyframes hint-bounce { 50% { transform: translateY(-3px); } }
@keyframes reveal { from { filter: brightness(1.2); } to { filter: brightness(1); } }
@keyframes stamp { 0% { transform: scale(.86); } 64% { transform: scale(1.08); } 100% { transform: scale(1); } }

.game-dialog {
  width: min(390px, calc(100% - 38px));
  max-height: calc(100% - 32px);
  border: 2px solid var(--ink);
  border-radius: 24px;
  padding: 0;
  color: var(--ink);
  background: var(--chalk);
  box-shadow: 5px 6px 0 var(--ink);
}
.game-dialog::backdrop { background: #27382880; }
.dialog-inner { position: relative; padding: 26px 24px 23px; text-align: center; }
.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 41px;
  height: 41px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: 600 1.45rem/1 system-ui;
}
.dialog-art { width: 82px; height: 82px; margin: 3px auto 11px; }
.dialog-inner h2 { margin: 0; font-size: 1.68rem; font-weight: 880; letter-spacing: -.05em; line-height: 1.25; }
.dialog-copy { margin: 12px auto 19px; text-align: left; font-size: .95rem; color: #494d39; line-height: 1.56; }
.dialog-copy p { margin: 0; text-align: center; }
.dialog-copy ol { margin: 0; padding-inline-start: 1.35em; }
.dialog-copy ol li + li { margin-top: 7px; }
.character-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.character-list li {
  display: flex;
  align-items: center;
  min-height: 43px;
  gap: 7px;
  padding: 5px;
  border: 1px solid #e4d7ac;
  border-radius: 8px;
  background: #fff5d7;
  font-size: .81rem;
  line-height: 1.35;
  font-weight: 720;
}
.character-list img { flex: 0 0 25px; width: 25px; height: 30px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.dialog-button { flex: 1 0 auto; min-height: 44px; padding: 8px 14px; font-size: .91rem; font-weight: 790; border-radius: 10px; }
.dialog-button[hidden] { display: none; }
.primary { background: var(--leaf); color: #fff9e6; border: 1px solid var(--leaf); }
.secondary { background: #fff3c7; border: 1px solid #b59d62; }

@media (hover: hover) {
  .small-button:hover, .station:not(:disabled):hover, .tool-button:not(:disabled):hover, .secondary:hover { background: #ffe69c; }
  .primary:hover { background: #327052; }
  .tile:not(:disabled):hover { box-shadow: inset 0 0 0 2px #fffdf6, 0 3px 0 #836137, 0 4px 6px #46352252; }
}
@media (min-width: 850px) and (max-height: 790px) {
  .layout { padding-top: 22px; padding-bottom: 27px; }
  .board { width: min(100%, 475px, 55dvh); }
}
@media (max-width: 849px) {
  .topbar { max-width: 580px; padding: 10px 15px 0; }
  .wordmark { font-size: .7rem; letter-spacing: .14em; gap: 8px; }
  .check-mark { width: 20px; height: 20px; background-size: 10px 10px; }
  .small-button { min-height: 39px; padding: 0 9px; font-size: .78rem; }
  .layout { display: block; min-height: unset; max-width: 580px; padding: 8px 13px max(19px, env(safe-area-inset-bottom)); }
  .intro { position: relative; margin: 0 0 11px; }
  .intro-copy { padding: 7px 2px 6px; position: relative; z-index: 1; }
  h1 { font-size: clamp(2.05rem, 8.7vw, 3.4rem); line-height: 1.14; }
  h1 span { display: inline-block; }
  h1 .title-accent { margin-left: .09em; }
  .intro-copy p { max-width: min(68%, 340px); margin: 6px 0 0; font-size: clamp(.76rem, 3.1vw, .95rem); line-height: 1.45; }
  .hero { position: absolute; top: -3px; right: 3px; width: min(32%, 149px); height: auto; aspect-ratio: 1.53; margin: 0; }
  .hero-card { border-width: 1px; box-shadow: inset 0 0 0 1px #fffef591, 1px 2px 0 var(--ink); }
  .hero-rose { filter: drop-shadow(1px 2px 0 #4d3a2d35); }
  .hero-cloth { border-width: 1px; box-shadow: 1px 2px #84231b29; background-size: 11px 11px; border-radius: 4px; }
  .sparkle-one { width: 12px; }
  .sparkle-two, .sparkle-three { width: 7px; }
  .stations { max-width: none; gap: 7px; margin-top: 5px; }
  .station { min-height: 44px; padding: 5px 6px; column-gap: 5px; }
  .station img { width: 21px; height: 23px; }
  .station strong { font-size: .76rem; }
  .station small { font-size: .64rem; margin-top: 1px; }
  .game { border-radius: 17px; padding: 10px; box-shadow: 3px 4px 0 var(--ink); }
  .stage-name { gap: 7px; }
  .level-number { min-width: 27px; height: 27px; }
  progress { margin: 8px 0; }
  .play-area { padding: 6px 5px 9px; border-radius: 11px; }
  .board { width: min(100%, 440px); }
  .basket { margin-top: 8px; padding: 7px; }
  .basket-heading { margin-bottom: 5px; }
  .tool-button { min-height: 39px; gap: 5px; }
  .toolbar { margin-top: 8px; gap: 6px; }
  .game-note { margin-top: 7px; }
}
@media (max-width: 370px) {
  .layout { padding-inline: 9px; }
  .game { padding: 8px; }
  .station { padding-inline: 4px; }
  .station img { width: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
