:root {
  color-scheme: light;
  --paper: #fbf8ed;
  --ink: #233b2a;
  --muted: #526553;
  --green: #244633;
  --yellow: #f8d45b;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Heiti SC", sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid #4b6e4f; outline-offset: 4px; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }

.topbar { border-bottom: 1px solid #e5e2d3; }
.header-inner, .game { width: min(1140px, calc(100% - 80px)); margin-inline: auto; }
.header-inner { min-height: 77px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: inline-flex; gap: 11px; align-items: center; }
.brand-mark {
  background: var(--green);
  border-radius: 12px;
  width: 43px;
  height: 43px;
  display: grid;
  place-content: center;
  grid-template: repeat(2, 8px) / repeat(2, 8px);
  gap: 3px;
  transform: rotate(-6deg);
}
.brand-mark i { display: block; background: #f9db6f; border-radius: 2px 4px 2px 4px; }
.brand-mark i:nth-child(2) { transform: translate(1px, -3px) rotate(23deg); }
.brand-mark i:nth-child(3) { transform: translate(-1px, 1px) rotate(-14deg); }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 20px; font-weight: 850; letter-spacing: .04em; line-height: 1.15; }
.brand-copy > span {
  font: 750 10px/1.2 system-ui, sans-serif;
  letter-spacing: .16em;
  color: var(--muted);
}
.sound-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 41px;
  padding: 0 14px;
  border: 1px solid #d7d9ca;
  background: #fffdf5;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
}
.sound-button:hover { background: #f2f3e6; }
.sound-icon { display: inline-flex; align-items: center; gap: 2px; height: 16px; }
.sound-icon i { display: block; background: #426b4e; height: 8px; width: 2px; border-radius: 3px; }
.sound-icon i:nth-child(2) { height: 13px; }
.sound-icon i:nth-child(3) { height: 10px; }
.sound-button[aria-pressed="false"] .sound-icon i { height: 2px; background: #737e70; }

.game { padding-block: 37px 42px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 22px; padding-bottom: 27px; }
.intro h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(37px, 4.6vw, 63px);
  letter-spacing: -.09em;
  line-height: 1.16;
}
.intro h1 > span { display: inline-block; white-space: nowrap; }
.exclamation { color: #ce731f; }
.intro p { margin: 11px 0 0; font-size: 16px; line-height: 1.55; color: var(--muted); }
.counter {
  display: grid;
  grid-template-columns: 40px max-content;
  grid-template-rows: auto auto;
  column-gap: 11px;
  align-items: center;
  flex-shrink: 0;
  min-width: 147px;
  padding: 10px 15px 10px 10px;
  border-radius: 15px;
  border: 1px solid #e6dfc6;
  background: #fffdf3;
  font-size: 14px;
}
.counter-mark {
  grid-row: span 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: #f9e9af;
  border-radius: 11px;
  color: #725118;
  font: 24px/1 system-ui, sans-serif;
}
.counter-label { color: var(--muted); }
.counter-value { line-height: 1; }
.counter-value b { font: 830 26px/.95 system-ui, sans-serif; font-variant-numeric: tabular-nums; }

.game-layout { display: grid; grid-template-columns: minmax(0, 2.16fr) minmax(295px, 1fr); gap: 21px; align-items: stretch; }
.tabletop {
  --surface: #dce9d6;
  --dot: #9bb39a;
  --plate: #f9f4d9;
  --plate-rim: #eee7c7;
  --scene: #779778;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  min-height: 545px;
  padding: 22px 25px 20px;
  border-radius: 27px;
  border: 1px solid #879f84;
  background-color: var(--surface);
  background-image: radial-gradient(color-mix(in srgb, var(--dot) 55%, transparent) 1px, transparent 1.25px);
  background-size: 17px 17px;
  background-position: 8px 8px;
  box-shadow: 0 3px 0 #e4e6d1;
  transition: background-color .22s;
}
.stage-header { display: flex; justify-content: space-between; align-items: start; gap: 10px; z-index: 2; pointer-events: none; }
.stage-label { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 740; color: #476548; }
.stage-label span { width: 7px; height: 7px; border-radius: 50%; background: #648b55; }
.stage-header h2 { margin: 4px 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.18; letter-spacing: -.055em; }
.stage-header p { margin: 0; color: #455d49; font-size: 14px; }
.food-status {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 11px;
  border: 1px solid #a9bc9f;
  background: #f3f6e7;
  border-radius: 21px;
  font-weight: 750;
  font-size: 14px;
  white-space: nowrap;
}
.food-status::before { content: ""; border-radius: 50%; width: 7px; height: 7px; background: #5b8756; }
.tabletop[data-state="crushed"] .food-status { color: #6b481f; border-color: #c8ae75; background: #fff2ce; }
.tabletop[data-state="crushed"] .food-status::before { background: #b96f26; }

.playfield { position: relative; display: grid; place-items: center; align-self: stretch; min-height: 309px; }
.plate {
  position: absolute;
  left: 50%;
  top: 60%;
  width: min(83%, 480px);
  aspect-ratio: 2.19;
  transform: translate(-50%, -50%) rotate(-6deg);
  border-radius: 50%;
  background: radial-gradient(ellipse at 48% 41%, #fffdf2 0%, var(--plate) 59%, var(--plate-rim) 84%);
  border: 1px solid #dcd5ae;
  box-shadow: 5px 14px 0 #29472317, 0 5px 0 #e8e0bc, inset 0 0 0 11px #fff9e8, inset 0 0 0 12px #ddd8b5;
}
.plate::after { content: ""; position: absolute; inset: 14% 8%; border: 1px solid #dfd5ac; border-radius: 50%; }
.scenery { position: absolute; color: var(--scene); line-height: 1; font-family: system-ui, sans-serif; user-select: none; pointer-events: none; }
.sparkle-one { top: 26%; left: 17%; font-size: 28px; transform: rotate(-13deg); }
.sparkle-two { top: 13%; right: 22%; font-size: 25px; }
.sparkle-three { right: 12%; bottom: 23%; font-size: 16px; }
.sparkle-four { left: 13%; bottom: 27%; font-size: 12px; opacity: .62; }
.food-target {
  border: 0;
  background: transparent;
  padding: 0;
  position: absolute;
  width: min(74%, 390px);
  height: 92%;
  top: 1%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  border-radius: 41%;
}
.food-target:disabled { visibility: hidden; pointer-events: none; }
.whole-food {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(7px 16px 10px #302b232e) drop-shadow(2px 4px 2px #40391e22);
  transition: filter .18s;
}
.food-target:hover .whole-food { filter: drop-shadow(7px 17px 12px #302b2340) drop-shadow(2px 5px 2px #40391e24); }
.crushed-food {
  position: absolute;
  left: 50%;
  top: 61%;
  width: min(63%, 350px);
  height: 59%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  filter: drop-shadow(4px 9px 5px #40301e3d);
  visibility: hidden;
  user-select: none;
  pointer-events: none;
}
.tabletop[data-state="crushed"] .crushed-food { visibility: visible; }
#effects { width: 100%; height: 100%; position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.crack-word {
  position: absolute;
  z-index: 5;
  top: 19%;
  left: 50%;
  font-size: clamp(30px, 5vw, 54px);
  font-weight: 900;
  letter-spacing: -.1em;
  color: #fff0ba;
  -webkit-text-stroke: 1.5px #683b23;
  paint-order: stroke fill;
  text-shadow: 2px 3px #9b472b;
  pointer-events: none;
  opacity: 0;
}
.crack-word.pop { animation: crack .47s ease-out both; }
@keyframes crack {
  0% { opacity: 0; transform: translate(-46%, 22px) rotate(-9deg) scale(.64); }
  13%, 56% { opacity: 1; }
  19% { transform: translate(-48%, 0) rotate(-9deg) scale(1.13); }
  100% { opacity: 0; transform: translate(-51%, -31px) rotate(-9deg) scale(.91); }
}

.action-area { display: grid; justify-items: center; gap: 9px; z-index: 6; }
.action-button {
  min-height: 52px;
  min-width: 194px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 22px;
  border: 1px solid #283b26;
  border-radius: 15px;
  background: var(--yellow);
  box-shadow: 0 4px 0 #314a32;
  font-size: 18px;
  font-weight: 850;
  touch-action: manipulation;
  transition: background .16s, transform .13s, box-shadow .13s;
}
.action-button:hover { background: #ffdf72; }
.action-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #314a32; }
.tabletop[data-state="crushed"] .action-button { background: #fff7db; }
.tabletop[data-state="crushed"] .action-button:hover { background: #f9e8b0; }
.action-icon { font: 700 23px/1 system-ui, sans-serif; }
#action-hint { font-size: 14px; color: #456049; margin: 4px 0 0; text-align: center; }

.menu {
  background: #fffdf5;
  border: 1px solid #e0ddcd;
  border-radius: 27px;
  padding: 20px 16px 16px;
  box-shadow: 0 3px 0 #eeeadb;
}
.menu-header { display: flex; justify-content: space-between; align-items: baseline; gap: 7px; padding: 0 4px 15px; }
.menu-header h2 { margin: 0; font-size: 22px; font-weight: 850; letter-spacing: -.06em; }
.menu-header > span { color: #566958; font-size: 14px; }
.menu-items { display: grid; gap: 7px; }
.menu-item {
  display: grid;
  grid-template-columns: 53px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  text-align: left;
  border: 1px solid #e8e6d9;
  background: #fcfaf0;
  border-radius: 14px;
  padding: 6px 10px 6px 7px;
  touch-action: manipulation;
}
.menu-item:hover { background: #f2f3e5; }
.menu-item[aria-pressed="true"] { border-color: #90aa84; background: #e8efdf; }
.menu-thumb {
  width: 53px;
  height: 53px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--thumb);
}
.menu-thumb img {
  display: block;
  width: 85%;
  height: 85%;
  object-fit: contain;
  filter: drop-shadow(1px 3px 2px #41312f33);
}
.menu-copy { display: grid; gap: 4px; }
.menu-copy strong { font-size: 16px; line-height: 1.15; font-weight: 800; }
.menu-copy > span { color: #536858; font-size: 14px; line-height: 1.15; }
.menu-indicator {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid #d6d9c6;
  border-radius: 50%;
  color: #fffdf0;
  font: 750 12px/1 system-ui, sans-serif;
}
.menu-item[aria-pressed="true"] .menu-indicator { border-color: #41694a; background: #41694a; }
.menu-item[data-crushed="true"]:not([aria-pressed="true"]) .menu-indicator { border-color: #e4d2a5; color: #705123; background: #f8efda; }

@media (max-width: 900px) {
  .header-inner, .game { width: calc(100% - 44px); }
  .game-layout { grid-template-columns: minmax(0, 1.56fr) minmax(262px, 1fr); gap: 15px; }
  .tabletop { padding-inline: 19px; }
  .menu { padding-inline: 11px; }
}
@media (max-width: 680px) {
  .header-inner, .game { width: calc(100% - 30px); }
  .header-inner { min-height: 60px; }
  .brand-mark { width: 35px; height: 35px; border-radius: 9px; }
  .brand-copy strong { font-size: 17px; }
  .brand-copy > span { font-size: 9px; }
  .sound-button { min-height: 36px; }
  .game { padding-block: 22px 32px; }
  .intro { align-items: center; gap: 8px; padding-bottom: 16px; }
  .intro h1 { font-size: clamp(28px, 6.9vw, 44px); letter-spacing: -.095em; }
  .intro p { font-size: 14px; line-height: 1.45; margin-top: 7px; }
  .counter { min-width: 0; padding: 6px 8px; grid-template-columns: max-content; text-align: center; border-radius: 11px; }
  .counter-mark { display: none; }
  .counter-label { font-size: 13px; }
  .counter-value b { font-size: 24px; }
  .game-layout { grid-template-columns: 1fr; gap: 15px; }
  .tabletop { min-height: 0; padding: 15px 15px 14px; border-radius: 22px; }
  .playfield { min-height: clamp(214px, 58vw, 320px); }
  .food-target { width: min(86%, 340px); height: 95%; }
  .crushed-food { width: min(72%, 310px); }
  .stage-header h2 { font-size: 26px; }
  .plate { width: min(88%, 460px); }
  .sparkle-one { left: 11%; }
  .sparkle-two { right: 12%; }
  .action-button { min-height: 46px; min-width: 172px; }
  .action-area { gap: 7px; }
  .menu { border-radius: 22px; padding: 14px 10px 11px; }
  .menu-header { padding-bottom: 10px; }
  .menu-header h2 { font-size: 20px; }
  .menu-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .menu-item { grid-template-columns: 38px minmax(0, 1fr); gap: 6px; min-height: 59px; padding: 5px; position: relative; }
  .menu-thumb { width: 38px; height: 43px; }
  .menu-copy strong { font-size: 14px; }
  .menu-copy > span { font-size: 13px; }
  .menu-indicator { display: none; }
  .menu-item[data-crushed="true"] .menu-copy > span { color: #7b5725; }
}
@media (max-width: 335px) {
  .header-inner, .game { width: calc(100% - 20px); }
  .intro h1 { font-size: 25px; }
  .menu-items { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.tabletop.bursting .crushed-food { animation: settle .33s ease-out both; }
@keyframes settle {
  0%, 23% { opacity: 0; }
  100% { opacity: 1; }
}

/* The warped texture is drawn over the food hit area while it is being squeezed. */
.tabletop[data-deformed="true"] .whole-food { opacity: 0; }
.tabletop[data-state="pressing"] .food-status {
  background: #fff4d4;
  border-color: #c2aa72;
  color: #624d22;
}
.tabletop[data-state="pressing"] .food-status::before { background: #b07c3c; }
.action-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.action-button::before {
  position: absolute;
  z-index: -1;
  content: "";
  inset: 0;
  background: #e8a94a;
  transform: scaleX(var(--pressure, 0));
  transform-origin: left;
}
.tabletop[data-state="crushed"] .action-button::before { visibility: hidden; }
.food-target:not(:disabled) { cursor: grab; }
.food-target:active { cursor: grabbing; }
