@font-face {
  font-family: BakeryHand;
  src: url('../assets/BakeryHand-subset.ttf') format('truetype');
  font-weight: 100 950;
  font-display: swap;
}
@font-face {
  font-family: Mali;
  src: url('../assets/Mali-SemiBold.ttf') format('truetype');
  font-weight: 100 950;
  font-display: swap;
}
@font-face {
  font-family: Nunito;
  src: url('../assets/Nunito.ttf') format('truetype');
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #542d19;
  --muted: #95663e;
  --paper: #ffedc9;
  font-family: Mali, BakeryHand, Nunito, 'Microsoft YaHei', 'PingFang SC', sans-serif;
  color: var(--ink);
  background: #bc8050;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}
/* 游戏界面不产生文字选区，也不显示移动端长按文字菜单。 */
* { box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html, body { margin: 0; min-width: 280px; min-height: 100%; }
body { position: relative; isolation: isolate; }
body::before {
  content: ''; position: fixed; z-index: -1; inset: -25px;
  background: url('../assets/bakery-backdrop.webp') center / cover;
  filter: blur(14px) brightness(.8); pointer-events: none;
}
button {
  appearance: none; font: inherit; color: inherit; border: 0; padding: 0;
  cursor: pointer; background: transparent; -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #47754e; outline-offset: 4px; }
img { display: block; user-select: none; -webkit-user-drag: none; }
svg { display: block; width: 24px; height: 24px; flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
#app {
  width: 100%; max-width: 460px; min-height: 100dvh; margin: auto;
  background: url('../assets/bakery-backdrop.webp') center / 100% 100% no-repeat;
  box-shadow: 0 0 75px #5c2f2940; position: relative; isolation: isolate;
}
.game-shell {
  height: 100dvh; min-height: 540px; max-height: 1080px;
  padding: calc(clamp(26px, 4.8dvh, 42px) + env(safe-area-inset-top, 0px)) 11px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 12px;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 4px;
  flex: 0 0 clamp(92px, 13dvh, 115px); position: relative;
}
.shop-sign {
  background: url('../assets/bakery-sign.webp') center / 100% 100% no-repeat;
  width: calc(100% - 90px); max-width: 295px; aspect-ratio: 2.2637;
  display: flex; align-items: center; justify-content: center; padding: 16px 14px 0;
  filter: drop-shadow(0 3px 1px #67371540); transform-origin: top center;
  animation: sign-settle .75s ease-out both; position: relative;
}
.shop-sign::before, .shop-sign::after {
  content: ''; position: absolute; height: 35px; width: 4px; border: 1px solid #704526;
  border-radius: 4px; background: #a37242; bottom: calc(100% - 22px); z-index: -1;
}
.shop-sign::before { left: 21%; }
.shop-sign::after { right: 21%; }
.topbar h1 {
  white-space: nowrap; font-size: clamp(25px, 7.6vw, 34px); font-weight: 950;
  letter-spacing: 1px; line-height: 1; color: #51290f;
  text-shadow: 0 1px #fff5d3, 1px 0 currentColor; transform: rotate(-1deg);
}
html[lang=en] .topbar h1 { font-size: clamp(21px, 6.5vw, 29px); letter-spacing: -.7px; }
.icon-button {
  width: 44px; height: 44px; flex: 0 0 44px; display: flex; align-items: center; justify-content: center;
  border: 2px solid #9a5c31; border-radius: 14px 12px 14px 12px;
  background: linear-gradient(#ffe0a4, #edb879);
  box-shadow: inset 0 2px 0 #fff0c6, inset 0 -3px 0 #db9c5d, 0 4px 0 #824a28, 0 6px 6px #5b32152a;
  transition: transform .12s ease-out, box-shadow .12s ease-out;
}
.icon-button svg { width: 25px; height: 25px; stroke-width: 3; }
.icon-button:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 2px 0 #fff0c6, 0 1px 0 #824a28; }
.topbar button:disabled { opacity: .7; }
.order-note {
  flex: 0 0 auto; padding: 12px 16px 11px; margin: 0 3px;
  background: url('../assets/bakery-paper.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 1px #79512526);
}
.level-line { display: flex; align-items: center; gap: 10px; min-height: 24px; }
.level-label { font-size: 16px; font-weight: 900; white-space: nowrap; }
.progress-track {
  flex: 1; height: 14px; border-radius: 10px; border: 2px solid #a6a66b;
  background: #d0d2a2; box-shadow: inset 0 2px 2px #6e754124, 0 1px #fff2cb; overflow: hidden;
}
.progress-track > span {
  display: block; height: 100%; width: 0; border-radius: 8px;
  background: linear-gradient(#b7d98a, #7eaa5c); transition: width .38s ease-out;
}
.progress-count { font-size: 15px; font-weight: 850; white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-count b { font-weight: 950; }
.guide {
  min-height: 25px; margin-top: 4px; display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 12px; font-weight: 800; line-height: 1.45; color: #855632;
}
.guide.success { color: #4c753c; }
.guide.error { color: #a04132; }
.board-stage {
  flex: 1 1 0; min-height: 190px; display: flex; align-items: center;
  justify-content: center; container-type: size; padding-top: 8px;
}
.sorting-tray {
  --frame-space: 75px;
  --cell-h: clamp(14px, calc((100cqh - var(--frame-space) - (var(--capacity) - 1) * 2px) / var(--capacity)), 44px);
  position: relative; width: min(100%, calc(var(--columns) * 44px + (var(--columns) - 1) * 3px + 40px));
  padding: 8px 1px 0; border: 18px solid transparent;
  border-image: url('../assets/bakery-tray.webp') 12% fill / 23px / 0 stretch;
  filter: drop-shadow(0 6px 1px #81431b40);
  animation: tray-arrive .4s cubic-bezier(.22, .8, .24, 1) both;
}
.board-meta {
  position: absolute; z-index: 3; top: -28px; left: 50%;
  transform: translateX(-50%) rotate(-.7deg); white-space: nowrap;
  padding: 6px 16px; min-width: 138px; text-align: center;
  font-size: 11px; font-weight: 850; line-height: 1.3; border: 2px solid #9d6239;
  border-radius: 9px 7px 8px 6px; color: #653a1f;
  background: linear-gradient(110deg, #edb97b, #ffdaad 46%, #efbb83);
  box-shadow: inset 0 1px #fff0c9, 0 3px 1px #7b472727;
}
.board {
  display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  gap: 3px; align-items: end; isolation: isolate;
}
.column {
  min-width: 0; padding: 3px 1px 0;
  background: linear-gradient(90deg, #f8dbaa, #fff0d0 16%, #fff1d5 75%, #f9dfb3);
  border: 1px solid #d5a46d; border-bottom: 3px solid #b5824c;
  border-radius: 9px 8px 8px 9px; box-shadow: inset 0 2px 2px #ac6e2e12;
  position: relative; touch-action: none;
  transition: background .2s, border-color .15s, box-shadow .15s;
}
.column-slots { display: grid; grid-template-rows: repeat(var(--capacity), var(--cell-h)); gap: 2px; }
.slot { display: flex; align-items: center; justify-content: center; min-width: 0; position: relative; }
.slot:not(.filled)::before {
  content: ''; position: absolute; inset: 3px 2px;
  border: 1px dashed #bb8d5250; border-radius: 6px;
}
.piece {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  position: relative; pointer-events: none; transform-origin: center;
}
.food-image {
  object-fit: contain; width: 100%; height: 100%; max-width: 56px; max-height: 56px;
  pointer-events: none; filter: drop-shadow(0 1px 0 #79512520);
}
.column-label {
  height: 18px; display: flex; align-items: center; justify-content: center;
  color: #92623a; font-size: 11px; font-weight: 900; line-height: 1;
}
.column-label svg { width: 13px; height: 13px; stroke-width: 3.4; }
.complete-check {
  display: flex; align-items: center; justify-content: center; width: 17px; height: 17px;
  background: #6e9450; color: #fff6d8; border-radius: 50%; box-shadow: 0 1px 1px #35582270;
}
.column.completed { background: linear-gradient(90deg, #d1dba3, #e9edc9 40%, #d5e0b5); border-color: #93a566; border-bottom-color: #688545; }
.column.completing { background: var(--paper); border-color: #d5a46d; }
.completing .complete-check { opacity: 0; }
.column.selected { background: #fff0ac; border-color: #b97827; box-shadow: inset 0 0 0 1px #e7b043, 0 -3px 0 #fff2b1, 0 2px 5px #8d551c3b; }
.chosen-piece .piece, .tray.selected .piece { transform: translateY(-5px) rotate(-3deg); transition: transform .12s ease-out; }
.valid-target { border-color: #7a9c51 !important; box-shadow: inset 0 0 0 2px #bacf7c !important; }
.hint-from { outline: 2px dashed #ad671d; outline-offset: 2px; }
.hint-to { outline: 2px dashed #537c3f; outline-offset: 2px; }
.drop-target { box-shadow: 0 0 0 3px #89b35a !important; background: #e5edbd !important; }
.counter-zone { flex: 0 0 auto; position: relative; padding: 0 6px; }
.lower-panel { min-height: 82px; display: flex; align-items: center; justify-content: center; }
.spare-area { display: flex; width: 100%; align-items: center; justify-content: center; gap: 9px; }
.spare-area h2 {
  font-size: 13px; font-weight: 900; white-space: nowrap;
  background: linear-gradient(#ffdc9b, #e6ad6f); border: 2px solid #a16a3f;
  border-radius: 5px 8px 6px 4px; padding: 7px 8px; transform: rotate(-5deg);
  box-shadow: 0 2px 1px #804c292b;
}
.trays { display: flex; gap: 6px; }
.tray {
  width: 76px; height: 61px; display: flex; align-items: center; justify-content: center;
  background: url('../assets/bakery-plate.webp') center / 100% 100% no-repeat;
  position: relative; padding: 9px 15px 13px; touch-action: none;
  border: 2px solid transparent; border-radius: 50%; filter: drop-shadow(0 3px 1px #87512335);
}
.tray-outline { width: 21px; height: 21px; border: 1.5px dashed #bda16f; border-radius: 50%; opacity: .5; }
.tray .food-image { max-width: 43px; max-height: 43px; }
.tray.selected { border-color: #bb842a; }
.tray.valid-target { box-shadow: none !important; border-color: #7c9e52 !important; }
.spare-note {
  white-space: nowrap; text-align: center; font-size: 11px; font-weight: 800; color: #825a36; line-height: 1.35;
  background: url('../assets/bakery-paper.webp') center / 100% 100% no-repeat; padding: 9px 8px;
}
html[lang=en] .spare-area h2 { white-space: normal; max-width: 64px; text-align: center; line-height: 1.15; }
html[lang=en] .spare-note { white-space: normal; max-width: 68px; }
.actions {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px; margin-top: 5px; padding-bottom: 5px;
}
.action-button {
  min-height: 53px; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 6px; border: 2px solid var(--button-edge, #956431);
  border-radius: 17px 15px 18px 15px; color: #573216; font-size: 17px; font-weight: 900; line-height: 1.25;
  background: linear-gradient(120deg, var(--button-light), var(--button-base));
  box-shadow: inset 0 3px 0 #fff7db8a, inset 0 -3px 0 #9b541529, 0 5px 0 var(--button-shadow), 0 7px 3px #6c3d2642;
  transition: transform .12s, filter .12s, box-shadow .12s; position: relative;
}
.action-button svg { width: 25px; height: 25px; stroke-width: 3; }
.action-button:hover:not(:disabled) { filter: brightness(1.045); transform: translateY(-1px); }
.action-button:active:not(:disabled) { transform: translateY(4px); box-shadow: inset 0 1px 0 #fff7db8a, 0 1px 0 var(--button-shadow); }
.action-button:disabled { filter: saturate(.45); opacity: .62; }
.yellow { --button-light: #d4df9d; --button-base: #adc56b; --button-edge: #7a893f; --button-shadow: #607334; }
.blue { --button-light: #ffe4a4; --button-base: #ffcd6a; --button-edge: #a87128; --button-shadow: #986025; }
.pink { --button-light: #ffb19a; --button-base: #f08d73; --button-edge: #af6242; --button-shadow: #985334; }
.thinking svg { animation: thinking .9s ease-in-out infinite; }
.game-footer {
  width: fit-content; min-width: 195px; max-width: 100%; margin: 16px auto 0; padding: 9px 20px;
  text-align: center; font-size: 11px; font-weight: 800; line-height: 1.4; color: #97643b;
  background: url('../assets/bakery-paper.webp') center / 100% 100% no-repeat;
}
.game-footer.save-error { color: #9d3f31; }
.win-summary {
  display: flex; align-items: center; justify-content: center; gap: 11px; padding: 13px 18px;
  background: url('../assets/bakery-paper.webp') center / 100% 100% no-repeat; width: 100%;
}
.win-check {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: #809a56; color: #fff7d9;
  display: flex; align-items: center; justify-content: center; border: 3px double #e3e6b3;
  box-shadow: 0 3px 0 #546c37; transform: rotate(-9deg);
}
.win-check svg { width: 25px; height: 25px; stroke-width: 3; }
.win-summary h2 { font-size: 18px; line-height: 1.35; font-weight: 900; }
.win-summary p { font-size: 12px; color: #97643b; margin-top: 5px; font-weight: 800; }
.win-actions { grid-template-columns: 1fr 1fr; gap: 12px; }
.win-actions .yellow { --button-light: #ffe2a0; --button-base: #ffca6b; --button-edge: #a87128; --button-shadow: #986025; }
.win-actions+.game-footer { visibility: hidden; }
.drag-ghost {
  position: fixed; z-index: 1000; pointer-events: none; width: 58px; height: 58px;
  transform: translate(-50%, -75%) rotate(-5deg); display: flex; align-items: center;
  justify-content: center; filter: drop-shadow(0 4px 3px #532b2340);
}
.drag-ghost img { max-width: 58px; max-height: 58px; }
.drag-ghost>span {
  position: absolute; bottom: -1px; right: -6px; background: #ffe3a6; border: 2px solid #a9713c;
  border-radius: 9px; font-size: 12px; font-weight: 900; min-width: 22px; text-align: center; padding: 1px 4px;
}
.drag-ghost>span:empty { display: none; }
dialog {
  padding: 0; color: var(--ink); border: 3px solid #aa7040;
  border-radius: 23px 19px 22px 20px; width: min(375px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px); overflow: auto; background: #ffedcc;
  box-shadow: inset 0 0 0 4px #fff6dd, 0 7px 0 #82502f, 0 20px 70px #4e291c55;
}
dialog::backdrop { background: #59361e73; backdrop-filter: blur(4px); }
dialog[open] { animation: note-open .24s cubic-bezier(.18, .85, .3, 1.15); }
.dialog-body { position: relative; padding: 28px 21px 23px; }
.dialog-close { position: absolute; right: 8px; top: 8px; width: 36px; height: 36px; min-height: 36px; border-radius: 11px; }
.dialog-close svg { width: 18px; height: 18px; stroke-width: 3; }
dialog h2 { font-size: 24px; line-height: 1.35; font-weight: 900; margin: 8px 0 19px; }
.chapter { margin-top: 20px; }
.chapter h3 { font-size: 13px; color: #96643b; font-weight: 850; margin-bottom: 10px; }
.level-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.level-button {
  display: flex; flex-direction: column; gap: 4px; position: relative; align-items: center; justify-content: center;
  min-height: 65px; border: 2px solid #c39460; border-radius: 12px 10px 12px 10px;
  background: #fff4d9; font-size: 21px; box-shadow: 0 3px 0 #bd8b55, inset 0 2px #fffbed; transition: transform .12s;
}
.level-button small { font-size: 11px; font-weight: 800; color: #99693d; }
.level-button.current { background: #ffdf91; border-color: #b88235; }
.level-button.finished { background: #dce8b5; border-color: #98ac65; box-shadow: 0 3px 0 #839d4c; }
.level-button svg { position: absolute; right: 3px; bottom: 3px; width: 13px; height: 13px; color: #597d37; stroke-width: 3; }
.level-button:hover { transform: translateY(-2px); }
.settings-list { display: grid; gap: 4px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; min-height: 60px;
  border-bottom: 1px dashed #d4b487; font-size: 15px; font-weight: 800; gap: 16px;
}
.setting-value, .sound-switch {
  min-height: 44px; padding: 8px 13px; border: 2px solid #c99b60; border-radius: 12px;
  background: #ffe3aa; font-size: 14px; font-weight: 800; box-shadow: 0 2px #b17f48;
}
.sound-switch { display: flex; align-items: center; gap: 8px; min-width: 85px; justify-content: center; }
.sound-switch.on { background: #d7e4a8; border-color: #9dab6a; box-shadow: 0 2px #82944e; }
.sound-switch svg { width: 19px; height: 19px; }
.help-link { display: flex; align-items: center; gap: 10px; text-align: left; min-height: 58px; font-weight: 800; padding: 0 3px; }
.help-link svg:last-child { margin-left: auto; width: 18px; }
.help-link svg:first-child { width: 20px; }
.settings-note { font-size: 12px; text-align: center; color: #976c46; line-height: 1.5; margin: 23px 0 8px; }
.version-note { font-size: 11px; color: #ad835d; text-align: center; }
.dialog-description { font-size: 14px; line-height: 1.65; color: #91633f; margin-bottom: 23px; }
.dialog-actions { display: grid; gap: 12px; }
.primary, .secondary {
  display: flex; align-items: center; justify-content: center; min-height: 47px; padding: 9px 15px;
  border: 2px solid #be8a3f; border-radius: 13px 11px 13px 11px; font-size: 15px; font-weight: 900;
  background: #ffda8c; box-shadow: 0 3px #aa7836, inset 0 2px #fff0b9;
}
.secondary { border-color: #c3a676; background: #fff3d9; box-shadow: 0 3px #b19564; }
.help-rules { padding-left: 23px; margin: 0 0 20px; display: grid; gap: 15px; line-height: 1.6; font-size: 14px; }
.help-rules li::marker { font-weight: 900; color: #78994d; }
.help-note { font-size: 12px; color: #966d47; line-height: 1.6; margin: 10px 0; }
.help-dialog .primary { width: 100%; margin-top: 20px; }
.loading {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 18px; padding: 30px; text-align: center; color: #8c5b35;
}
.loading strong { font-size: 28px; font-weight: 900; color: var(--ink); }
@keyframes thinking { 50% { transform: rotate(-12deg) scale(1.08); } }
@keyframes sign-settle {
  0% { transform: rotate(-4deg); } 45% { transform: rotate(2deg); }
  75% { transform: rotate(-1deg); } 100% { transform: rotate(0); }
}
@keyframes tray-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes note-open { from { opacity: 0; transform: translateY(12px) scale(.97) rotate(-1deg); } to { opacity: 1; transform: none; } }
@media (max-width: 365px) {
  .game-shell { padding-left: 7px; padding-right: 7px; gap: 9px; }
  .shop-sign { width: calc(100% - 87px); padding-top: 13px; }
  .topbar h1 { font-size: 25px; letter-spacing: 0; }
  html[lang=en] .topbar h1 { font-size: 21px; }
  .order-note { padding-left: 12px; padding-right: 12px; margin: 0 2px; }
  .level-label { font-size: 14px; }
  .progress-count { font-size: 13px; }
  .level-line { gap: 8px; }
  .guide { font-size: 11px; }
  .sorting-tray { --frame-space: 69px; padding-left: 0; padding-right: 0; border-width: 12px; border-image-width: 16px; }
  .board { gap: 2px; }
  .column { padding-left: 0; padding-right: 0; border-radius: 6px; }
  .board-meta { font-size: 10px; padding: 5px 12px; top: -24px; }
  .counter-zone { padding: 0 5px; }
  .spare-area { gap: 6px; }
  .spare-area h2 { padding: 7px 6px; font-size: 12px; }
  .tray { width: 67px; height: 55px; padding: 8px 12px 11px; }
  .spare-note { font-size: 10px; padding: 8px 5px; }
  .actions { gap: 7px; }
  .action-button { min-height: 49px; font-size: 15px; gap: 4px; }
  .action-button svg { width: 23px; height: 23px; }
  .win-summary h2 { font-size: 16px; }
}
@media (max-height: 700px) {
  .game-shell { gap: 8px; padding-top: calc(27px + env(safe-area-inset-top, 0px)); padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .topbar { flex-basis: 82px; }
  .shop-sign { max-width: 235px; }
  .order-note { padding-top: 9px; padding-bottom: 8px; }
  .level-line { min-height: 21px; }
  .guide { margin-top: 2px; min-height: 23px; }
  .lower-panel { min-height: 68px; }
  .game-footer { margin-top: 12px; padding-top: 7px; padding-bottom: 7px; }
  .actions { margin-top: 1px; }
}
@media (max-height: 580px) {
  .game-shell { gap: 6px; padding-top: calc(20px + env(safe-area-inset-top, 0px)); padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .topbar { flex-basis: 68px; }
  .shop-sign { max-width: 178px; }
  .topbar h1 { font-size: 23px; }
  html[lang=en] .topbar h1 { font-size: 19px; }
  .order-note { padding-top: 7px; padding-bottom: 6px; }
  .lower-panel { min-height: 52px; }
  .game-footer { margin-top: 8px; padding-top: 5px; padding-bottom: 5px; font-size: 10px; }
  .board-stage { min-height: 180px; }
  .tray { height: 51px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}


/* 封面与点心地图：首版插画构图，所有文字和关卡均为可交互界面。 */
#app[data-screen=cover] { background: url('../assets/bakery-cover.webp') center / 100% 100% no-repeat; }
.cover-screen { position: relative; z-index: 1; height: 100dvh; min-height: 540px; max-height: 1080px; overflow: hidden; }
.cover-ambience { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; container-type: size; }
.cover-foreground { position: absolute; inset: 0; overflow: hidden; z-index: 2; pointer-events: none; container-type: size; }
.cover-clean-plate { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover-tree { position: absolute; left: -1.2%; top: -1%; width: 54.8%; height: 16.1%; transform-origin: 2% 83%; will-change: transform; }
.tree-main { width: 100%; height: 100%; }
.tree-twig { position: absolute; will-change: transform; }
.twig-a { left: 17.51094%; top: 45.73171%; width: 18.13634%; height: 33.53659%; transform-origin: 46.9% 5.45%; }
.twig-b { left: 46.27892%; top: 38.61789%; width: 16.88555%; height: 30.4878%; transform-origin: 43.7% 6%; }
.cover-plaque { position: absolute; left: 39.64706%; top: 47.71987%; width: 4.70588%; height: 3.4202%; transform-origin: 50% 2%; will-change: transform; }
.cover-steam { position: absolute; left: 51.5%; top: 52.4%; width: 12%; height: 6.4%; overflow: visible; }
.steam-wisp { stroke: #fff2d9; stroke-width: 2; stroke-linecap: round; opacity: 0; filter: blur(.45px); transform-box: fill-box; transform-origin: center bottom; will-change: transform,opacity; }
.cover-cat { position: absolute; left: 53.05882%; top: 65.961%; width: 15.05882%; height: 4.01737%; }
.cat-ground-shadow { position: absolute; left: 5%; top: 85%; width: 94%; height: 17%; background: radial-gradient(ellipse,#72513b50,transparent 70%); }
.cat-body { position: absolute; left: 24%; top: 0; width: 76%; height: 94%; transform-origin: 65% 100%; will-change: transform; }
.cat-tail { position: absolute; left: 40%; top: 48%; width: 60%; height: 52%; z-index: 2; }
/* 静态回退也隐藏尾根封口；两个遮罩合并后只影响右上方的接合区。 */
.tail-fallback { position: absolute; inset: 0; width: 100%; height: 100%; mask-image: linear-gradient(90deg,#000 66%,transparent 78%),linear-gradient(180deg,transparent 27%,#000 53%); mask-composite: add; }
.tail-mesh { position: absolute; left: -19.23077%; top: -68.18182%; width: 138.46154%; height: 174.24242%; visibility: hidden; }
.cat-tail[data-tail-renderer=mesh] .tail-fallback { visibility: hidden; }
.cat-tail[data-tail-renderer=mesh] .tail-mesh { visibility: visible; }
.cat-head { position: absolute; inset: 0; z-index: 1; transform-origin: 27% 85%; will-change: transform; }
/* 裁切停在下巴处，避免把表情原图里的静止尾尖当成后爪一起画出。 */
.cat-face { position: absolute; inset: 0; clip-path: polygon(0 38%,17% 19%,31% 18%,53% 40%,60% 64%,44% 70%,40% 77%,40% 93%,0 96%); }
.cat-face-frame,.cat-ear { position: absolute; inset: 0; width: 100%; height: 100%; }
.face-half,.face-open {
  opacity: 0;
  mask-image: radial-gradient(ellipse 7% 8% at 19% 58%,#000 78%,transparent 100%),radial-gradient(ellipse 8% 8% at 39% 58%,#000 78%,transparent 100%);
  will-change: opacity;
}
.ear-left { clip-path: polygon(4% 0,27% 0,29% 35%,3% 49%); transform-origin: 17% 31%; will-change: transform; }
.ear-right { clip-path: polygon(29% 0,59% 0,60% 51%,43% 50%,29% 34%); transform-origin: 46% 39%; will-change: transform; }
.cover-falling-leaf { position: absolute; left: 0; top: 0; width: 19px; height: 22px; background: url('../assets/bakery-leaf.webp') center / contain no-repeat; opacity: 0; will-change: transform,opacity; }
.leaf-two { width: 13px; height: 16px; }
.leaf-three { width: 15px; height: 18px; }
.leaf-four { width: 17px; height: 20px; }
.cover-ambience[data-motion=reduced],.cover-foreground[data-motion=reduced] { display: none; }
.cover-top { position: absolute; top: max(20px, env(safe-area-inset-top)); right: 18px; z-index: 3; }
.cover-title { position: absolute; top: 8%; left: 5%; width: 90%; text-align: center; }
.cover-title .shop-sign { width: 100%; max-width: none; padding: 20px 20px 0; }
.cover-title h1 { font-size: clamp(32px, 10vw, 45px); line-height: 1; letter-spacing: 1px; font-weight: 950; white-space: nowrap; transform: rotate(-1deg); text-shadow: 0 1px #fff3ce, 1px 0 currentColor; }
html[lang=en] .cover-title h1 { font-size: clamp(30px, 8.5vw, 40px); letter-spacing: -1px; }
.cover-title .shop-sign::before,.cover-title .shop-sign::after { display: none; }
.cover-subtitle { position: relative; margin: -4px auto 0; width: 90%; padding: 9px 5px; font-size: 14px; font-weight: 900; background: url('../assets/bakery-paper.webp') center / 100% 100% no-repeat; }
.cover-actions { position: absolute; bottom: 8.5%; left: 13%; right: 13%; display: grid; gap: 17px; }
.cover-play { min-height: 65px; border-radius: 30px 27px 30px 28px; font-size: 25px; gap: 12px; }
.cover-play svg { width: 31px; height: 31px; }
.cover-map { min-height: 52px; margin: 0 9%; font-size: 21px; border-radius: 24px 21px 24px 21px; gap: 10px; }
.cover-play, .cover-map, .map-footer .action-button { border: 0; box-shadow: none; padding: 8px 25px 12px; background: url('../assets/bakery-button-gold.webp') center / 100% 100% no-repeat; }
.cover-play { min-height: 74px; }
.cover-map { min-height: 60px; color: #354821; background-image: url('../assets/bakery-button-sage.webp'); }
.cover-play:active, .cover-map:active, .map-footer .action-button:active { box-shadow: none; transform: translateY(2px); }
.cover-foot { position: absolute; bottom: max(15px, env(safe-area-inset-bottom)); left: 18px; right: 18px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cover-foot span { font-size: 10px; font-weight: 800; padding: 5px 8px; background: #ffefcfdd; border-radius: 5px; }
.cover-language { min-height: 36px; padding: 5px 10px; font-size: 12px; font-weight: 900; background: #ffefcfdd; border: 1px solid #bf9260; border-radius: 9px; }
.map-screen { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; background: #f8e9bf; }
.map-header { flex: 0 0 90px; min-height: 0; padding: max(5px,env(safe-area-inset-top)) 14px 3px; display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 4px; background: repeating-linear-gradient(3deg,transparent 0 11px,#8d51241a 12px,transparent 14px),linear-gradient(#bb7540,#ae6638); border-bottom: 3px solid #8f572f; z-index: 2; box-shadow: 0 3px 4px #6a3b2226; }
.map-header .shop-sign { min-width: 0; width: 100%; height: 83px; justify-self: center; aspect-ratio: auto; padding-top: 10px; animation: none; }
.map-header .shop-sign::before,.map-header .shop-sign::after { display: none; }
.map-header h1 { font-size: 27px; line-height: 1; font-weight: 950; letter-spacing: 1px; white-space: nowrap; }
html[lang=en] .map-header h1 { font-size: 25px; letter-spacing: -.6px; }
.map-scroll { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.map-chapter { --node-size: clamp(44px,13.3vw,58px); position: relative; width: 100%; flex: 540 1 0; min-height: 0; background-size: 100% 100%; background-repeat: no-repeat; container-type: size; container-name: map-chapter; }
.chapter-0 { background-image: url('../assets/bakery-map-chapter-0.webp'); }
.chapter-1 { background-image: url('../assets/bakery-map-chapter-1.webp'); }
.chapter-2 { flex-grow: 456; background-image: url('../assets/bakery-map-chapter-2.webp'); }
.map-chapter-title { position: absolute; left: 4%; top: 5%; width: 50%; aspect-ratio: 2.2; max-height: calc(50cqh - var(--node-size) / 2 - 3px); background: url('../assets/map-paper-0.webp') center / 100% 100% no-repeat; z-index: 1; }
.chapter-1 .map-chapter-title { background-image: url('../assets/map-paper-1.webp'); }
.chapter-2 .map-chapter-title { background-image: url('../assets/map-paper-2.webp'); top: 4%; max-height: calc(57cqh - var(--node-size) / 2 - 3px); }
.map-chapter-copy { height: 100%; margin-left: 34%; margin-right: 8%; padding: 8px 0; display: flex; flex-direction: column; justify-content: center; gap: 7px; text-align: left; }
.map-chapter-copy h2 { flex: 0 0 auto; font-size: clamp(18px,5.2vw,24px); font-weight: 900; line-height: 1.15; white-space: nowrap; }
.map-chapter-copy p { flex: 0 0 auto; font-size: clamp(9px,2.5vw,10.5px); font-weight: 600; line-height: 1.35; }
html[lang=en] .map-chapter-copy h2 { font-size: clamp(14px,3.9vw,17px); line-height: 1.1; white-space: normal; }
html[lang=en] .map-chapter-copy p { font-size: clamp(9px,2.5vw,10.5px); }
.chapter-2 .map-node { top: var(--compact-y); }
.chapter-2 .route-standard { display: none; }
.chapter-2 .route-compact { display: block; }
.map-route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-route path { fill: none; stroke: #ad6b39; stroke-width: 4; stroke-dasharray: 6 7; stroke-linecap: round; }
.route-compact { display: none; }
.map-node { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%,-50%); width: clamp(44px,13.3vw,58px); height: clamp(44px,13.3vw,58px); display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; box-shadow: none; font-size: clamp(22px,6vw,27px); font-weight: 800; line-height: 1; z-index: 2; transition: translate .15s; }
.map-node::before { content: ''; position: absolute; inset: 0; background: url('../assets/map-cookie-0.webp') center / 100% 100% no-repeat; z-index: -1; }
.map-node:nth-of-type(even)::before { rotate: 7deg; }
.map-node b { padding-bottom: 3px; }
.map-node:hover { translate: 0 -3px; }
.map-node:active { translate: 0 2px; }
.map-node.finished::before { background-image: url('../assets/map-cookie-1.webp'); }
.map-node.current::before { inset: -4px; background-image: url('../assets/map-cookie-2.webp'); }
.map-node.current.finished::before { background-image: url('../assets/map-cookie-1.webp'); inset: 0; }
.map-node.current.finished { outline: 2px solid #fff3bd; outline-offset: 2px; }
.map-seal { position: absolute; bottom: -1px; right: -4px; background: #648845; border: 2px solid #ffefcd; border-radius: 50%; width: 23px; height: 23px; display: grid; place-items: center; color: #fff9df; }
.map-seal svg { width: 14px; height: 14px; stroke-width: 3; }
.map-footer { flex-shrink: 0; padding: 2px 42px calc(6px + env(safe-area-inset-bottom)); background: repeating-linear-gradient(3deg,transparent 0 11px,#8d51241a 12px,transparent 14px),linear-gradient(#bb7540,#ae6638); border-top: 3px solid #8f572f; box-shadow: 0 -3px 5px #80502533; z-index: 2; }
.map-footer .action-button { width: 100%; font-size: clamp(20px,5.8vw,26px); min-height: 67px; border-radius: 27px; gap: 10px; }
.map-footer .action-button svg { width: 29px; height: 29px; }
html[lang=en] .map-footer .action-button { font-size: 20px; }
/* 一眼能看懂的两步引导，箭头不拦截点击和拖动。 */
.game-shell { position: relative; }
.hint-overlay { position: absolute; inset: 0; z-index: 20; pointer-events: none; overflow: visible; }
.hint-overlay > svg { width: 100%; height: 100%; overflow: visible; }
.hint-path-under { fill: none; stroke: #fff7d6; stroke-width: 8; stroke-linecap: round; }
.hint-path { fill: none; stroke: #597a43; stroke-width: 3; stroke-dasharray: 6 6; stroke-linecap: round; }
.hint-landing { fill: #dfefaf33; stroke: #618547; stroke-width: 3; stroke-dasharray: 3 4; }
.hint-badge { position: absolute; width: 24px; height: 24px; display: grid; place-items: center; transform: translate(-50%,-50%); border: 2px solid #fff4d4; border-radius: 50%; color: #fff9e6; background: #be7d2f; box-shadow: 0 2px 0 #78512b; font-size: 14px; line-height: 1; font-weight: 950; }
.hint-badge.destination { background: #5f8143; }
.hint-demo { position: absolute; top: 0; left: 0; width: 34px; height: 34px; object-fit: contain; offset-rotate: 0deg; offset-anchor: center; animation: hint-travel 2.4s ease-in-out infinite; }
.hint-instruction { color: #496538; font-weight: 950; }
.hint-piece { outline: 2px solid #e4ae41; outline-offset: -1px; border-radius: 8px; }

#app:has(dialog[open]) .hint-overlay { visibility: hidden; }
@keyframes hint-travel { 0%,12% { offset-distance: 0%; opacity: 0; } 20% { opacity: .9; } 70% { opacity: .9; } 85%,100% { offset-distance: 100%; opacity: 0; } }
/* 动画只移动独立点心层，不对棋盘做滤镜或缩放。 */
.sorting-tray { filter: none; border-radius: 20px; box-shadow: 0 5px 2px #81431b40; }
.food-image { filter: none; }
.move-sprite { position: fixed; z-index: 1000; pointer-events: none; display: grid; place-items: center; will-change: transform; }
.move-sprite img { width: 100%; height: 100%; object-fit: contain; max-width: 56px; max-height: 56px; }
#app[data-busy=true] .action-button:disabled, #app[data-busy=true] .topbar button:disabled { filter: none; opacity: 1; }
.volume-row { display: grid; grid-template-columns: 76px 1fr 36px; align-items: center; gap: 7px; min-height: 40px; font-size: 12px; font-weight: 800; }
.volume-row input { width: 100%; accent-color: #7e9b4e; margin: 0; min-height: 34px; cursor: pointer; }
.volume-row output { text-align: right; font-variant-numeric: tabular-nums; }
.language-row { gap: 8px; }
.language-row select { max-width: 72%; min-height: 42px; font: inherit; font-size: 12px; font-weight: 800; color: var(--ink); background: #ffdfa6; border: 2px solid #c99b60; border-radius: 10px; padding: 6px; }
.locale-status,.audio-status { font-size: 10px; color: #8c6847; line-height: 1.4; padding: 2px 0 6px; }
.sound-preview { display: flex; gap: 7px; align-items: center; justify-content: center; min-height: 38px; font-size: 12px; font-weight: 800; background: #e1e8bf; border-radius: 9px; }
.sound-preview svg { width: 17px; height: 17px; }
.settings-dialog .help-link { min-height: 43px; font-size: 13px; }
.settings-dialog .settings-note { margin-top: 12px; }
@media(max-width:365px) {
 .cover-title { top: 10%; }
 .cover-title h1 { font-size: 32px; }
 html[lang=en] .cover-title h1 { font-size: 29px; }
 .cover-subtitle { font-size: 11px; }
 .cover-play { font-size: 22px; min-height: 57px; }
 .cover-map { font-size: 19px; min-height: 47px; }
 .map-header { flex-basis: 80px; padding-left: 10px; padding-right: 10px; }
 .map-header h1 { font-size: 23px; }
 html[lang=en] .map-header h1 { font-size: 21px; }
 .map-chapter { min-height: 0; }
 .map-footer { padding-left: 38px; padding-right: 38px; }
 .cover-foot span { font-size: 9px; }
}
@media(max-height:650px) { .cover-actions { gap: 11px; bottom: 10%; } .cover-play { min-height: 55px; } .cover-map { min-height: 44px; } }
@media(max-height:700px) {
 .map-header { flex-basis: 78px; }
 .map-header .shop-sign { height: 70px; }
 .map-footer { padding-top: 7px; padding-bottom: max(9px,env(safe-area-inset-bottom)); }
 .map-footer .action-button { min-height: 47px; }
}
@media(max-height:580px) { .map-header { flex-basis: 72px; } .map-header .shop-sign { height: 64px; } }
@container map-chapter (max-height: 200px) {
 .map-chapter-title { top: 4%; width: 50%; height: 57px; aspect-ratio: auto; max-height: calc(57cqh - 25px); }
 .map-chapter-copy { padding: 7px 0; }
 .map-chapter-copy h2 { font-size: 18px; }
 html[lang=en] .map-chapter-copy h2 { font-size: 12px; }
 .map-chapter-copy p { display: none; }
 .map-node { top: var(--compact-y); width: 44px; height: 44px; font-size: 22px; }
 .route-standard { display: none; }
 .route-compact { display: block; }
}
@media(prefers-reduced-motion:reduce) { .hint-demo { display: none; } }
@media(prefers-reduced-motion:reduce) { .cover-ambience { display: none; } }
