:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --cream: #f8edcf;
  --paper: #f1dfb4;
  --brown: #5c3a28;
  --brown-2: #826148;
  --mint: #7daa8d;
  --mint-dark: #426f5d;
  --amber: #d3963c;
  --red: #b95e48;
  --blue: #c8d8d1;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overscroll-behavior: none; }
body {
  min-height: 100vh;
  background: radial-gradient(circle at 50% 10%, #f6ecd6 0, #d8c09e 52%, #9d765b 100%);
  color: var(--brown);
}
button { font: inherit; color: inherit; }
.page-shell { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 10px; padding: 10px; }
.game {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 390 / 844;
  overflow: hidden;
  border: 4px solid #5f3a29;
  border-radius: 26px;
  background: #c7d8c9;
  box-shadow: 0 24px 55px rgb(75 43 28 / .34), inset 0 0 0 2px rgb(255 246 216 / .28);
  touch-action: none;
  user-select: none;
  isolation: isolate;
}
.game.shake { animation: shake .24s ease; }
.scene { position: absolute; inset: 0; background-position: center; background-repeat: no-repeat; background-size: cover; z-index: -4; }
.kitchen-scene { background-image: url("assets/generated/kitchen-scene.png"); }
.map-scene { background-image: url("assets/generated/food-street-map.png"); }
.board-scene { background-image: url("assets/generated/food-street-map.png"); filter: blur(2px) saturate(.85); transform: scale(1.025); }
.kitchen-vignette { position: absolute; inset: 0; z-index: -3; background: linear-gradient(180deg, rgb(39 22 12 / .08), transparent 36%, rgb(63 35 21 / .12)); pointer-events: none; }
.map-wash, .board-wash { position: absolute; inset: 0; z-index: -3; pointer-events: none; }
.map-wash { background: linear-gradient(180deg, rgb(255 248 214 / .05), transparent 55%, rgb(45 69 47 / .22)); }
.board-wash { background: linear-gradient(180deg, rgb(239 226 188 / .6), rgb(197 216 200 / .82)); }
.desktop-hint { margin: 0; max-width: 430px; text-align: center; color: #6d4b34; font-size: 13px; line-height: 1.45; }

.hud {
  position: absolute;
  z-index: 20;
  left: 7px;
  right: 7px;
  top: max(7px, env(safe-area-inset-top));
  height: 43px;
  display: flex;
  align-items: center;
  gap: 5px;
  filter: drop-shadow(0 2px 2px rgb(67 43 26 / .25));
}
.level-badge, .resource {
  height: 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.level-badge { width: 55px; border-radius: 8px 16px 16px 8px; display: flex; align-items: center; justify-content: center; gap: 3px; }
.level-badge span { font-size: 8px; color: #8a6349; }
.level-badge strong { font-size: 18px; }
.resource { min-width: 71px; display: flex; align-items: center; justify-content: center; padding: 1px 8px 1px 3px; gap: 1px; background: url("assets/generated/ui-panel-resource-v1.png") center / 100% 100% no-repeat; }
.resource strong { min-width: 27px; text-align: center; font-size: 13px; }
.atlas-icon {
  display: inline-block;
  background: url("assets/generated/item-atlas-v3.png") var(--atlas-x) var(--atlas-y) / 400% 400% no-repeat;
  background-origin: border-box;
}
.ui-icon {
  display: inline-block;
  background: url("assets/generated/ui-atlas-v1.png") var(--atlas-x) var(--atlas-y) / 400% 400% no-repeat;
  background-origin: border-box;
  pointer-events: none;
}
.resource-icon { width: 31px; height: 31px; flex: 0 0 auto; }
.level-badge { position: relative; isolation: isolate; border: 0; background: transparent; box-shadow: none; }
.level-crest { position: absolute; z-index: -1; width: 72px; height: 58px; left: -9px; top: -12px; filter: drop-shadow(0 2px 1px rgb(68 40 24 / .28)); }
.gem-icon { width: 29px; height: 29px; margin-left: -2px; filter: drop-shadow(0 1px 1px rgb(77 36 30 / .22)); }
.reset-button { margin-left: auto; width: 43px; height: 43px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; }
.reset-icon { width: 46px; height: 46px; filter: drop-shadow(0 2px 1px rgb(68 40 24 / .28)); }

.tutorial-order { position: absolute; z-index: 8; top: 55px; left: 68px; right: 68px; }
.order-card {
  position: relative;
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 42px 53px 1fr 40px;
  align-items: center;
  gap: 3px;
  border: 0;
  border-radius: 0;
  background: url("assets/generated/ui-panel-order-v1.png") center / 100% 100% no-repeat;
  box-shadow: none;
  padding: 8px 10px;
  cursor: pointer;
  overflow: hidden;
}
.order-card.ready { animation: readyGlow 1.1s ease-in-out infinite; }
.customer-stamp { width: 45px; height: 45px; margin-left: -2px; filter: drop-shadow(0 2px 1px rgb(68 40 24 / .2)); }
.order-item { width: 52px; height: 52px; }
.order-copy { display: grid; text-align: left; gap: 3px; min-width: 0; }
.order-copy strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-copy span { font-size: 9px; color: #886047; }
.reward { align-self: stretch; border-left: 1px dashed #d7a765; display: grid; align-content: center; justify-items: center; font-size: 11px; }
.reward-coin { width: 27px; height: 27px; }
.reward b { margin-top: -4px; }
.ready-seal { position: absolute; z-index: 3; right: 1px; top: -1px; width: 25px; height: 25px; filter: drop-shadow(0 1px 1px rgb(68 40 24 / .22)); }
.chef-status { position: absolute; z-index: 5; top: 421px; left: 50%; transform: translateX(-50%); min-width: 160px; min-height: 34px; padding: 3px 15px 3px 7px; background: url("assets/generated/ui-panel-resource-v1.png") center / 100% 100% no-repeat; color: #68472e; font-size: 11px; letter-spacing: .05em; filter: drop-shadow(0 2px 1px rgb(62 39 24 / .24)); display: flex; align-items: center; justify-content: center; gap: 2px; }
.steam-emblem { width: 27px; height: 27px; flex: 0 0 auto; }

.board-wrap { position: absolute; z-index: 7; }
.tutorial-board-wrap { left: 7px; right: 7px; bottom: 6px; }
.speech-panel {
  min-height: 52px;
  margin: 0 8px -5px;
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 51px 1fr;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: url("assets/generated/ui-panel-dialog-v1.png") center / 100% 100% no-repeat;
  padding: 6px 22px 8px;
  filter: drop-shadow(0 3px 1px rgb(73 44 27 / .2));
}
.speech-panel p, .map-dialog p, .message-strip p { margin: 0; font-size: 11px; line-height: 1.4; }
.mini-goose { width: 49px; height: 49px; margin: -4px 0 -3px -4px; filter: drop-shadow(0 2px 1px rgb(68 40 24 / .2)); }
.merge-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  gap: 2px;
  padding: 5px;
  border: 4px solid #6c4634;
  border-radius: 14px;
  background-color: #9fbdb4;
  background-image: repeating-linear-gradient(7deg, rgb(54 91 81 / .035) 0 1px, transparent 1px 5px);
  box-shadow: inset 0 0 0 3px #cdd9c8, 0 5px 0 rgb(74 41 25 / .26);
  overflow: hidden;
}
.tutorial-board-wrap .merge-board { height: 235px; }
.cell { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; border-radius: 8px; }
.cell.open { background: rgb(211 223 207 / .66); box-shadow: inset 0 0 0 1px rgb(70 104 93 / .18); }
.cell.blocked { background: #8da89f; box-shadow: inset 0 0 0 1px rgb(65 84 76 / .3); }
.crate-icon { width: 100%; height: 100%; filter: saturate(.78) brightness(.94); }
.crate-button { width: 100%; height: 100%; position: relative; display: grid; place-items: center; padding: 0; border: 0; background: transparent; cursor: pointer; overflow: hidden; }
.crate-button > .crate-icon { position: absolute; inset: 0; z-index: 2; transition: transform .16s ease, filter .16s ease; }
.crate-button:hover > .crate-icon { transform: scale(1.04); filter: saturate(.9) brightness(1.04); }
.crate-button.hp-1 > .crate-icon { filter: saturate(.7) brightness(1.08); }
.crate-peek { position: absolute; z-index: 3; width: 46%; height: 46%; display: grid; place-items: center; border: 2px solid #70442f; border-radius: 50%; background: #dfc995; box-shadow: 0 1px 0 rgb(255 249 222 / .38) inset, 0 2px 4px rgb(72 39 21 / .24); }
.crate-hidden-icon { width: 142%; height: 142%; }
.crate-lock-art { position: absolute; z-index: 5; left: -3px; top: -3px; width: 27px; height: 27px; filter: drop-shadow(0 1px 1px rgb(58 34 21 / .26)); }
.crate-cost { position: absolute; z-index: 4; right: 1px; bottom: 1px; min-width: 27px; height: 18px; display: flex; align-items: center; justify-content: center; gap: -2px; border: 0; background: url("assets/generated/ui-panel-resource-v1.png") center / 100% 100% no-repeat; font-size: 8px; filter: drop-shadow(0 1px 1px rgb(62 34 19 / .22)); }
.crate-energy-icon { width: 18px; height: 18px; margin-left: -4px; }
.crate-cost b { margin-left: -3px; }
.board-item { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; position: relative; display: grid; place-items: center; cursor: grab; touch-action: none; }
.board-item:active { cursor: grabbing; }
.board-item > .atlas-icon { width: 96%; height: 96%; filter: saturate(.88) drop-shadow(0 2px 1px rgb(87 44 24 / .2)); transition: transform .15s ease; }
.board-item:hover > .atlas-icon { transform: scale(1.07); }
.board-item.dragging { opacity: .25; }
.board-item.pulse::after { content: ""; position: absolute; inset: 3px; border: 3px solid #e3c56c; border-radius: 12px; box-shadow: 0 0 0 2px rgb(255 244 209 / .48), 0 0 10px rgb(227 197 108 / .58); animation: pulseRing 1.1s ease-in-out infinite; }
.board-item.generator::before { content: ""; position: absolute; inset: 4px; border-radius: 13px; background: rgb(229 203 119 / .18); box-shadow: 0 0 9px rgb(208 170 75 / .45); }
.generator-tag { position: absolute; z-index: 3; left: 50%; bottom: -5px; width: 42px; height: 24px; transform: translateX(-50%); display: grid; place-items: center; color: #4e3524; font-size: 8px; font-weight: 900; }
.generator-tag-art { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 1px 1px rgb(58 34 21 / .2)); }
.generator-tag b { position: relative; z-index: 2; font-size: 7px; }
.drag-ghost { position: absolute; z-index: 80; width: 54px !important; height: 54px !important; transform: translate(-50%, -58%) scale(1.14); pointer-events: none; opacity: .9; filter: drop-shadow(0 8px 4px rgb(58 31 16 / .28)); }

.modal-backdrop { position: absolute; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: rgb(42 27 17 / .67); backdrop-filter: blur(3px); }
.dish-card { width: 100%; min-height: 485px; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; border: 0; background: url("assets/generated/ui-reward-frame-v1.png") center / 100% 100% no-repeat; filter: drop-shadow(0 18px 20px rgb(30 17 10 / .42)); padding: 44px 36px 36px; overflow: visible; animation: modalIn .38s cubic-bezier(.2,.8,.2,1); }
.dish-glow { position: absolute; z-index: 0; width: 260px; height: 260px; top: 29px; opacity: .72; filter: drop-shadow(0 0 9px rgb(225 170 62 / .44)); animation: spin 12s linear infinite; }
.dish-hero { position: relative; z-index: 1; width: 205px; height: 205px; filter: drop-shadow(0 12px 6px rgb(100 45 20 / .27)); animation: dishFloat 1.8s ease-in-out infinite; }
.eyebrow { margin: -4px 0 4px; padding: 4px 14px; border-radius: 13px; background: #e56a4e; color: white; font-weight: 800; font-size: 11px; letter-spacing: .15em; }
.eyebrow, .dish-card h2, .dish-card > p, .dish-reward, .primary-button { position: relative; z-index: 2; }
.dish-card h2 { margin: 6px 0; font-family: "STKaiti", "KaiTi", serif; font-size: 24px; color: #743b24; }
.dish-card > p:not(.eyebrow) { margin: 4px 0 12px; font-size: 12px; line-height: 1.65; color: #8a5d42; }
.dish-reward { display: flex; align-items: center; gap: 3px; height: 40px; }
.dish-reward .reward-coin { width: 38px; height: 38px; }
.dish-reward strong { font-size: 20px; color: #a66c18; }
.dish-reward span { margin-left: 4px; font-size: 10px; color: #906545; }
.primary-button { min-width: 190px; min-height: 54px; margin-top: auto; border: 0; background: url("assets/generated/ui-panel-button-v1.png") center / 100% 100% no-repeat; color: #31493c; font-weight: 900; padding: 12px 28px; filter: drop-shadow(0 4px 1px rgb(58 44 28 / .25)); cursor: pointer; }

.map-title { position: absolute; z-index: 4; top: 57px; left: 15px; min-width: 145px; padding: 17px 24px 18px; border: 0; background: url("assets/generated/ui-panel-order-v1.png") center / 100% 100% no-repeat; filter: drop-shadow(0 5px 8px rgb(52 48 29 / .18)); }
.map-title p, .map-title h1, .map-title span { margin: 0; }
.map-title p { color: #b36d32; font-size: 9px; font-weight: 900; letter-spacing: .2em; }
.map-title h1 { font-family: "STKaiti", "KaiTi", serif; font-size: 25px; }
.map-title span { color: #80624a; font-size: 10px; }
.stall-marker { position: absolute; z-index: 6; top: 278px; right: 20px; width: 180px; min-height: 174px; border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; filter: drop-shadow(0 5px 4px rgb(41 39 24 / .25)); }
.marker-aura { position: absolute; z-index: 0; top: -4px; width: 132px; height: 132px; opacity: .66; animation: markerRing 1.55s ease-out infinite; }
.map-marker-art { position: absolute; z-index: 1; inset: -8px 5px auto; width: 170px; height: 170px; }
.stall-marker strong, .stall-marker small { position: absolute; z-index: 2; text-align: center; }
.stall-marker strong { bottom: 25px; width: 112px; padding: 3px 5px; color: #654324; text-shadow: 0 1px rgb(255 240 189 / .6); }
.stall-marker small { bottom: 2px; width: 118px; padding: 3px 4px; border: 2px solid #75472e; border-radius: 8px; background: rgb(242 224 183 / .94); color: #76543d; font-size: 9px; }
.map-dialog { position: absolute; z-index: 8; left: 13px; right: 13px; bottom: 82px; display: grid; grid-template-columns: 51px 1fr; gap: 7px; align-items: center; min-height: 66px; border: 0; background: url("assets/generated/ui-panel-dialog-v1.png") center / 100% 100% no-repeat; filter: drop-shadow(0 4px 1px rgb(78 47 31 / .2)); padding: 8px 22px; }
.bottom-nav { position: absolute; z-index: 9; left: 0; right: 0; bottom: 0; height: 69px; display: grid; grid-template-columns: 1fr 1fr; background: linear-gradient(#e8d5a8, #c89558); border-top: 3px solid #72462f; box-shadow: inset 0 2px 0 rgb(255 242 207 / .45); }
.bottom-nav button { border: 0; border-right: 1px solid rgb(110 67 42 / .3); background: transparent; display: grid; grid-template-columns: 48px auto; place-content: center; align-items: center; gap: 2px; cursor: pointer; }
.bottom-nav button.active { background: rgb(125 170 141 / .35); }
.bottom-nav strong { font-size: 11px; }
.nav-shop, .nav-bowl { width: 48px; height: 48px; filter: drop-shadow(0 2px 1px rgb(65 39 24 / .22)); }

.main-orders { position: absolute; z-index: 8; top: 56px; left: 8px; right: 8px; height: 75px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.order-card.compact { min-height: 72px; grid-template-columns: 31px 43px 1fr; padding: 7px 9px; }
.order-card.compact .customer-stamp { width: 35px; height: 35px; margin-left: -4px; }
.order-card.compact .order-item { width: 42px; height: 42px; }
.order-card.compact .order-copy strong { font-size: 9px; }
.order-card.compact .order-copy span { font-size: 8px; }
.order-card.compact .reward { position: absolute; right: 10px; bottom: 7px; display: flex; align-items: center; border: 0; }
.order-card.compact .reward-coin { width: 20px; height: 20px; }
.main-board-wrap { top: 139px; left: 6px; right: 6px; bottom: 59px; }
.main-board-wrap .merge-board { height: 100%; border-color: #78513d; border-radius: 15px; background-color: #a8beb3; }
.main-board-wrap .merge-board .cell { border-radius: 6px; }
.board-footer { position: absolute; z-index: 10; left: 5px; right: 5px; bottom: 6px; height: 48px; display: grid; grid-template-columns: 1fr 43px; gap: 5px; }
.message-strip { border: 0; background: url("assets/generated/ui-panel-dialog-v1.png") center / 100% 100% no-repeat; filter: drop-shadow(0 2px 1px rgb(68 40 24 / .22)); display: grid; grid-template-columns: 42px 1fr; align-items: center; padding: 5px 19px; }
.tool-icon { width: 37px; height: 37px; margin-left: -4px; filter: drop-shadow(0 2px 1px rgb(65 39 24 / .2)); }
.trash-button { border: 0; padding: 0; background: transparent; display: grid; place-items: center; cursor: pointer; }
.trash-art { width: 48px; height: 48px; filter: drop-shadow(0 2px 1px rgb(65 39 24 / .25)); }

@keyframes pulseRing { 0%, 100% { transform: scale(.88); opacity: .55; } 50% { transform: scale(1.04); opacity: 1; } }
@keyframes readyGlow { 0%, 100% { filter: drop-shadow(0 0 2px rgb(218 191 99 / .45)); } 50% { filter: drop-shadow(0 0 7px rgb(218 191 99 / .7)); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(35px) scale(.88); } to { opacity: 1; transform: none; } }
@keyframes dishFloat { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-8px) rotate(1deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes markerRing { 0% { transform: scale(.65); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }

@media (max-width: 430px) {
  .page-shell { padding: 0; display: block; }
  .game { width: 100vw; height: 100dvh; max-height: none; border: 0; border-radius: 0; aspect-ratio: auto; }
  .desktop-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
