@font-face {
  font-family: "OrchardHand";
  src: url("./assets/fonts/yozai-sub.woff2?v=38") format("woff2"),
       url("./assets/fonts/yozai-sub.ttf?v=38") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "OrchardBody";
  src: url("./assets/fonts/wenkai-sub.woff2?v=38") format("woff2"),
       url("./assets/fonts/wenkai-sub.ttf?v=38") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #3a2215;
  --ink-soft: #654530;
  --cream: #f7edd8;
  --gold-bright: #ffe178;
  --tag-grove: #3a7f44;
  --tag-bee: #d68514;
  --tag-craft: #8c3871;
  --tag-util: #2d7d96;
  --tag-econ: #be7217;
  --display: "OrchardHand", "OrchardBody", cursive, serif;
  --body: "OrchardBody", "OrchardHand", serif;
}

* { box-sizing: border-box; }
:focus { outline: none; }
:focus-visible { outline: 2px solid rgba(255, 214, 102, 0.78); outline-offset: 2px; }
[hidden] { display: none !important; }
html, body {
  height: 100%;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
strong, b, h1, h2, h3 { font-weight: 400; }
.ui-ico { width: 14px; height: 14px; flex: none; display: inline-block; vertical-align: -2px; }
.head-ico { width: 22px; height: 22px; }
.wood-chip { display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.lb-head h2 { display: inline-flex; align-items: center; gap: 6px; }
.lb-tag { display: inline-flex; align-items: center; gap: 2px; }
.lb-tag .ui-ico { width: 12px; height: 12px; }
.lb-mini-btn, .dialog-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.lb-mini-btn .ui-ico, .dialog-actions button .ui-ico { width: 13px; height: 13px; }

/* Per-Boss Atmospheric Battlefield Vignette */
body.boss-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.45s ease;
}
body.boss-birds::before {
  background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 45%, rgba(118, 18, 18, 0.52) 100%);
}
body.boss-frost::before {
  background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 42%, rgba(16, 62, 108, 0.56) 100%);
}
body.boss-calm::before {
  background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 46%, rgba(138, 58, 12, 0.48) 100%);
}
body.boss-inspector::before {
  background: radial-gradient(ellipse 72% 68% at 50% 45%, transparent 40%, rgba(72, 12, 24, 0.58) 100%);
}
body.boss-mode .tabletop { position: relative; z-index: 2; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  min-inline-size: 320px;
  background:
    radial-gradient(ellipse 72% 68% at 48% 48%, rgba(118, 58, 16, 0.14) 0%, rgba(48, 22, 6, 0.44) 100%),
    url("./assets/ui/table-bg.webp?v=38") center / cover no-repeat fixed,
    #5c3416;
  overflow-x: hidden;
  transition: filter 0.45s ease;
}

/* Dramatic crimson lantern tint on Boss stages */
body.boss-mode::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 75% 75% at 50% 50%, rgba(168, 30, 30, 0.08) 0%, rgba(72, 10, 14, 0.48) 100%);
}

button {
  color: inherit;
  font-family: var(--display);
  cursor: pointer;
  border: none;
  background: none;
  transition: transform 0.12s ease, filter 0.14s ease;
}
button:not(:disabled):hover { filter: brightness(1.06); }
button:not(:disabled):active { transform: translateY(2px) scale(0.98); }
button:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 2px; z-index: 5; }
button:disabled { cursor: default; opacity: 0.55; filter: saturate(0.75); }
h1, h2, h3, p { margin: 0; }

/* Full-Viewport Living 60fps Watercolor Orchard World Canvas (src/backdrop.js) */
.ambient-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Tabletop corner art is now natively hand-painted into table-bg.webp & table-bg-mobile.webp */
.table-prop { display: none; }
.table-prop-tl {
  top: -6px;
  left: -8px;
  width: 176px;
  height: 148px;
  transform-origin: 0% 10%;
  animation: bough-sway 6.2s ease-in-out infinite;
}
.table-prop-bl {
  bottom: 4px;
  left: 10px;
  width: 158px;
  height: 126px;
}
.table-prop-br {
  bottom: 6px;
  right: 12px;
  width: 148px;
  height: 114px;
}
@keyframes bough-sway {
  0%, 100% { transform: rotate(-0.8deg); }
  50% { transform: rotate(1.1deg); }
}
body.season-autumn .table-prop-tl .sprig-leaf { fill: #d47228; }
body.season-autumn .table-prop-tl .sprig-leaf-b { fill: #e8a838; }
body.season-winter .table-prop-tl .sprig-leaf { fill: #5e8a7d; }
body.season-winter .table-prop-tl .sprig-leaf-b { fill: #8fb8aa; }
@media (max-width: 1280px) {
  .table-prop-tl { width: 130px; height: 110px; opacity: 0.92; }
  .table-prop-bl { width: 122px; height: 98px; opacity: 0.92; }
  .table-prop-br { width: 118px; height: 92px; opacity: 0.92; }
}
@media (max-width: 1140px) {
  .table-prop-br { display: none; }
}
@media (max-width: 1080px) {
  .table-prop { display: none; }
}

/* ── Full-Tabletop One-Screen Layout ── */
.tabletop {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: 12px 0 12px;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

/* Floating 2D Pure-Icon Round Cream Stamps in Top-Right Corner */
.table-controls {
  position: fixed;
  top: 14px;
  right: 20px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wood-chip {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #3e2723;
  border-radius: 50%;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.7), 0 2.5px 0 #5c3a20;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.14s ease;
}
.wood-chip .ui-ico { width: 20px; height: 20px; }
.wood-chip:not(:disabled):hover {
  transform: translateY(-1.5px);
  background: #fffdf4;
}
.wood-chip:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0.5px 0 #5c3a20;
}
.wood-chip.is-muted {
  background: #ebe0c7;
  opacity: 0.78;
}

/* ── Two-Side Tabletop Spread ── */
.spread {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(370px, 445px);
  gap: 26px;
  align-items: center;
}

/* ── Left: Hero Wooden Orchard Board ── */
.board-column {
  --board-size: clamp(320px, min(49vw, calc(100dvh - 166px)), 536px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Airy 2D Floating Ribbon HUD above the board (Zero Heavy Box!) */
.score-plaque {
  position: relative;
  width: min(100%, calc(var(--board-size) + 40px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 4px;
  cursor: pointer;
  background: none;
  border: none;
}

.stage-tag {
  position: relative;
  flex: none;
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.1;
  padding: 5px 13px;
  border-radius: 4px;
  background: #9bb885;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 240, 0.45), 0 2.5px 0 #4d6b3f;
  color: #2b1a10;
  white-space: nowrap;
  z-index: 2;
}
.stage-tag::before,
.stage-tag::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 11px;
  height: calc(100% - 4px);
  background: #7d9e68;
  border: 2px solid #3e2723;
  z-index: -1;
}
.stage-tag::before {
  left: -9px;
  border-right: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 42% 50%);
}
.stage-tag::after {
  right: -9px;
  border-left: none;
  clip-path: polygon(0 0, 100% 0, 58% 50%, 100% 100%, 0 100%);
}
.stage-tag.boss {
  background: #c84a36;
  color: #fff6df;
  box-shadow: inset 0 1.5px 0 rgba(255, 224, 200, 0.35), 0 2.5px 0 #6e1f16;
}
.stage-tag.boss::before,
.stage-tag.boss::after { background: #9e2f20; }
.stage-title { display: none; }

.boss-tag {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px 4px 6px;
  border-radius: 4px 6px 6px 4px;
  font-family: var(--display);
  font-size: 13.5px;
  line-height: 1.1;
  background: #c84a36;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 226, 208, 0.32), 0 2.5px 0 #6e1f16;
  color: #fff8e6;
  white-space: nowrap;
}
.boss-tag .boss-seal {
  width: 24px;
  height: 24px;
  margin: -5px 0 -5px -2px;
  border-radius: 50%;
  background: #a42c20;
  border: 2px solid #3e2723;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 220, 200, 0.35), 0 1.5px 0 #5c1610;
}
.boss-tag svg { width: 16px; height: 16px; flex: none; }
.boss-tag.active {
  background: #a4281e;
  box-shadow: 0 0 0 2px #f4c44e, 0 2.5px 0 #59110d;
}

.plaque-meter { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.boss-hp-icon { display: none !important; }

.meter-track {
  position: relative;
  flex: 1;
  height: 25px;
  border-radius: 999px;
  background: #c7a675;
  border: 2px solid #3e2723;
  box-shadow: inset 0 2px 0 rgba(92, 58, 32, 0.25), 0 2.5px 0 #5c3a20;
}
.meter-track #fill {
  position: absolute;
  inset: 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #fce27e 0%, #f0b636 100%);
  transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
body.boss-mode .meter-track { background: #703932; }
body.boss-mode .meter-track:not(.passed) #fill {
  background: linear-gradient(180deg, #f07e68 0%, #c8412f 100%);
}
.meter-track.passed { box-shadow: 0 0 0 2px rgba(244, 196, 78, 0.72), 0 2.5px 0 #5c3a20; }
.meter-track.passed #fill {
  background: linear-gradient(90deg, #ffd147, #f59c24, #ffe270, #f59c24);
  background-size: 200% 100%;
  animation: lava-flow 1.4s linear infinite;
}
.fire { display: none; position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: inherit; }
.meter-track.passed .fire { display: block; }
.fire i {
  position: absolute;
  bottom: 0;
  left: calc(6% + var(--idx, 0) * 12%);
  width: 10px;
  height: 15px;
  border-radius: 65% 35% 50% 50%;
  background: linear-gradient(0deg, #ff7a14, #ffca47 62%, #fff7c2);
  animation: flame-dance 0.58s calc(var(--idx, 0) * -0.09s) ease-in-out alternate infinite;
}
.fire i:nth-child(2){--idx:1}.fire i:nth-child(3){--idx:2}.fire i:nth-child(4){--idx:3}
.fire i:nth-child(5){--idx:4}.fire i:nth-child(6){--idx:5}.fire i:nth-child(7){--idx:6}.fire i:nth-child(8){--idx:7}

.score-readout {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  font-family: var(--display);
  text-shadow: 0 1px 0 rgba(255, 250, 232, 0.9), 0 0 4px rgba(255, 248, 224, 0.85);
}
#score { font-size: 16px; line-height: 1; color: #2b180b; }
.score-plaque.passed #score { color: #8c3604; }
.score-readout span { font-size: 13px; color: #472a14; }
.score-readout em { font-style: normal; }
body.boss-mode .score-readout { text-shadow: 0 1.5px 0 #3e1410, 0 0 3px rgba(62, 20, 16, 0.7); }
body.boss-mode #score { color: #fff8e2; }
body.boss-mode .score-readout span { color: #fde4c0; }
body.boss-mode .score-plaque.passed .score-readout { text-shadow: 0 1px 0 rgba(255, 250, 232, 0.9); }
body.boss-mode .score-plaque.passed #score { color: #8c3604; }
body.boss-mode .score-plaque.passed .score-readout span { color: #472a14; }
.tier-stars {
  position: absolute;
  right: 12px;
  top: -12px;
  z-index: 3;
  display: inline-flex;
  gap: 4px;
  font-size: 14px;
  line-height: 1;
}
.tier-stars i {
  font-style: normal;
  color: #f3e4bd;
  -webkit-text-stroke: 1.1px #3e2723;
  paint-order: stroke fill;
  transition: transform 0.2s ease, color 0.2s ease;
}
.tier-stars i.lit { color: #ffd23f; transform: scale(1.22); }
.tier-stars i.lit-super { color: #ff7a45; transform: scale(1.3); }

/* ── Pure 2D Hand-Inked Oak Board Frame ── */
.board-wrap { position: relative; display: grid; place-items: center; }
.plaque-ropes { display: none; }

.board-frame {
  --rim: 15px;
  position: relative;
  width: calc(var(--board-size) + 2 * var(--rim));
  height: calc(var(--board-size) + 2 * var(--rim));
  padding: var(--rim);
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(122, 74, 34, 0.055) 0 16px, transparent 16px 32px),
    linear-gradient(180deg, #dfb47b 0%, #c8965b 100%);
  border: 2.5px solid #3e2723;
  box-shadow: inset 0 2px 0 rgba(255, 245, 214, 0.55), inset 0 -2px 0 rgba(112, 68, 28, 0.35), 0 5px 0 #5c3a20;
}

/* 4-Corner Hand-Inked Break-Frame Botanical Garlands + Left/Right Flanking Orchard Vignettes */
.board-sprig {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(18, 8, 2, 0.48));
  transition: filter 0.6s ease;
}
.board-sprig-tl { width: 76px; height: 64px; top: -14px; left: -14px; }
.board-sprig-tr { width: 60px; height: 54px; top: -12px; right: -12px; }
.board-sprig-bl { width: 62px; height: 54px; bottom: -12px; left: -12px; }
.board-sprig-br { width: 72px; height: 62px; bottom: -12px; right: -14px; }
.board-flank {
  position: absolute;
  top: 6%;
  height: 88%;
  width: 56px;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(32, 16, 6, 0.34));
  transition: filter 0.6s ease;
}
.board-flank-l { left: -46px; }
.board-flank-r { right: -46px; }
.board-flank .flank-lantern,
.board-flank .flank-lantern-alt,
.board-flank .flank-leaf,
.board-flank .flank-leaf-alt {
  transform-box: view-box;
}
.board-flank .flank-lantern {
  animation: flank-lantern-swing 4.6s ease-in-out infinite;
}
.board-flank .flank-lantern-alt {
  animation: flank-lantern-swing 5.2s ease-in-out -2.1s infinite;
}
.board-flank .flank-glow {
  animation: flank-glow-breathe 3.4s ease-in-out infinite;
}
.board-flank .flank-glow-alt {
  animation: flank-glow-breathe 3.9s ease-in-out -1.6s infinite;
}
.board-flank .flank-leaf {
  animation: flank-leaf-sway 4.2s ease-in-out infinite;
}
.board-flank .flank-leaf-alt {
  animation: flank-leaf-sway 4.8s ease-in-out -1.9s infinite;
}
@keyframes flank-lantern-swing {
  0%, 100% { transform: rotate(-3.8deg); }
  50% { transform: rotate(3.8deg); }
}
@keyframes flank-glow-breathe {
  0%, 100% { opacity: 0.68; }
  50% { opacity: 1; }
}
@keyframes flank-leaf-sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4.5deg); }
}
body.season-summer .board-sprig .sprig-leaf,
body.season-summer .board-flank .sprig-leaf { fill: #4a9638; }
body.season-summer .board-sprig .sprig-leaf-b,
body.season-summer .board-flank .sprig-leaf-b { fill: #78bf42; }
body.season-autumn .board-sprig .sprig-leaf,
body.season-autumn .board-flank .sprig-leaf { fill: #cf6b24; }
body.season-autumn .board-sprig .sprig-leaf-b,
body.season-autumn .board-flank .sprig-leaf-b { fill: #eba938; }
body.season-winter .board-sprig .sprig-leaf,
body.season-winter .board-flank .sprig-leaf { fill: #5b877c; }
body.season-winter .board-sprig .sprig-leaf-b,
body.season-winter .board-flank .sprig-leaf-b { fill: #8eb8ab; }

.board {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 5px;
  padding: 5px;
  background: #8a643b;
  border: 2px solid #5e3c1f;
  border-radius: 6px;
  box-shadow: inset 0 2px 5px rgba(34, 18, 6, 0.34);
  touch-action: none;
}

/* Hand-Painted Watercolor Meadow & Golden Soil Tiles (Clean Grass + Soft Warm Garden-Bed Edge) */
.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 7px;
  background: #9bb853;
  box-shadow: inset 0 1px 0 rgba(255, 250, 212, 0.42), inset 0 -2px 0 rgba(68, 88, 28, 0.34), 0 1px 2px rgba(34, 18, 6, 0.28);
  isolation: isolate;
  touch-action: none;
  overflow: hidden;
}
.tile-tex {
  position: absolute;
  inset: -1px;
  z-index: 0;
  pointer-events: none;
  background: url("./assets/ui/tile-meadow.webp?v=38") center / cover no-repeat;
  transform: rotate(var(--tile-rot, 0deg));
  filter: brightness(var(--tile-tint, 1));
}
.cell:not(:disabled):hover { filter: brightness(1.07); }

.cell.fertile {
  background: #e9c155;
  box-shadow: inset 0 0 0 1.5px rgba(188, 122, 22, 0.72), inset 0 0 12px rgba(255, 242, 168, 0.55);
}
.cell.fertile .tile-tex {
  background-image: url("./assets/ui/tile-gold.webp?v=38");
  filter: none;
}
.cell.fertile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(125deg, transparent 36%, rgba(255, 255, 232, 0.55) 50%, transparent 64%);
  background-size: 240% 240%;
  animation: gold-shimmer 4.4s ease-in-out infinite;
}

/* ── Living Part-Level 60fps Vector Card Animations (All 18 Units + Consumables + Bosses) ── */
/* Scoped to live cards/board/detail/modals so 16px mini-board thumbnails stay zero-cost static */
@keyframes svg-spin-360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes svg-canopy-sway {
  0%, 100% { transform: rotate(-2.5deg) scale(1); }
  50% { transform: rotate(2.5deg) scale(1.018); }
}
@keyframes svg-canopy-tall {
  0%, 100% { transform: rotate(-3.2deg); }
  50% { transform: rotate(3.2deg); }
}
@keyframes svg-bush-rustle {
  0%, 100% { transform: rotate(-2deg) scale(1, 1); }
  50% { transform: rotate(2.2deg) scale(1.022, 0.985); }
}
@keyframes svg-fruit-bob {
  0%, 100% { transform: rotate(-3.5deg) translateY(0px); }
  50% { transform: rotate(3.5deg) translateY(0.9px); }
}
@keyframes svg-fruit-dangle {
  0%, 100% { transform: rotate(-5.5deg); }
  50% { transform: rotate(5.5deg); }
}
@keyframes svg-citrus-pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}
@keyframes svg-pendulum {
  0%, 100% { transform: rotate(-3.4deg); }
  50% { transform: rotate(3.4deg); }
}
@keyframes svg-leaf-flutter {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(6.5deg); }
}
@keyframes svg-sprout-grow {
  0%, 100% { transform: rotate(-3deg) scale(1, 0.97); }
  50% { transform: rotate(3.2deg) scale(1.03, 1.05); }
}
@keyframes svg-petal-drift {
  0% { transform: translate(0px, -2px) rotate(0deg); opacity: 0; }
  18% { opacity: 0.95; }
  75% { opacity: 0.85; }
  100% { transform: translate(5px, 16px) rotate(55deg); opacity: 0; }
}
@keyframes svg-petal-drift-alt {
  0% { transform: translate(0px, -2px) rotate(12deg); opacity: 0; }
  20% { opacity: 0.9; }
  78% { opacity: 0.8; }
  100% { transform: translate(-6px, 17px) rotate(-48deg); opacity: 0; }
}
@keyframes svg-steam-rise {
  0% { transform: translateY(3px) scale(0.85); opacity: 0; }
  28% { opacity: 0.85; }
  80% { opacity: 0.45; }
  100% { transform: translateY(-7px) scale(1.12); opacity: 0; }
}
@keyframes svg-bubble-rise {
  0% { transform: translateY(4px) scale(0.55); opacity: 0; }
  25% { opacity: 0.92; }
  80% { opacity: 0.65; }
  100% { transform: translateY(-9px) scale(1.1); opacity: 0; }
}
@keyframes svg-sunbeam-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.82; }
}
@keyframes svg-sunray-sweep {
  0%, 100% { transform: translateX(-2px); opacity: 0.22; }
  50% { transform: translateX(6px); opacity: 0.62; }
}
@keyframes svg-sunflower-sway {
  0%, 100% { transform: rotate(-3.4deg); }
  50% { transform: rotate(3.6deg); }
}
@keyframes svg-head-nod {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50% { transform: rotate(4.5deg) scale(1.04); }
}
@keyframes svg-bee-hover {
  0%, 100% { transform: translate(0px, 0px) rotate(-2deg); }
  25% { transform: translate(2.4px, -2.6px) rotate(3deg); }
  50% { transform: translate(0.4px, -1px) rotate(-1deg); }
  75% { transform: translate(-2.2px, -3px) rotate(-4deg); }
}
@keyframes svg-wing-flap {
  0% { transform: scaleY(1) rotate(-8deg); }
  100% { transform: scaleY(0.42) rotate(14deg); }
}
@keyframes svg-bird-wing-flap {
  0%, 100% { transform: rotate(-10deg) scaleY(1); }
  50% { transform: rotate(16deg) scaleY(0.74); }
}
@keyframes svg-hive-hum {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.018, 0.988); }
}
@keyframes svg-hive-breathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.032, 0.978); }
}
@keyframes svg-crown-float {
  0%, 100% { transform: translateY(0.5px) rotate(-3deg); }
  50% { transform: translateY(-2.8px) rotate(3deg); }
}
@keyframes svg-barrel-rock {
  0%, 100% { transform: rotate(-2.4deg) scale(1); }
  50% { transform: rotate(2.4deg) scale(1.02, 0.985); }
}
@keyframes svg-jar-bob {
  0%, 100% { transform: rotate(-1.6deg) scale(1, 1); }
  50% { transform: rotate(1.6deg) scale(1.025, 0.98); }
}
@keyframes svg-awning-wave {
  0%, 100% { transform: scaleY(1) skewX(-1.4deg); }
  50% { transform: scaleY(1.04) skewX(1.6deg); }
}
@keyframes svg-coin-bob {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-1.8px) scale(1.05); }
}
@keyframes svg-worm-wiggle {
  0%, 100% { transform: translateY(0.8px) rotate(-4.5deg) scale(1, 0.96); }
  50% { transform: translateY(-2.4px) rotate(4.2deg) scale(0.96, 1.06); }
}
@keyframes svg-core-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.86; }
  50% { transform: scale(1.12); opacity: 1; }
}
@keyframes svg-vine-sway {
  0%, 100% { transform: rotate(-2.2deg) scale(1); }
  50% { transform: rotate(2.2deg) scale(1.028); }
}
@keyframes svg-twinkle {
  0%, 100% { transform: scale(0.74); opacity: 0.62; }
  50% { transform: scale(1.16); opacity: 1; }
}
@keyframes svg-twinkle-spin {
  0%, 100% { transform: scale(0.78) rotate(0deg); opacity: 0.68; }
  50% { transform: scale(1.18) rotate(45deg); opacity: 1; }
}
@keyframes svg-twinkle-float {
  0%, 100% { transform: translateY(1.2px) scale(0.82); opacity: 0.72; }
  50% { transform: translateY(-2.2px) scale(1.15); opacity: 1; }
}

/* ViewBox-Coordinate Pivots (exact 0..64 SVG pivots) */
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon :is(
  .svg-spin-hub, .svg-spin-slow, .svg-halo-gold, .svg-halo-ascend,
  .svg-canopy, .svg-canopy-tall, .svg-bush, .svg-pendulum, .svg-sprout,
  .svg-sunflower-1, .svg-sunflower-2, .svg-hive-hum, .svg-hive-breathe,
  .svg-crown-float, .svg-barrel-rock, .svg-tap-glint, .svg-jar-bob,
  .svg-awning, .svg-coin-bob, .svg-coin-bob-alt, .svg-coin-bob-top,
  .svg-worm-wiggle, .svg-core-pulse, .svg-vine-sway, .svg-bird-wing
) {
  transform-box: view-box;
}

/* Local-Coordinate Pivots (inside translated/scaled helpers) */
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon :is(
  .svg-twinkle, .svg-twinkle-alt, .svg-twinkle-spin, .svg-twinkle-float,
  .svg-bee-hover, .svg-wing, .svg-head-nod, .svg-head-nod-alt,
  .svg-fruit-bob, .svg-fruit-bob-alt, .svg-fruit-dangle, .svg-fruit-dangle-alt,
  .svg-citrus-pop, .svg-citrus-pop-alt, .svg-leaf-flutter, .svg-leaf-flutter-alt,
  .svg-petal-fall, .svg-petal-fall-alt, .svg-steam, .svg-steam-alt,
  .svg-bubble-rise, .svg-bubble-rise-alt, .svg-sunbeam, .svg-sunray
) {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

/* Bind Each Semantic Part to Its Bespoke Loop */
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-spin-hub {
  animation: svg-spin-360 4.8s linear var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-spin-slow {
  animation: svg-spin-360 12s linear var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-halo-gold {
  animation: svg-spin-360 18s linear var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-halo-ascend {
  animation: svg-spin-360 10s linear var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-canopy {
  animation: svg-canopy-sway 4.4s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-canopy-tall {
  animation: svg-canopy-tall 4.1s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-bush {
  animation: svg-bush-rustle 3.8s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-fruit-bob {
  transform-origin: 50% 15%;
  animation: svg-fruit-bob 3.1s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-fruit-bob-alt {
  transform-origin: 50% 15%;
  animation: svg-fruit-bob 3.5s ease-in-out calc(var(--idle-delay, 0s) - 1.3s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-fruit-dangle {
  transform-origin: 50% 8%;
  animation: svg-fruit-dangle 3.2s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-fruit-dangle-alt {
  transform-origin: 50% 8%;
  animation: svg-fruit-dangle 3.6s ease-in-out calc(var(--idle-delay, 0s) - 1.4s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-citrus-pop {
  animation: svg-citrus-pop 2.9s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-citrus-pop-alt {
  animation: svg-citrus-pop 3.2s ease-in-out calc(var(--idle-delay, 0s) - 1.1s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-pendulum {
  animation: svg-pendulum 3.9s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-leaf-flutter {
  transform-origin: 0% 85%;
  animation: svg-leaf-flutter 3.1s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-leaf-flutter-alt {
  transform-origin: 0% 85%;
  animation: svg-leaf-flutter 3.4s ease-in-out calc(var(--idle-delay, 0s) - 1.5s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-sprout {
  animation: svg-sprout-grow 3.3s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-petal-fall {
  animation: svg-petal-drift 3.8s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-petal-fall-alt {
  animation: svg-petal-drift-alt 4.3s ease-in-out calc(var(--idle-delay, 0s) - 2.1s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-steam {
  transform-origin: 50% 100%;
  animation: svg-steam-rise 2.8s ease-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-steam-alt {
  transform-origin: 50% 100%;
  animation: svg-steam-rise 3.1s ease-out calc(var(--idle-delay, 0s) - 1.4s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-bubble-rise {
  animation: svg-bubble-rise 2.6s ease-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-bubble-rise-alt {
  animation: svg-bubble-rise 2.9s ease-out calc(var(--idle-delay, 0s) - 1.3s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-sunbeam {
  animation: svg-sunbeam-pulse 3.2s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-sunray {
  animation: svg-sunray-sweep 3.8s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-sunflower-1 {
  animation: svg-sunflower-sway 4s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-sunflower-2 {
  animation: svg-sunflower-sway 3.6s ease-in-out calc(var(--idle-delay, 0s) - 1.7s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-head-nod {
  animation: svg-head-nod 3.4s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-head-nod-alt {
  animation: svg-head-nod 3.1s ease-in-out calc(var(--idle-delay, 0s) - 1.2s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-bee-hover {
  animation: svg-bee-hover 2.8s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-wing {
  transform-origin: 50% 92%;
  animation: svg-wing-flap 0.19s ease-in-out alternate infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-bird-wing {
  animation: svg-bird-wing-flap 0.55s ease-in-out infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-hive-hum {
  animation: svg-hive-hum 2.4s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-hive-breathe {
  animation: svg-hive-breathe 3.1s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-crown-float {
  animation: svg-crown-float 2.7s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-barrel-rock {
  animation: svg-barrel-rock 3.5s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-tap-glint {
  animation: svg-core-pulse 2.4s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-jar-bob {
  animation: svg-jar-bob 3.2s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-awning {
  animation: svg-awning-wave 3.4s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-coin-bob {
  animation: svg-coin-bob 2.5s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-coin-bob-alt {
  animation: svg-coin-bob 2.5s ease-in-out calc(var(--idle-delay, 0s) - 0.8s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-coin-bob-top {
  animation: svg-coin-bob 2.5s ease-in-out calc(var(--idle-delay, 0s) - 1.6s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-worm-wiggle {
  animation: svg-worm-wiggle 2.6s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-core-pulse {
  animation: svg-core-pulse 2.5s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-vine-sway {
  animation: svg-vine-sway 3.7s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-twinkle {
  animation: svg-twinkle 2.4s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-twinkle-alt {
  animation: svg-twinkle 2.7s ease-in-out calc(var(--idle-delay, 0s) - 1.2s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-twinkle-spin {
  animation: svg-twinkle-spin 3.1s ease-in-out var(--idle-delay, 0s) infinite;
}
:is(.cell, .shop-card, .consumable-card, .detail-art, .choice, .farm-card, .specimen-stamp, .boss-hp-icon, .boss-tag, .boss-ribbon, .relic-chip) .drawn-icon .svg-twinkle-float {
  animation: svg-twinkle-float 2.6s ease-in-out var(--idle-delay, 0s) infinite;
}

/* Pause board SVG motion while actively dragging so pointer drag stays buttery 60fps */
body.dragging .cell .drawn-icon * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .drawn-icon * { animation: none !important; }
}

.cell.weather-cell { box-shadow: inset 0 0 0 2.5px rgba(255, 212, 86, 0.92), inset 0 0 14px rgba(255, 238, 145, 0.5); }
.cell.boss-frost { box-shadow: inset 0 0 0 3px rgba(102, 204, 255, 0.95), inset 0 0 16px rgba(145, 226, 255, 0.55); filter: saturate(0.78); }
.cell.boss-birds { box-shadow: inset 0 0 0 3px rgba(226, 56, 48, 0.95), inset 0 0 14px rgba(235, 76, 66, 0.42); }
.cell.boss-calm  { box-shadow: inset 0 0 0 3px rgba(242, 126, 42, 0.95), inset 0 0 14px rgba(255, 162, 72, 0.42); }

.boss-mark {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 4;
  padding: 1px 4px;
  border-radius: 5px;
  font-family: var(--display);
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
  color: #fff;
  background: rgba(190, 34, 34, 0.94);
  pointer-events: none;
}
.boss-mark.frost { background: rgba(42, 126, 178, 0.94); }
.boss-mark.calm  { background: rgba(202, 88, 20, 0.94); }

/* Subtle Archetype Rim */
.cell[data-tag="grove"] { border-bottom: 3px solid var(--tag-grove); }
.cell[data-tag="bee"]   { border-bottom: 3px solid var(--tag-bee); }
.cell[data-tag="craft"] { border-bottom: 3px solid var(--tag-craft); }
.cell[data-tag="util"]  { border-bottom: 3px solid var(--tag-util); }
.cell[data-tag="econ"]  { border-bottom: 3px solid var(--tag-econ); }

.cell .drawn-icon {
  position: relative;
  z-index: 1;
  width: 86%;
  height: 86%;
  max-width: 86px;
  pointer-events: none;
  filter: drop-shadow(0 3px 2px rgba(42, 22, 10, 0.34));
  transition: transform 0.15s ease;
}
.cell:not(:disabled):hover .drawn-icon { transform: translateY(-2px) scale(1.05); }
.cell.level-3 .drawn-icon { filter: drop-shadow(0 0 8px rgba(255, 200, 48, 0.95)); }

.soil-star {
  position: absolute;
  top: 3px;
  left: 4px;
  z-index: 2;
  font-family: var(--display);
  font-size: 11px;
  color: #7c3f08;
  text-shadow: 0 1px 0 rgba(255, 248, 210, 0.85);
  pointer-events: none;
}
.worm-charge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  z-index: 2;
  font-family: var(--display);
  font-size: 9.5px;
  line-height: 1.15;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(114, 72, 22, 0.92);
  color: #ffe99e;
  pointer-events: none;
}

.stars {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 2;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  padding: 1.5px 4px;
  border-radius: 5px;
  color: #fff6d4;
  background: rgba(58, 34, 18, 0.88);
  pointer-events: none;
}
.cell.level-2 .stars { background: #3b6932; border: 1px solid #d5ebb0; }
.cell.level-3 .stars { background: #b85d0a; border: 1px solid #ffe078; color: #fff5b8; }
.cell.ascended { box-shadow: inset 0 0 0 2px rgba(244, 152, 255, 0.92), 0 0 12px rgba(196, 62, 232, 0.55); }
.cell.ascended .drawn-icon { filter: drop-shadow(0 0 9px rgba(232, 118, 255, 0.95)); }
.cell.ascended .stars {
  background: linear-gradient(135deg, #7c2ae8, #c026d3 60%, #d97706);
  border: 1px solid #fff3a1;
  color: #fffbe6;
}

.yield-pill {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 4;
  font-family: var(--display);
  font-size: 12px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(44, 24, 12, 0.9);
  color: #ffe382;
  border: 1px solid rgba(255, 209, 92, 0.7);
  pointer-events: none;
}
.cell.mvp .yield-pill { background: #c7620c; color: #fffbe6; border-color: #fff1a8; }

.cell.in-range::after,
.cell.mergeable::after,
.cell.consumable-target::after,
.cell.plan-target::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 5px;
  pointer-events: none;
  z-index: 3;
}
.cell.in-range::after { border: 2.5px dashed rgba(34, 106, 54, 0.94); background: rgba(94, 186, 114, 0.16); }
.cell.in-range[data-range-kind="bee"]::after { border-color: rgba(214, 132, 16, 0.95); background: rgba(255, 202, 72, 0.2); }
.cell.in-range[data-range-kind="craft"]::after { border-color: rgba(154, 52, 122, 0.94); background: rgba(188, 92, 160, 0.18); }
.cell.in-range[data-range-kind="util"]::after { border-color: rgba(38, 134, 166, 0.94); background: rgba(92, 194, 224, 0.18); }
.cell.in-range[data-range-kind="econ"]::after { border-color: rgba(196, 122, 22, 0.94); background: rgba(242, 178, 62, 0.18); }
.cell.consumable-target::after { border: 2.5px dashed #2e9fc4; background: rgba(102, 212, 240, 0.24); }
.cell.plan-target::after {
  border: 3px solid #f5c64a;
  background: rgba(245, 198, 74, 0.22);
  box-shadow: 0 0 14px rgba(245, 198, 74, 0.92), inset 0 0 12px rgba(255, 244, 186, 0.65);
  animation: plan-pulse 0.65s ease-in-out alternate infinite;
}
.plan-target-flag {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-family: var(--display);
  font-size: 9.5px;
  padding: 0 6px;
  border-radius: 999px;
  background: #2b6b3e;
  color: #fff9df;
  border: 1px solid #f5d068;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 5px rgba(20, 12, 4, 0.45);
}
.cell.mergeable::after {
  border: 3px solid #ffd24c;
  box-shadow: 0 0 12px rgba(255, 196, 46, 0.92), inset 0 0 12px rgba(255, 214, 84, 0.65);
  animation: merge-pulse 0.55s ease-in-out alternate infinite;
}
.merge-flag {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-family: var(--display);
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d67108;
  color: #fffbe6;
  white-space: nowrap;
  pointer-events: none;
}

.cell.selected, .shop-card.selected, .consumable-card.selected {
  outline: 3px solid #ffe178;
  outline-offset: -3px;
  box-shadow: 0 0 14px rgba(255, 216, 102, 0.7);
}
.drop-target { outline: 3px solid #ffe070; outline-offset: -3px; transform: scale(1.03); }
.cell.hit { box-shadow: inset 0 0 0 3px #fff5b0, 0 0 16px rgba(255, 202, 74, 0.95); z-index: 2; }
.cell.hit-nuke { box-shadow: inset 0 0 0 3.5px #fff8c8, 0 0 24px rgba(255, 136, 46, 1); z-index: 3; }

/* Board Overlays (aligned to inner .board inside padding: var(--rim)) */
#links, #fx-canvas, #bursts {
  position: absolute;
  inset: var(--rim);
  width: calc(100% - 2 * var(--rim));
  height: calc(100% - 2 * var(--rim));
  pointer-events: none;
}
#links { overflow: visible; z-index: 4; }
#fx-canvas { z-index: 5; }
#bursts { overflow: visible; z-index: 6; }

.preview-link { fill: none; stroke: #2c7a49; stroke-width: 2.8; stroke-dasharray: 6 5; stroke-linecap: round; opacity: 0.92; animation: dash-march 0.9s linear infinite; }
.preview-link.bee { stroke: #d98c16; }
.preview-link.craft { stroke: #9d3f7d; }
.preview-link.util { stroke: #2c8da8; }
.preview-link.econ { stroke: #c2781a; }

.combo-badge {
  position: absolute;
  top: -26px;
  right: -24px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 74px;
  padding: 5px 12px;
  border-radius: 14px;
  background: linear-gradient(155deg, #ffce47, #db7114);
  border: 2.5px solid #fff3bd;
  color: #fffdf0;
  font-family: var(--display);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.combo-badge.hot { background: linear-gradient(155deg, #ff9929, #c92b2b); }
.combo-badge.god { background: linear-gradient(155deg, #ffe77a, #f27c16 55%, #b5216f); box-shadow: 0 0 18px rgba(255, 165, 42, 0.8), 0 5px 16px rgba(0, 0, 0, 0.5); }
.combo-badge.hyper {
  background: linear-gradient(135deg, #fff394, #ff9d1c 35%, #d92672 72%, #7c2ae8);
  border-color: #fffbe0;
  box-shadow: 0 0 26px rgba(255, 206, 68, 0.95), 0 0 12px rgba(235, 64, 152, 0.85), 0 5px 16px rgba(0, 0, 0, 0.55);
}
.combo-tag { font-size: 10px; letter-spacing: 0.12em; opacity: 0.92; }
.combo-badge strong { font-size: 24px; line-height: 1; }

.clear-toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: max-content;
  max-width: calc(100% - 16px);
  padding: 5px 14px;
  border-radius: 999px;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  color: #3e2723;
  font-family: var(--display);
  font-size: 13.5px;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.78), 0 3px 0 #5c3a20;
  pointer-events: none;
  animation: toast-pop 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.clear-toast[hidden] { display: none; }
.clear-toast:not(.is-harvest) { white-space: normal; }
.clear-toast.is-harvest {
  padding: 4px 10px 4px 5px;
  gap: 8px;
  border-radius: 10px;
}
.toast-badge {
  padding: 2px 8px;
  border-radius: 6px;
  background: #4e965b;
  border: 1.5px solid #3e2723;
  color: #fff8e2;
  font-size: 12.5px;
  line-height: 1.15;
}
.clear-toast.tier-1 .toast-badge { background: #e59b24; color: #3e2723; }
.clear-toast.tier-2 .toast-badge { background: #d96420; color: #fff8e2; }
.toast-score { font-size: 13px; color: #5c3a20; }
.toast-score b { font-size: 15px; color: #3e2723; margin-right: 1px; }
.toast-coin {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #9c5208;
  font-size: 14px;
}
.toast-coin .ui-ico { width: 16px; height: 16px; flex: none; }
.toast-free {
  padding: 1px 6px;
  border-radius: 5px;
  background: #e1f2d5;
  border: 1.4px solid #3e2723;
  color: #25572c;
  font-size: 11.5px;
  line-height: 1.2;
}
.toast-mvp {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-left: 7px;
  border-left: 1.5px dashed #bfa57b;
  color: #8c3d0c;
  font-size: 13px;
}
.toast-mvp .drawn-icon { width: 22px; height: 22px; flex: none; }
@keyframes toast-pop {
  from { opacity: 0; transform: translate(-50%, 8px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* Full-Viewport 60fps Live-Board Boss Invasion Stage */
.boss-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 95;
  cursor: pointer;
  touch-action: none;
}
.boss-replay-btn {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b83b32, #7d1f19);
  border: 1px solid #f0be6a;
  color: #fff6de;
  font-family: var(--display);
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
}
.boss-replay-btn:hover { filter: brightness(1.1); }
.boss-shatter-stamp {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) rotate(-8deg);
  z-index: 13;
  padding: 8px 24px;
  border-radius: 12px;
  background: radial-gradient(circle, #c93228, #7a1410);
  border: 3px solid #ffe285;
  color: #fff7d6;
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.14em;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.65);
  box-shadow: 0 0 36px rgba(255, 198, 66, 0.85), 0 12px 26px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  animation: boss-shatter-pop 1.15s cubic-bezier(0.18, 0.9, 0.25, 1) forwards;
}
@keyframes boss-shatter-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(2.1); }
  22% { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(0.96); }
  72% { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(1.02); }
  100% { opacity: 0; transform: translate(-50%, -58%) rotate(-5deg) scale(1.1); }
}

.guide-banner {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(254, 245, 222, 0.96), rgba(240, 222, 184, 0.96));
  border: 2px solid #9e6b36;
  color: var(--ink);
  font-family: var(--body);
  font-size: 12.5px;
  line-height: 1.2;
  box-shadow: 0 6px 16px rgba(18, 9, 3, 0.56);
  pointer-events: none;
  transition: opacity 0.14s ease;
}
body.dragging .guide-banner,
body.dragging .guide-skip {
  pointer-events: none !important;
  opacity: 0.36;
}
.guide-step {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: #33633c;
  color: #fff6dc;
  font-family: var(--display);
  font-size: 11px;
}
.guide-text { flex: 1; min-width: 0; }
.guide-skip {
  flex: none;
  pointer-events: auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(114, 72, 34, 0.16);
  border: 1px solid rgba(114, 72, 34, 0.32);
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.cell.guide-pulse {
  box-shadow: inset 0 0 0 3px #ffe266, 0 0 16px rgba(255, 212, 68, 0.95);
  animation: merge-pulse 0.7s ease-in-out alternate infinite;
}

.jump {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-family: var(--display);
  font-size: 25px;
  line-height: 1;
  color: #fff6c2;
  text-shadow: 0 2px 3px #361d10, 1.5px 0 #361d10, -1.5px 0 #361d10, 0 -1.5px #361d10;
}
.jump.large { font-size: 33px; color: #ffc554; }
.jump.nuke { font-size: 44px; color: #ffe87a; text-shadow: 0 3px 5px #59162d, 2px 0 #59162d, -2px 0 #59162d, 0 -2px #59162d, 0 0 16px rgba(255, 130, 52, 0.95); }
.jump.money { font-size: 18px; color: #ffe36e; }
.jump.zap { font-size: 16px; color: #d8ff9e; text-shadow: 0 1.5px 2px #1c3a14, 1px 0 #1c3a14, -1px 0 #1c3a14, 0 -1px #1c3a14; }
.jump.block { font-size: 20px; color: #ff8a80; }
.jump.reward { font-size: 31px; color: #fff199; }

.board-frame.shake { animation: shake-mild 0.28s both; }
.board-frame.shake-hard { animation: shake-hard 0.38s both; }

/* Relic Ribbon & Boss Strip beneath Board (Pure 2D Storybook) */
.board-tray {
  width: min(100%, calc(var(--board-size) + 34px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.relic-shelf {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  min-height: 36px;
  border-radius: 5px;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  box-shadow: 0 2.5px 0 #5c3a20;
  color: #3e2723;
}
.relic-shelf::before,
.relic-shelf::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 10px;
  height: calc(100% - 4px);
  background: #ead9b3;
  border: 2px solid #3e2723;
  z-index: -1;
}
.relic-shelf::before { left: -8px; border-right: none; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 44% 50%); }
.relic-shelf::after  { right: -8px; border-left: none; clip-path: polygon(0 0, 100% 0, 56% 50%, 100% 100%, 0 100%); }
.shelf-label { font-family: var(--display); font-size: 13px; color: #6e4a28; white-space: nowrap; }
.relic-list { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #6e4a28; overflow-x: auto; }
.relic-chip {
  width: 28px;
  height: 28px;
  flex: none;
  padding: 2px;
  border-radius: 50%;
  background: #f5e5b8;
  border: 1.8px solid #3e2723;
  box-shadow: 0 1.5px 0 #5c3a20;
}
.relic-chip svg { width: 100%; height: 100%; display: block; }
.relic-chip.invoked { box-shadow: 0 0 0 2.5px #f4c44e; transform: scale(1.16); }

.boss-ribbon {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 5px;
  background: #fbe4da;
  border: 2px solid #3e2723;
  border-left: 5px solid #c84a36;
  color: #6e1a14;
  font-family: var(--display);
  font-size: 13px;
  box-shadow: 0 2.5px 0 #6e2b1e;
}
.boss-ribbon svg { width: 17px; height: 17px; flex: none; }

/* ── Right Side: 2D Paper Field Note + Light-Oak Market Stall + Emerald Ribbon CTA ── */
.side-spread {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding-top: 38px; /* clears floating top-right round stamps */
}

/* Pure 2D Cream Paper Field Note with Flat Brass Pushpin */
.parchment-note {
  position: relative;
  min-height: 98px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 7px;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.7), 0 3px 0 #5c3a20;
  transform: none;
}
.note-pin {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f4c44e;
  border: 2px solid #3e2723;
  box-shadow: 0 1.5px 0 #5c3a20;
  pointer-events: none;
  z-index: 3;
}
.detail-body { display: flex; align-items: center; gap: 12px; width: 100%; }
.detail-art {
  width: 58px;
  height: 58px;
  flex: none;
  padding: 4px;
  border-radius: 8px;
  background: #f4e8c6;
  border: 1.5px solid rgba(62, 39, 35, 0.24);
}
.detail-art svg { width: 100%; height: 100%; display: block; }
.detail-copy { min-width: 0; flex: 1; font-size: 13px; line-height: 1.42; color: var(--ink-soft); }
.detail-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail-copy strong { font-family: var(--display); font-size: 18px; color: var(--ink); line-height: 1.1; }
.detail-tag {
  font-family: var(--display);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  border: 1.4px solid #3e2723;
  color: #fff;
  background: var(--tag-grove);
}
.detail-tag[data-tag="bee"]   { background: var(--tag-bee); }
.detail-tag[data-tag="craft"] { background: var(--tag-craft); }
.detail-tag[data-tag="util"]  { background: var(--tag-util); }
.detail-tag[data-tag="econ"]  { background: var(--tag-econ); }
.detail-tag[data-tag="relic"] { background: #9b6b1e; }
.detail-tag[data-tag="boss"]  { background: #c84a36; }
.detail-copy p { margin-top: 3px; }
.detail-est {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 13px;
  color: #2b6435;
}
.detail-est b { color: #b54f08; }

/* Pure 2D Light-Oak Market Stall + Scalloped Awning (Zero Box-in-Box!) */
.wood-crate {
  position: relative;
  margin-top: 22px;
  padding: 10px 10px 10px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(180deg, rgba(122, 74, 34, 0.045) 0 18px, transparent 18px 36px),
    linear-gradient(180deg, #e2ba86 0%, #d2a268 100%);
  border: 2.2px solid #3e2723;
  box-shadow: inset 0 2px 0 rgba(255, 246, 218, 0.45), 0 4px 0 #5c3a20;
}
.crate-awning {
  position: absolute;
  top: -21px;
  left: -6px;
  right: -6px;
  height: 22px;
  z-index: 4;
  pointer-events: none;
}
.crate-awning svg { width: 100%; height: 100%; display: block; }
.wood-crate.sell-ready {
  box-shadow: 0 0 0 3px #eb7638, 0 4px 0 #5c3a20;
}
.sell-overlay {
  position: absolute;
  inset: 2px;
  z-index: 6;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(168, 58, 32, 0.88);
  border: 2.5px dashed #ffe08a;
  color: #fff8de;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.08em;
  pointer-events: none;
}
.crate-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 0 2px; }
.crate-head h2 { font-family: var(--display); font-size: 20px; color: #3e2723; line-height: 1; }

.gold-pouch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px 2px 5px;
  border-radius: 999px;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  color: #3e2723;
  font-family: var(--display);
  box-shadow: 0 2px 0 #5c3a20;
}
.gold-pouch strong { font-size: 18px; line-height: 1; }
.pouch-ico { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pouch-ico svg { width: 20px; height: 20px; display: block; }

/* Market Main Row: 4 Seed-Packet Cards + Right Vertical Refresh/Lock Icon Stamps */
.market-main {
  display: flex;
  align-items: stretch;
  gap: 7px;
  margin-bottom: 18px;
}

.shop {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
}
.shop-card {
  position: relative;
  cursor: grab;
  touch-action: none;
  min-width: 0;
  min-height: 102px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  padding: 10px 2px 14px;
  border-radius: 8px;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.72), 0 2.5px 0 #5c3a20;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.14s ease;
}
.shop-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 6px 6px 0 0;
  background: #5d9c48;
  pointer-events: none;
}
.shop-card[data-tag="grove"]::before { background: #5d9c48; }
.shop-card[data-tag="bee"]::before   { background: #e5a024; }
.shop-card[data-tag="craft"]::before { background: #b25482; }
.shop-card[data-tag="util"]::before  { background: #3c8fa6; }
.shop-card[data-tag="econ"]::before  { background: #d6881e; }
.shop-card:not(:disabled):hover {
  transform: translateY(-4px);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.8), 0 6px 0 #5c3a20;
  z-index: 3;
}
.shop-card .drawn-icon { width: 52px; height: 52px; pointer-events: none; }
.shop-card strong { font-family: var(--display); font-size: 12.5px; white-space: nowrap; color: #3e2723; line-height: 1.1; }
.shop-card .cost {
  position: absolute;
  left: 50%;
  bottom: -12px;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  margin: 0;
  background: #f4c44e;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 #fff3b0, 0 1.5px 0 #5c3a20;
  font-family: var(--display);
  font-size: 12px;
  line-height: 1;
  color: #3e2723;
  z-index: 2;
}
.shop-card .cost b { font-size: 12.5px; }
.shop-card.poor .cost {
  background: #e8a89a;
  color: #6e1a14;
}
.shop-card.rare { background: #fff9df; box-shadow: inset 0 0 0 1.5px #e6aa32, 0 2.5px 0 #5c3a20; }
.shop-card.plan-match {
  box-shadow: 0 0 0 2.5px #e6a828, 0 2.5px 0 #5c3a20;
}
.choice.plan-match {
  box-shadow: 0 0 0 3px #e6a828, 0 3px 0 #5c3a20;
}
.shop-card .plan-pill {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #4a9159;
  color: #fff9df;
  border: 1.6px solid #3e2723;
  box-shadow: 0 1.5px 0 #264f30;
  white-space: nowrap;
  z-index: 3;
}
.shop-card .plan-pill.combo-pill {
  background: #c86416;
}
.shop-card .up-pill {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e07b18;
  border: 1.6px solid #3e2723;
  color: #fffbe6;
  box-shadow: 0 1.5px 0 #6e3508;
  white-space: nowrap;
  z-index: 3;
}
.shop-card.empty {
  cursor: default;
  border: 2px dashed rgba(62, 39, 35, 0.34);
  background: rgba(252, 245, 227, 0.45);
  box-shadow: none;
  color: #7d5f42;
  font-size: 12px;
}
.shop-card.empty::before { display: none; }

/* Fixed-Height 2D Notched Cream Paper Consumable Ticket (Zero Shift on Purchase!) */
.consumable-slot { margin-bottom: 0; }
.consumable-card {
  position: relative;
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.7), 0 2px 0 #5c3a20;
  text-align: left;
  cursor: grab;
  touch-action: none;
  transition: transform 0.12s ease;
}
.consumable-card:not(:disabled):hover {
  transform: translateY(-1.5px);
}
.consumable-card .drawn-icon { width: 32px; height: 32px; flex: none; pointer-events: none; }
.consumable-card .c-meta { min-width: 0; flex: 1; }
.consumable-card strong { font-family: var(--display); font-size: 13.5px; color: #3e2723; display: block; line-height: 1.1; }
.consumable-card small { font-family: var(--body); font-size: 11px; color: var(--ink-soft); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.consumable-card .c-price { font-family: var(--display); font-size: 13px; color: #3e2723; white-space: nowrap; }
.consumable-card .c-coin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  background: #f4c44e;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 #fff3b0, 0 1.5px 0 #5c3a20;
  flex: none;
}
.consumable-card .c-coin b { font-size: 13.5px; line-height: 1; }
.consumable-card.poor .c-coin {
  background: #e8a89a;
  color: #6e1a14;
}
.consumable-card.is-pack {
  background: #f4faea;
}
.consumable-card.is-pack.rare {
  background: #fdf2f8;
}
.pack-open-btn {
  padding: 3px 9px;
  border-radius: 6px;
  background: #4a9159;
  border: 1.8px solid #3e2723;
  color: #fff8de !important;
  font-family: var(--display);
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 0 #264f30;
  cursor: pointer;
}
.consumable-card.is-pack.rare .pack-open-btn {
  background: #a63a72;
  box-shadow: 0 2px 0 #450f2d;
}
.consumable-card.poor .pack-open-btn {
  background: #b5a38d;
  box-shadow: none;
  opacity: 0.76;
}
.consumable-card.empty {
  cursor: default;
  justify-content: center;
  height: 48px;
  border: 2px dashed rgba(62, 39, 35, 0.34);
  border-radius: 6px;
  background: rgba(252, 245, 227, 0.45);
  box-shadow: none;
  color: #7d5f42;
  font-size: 12px;
}

.wood-crate.is-locked {
  box-shadow: 0 0 0 2.5px #f4c44e, 0 4px 0 #5c3a20;
}
.wood-crate.is-locked .shop-card:not(.empty)::after,
.wood-crate.is-locked .consumable-card:not(.empty)::after {
  content: "锁";
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 0 4px;
  border-radius: 4px;
  background: #9c6224;
  border: 1.4px solid #3e2723;
  color: #fff7dc;
  font-family: var(--display);
  font-size: 9px;
  line-height: 1.3;
  pointer-events: none;
}

/* 5-Card Caravan Pass Compact Layout */
.shop.is-five { gap: 4px; }
.shop.is-five .shop-card { padding: 8px 1px 13px; min-height: 98px; }
.shop.is-five .shop-card .drawn-icon { width: 40px; height: 40px; }
.shop.is-five .shop-card strong { font-size: 11px; }
.shop.is-five .shop-card .cost { width: 22px; height: 22px; bottom: -11px; font-size: 11px; }
.shop.is-five .shop-card .cost b { font-size: 11px; }

/* Free Upgrade Reward Voucher Strip */
.free-upgrade-slot { margin-bottom: 6px; }
.free-upgrade-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 9px;
  background: linear-gradient(180deg, #fff4c4, #f0c965);
  border: 2px solid #b86c14;
  box-shadow: 0 2px 8px rgba(214, 142, 24, 0.45), inset 0 1px 0 #fffbe6;
  color: #4f2804;
  text-align: left;
  cursor: grab;
  touch-action: none;
}
.free-upgrade-card strong { font-family: var(--display); font-size: 13.5px; display: block; line-height: 1.1; }
.free-upgrade-card small { font-family: var(--body); font-size: 11px; color: #6e3d0c; display: block; }
.free-upgrade-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: #b84a0c;
  color: #fff8de;
  font-family: var(--display);
  font-size: 12px;
  white-space: nowrap;
}

/* Drag Hover Real-Time Score Preview Pill */
.drag-preview {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  transform: translate(-50%, -140%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 18, 9, 0.94);
  border: 2px solid #ffd866;
  color: #fff6d2;
  font-family: var(--display);
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}
.drag-preview.pos { border-color: #84e680; color: #d8ffcf; }
.drag-preview.neg { border-color: #ff8c7a; color: #ffd4cc; }

/* Right-Side Stacked 2D Square Icon Stamps (Refresh + Lock) */
.crate-actions {
  width: 46px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.paper-btn {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #3e2723;
  border-radius: 8px;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.72), 0 2.5px 0 #5c3a20;
  transition: transform 0.1s ease, background 0.15s ease;
}
.paper-btn .ui-ico { width: 22px; height: 22px; }
#lock.paper-btn {
  background: #f5ebd2;
}
.paper-btn:not(:disabled):hover {
  background: #fffaf0;
  transform: translateY(-1px);
}
.paper-btn:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0.5px 0 #5c3a20;
}
.paper-btn[aria-pressed="true"] {
  background: #dff0c8;
  border-color: #3e2723;
  color: #254f20;
  box-shadow: inset 0 1.5px 0 rgba(250, 255, 232, 0.75), 0 2.5px 0 #2d4f20;
}
.stamp-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f4c44e;
  border: 1.8px solid #3e2723;
  box-shadow: 0 1.5px 0 #5c3a20;
  font-family: var(--display);
  font-size: 11px;
  line-height: 1;
  color: #3e2723;
  pointer-events: none;
}
.stamp-badge.is-free {
  background: #5ba467;
  color: #fff8e2;
}
.stamp-badge.is-locked {
  background: #d8c8ad;
  color: #5c4328;
}

/* Pure 2D Emerald Swallowtail Harvest Ribbon + Flanking Golden Wheat Sprays */
.harvest-plaque {
  position: relative;
  overflow: visible;
  width: 100%;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 4px;
  background: none;
  border: none;
  color: #fff9e6;
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.14em;
  transition: transform 0.12s ease;
}
.harvest-ribbon {
  position: relative;
  z-index: 2;
  flex: 0 1 auto;
  min-width: 196px;
  height: 48px;
  padding: 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #4e965b;
  border: 2.2px solid #3e2723;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), inset 0 -2px 0 rgba(30, 72, 38, 0.34), 0 4px 0 #264f30;
  text-shadow: 0 1.5px 0 #264f30;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}
.harvest-ribbon::before,
.harvest-ribbon::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 18px;
  height: calc(100% - 6px);
  background: #3b7c47;
  border: 2.2px solid #3e2723;
  z-index: -1;
}
.harvest-ribbon::before {
  left: -14px;
  border-right: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 42% 50%);
}
.harvest-ribbon::after {
  right: -14px;
  border-left: none;
  clip-path: polygon(0 0, 100% 0, 58% 50%, 100% 100%, 0 100%);
}
.harvest-flourish {
  width: 84px;
  height: 26px;
  flex: none;
  pointer-events: none;
  filter: drop-shadow(0 2px 0 rgba(62, 39, 35, 0.42));
}
.harvest-flourish.is-right { transform: scaleX(-1); }
.harvest-flourish .harvest-spray {
  transform-box: view-box;
  animation: harvest-spray-sway 3.2s ease-in-out infinite;
}
.harvest-flourish.is-right .harvest-spray {
  animation: harvest-spray-sway 3.2s ease-in-out -1.6s infinite;
}
.harvest-flourish .harvest-sparkle {
  transform-box: view-box;
  animation: svg-twinkle 2.4s ease-in-out infinite;
}
.harvest-flourish .harvest-sparkle-alt {
  transform-box: view-box;
  animation: svg-twinkle 2.8s ease-in-out -1.2s infinite;
}
.harvest-plaque:disabled .harvest-spray,
.harvest-plaque:disabled .harvest-sparkle,
.harvest-plaque:disabled .harvest-sparkle-alt {
  animation-play-state: paused;
}
@keyframes harvest-spray-sway {
  0%, 100% { transform: rotate(-3.2deg) scale(1); }
  50% { transform: rotate(3.6deg) scale(1.03); }
}
.harvest-plaque:not(:disabled):hover .harvest-ribbon {
  background: #58a666;
  transform: translateY(-2px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.34), inset 0 -2px 0 rgba(30, 72, 38, 0.34), 0 6px 0 #264f30;
}
.harvest-plaque:not(:disabled):hover .harvest-spray { animation-duration: 1.6s; }
.harvest-plaque:not(:disabled):active .harvest-ribbon {
  transform: translateY(2px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 1.5px 0 #264f30;
}
.harvest-plaque.skip-mode { font-size: 19px; letter-spacing: 0.08em; }
.harvest-plaque.skip-mode .harvest-ribbon {
  background: #d48324;
  box-shadow: inset 0 2px 0 rgba(255, 245, 210, 0.34), 0 4px 0 #7a4208;
  text-shadow: 0 1.5px 0 #7a4208;
}
.harvest-plaque.skip-mode .harvest-ribbon::before,
.harvest-plaque.skip-mode .harvest-ribbon::after {
  background: #b56816;
}

/* Drag Ghost */
.dragging { cursor: grabbing !important; }
.ghost { position: fixed; z-index: 30; pointer-events: none; width: 80px; height: 80px; transform: translate(-50%, -58%) scale(1.12); will-change: transform, left, top; filter: drop-shadow(0 16px 16px rgba(15, 6, 1, 0.58)); }
.ghost svg { width: 100%; height: 100%; }

/* ── Pure 2D Storybook Notebook & Blueprint Clipboard Dialogs ── */
dialog {
  border: none;
  background: transparent;
  color: var(--ink);
  width: min(740px, calc(100% - 20px));
  max-width: none;
  max-height: calc(100dvh - 16px);
  overflow: visible;
  padding: 0;
  text-align: left;
  box-shadow: none;
}
dialog#result { width: min(680px, calc(100% - 20px)); }
dialog::backdrop { background: rgba(24, 15, 7, 0.52); }
dialog h2 { font-family: var(--display); font-size: 26px; color: #3e2723; margin: 0; line-height: 1.15; }
dialog p { font-size: 13.5px; line-height: 1.48; margin: 4px 0; color: var(--ink-soft); }

/* Unified Storybook Shell: Protruding Bookmark Tabs + Oak Cover + Cream Page + Corner Close Stamp */
.book-shell {
  position: relative;
  padding-top: 34px;
  padding-bottom: 14px;
}
.book-shell.is-result,
.book-shell.is-compact { padding-top: 10px; padding-bottom: 6px; }
.book-shell.is-result { text-align: center; }

.book-tabs {
  position: absolute;
  top: 2px;
  left: 22px;
  right: 48px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.book-tabs.is-offset { left: 84px; }
.book-tab {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 18px;
  border-radius: 10px 10px 0 0;
  border: 2.2px solid #3e2723;
  border-bottom: none;
  background: #d8b27c;
  color: #3e2723;
  font-family: var(--display);
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.14s ease;
}
.book-tab .ui-ico { width: 17px; height: 17px; flex: none; }
.book-tab.tab-sage   { background: #7da66b; color: #24381c; }
.book-tab.tab-honey  { background: #efb948; color: #3e2723; }
.book-tab.tab-berry  { background: #c95640; color: #fff8ea; }
.book-tab.tab-silver { background: #b4c4d0; color: #243440; }
.book-tab.tab-oak    { background: #d8b27c; color: #3e2723; }
.book-tab.tab-cream  { background: #ead9b6; color: #3e2723; }
.book-tab:not(.active):hover { transform: translateY(-2px); }
.book-tab.active {
  z-index: 7;
  height: 36px;
  background: #fcf5e3;
  color: #3e2723;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.72);
}
.book-tab.active::after {
  content: "";
  position: absolute;
  left: -2.2px;
  right: -2.2px;
  bottom: -16px;
  height: 17px;
  background: #fcf5e3;
  border-left: 2.2px solid #3e2723;
  border-right: 2.2px solid #3e2723;
  pointer-events: none;
}

.book-close {
  position: absolute;
  top: 20px;
  right: -8px;
  z-index: 9;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fcf5e3;
  border: 2.2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.75), 0 2.5px 0 #5c3a20;
  color: #5c3a20;
  font-family: var(--display);
  font-size: 22px;
  line-height: 1;
  padding: 0;
  transition: transform 0.12s ease, background 0.12s ease;
}
.book-shell.is-compact .book-close { top: -2px; }
.book-close:hover { background: #fffbf2; transform: translateY(-1.5px); }
.book-close:active { transform: translateY(1.5px); box-shadow: 0 1px 0 #5c3a20; }

.book-clip {
  position: absolute;
  top: 13px;
  left: 24px;
  z-index: 9;
  width: 50px;
  height: 50px;
  pointer-events: none;
  filter: drop-shadow(0 2.5px 0 rgba(62, 39, 35, 0.35));
}
.book-shell.is-compact .book-clip { top: -12px; }
.book-clip svg { width: 100%; height: 100%; display: block; }

.book-cover {
  position: relative;
  z-index: 5;
  padding: 10px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(122, 74, 34, 0.045) 0 16px, transparent 16px 32px),
    linear-gradient(180deg, #e4be89 0%, #d4a46a 100%);
  border: 2.5px solid #3e2723;
  box-shadow: inset 0 2px 0 rgba(255, 248, 224, 0.55), inset 0 -2px 0 rgba(112, 68, 28, 0.28), 0 6px 0 #5c3a20;
}
.book-page {
  position: relative;
  padding: 16px 20px 18px;
  border-radius: 9px;
  background: #fcf5e3;
  border: 2px solid #3e2723;
  box-shadow: 3px 3px 0 #e6d1a8;
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
}
.book-page.is-open-book {
  background:
    linear-gradient(90deg, transparent 49%, rgba(138, 96, 52, 0.14) 50%, transparent 51%),
    #fcf5e3;
}
.book-ribbon-tail {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  z-index: 4;
  width: 24px;
  height: 28px;
  background: #c84a36;
  border: 2px solid #3e2723;
  border-top: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 68%, 0 100%);
}

/* Title Hero & Handwritten Subline (No Bootstrap Alert Boxes!) */
.sheet-hero {
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid rgba(138, 96, 52, 0.25);
}
.sheet-hero.is-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.sheet-hero h2,
.sheet-title-row h2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sheet-title-row {
  text-align: center;
  margin-bottom: 10px;
}
.title-sprig { width: 22px; height: 22px; flex: none; }
.sheet-sub {
  margin: 4px auto 0;
  max-width: 56ch;
  font-size: 12.5px;
  color: #7c5b3b;
  line-height: 1.4;
}
.sheet-sub.diff-sub-artisan { color: #365066; }
.sheet-sub.diff-sub-royal { color: #8c261e; }

/* Almanac Open-Book Header: Title + Single-Line Handwritten Career Ledger + Wax Seal */
.almanac-ledger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1.6px solid rgba(138, 96, 52, 0.28);
}
.almanac-ledger h2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 28px;
  color: #3e2723;
}
.ledger-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ledger-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 5px 10px;
  border-top: 1.5px solid rgba(62, 39, 35, 0.42);
  border-bottom: 1.5px solid rgba(62, 39, 35, 0.42);
}
.ledger-stats span {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 4px;
  align-items: center;
  text-align: center;
  font-size: 11px;
  color: #6e4f32;
}
.ledger-stats .ui-ico { width: 14px; height: 14px; }
.ledger-stats em { font-style: normal; white-space: nowrap; }
.ledger-stats b {
  grid-column: 1 / -1;
  font-family: var(--display);
  font-size: 15px;
  color: #3e2723;
  line-height: 1.15;
}
.wax-badge {
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #e06346 0%, #c43f2b 65%, #992a1c 100%);
  border: 2.2px solid #3e2723;
  outline: 1.8px dashed rgba(255, 228, 168, 0.72);
  outline-offset: -5px;
  box-shadow: 0 3px 0 #5c1c14;
  color: #fff8e2;
  font-family: var(--display);
  font-size: 14px;
  line-height: 1;
  transform: rotate(-6deg);
}

/* Postage-Stamp Botanical Specimen Frame (Zero Box-in-Box!) */
.specimen-stamp {
  width: 54px;
  height: 54px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: 6px;
  background: #fffdf6;
  border: 2px dashed #c7ae84;
  box-shadow: 0 1.5px 0 rgba(122, 82, 42, 0.25);
}
.specimen-stamp .drawn-icon { width: 42px; height: 42px; display: block; }

.almanac-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 4px;
  max-height: 365px;
  overflow-y: auto;
  padding: 2px 4px 2px 2px;
}
.specimen-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(240, 226, 194, 0.45);
  border-bottom: 1.6px dashed rgba(154, 114, 68, 0.38);
  text-align: left;
}
.specimen-item.is-locked {
  background: transparent;
  border: 1.8px dashed #cbb38b;
  opacity: 0.72;
}
.specimen-item.is-locked .specimen-stamp {
  background: rgba(245, 234, 208, 0.55);
  border-color: #d4bf9a;
  box-shadow: none;
}
.specimen-item.is-locked .drawn-icon { filter: sepia(0.75) opacity(0.55); }
.specimen-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.specimen-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.specimen-head strong { font-family: var(--display); font-size: 15px; color: #3e2723; line-height: 1.15; }
.specimen-copy p { font-size: 11.5px; line-height: 1.38; margin: 0; color: var(--ink-soft); }
.specimen-copy small { font-size: 10.5px; color: #8c6640; }

.mini-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(138, 92, 42, 0.16);
  color: #6b4319;
  font-size: 10px;
  font-family: var(--display);
}

/* Result & Reward Choices (Stamp Cards on Cream Paper) */
.mvp-strip { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 12px; }
.mvp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f5e6c2;
  border: 1.6px solid #8a643b;
  font-family: var(--display);
  font-size: 13px;
  color: #3e2723;
}
.mvp-chip svg { width: 20px; height: 20px; }
.mvp-chip b { color: #9c4a08; }

.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.choices.four-col { grid-template-columns: repeat(2, 1fr); }
.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 10px;
  border-radius: 9px;
  background: #f6ecd4;
  border: 2px solid #c9af82;
  box-shadow: 0 3px 0 rgba(122, 82, 42, 0.28);
  text-align: center;
  transition: transform 0.12s ease, border-color 0.14s ease, box-shadow 0.12s ease;
}
.choice:hover {
  transform: translateY(-3px);
  background: #fffaf0;
  border-color: #3e2723;
  box-shadow: 0 5px 0 #5c3a20;
}
.choice.plan-match {
  background: #fff6d6;
  border-color: #d4891c;
  box-shadow: 0 3px 0 #8a4c0e;
}
.choice .specimen-stamp { width: 64px; height: 64px; }
.choice .specimen-stamp .drawn-icon { width: 52px; height: 52px; }
.choice strong { font-family: var(--display); font-size: 16px; color: var(--ink); }
.choice small { font-family: var(--body); font-size: 12px; line-height: 1.42; color: var(--ink-soft); }

/* Handwritten Ledger Line Recap (No Grey KPI Boxes) */
.recap {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 12px auto;
  padding: 8px 18px;
  max-width: 340px;
  border-top: 1.6px dashed #bfa47a;
  border-bottom: 1.6px dashed #bfa47a;
}
.recap span { font-size: 12.5px; color: var(--ink-soft); text-align: center; }
.recap b { display: block; font-family: var(--display); font-size: 24px; color: #7a4212; margin-top: 1px; }

.dialog-actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.dialog-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 18px;
  font-size: 15px;
  border-radius: 8px;
  background: #f5e9cc;
  border: 2px solid #3e2723;
  color: #3e2723;
  box-shadow: 0 2.5px 0 #5c3a20;
}
.dialog-actions .primary { background: #4e965b; border-color: #3e2723; color: #fff8e2; box-shadow: 0 2.5px 0 #264f30; }
.dialog-actions .gold-btn { background: #f4c44e; border-color: #3e2723; color: #3e2723; box-shadow: 0 2.5px 0 #7a4208; }

/* Monument Stack Badge */
.relic-chip { position: relative; }
.relic-chip.monument-chip { border-color: #ffcf5c; background: linear-gradient(180deg, #fff2bf, #e5aa3e); }
.stack-count {
  position: absolute;
  right: -4px;
  bottom: -4px;
  padding: 0 4px;
  border-radius: 999px;
  background: #8f2d14;
  color: #fff8de;
  border: 1px solid #ffe078;
  font-family: var(--display);
  font-size: 9px;
  line-height: 1.2;
}

/* ── Handwritten Inline Input Strip (Leaderboard & Saved Plans) ── */
.sheet-inline-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px;
  margin-bottom: 10px;
  border-radius: 7px;
  background: rgba(235, 218, 182, 0.48);
  border-bottom: 1.6px dashed rgba(138, 96, 52, 0.42);
  font-size: 12.5px;
}
.ledger-label { font-family: var(--display); color: #6b4826; white-space: nowrap; }
.sheet-inline-bar input {
  flex: 1;
  min-width: 110px;
  padding: 4px 8px;
  border: none;
  border-bottom: 2px solid #8a643b;
  border-radius: 4px 4px 0 0;
  background: rgba(255, 253, 245, 0.85);
  color: var(--ink);
  font-family: var(--body);
  font-size: 13px;
}
.sheet-inline-bar input:focus { outline: none; border-bottom-color: #4e965b; background: #fffdf6; }
.lb-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  background: #f5e9cc;
  border: 1.8px solid #3e2723;
  box-shadow: 0 1.5px 0 #5c3a20;
  color: var(--ink);
}
.lb-mini-btn.primary { background: #4e965b; border-color: #3e2723; box-shadow: 0 1.5px 0 #264f30; color: #fff8e2; }
.lb-mini-btn.danger { background: #fbe2dc; border-color: #3e2723; color: #7a2016; }

/* ── Global Leaderboard Dotted Ledger Rows ── */
.lb-chip { color: #3e2723; }
.lb-status { font-size: 12px; color: #7c5b3b; }
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 330px;
  overflow-y: auto;
  padding-right: 4px;
}
.lb-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  background: transparent;
  border-bottom: 1.5px dashed rgba(154, 114, 68, 0.42);
}
.lb-row:last-child { border-bottom: none; }
.lb-row.is-me {
  background: rgba(244, 196, 78, 0.24);
  border: 1.6px solid #d49428;
}
.lb-rank { font-family: var(--display); font-size: 15px; text-align: center; color: #7a4212; }
.lb-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-name { font-family: var(--display); font-size: 14.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--ink-soft); }
.lb-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 4px;
  border: 1.3px solid #3e2723;
  font-family: var(--display);
  font-size: 10.5px;
  color: #fff;
  background: #5a7a42;
}
.lb-tag .ui-ico { width: 12px; height: 12px; }
.lb-tag[data-tag="grove"] { background: var(--tag-grove); }
.lb-tag[data-tag="bee"] { background: var(--tag-bee); }
.lb-tag[data-tag="craft"] { background: var(--tag-craft); }
.lb-tag[data-tag="econ"] { background: var(--tag-econ); }
.lb-units { display: inline-flex; align-items: center; gap: 2px; }
.lb-units .drawn-icon { width: 22px; height: 22px; }
.lb-score {
  min-width: 78px;
  font-family: var(--display);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: #9c4408;
  text-align: right;
  white-space: nowrap;
}
.lb-empty { text-align: center; padding: 26px 10px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.lb-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: #f5ead0;
  border: 1.6px solid #3e2723;
  box-shadow: 0 1.5px 0 #5c3a20;
  color: #3e2723;
  white-space: nowrap;
}
.lb-view-btn .ui-ico { width: 12px; height: 12px; }
.lb-right { display: flex; align-items: center; gap: 6px; }
.lb-rank .ui-ico { width: 22px; height: 22px; }

/* ── Difficulty Pills & Farm Selector (Specimen Grid) ── */
.almanac-chip { color: #3e2723; }
.diff-seal-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--display);
  font-size: 10px;
  line-height: 1.2;
}
.diff-seal-pill .ui-ico { width: 12px; height: 12px; }
.diff-seal-pill.diff-casual { background: #e1f2d5; border: 1.2px solid #4d8a4b; color: #225427; }
.diff-seal-pill.diff-artisan { background: #e8eff4; border: 1.2px solid #6b8499; color: #2c4356; }
.diff-seal-pill.diff-royal { background: #fae1dc; border: 1.2px solid #b5322a; color: #821b15; }

.stage-tag.diff-artisan:not(.boss) { background: #5a7488; border-color: #3e2723; color: #f4f8fc; box-shadow: 0 2px 0 #2c3f4d; }
.stage-tag.diff-artisan:not(.boss)::before,
.stage-tag.diff-artisan:not(.boss)::after { background: #425a6c; }
.stage-tag.diff-royal:not(.boss) { background: #b53a30; border-color: #3e2723; color: #fff6d4; box-shadow: 0 2px 0 #6e1a14; }
.stage-tag.diff-royal:not(.boss)::before,
.stage-tag.diff-royal:not(.boss)::after { background: #8a241c; }

.farm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.farm-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(242, 228, 198, 0.56);
  border: 1.8px solid #cfb88e;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.14s ease, border-color 0.14s ease;
}
.farm-card:hover {
  transform: translateY(-2px);
  background: #fffaf0;
  border-color: #8a643b;
}
.farm-card.active {
  background: #fff3c9;
  border: 2px solid #3e2723;
  box-shadow: 0 3px 0 #a36c1c;
}
.farm-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.farm-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.farm-seals { display: inline-flex; align-items: center; gap: 2px; }
.farm-seal { display: inline-flex; opacity: 0.24; filter: grayscale(0.9); }
.farm-seal.earned { opacity: 1; filter: none; }
.farm-seal .ui-ico { width: 15px; height: 15px; }
.farm-card strong { font-family: var(--display); font-size: 15.5px; color: var(--ink); }
.farm-card small { font-family: var(--body); font-size: 11.5px; line-height: 1.38; color: var(--ink-soft); }

.share-preview { text-align: center; }
.share-preview img {
  max-width: min(320px, 86%);
  max-height: 56dvh;
  border-radius: 10px;
  border: 2px solid #3e2723;
  box-shadow: 0 5px 0 #5c3a20;
  margin: 4px auto 8px;
  display: block;
}
.share-dl-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-family: var(--display);
  font-size: 15px;
  background: #4e965b;
  border: 2px solid #3e2723;
  color: #fff8e2;
  box-shadow: 0 3px 0 #264f30;
}

/* ── Blueprint Clipboard Lineup Planner (Taped 5×5 Mini-Boards + Dotted Rows) ── */
.plan-chip { color: #3e2723; }
.plan-chip.is-active {
  background: #4e965b;
  border-color: #3e2723;
  color: #fff8e2;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.25), 0 2.5px 0 #264f30;
}
.plan-chip.is-active svg * { stroke: #fff8e2; }
.plan-list {
  display: flex;
  flex-direction: column;
  max-height: 365px;
  overflow-y: auto;
  padding-right: 4px;
}
.plan-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 128px;
  gap: 14px;
  align-items: center;
  padding: 12px 6px;
  border-bottom: 1.8px dashed rgba(154, 114, 68, 0.42);
}
.plan-row:last-child { border-bottom: none; }
.plan-row.is-active {
  background: rgba(164, 206, 134, 0.22);
  border-radius: 8px;
  padding-inline: 10px;
}
.plan-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.plan-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.plan-top strong { font-family: var(--display); font-size: 17px; color: #3e2723; }
.plan-info p { margin: 0; font-size: 12px; line-height: 1.44; color: var(--ink-soft); }

.plan-side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}
.plan-meter { display: flex; flex-direction: column; gap: 3px; text-align: center; }
.plan-prog { font-family: var(--display); font-size: 11.5px; color: #5c3a20; }
.plan-bar {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: #e5d2ab;
  border: 1.4px solid #3e2723;
  overflow: hidden;
}
.plan-bar i {
  display: block;
  height: 100%;
  background: #e8a732;
  border-radius: inherit;
}
.stamp-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 7px;
  background: #4e965b;
  border: 2px solid #3e2723;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.25), 0 2.5px 0 #264f30;
  color: #fff8e2;
  font-family: var(--display);
  font-size: 13.5px;
  white-space: nowrap;
  transition: transform 0.1s ease, background 0.12s ease;
}
.stamp-cta .ui-ico { width: 14px; height: 14px; }
.stamp-cta:hover { background: #5aa667; transform: translateY(-1px); }
.stamp-cta:active { transform: translateY(1.5px); box-shadow: 0 1px 0 #264f30; }
.stamp-cta.is-muted {
  background: #f2e4c4;
  color: #5c3a20;
  box-shadow: 0 2px 0 #7c5b3b;
}
.stamp-cta.is-sm { padding: 4px 9px; font-size: 12px; }
.plan-btns { display: inline-flex; justify-content: center; gap: 5px; }

/* Taped Mini 5×5 Orchard Blueprint Thumbnail */
.taped-board {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: fit-content;
  margin: 0 auto;
}
.taped-board::before,
.taped-board::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 9px;
  background: rgba(247, 236, 206, 0.92);
  border: 1.4px solid #3e2723;
  z-index: 3;
  pointer-events: none;
}
.taped-board::before { top: -2px; left: -6px; transform: rotate(-36deg); }
.taped-board::after  { bottom: -2px; right: -6px; transform: rotate(-36deg); }
.taped-board.is-large-wrap { display: grid; margin: 10px auto; }

.mini-board {
  width: 102px;
  height: 102px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 2px;
  padding: 4px;
  border-radius: 6px;
  background: #c89a60;
  border: 2px solid #3e2723;
  box-shadow: 0 2.5px 0 rgba(92, 58, 32, 0.35);
  flex: none;
}
.mini-board.is-large { width: 220px; height: 220px; gap: 3px; padding: 5px; margin: 8px auto; }
.mini-cell {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: #c5d678;
  overflow: hidden;
}
.mini-cell.has-unit { background: #e8df9e; }
.mini-cell.is-fertile {
  background: url("./assets/ui/tile-gold.webp?v=38") center / cover no-repeat, #f2cc64;
  box-shadow: inset 0 0 0 1px rgba(196, 126, 16, 0.78);
}
.mini-cell.is-matched { box-shadow: inset 0 0 0 1.5px #2e8b47; }
.mini-cell.is-matched:not(.is-fertile) { background: #b4f0c4; }
.mini-cell.lv-3 { box-shadow: inset 0 0 0 1.5px #d98212; }
.mini-cell.is-ascend { box-shadow: inset 0 0 0 1.5px #b038ba; }
.mini-cell .drawn-icon { width: 92%; height: 92%; }
.mini-rank {
  position: absolute;
  right: 1px;
  bottom: 1px;
  padding: 0 2.5px;
  border-radius: 3px;
  font-style: normal;
  font-family: var(--display);
  font-size: 7px;
  line-height: 1.15;
  color: #fff8d6;
  background: rgba(56, 32, 16, 0.85);
  pointer-events: none;
}
.mini-board.is-large .mini-rank { font-size: 9px; padding: 0 3.5px; }
.mini-cell.lv-2 .mini-rank { background: #386b30; }
.mini-cell.lv-3 .mini-rank { background: #b8580a; }
.mini-cell.is-ascend .mini-rank { background: #8c2d8a; }
.plan-active-view { text-align: center; }
.plan-active-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.plan-checklist { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin: 8px 0; }
.plan-chip-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(188, 144, 84, 0.2);
  border: 1px solid #c9a672;
  font-size: 11.5px;
  color: var(--ink);
}
.plan-chip-item.done { background: rgba(76, 175, 96, 0.22); border-color: #469656; color: #1f5c2b; }
.plan-chip-item .drawn-icon { width: 18px; height: 18px; }
.plan-lb-meta { text-align: center; margin: 4px 0 8px; font-size: 13px; }
@keyframes plan-pulse { from { box-shadow: 0 0 8px rgba(242, 186, 56, 0.72), inset 0 0 8px rgba(255, 240, 176, 0.45); } to { box-shadow: 0 0 18px rgba(245, 200, 72, 1), inset 0 0 16px rgba(255, 246, 198, 0.85); } }

/* ── Animations ── */
@keyframes gold-shimmer { 0%,100%{background-position:0% 0%} 50%{background-position:100% 100%} }
@keyframes flame-dance { from{transform:translateY(4px) scale(.72,.58) rotate(-10deg);opacity:.6} to{transform:translateY(-5px) scale(1.06,1.32) rotate(12deg);opacity:1} }
@keyframes lava-flow { from{background-position:0% 50%} to{background-position:200% 50%} }
@keyframes merge-pulse { from{box-shadow:0 0 8px rgba(255,196,46,.7),inset 0 0 8px rgba(255,214,84,.45)} to{box-shadow:0 0 18px rgba(255,214,70,1),inset 0 0 16px rgba(255,224,96,.85)} }
@keyframes dash-march { to{stroke-dashoffset:-22} }
@keyframes shake-mild { 20%,60%{transform:translate(-3px,1px) rotate(-.3deg)} 40%,80%{transform:translate(3px,-1px) rotate(.3deg)} }
@keyframes shake-hard { 15%,45%,75%{transform:translate(-6px,2px) rotate(-.6deg)} 30%,60%,90%{transform:translate(6px,-2px) rotate(.6deg)} }

/* ── Compact Laptop Height Fit ── */
@media (max-height: 780px) and (min-width: 901px) {
  .tabletop { padding: 8px 0 8px; }
  .board-column { --board-size: clamp(290px, calc(100dvh - 154px), 500px); gap: 8px; }
  .board-frame { --rim: 13px; }
  .parchment-note { min-height: 86px; padding: 8px 12px; }
  .wood-crate { margin-top: 14px; padding: 8px 9px 9px; }
  .shop-card { min-height: 92px; padding: 8px 2px 13px; }
  .shop-card .drawn-icon { width: 44px; height: 44px; }
  .harvest-plaque { height: 50px; font-size: 21px; }
  .harvest-ribbon { height: 42px; min-width: 176px; }
  .side-spread { gap: 10px; padding-top: 34px; }
}

.note-close { display: none; }

@media (max-width: 900px) {
  html, body {
    width: 100%;
    height: 100%;
    height: var(--app-vh, 100dvh);
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
  }
  body {
    background:
      radial-gradient(ellipse 76% 68% at 50% 46%, rgba(122, 62, 16, 0.14) 0%, rgba(56, 26, 8, 0.44) 100%),
      url("./assets/ui/table-bg-mobile.webp?v=38") center / cover no-repeat,
      #5c3416;
    background-attachment: scroll;
    -webkit-tap-highlight-color: transparent;
  }
  .tabletop {
    width: 100%;
    max-width: 460px;
    height: var(--app-vh, 100dvh);
    max-height: var(--app-vh, 100dvh);
    margin: 0 auto;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 8px calc(6px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    overflow: hidden;
  }
  .table-controls {
    position: static;
    flex: none;
    width: 100%;
    padding: 0 4px;
    background: none;
    border: none;
    box-shadow: none;
    justify-content: space-between;
    gap: 6px;
    transition: opacity 0.14s ease;
  }
  .wood-chip {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    padding: 0;
    border: 2px solid #3e2723;
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.72), 0 2px 0 #5c3a20;
  }
  .wood-chip .ui-ico { width: 17px; height: 17px; }

  .spread {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: 5px;
  }
  .board-column {
    flex: 1;
    min-height: 0;
    width: 100%;
    --board-size: min(calc(100vw - 84px), calc(var(--app-vh, 100dvh) - 348px), 322px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
  }
  .board-wrap { flex: 0 0 auto; margin: auto 0; }
  .board-frame { --rim: 10px; }
  .plaque-ropes { display: none; }
  .board-sprig-tl { width: 42px; height: 36px; top: -11px; left: -11px; }
  .board-sprig-tr { width: 34px; height: 30px; top: -10px; right: -10px; }
  .board-sprig-bl { width: 36px; height: 32px; bottom: -10px; left: -10px; }
  .board-sprig-br { width: 40px; height: 35px; bottom: -11px; right: -11px; }
  .board-flank {
    display: none;
    top: 4%;
    height: 92%;
    width: 44px;
  }
  .board-frame.has-flanks .board-flank { display: block; }
  .board-flank-l { left: -38px; }
  .board-flank-r { right: -38px; }
  .note-pin { display: none; }
  .harvest-flourish { width: 52px; height: 18px; }
  .board { gap: 3px; padding: 3px; }
  .stars { font-size: 7.5px; padding: 1.5px 3.5px; right: 2px; bottom: 2px; }
  .soil-star { font-size: 9px; top: 2px; left: 3px; }
  .worm-charge { font-size: 8px; padding: 0 3px; left: 2px; bottom: 2px; }
  .yield-pill { font-size: 10px; padding: 1px 4px; top: 2px; right: 2px; }
  .combo-badge { top: 4px; right: 4px; min-width: 58px; padding: 3px 8px; }
  .combo-badge strong { font-size: 18px; }
  .clear-toast { font-size: 12px; padding: 4px 10px; bottom: 8px; gap: 5px; max-width: calc(100% - 10px); }
  .clear-toast.is-harvest { padding: 3px 7px 3px 4px; gap: 5px; }
  .toast-badge { font-size: 10.5px; padding: 1.5px 6px; }
  .toast-score { font-size: 11px; }
  .toast-score b { font-size: 12.5px; }
  .toast-coin { font-size: 12px; gap: 2px; }
  .toast-coin .ui-ico { width: 13px; height: 13px; }
  .toast-free { font-size: 10px; padding: 1px 4px; }
  .toast-mvp { font-size: 11px; padding-left: 5px; gap: 2px; }
  .toast-mvp .drawn-icon { width: 18px; height: 18px; }
  .guide-banner { left: 4px; right: 4px; bottom: 4px; padding: 3px 6px; gap: 5px; font-size: 10.5px; }
  .guide-step { font-size: 9.5px; padding: 1px 4px; }
  .guide-skip { width: 17px; height: 17px; font-size: 12px; }

  .score-plaque {
    flex: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px 2px;
    background: none;
    border: none;
    transition: opacity 0.14s ease;
  }
  .stage-tag { font-size: 12px; padding: 4px 8px 4px 10px; white-space: nowrap; flex: none; }
  .climate-tag { display: none; }
  .boss-tag { font-size: 11px; padding: 4px 7px 4px 6px; max-width: 34%; }
  .boss-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .boss-tag .boss-seal { width: 17px; height: 17px; }
  .boss-mark { font-size: 8px; padding: 0 3px; top: 1px; right: 1px; border-radius: 4px; }
  .boss-hp-icon { width: 18px; height: 18px; }
  .boss-hp-icon svg { width: 12px; height: 12px; }
  .meter-track { height: 22px; }
  .score-readout #score { font-size: 14px; }
  .score-readout span { font-size: 11.5px; }
  .tier-stars { font-size: 12px; top: -10px; right: 8px; gap: 2px; }

  /* Cleanly hide top header while mobile floating inspector occupies the top slot (zero peeking overlap!) */
  body.mobile-note-open .table-controls,
  body.mobile-note-open .score-plaque {
    opacity: 0;
    pointer-events: none;
  }

  .board-tray { flex: none; width: 100%; flex-wrap: wrap; gap: 4px; }
  .relic-shelf { min-height: 24px; padding: 2px 9px; }
  .shelf-label { font-size: 11px; }
  .relic-chip { width: 20px; height: 20px; }
  .boss-ribbon { padding: 2px 8px; font-size: 11px; }

  .side-spread { flex: none; width: 100%; padding-top: 0; gap: 5px; }

  /* Floating inspector card on mobile: takes 0 layout space until player taps a card/unit/Boss/relic */
  .parchment-note {
    display: none;
    position: fixed;
    top: calc(6px + env(safe-area-inset-top, 0px));
    left: 8px;
    right: 8px;
    max-width: 444px;
    margin: 0 auto;
    z-index: 60;
    min-height: 0;
    padding: 7px 30px 7px 10px;
    border-radius: 8px;
    border: 2px solid #3e2723;
    box-shadow: 0 4px 0 #5c3a20;
    transform: none;
  }
  .parchment-note.mobile-open {
    display: flex;
    animation: note-pop 0.16s ease-out;
  }
  .note-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f3e4c2;
    border: 1.5px solid #3e2723;
    color: var(--ink);
    font-size: 14px;
    line-height: 1;
    padding: 0;
  }
  .detail-body { gap: 8px; }
  .detail-art { width: 36px; height: 36px; }
  .detail-copy { font-size: 11.5px; line-height: 1.32; }
  .detail-copy strong { font-size: 14px; }
  .detail-est { font-size: 11px; margin-top: 2px; }

  .wood-crate { width: 100%; margin-top: 16px; padding: 7px 7px 7px; border-radius: 9px; }
  .crate-awning { top: -15px; left: -4px; right: -4px; height: 17px; }
  .shop-card:nth-child(n) { transform: none; }
  .pouch-ico, .pouch-ico svg { width: 17px; height: 17px; }
  .crate-head { margin-bottom: 6px; padding: 0 2px; }
  .crate-head h2 { font-size: 16px; }
  .gold-pouch { padding: 1px 8px 1px 4px; }
  .gold-pouch strong { font-size: 15px; }
  .market-main { gap: 5px; margin-bottom: 14px; }
  .shop { gap: 4px; }
  .shop-card { min-height: 78px; padding: 7px 1px 11px; border-radius: 7px; gap: 2px; }
  .shop-card::before { height: 3.5px; }
  .shop-card .drawn-icon { width: 38px; height: 38px; }
  .shop-card strong { font-size: 10.5px; }
  .shop-card .cost { width: 20px; height: 20px; bottom: -10px; font-size: 10px; border-width: 1.8px; }
  .shop-card .cost b { font-size: 10.5px; }
  .shop-card .up-pill { font-size: 8.5px; top: -9px; padding: 0.5px 5px; }
  .shop-card .plan-pill { font-size: 8.5px; top: -9px; padding: 0.5px 5px; }
  .shop.is-five { gap: 3px; }
  .shop.is-five .shop-card { min-height: 74px; padding: 6px 0 10px; }
  .shop.is-five .shop-card .drawn-icon { width: 29px; height: 29px; }
  .shop.is-five .shop-card strong { font-size: 9px; }
  .shop.is-five .shop-card .cost { width: 18px; height: 18px; bottom: -9px; font-size: 9px; }
  .shop.is-five .shop-card .cost b { font-size: 9px; }
  .crate-actions { width: 38px; gap: 5px; }
  .paper-btn { min-height: 36px; border-radius: 7px; }
  .paper-btn .ui-ico { width: 18px; height: 18px; }
  .stamp-badge { min-width: 17px; height: 17px; font-size: 9.5px; right: -5px; bottom: -5px; }
  .free-upgrade-slot { margin-bottom: 4px; }
  .free-upgrade-card { padding: 3px 7px; gap: 5px; }
  .free-upgrade-card strong { font-size: 11.5px; }
  .free-upgrade-card small { font-size: 9.5px; }
  .free-upgrade-badge { font-size: 10.5px; padding: 1px 6px; }

  .consumable-slot { margin-bottom: 0; }
  .consumable-card { height: 42px; padding: 3px 8px; gap: 6px; }
  .consumable-card .drawn-icon { width: 26px; height: 26px; }
  .consumable-card strong { font-size: 12px; }
  .consumable-card small { font-size: 10px; }
  .consumable-card .c-price { font-size: 11px; }
  .consumable-card .c-coin { width: 24px; height: 24px; border-width: 1.8px; }
  .consumable-card .c-coin b { font-size: 11.5px; }
  .consumable-card.empty { height: 42px; min-height: 42px; font-size: 11px; }

  .harvest-plaque { height: 44px; font-size: 19px; gap: 6px; letter-spacing: 0.1em; }
  .harvest-ribbon { height: 38px; min-width: 158px; padding: 0 22px; }
  .harvest-ribbon::before, .harvest-ribbon::after { width: 14px; }
  .harvest-ribbon::before { left: -11px; }
  .harvest-ribbon::after { right: -11px; }
  .stars { right: 2px; bottom: 2px; font-size: 7px; padding: 1px 3px; }
  dialog, dialog#result { width: calc(100% - 14px); }
  dialog h2 { font-size: 19px; }
  dialog p { font-size: 12px; line-height: 1.38; }
  .book-shell { padding-top: 30px; padding-bottom: 10px; }
  .book-tabs { left: 10px; right: 36px; gap: 4px; top: 2px; }
  .book-tabs.is-offset { left: 48px; }
  .book-tab {
    flex: 0 1 auto;
    min-width: 0;
    height: 27px;
    padding: 0 8px;
    font-size: 11.5px;
    border-radius: 8px 8px 0 0;
    gap: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .book-tab .ui-ico { width: 13px; height: 13px; }
  .book-tab.active { height: 31px; }
  .book-tab.active::after { bottom: -12px; height: 13px; }
  .book-clip { width: 38px; height: 38px; left: 9px; top: 13px; }
  .book-shell.is-compact .book-clip { top: -9px; }
  .book-close { width: 30px; height: 30px; font-size: 18px; top: 18px; right: -4px; }
  .book-cover { padding: 7px; border-radius: 11px; }
  .book-page { padding: 11px 11px 12px; max-height: calc(100dvh - 84px); }
  .book-page.is-open-book { background: #fcf5e3; }
  .almanac-ledger { flex-direction: column; align-items: stretch; gap: 6px; padding-bottom: 8px; margin-bottom: 8px; }
  .almanac-ledger h2 { font-size: 20px; }
  .ledger-right { justify-content: space-between; gap: 8px; }
  .ledger-stats { gap: 8px; padding: 3px 6px; flex: 1; justify-content: space-around; }
  .ledger-stats span { font-size: 10px; }
  .ledger-stats b { font-size: 13px; }
  .wax-badge { width: 42px; height: 42px; font-size: 11.5px; }
  .specimen-stamp { width: 44px; height: 44px; }
  .specimen-stamp .drawn-icon { width: 34px; height: 34px; }
  .almanac-grid { grid-template-columns: 1fr; row-gap: 5px; max-height: 310px; }
  .specimen-item { padding: 7px 8px; gap: 8px; }
  .specimen-head strong { font-size: 14px; }
  .sheet-hero { margin-bottom: 8px; padding-bottom: 6px; }
  .sheet-hero.is-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .sheet-sub { font-size: 11px; }
  .choices, .choices.four-col { grid-template-columns: 1fr; gap: 7px; margin-top: 8px; }
  .choice {
    display: grid;
    grid-template-columns: 46px 1fr;
    grid-template-rows: auto auto;
    column-gap: 9px;
    row-gap: 1px;
    align-items: center;
    text-align: left;
    padding: 7px 9px;
  }
  .choice .specimen-stamp { grid-row: 1 / 3; width: 46px; height: 46px; }
  .choice .specimen-stamp .drawn-icon { width: 36px; height: 36px; }
  .choice strong { font-size: 14px; line-height: 1.15; }
  .choice small { font-size: 11px; line-height: 1.28; }
  .dialog-actions { margin-top: 10px; gap: 8px; }
  .dialog-actions button { padding: 6px 14px; font-size: 13.5px; }
  .sheet-inline-bar { padding: 5px 6px; gap: 5px; font-size: 11.5px; }
  .sheet-inline-bar input { font-size: 12px; padding: 3px 6px; }
  .lb-list { max-height: 270px; }
  .lb-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 6px; padding: 6px 6px; }
  .lb-units .drawn-icon { width: 17px; height: 17px; }
  .lb-score { min-width: 58px; font-size: 13.5px; }
  .farm-grid { grid-template-columns: 1fr; gap: 6px; margin-top: 6px; }
  .farm-card { padding: 7px 9px; gap: 8px; }
  .farm-seal .ui-ico { width: 13px; height: 13px; }
  .farm-card strong { font-size: 13.5px; }
  .farm-card small { font-size: 10.5px; }
  .plan-row {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px 10px;
    padding: 9px 4px;
  }
  .plan-side {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .plan-meter { flex: 1; text-align: left; }
  .mini-board { width: 82px; height: 82px; padding: 3px; }
  .mini-board.is-large { width: 184px; height: 184px; }
  .plan-top strong { font-size: 14px; }
  .plan-info p { font-size: 11px; }
  .plan-target-flag { font-size: 8px; padding: 0 3px; }
}

@keyframes note-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Instant Desktop Phone-Frame Preview (?mobile=1) */
body.force-mobile {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  background: #140c07;
  padding: 10px 0;
  overflow: hidden;
}
body.force-mobile.mobile-scaled {
  align-items: start;
}
body.force-mobile .tabletop {
  position: relative;
  width: min(390px, 100%);
  height: min(680px, calc(100dvh - 20px));
  max-height: min(680px, calc(100dvh - 20px));
  padding: 6px 8px 7px;
  border-radius: 26px;
  border: 6px solid #3e2723;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.52), inset 0 0 0 1px rgba(255, 246, 224, 0.25);
  background: linear-gradient(180deg, rgba(164, 214, 232, 0.24) 0%, rgba(164, 214, 232, 0.08) 38%, rgba(114, 174, 82, 0.14) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  overflow: hidden;
}
body.force-mobile .table-controls { position: static; flex: none; width: 100%; padding: 0 4px; justify-content: space-between; gap: 6px; }
body.force-mobile .wood-chip { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
body.force-mobile .wood-chip .ui-ico { width: 17px; height: 17px; }
body.force-mobile .spread { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 5px; }
body.force-mobile .board-column { flex: 1; min-height: 0; width: 100%; --board-size: 272px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; }
body.force-mobile .board-wrap { flex: 0 0 auto; margin: auto 0; }
body.force-mobile.mobile-note-open .table-controls,
body.force-mobile.mobile-note-open .score-plaque { opacity: 0; pointer-events: none; }
body.force-mobile .board-frame { --rim: 10px; }
body.force-mobile .board-sprig-tl { width: 42px; height: 36px; top: -11px; left: -11px; }
body.force-mobile .board-sprig-tr { width: 34px; height: 30px; top: -10px; right: -10px; }
body.force-mobile .board-sprig-bl { width: 36px; height: 32px; bottom: -10px; left: -10px; }
body.force-mobile .board-sprig-br { width: 40px; height: 35px; bottom: -11px; right: -11px; }
body.force-mobile .board-flank { display: none; top: 4%; height: 92%; width: 44px; }
body.force-mobile .board-frame.has-flanks .board-flank { display: block; }
body.force-mobile .board-flank-l { left: -38px; }
body.force-mobile .board-flank-r { right: -38px; }
body.force-mobile .board { gap: 3px; padding: 3px; }
body.force-mobile .combo-badge { top: 4px; right: 4px; min-width: 58px; padding: 3px 8px; }
body.force-mobile .combo-badge strong { font-size: 18px; }
body.force-mobile .score-plaque { flex: none; width: 100%; display: flex; align-items: center; gap: 6px; padding: 4px 2px 2px; background: none; border: none; }
body.force-mobile .stage-tag { font-size: 12px; padding: 4px 8px 4px 10px; }
body.force-mobile .climate-tag { display: none; }
body.force-mobile .boss-tag { font-size: 11px; padding: 4px 7px 4px 6px; max-width: 34%; }
body.force-mobile .boss-tag .boss-seal { width: 17px; height: 17px; }
body.force-mobile .meter-track { height: 22px; }
body.force-mobile .score-readout #score { font-size: 14px; }
body.force-mobile .score-readout span { font-size: 11.5px; }
body.force-mobile .tier-stars { font-size: 12px; top: -10px; right: 8px; gap: 2px; }
body.force-mobile .board-tray { flex: none; width: 100%; flex-wrap: wrap; gap: 4px; }
body.force-mobile .relic-shelf { min-height: 24px; padding: 2px 9px; }
body.force-mobile .shelf-label { font-size: 11px; }
body.force-mobile .relic-chip { width: 20px; height: 20px; }
body.force-mobile .boss-ribbon { padding: 2px 8px; font-size: 11px; }
body.force-mobile .side-spread { flex: none; width: 100%; padding-top: 0; gap: 5px; }
body.force-mobile .parchment-note {
  display: none;
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  z-index: 60;
  min-height: 0;
  padding: 7px 30px 7px 10px;
  border-radius: 8px;
  border: 2px solid #3e2723;
  box-shadow: 0 4px 0 #5c3a20;
  transform: none;
}
body.force-mobile .parchment-note.mobile-open { display: flex; }
body.force-mobile .note-close {
  display: grid;
  place-items: center;
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f3e4c2;
  border: 1.5px solid #3e2723;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
body.force-mobile .note-pin { display: none; }
body.force-mobile .detail-body { gap: 8px; }
body.force-mobile .detail-art { width: 36px; height: 36px; }
body.force-mobile .detail-copy { font-size: 11.5px; line-height: 1.32; }
body.force-mobile .detail-copy strong { font-size: 14px; }
body.force-mobile .detail-est { font-size: 11px; margin-top: 2px; }
body.force-mobile .wood-crate { width: 100%; margin-top: 16px; padding: 7px 7px 7px; border-radius: 9px; }
body.force-mobile .crate-awning { top: -15px; left: -4px; right: -4px; height: 17px; }
body.force-mobile .crate-head { margin-bottom: 5px; padding: 0 2px; }
body.force-mobile .crate-head h2 { font-size: 16px; }
body.force-mobile .gold-pouch { padding: 1px 8px 1px 4px; }
body.force-mobile .gold-pouch strong { font-size: 15px; }
body.force-mobile .market-main { gap: 5px; margin-bottom: 14px; }
body.force-mobile .shop { gap: 4px; }
body.force-mobile .shop-card { min-height: 76px; padding: 7px 1px 11px; border-radius: 7px; gap: 2px; }
body.force-mobile .shop-card .drawn-icon { width: 36px; height: 36px; }
body.force-mobile .shop-card strong { font-size: 10.5px; }
body.force-mobile .shop-card .cost { width: 20px; height: 20px; bottom: -10px; font-size: 10px; border-width: 1.8px; }
body.force-mobile .shop-card .cost b { font-size: 10.5px; }
body.force-mobile .shop-card .up-pill { font-size: 8.5px; top: -9px; padding: 0.5px 5px; }
body.force-mobile .shop-card .plan-pill { font-size: 8.5px; top: -9px; padding: 0.5px 5px; }
body.force-mobile .crate-actions { width: 38px; gap: 5px; }
body.force-mobile .paper-btn { min-height: 36px; border-radius: 7px; }
body.force-mobile .paper-btn .ui-ico { width: 18px; height: 18px; }
body.force-mobile .stamp-badge { min-width: 17px; height: 17px; font-size: 9.5px; right: -5px; bottom: -5px; }
body.force-mobile .consumable-slot { margin-bottom: 0; }
body.force-mobile .consumable-card { height: 42px; padding: 3px 8px; gap: 6px; }
body.force-mobile .consumable-card .drawn-icon { width: 26px; height: 26px; }
body.force-mobile .consumable-card strong { font-size: 12px; }
body.force-mobile .consumable-card small { font-size: 10px; }
body.force-mobile .consumable-card .c-price { font-size: 11px; }
body.force-mobile .consumable-card .c-coin { width: 24px; height: 24px; border-width: 1.8px; }
body.force-mobile .consumable-card .c-coin b { font-size: 11.5px; }
body.force-mobile .consumable-card.empty { height: 42px; min-height: 42px; font-size: 11px; }
body.force-mobile .harvest-plaque { height: 42px; font-size: 19px; gap: 6px; }
body.force-mobile .harvest-ribbon { height: 36px; min-width: 154px; padding: 0 20px; }
body.force-mobile .harvest-flourish { width: 48px; height: 16px; }
body.force-mobile .stars { right: 2px; bottom: 2px; font-size: 7px; padding: 1px 3px; }
body.force-mobile .shop.is-five { gap: 3px; }
body.force-mobile .shop.is-five .shop-card { min-height: 72px; padding: 6px 0 10px; }
body.force-mobile .shop.is-five .shop-card .drawn-icon { width: 28px; height: 28px; }
body.force-mobile .shop.is-five .shop-card strong { font-size: 9px; }
body.force-mobile .shop.is-five .shop-card .cost { width: 18px; height: 18px; bottom: -9px; font-size: 9px; }
body.force-mobile .free-upgrade-slot { margin-bottom: 4px; }
body.force-mobile .free-upgrade-card { padding: 3px 7px; gap: 5px; }
body.force-mobile .free-upgrade-card strong { font-size: 11.5px; }
body.force-mobile .free-upgrade-card small { font-size: 9.5px; }
body.force-mobile .free-upgrade-badge { font-size: 10.5px; padding: 1px 6px; }
body.force-mobile dialog,
body.force-mobile dialog#result { width: min(376px, calc(100% - 14px)); }
body.force-mobile dialog h2 { font-size: 19px; }
body.force-mobile dialog p { font-size: 12px; line-height: 1.38; }
body.force-mobile .book-shell { padding-top: 30px; padding-bottom: 10px; }
body.force-mobile .book-tabs { left: 10px; right: 36px; gap: 4px; top: 2px; }
body.force-mobile .book-tabs.is-offset { left: 48px; }
body.force-mobile .book-tab { flex: 0 1 auto; min-width: 0; height: 27px; padding: 0 8px; font-size: 11.5px; border-radius: 8px 8px 0 0; gap: 3px; overflow: hidden; text-overflow: ellipsis; }
body.force-mobile .book-tab .ui-ico { width: 13px; height: 13px; }
body.force-mobile .book-tab.active { height: 31px; }
body.force-mobile .book-tab.active::after { bottom: -12px; height: 13px; }
body.force-mobile .book-tab .diff-sub-label { display: none; }
body.force-mobile .book-clip { width: 38px; height: 38px; left: 9px; top: 13px; }
body.force-mobile .book-shell.is-compact .book-clip { top: -9px; }
body.force-mobile .book-close { width: 30px; height: 30px; font-size: 18px; top: 18px; right: -4px; }
body.force-mobile .book-cover { padding: 7px; border-radius: 11px; }
body.force-mobile .book-page { padding: 11px 11px 12px; max-height: calc(100dvh - 84px); }
body.force-mobile .book-page.is-open-book { background: #fcf5e3; }
body.force-mobile .almanac-ledger { flex-direction: column; align-items: stretch; gap: 6px; padding-bottom: 8px; margin-bottom: 8px; }
body.force-mobile .almanac-ledger h2 { font-size: 20px; }
body.force-mobile .ledger-right { justify-content: space-between; gap: 8px; }
body.force-mobile .ledger-stats { gap: 8px; padding: 3px 6px; flex: 1; justify-content: space-around; }
body.force-mobile .wax-badge { width: 42px; height: 42px; font-size: 11.5px; }
body.force-mobile .specimen-stamp { width: 44px; height: 44px; }
body.force-mobile .specimen-stamp .drawn-icon { width: 34px; height: 34px; }
body.force-mobile .almanac-grid { grid-template-columns: 1fr; row-gap: 5px; max-height: 310px; }
body.force-mobile .farm-grid { grid-template-columns: 1fr; gap: 6px; margin-top: 6px; }
body.force-mobile .plan-row { grid-template-columns: 86px minmax(0, 1fr); gap: 8px 10px; padding: 9px 4px; }
body.force-mobile .plan-side { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
body.force-mobile .plan-meter { flex: 1; text-align: left; }
body.force-mobile .mini-board { width: 82px; height: 82px; padding: 3px; }
body.force-mobile .lb-score { min-width: 58px; font-size: 13.5px; }
body.force-mobile .choices, body.force-mobile .choices.four-col { grid-template-columns: 1fr; gap: 6px; }
body.force-mobile .choice { display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: 9px; row-gap: 1px; align-items: center; text-align: left; padding: 7px 9px; }
body.force-mobile .choice .specimen-stamp { grid-row: 1 / 3; width: 46px; height: 46px; }
body.force-mobile .choice .specimen-stamp .drawn-icon { width: 36px; height: 36px; }
body.force-mobile .choice strong { font-size: 14px; line-height: 1.15; }
body.force-mobile .choice small { font-size: 11px; line-height: 1.28; }

@media (max-width: 440px) {
  .book-tab .diff-sub-label { display: none; }
}

@media (max-width: 380px) {
  .table-controls { gap: 3px; padding: 0 2px; }
  .wood-chip { width: 31px; height: 31px; }
  .wood-chip .ui-ico { width: 15px; height: 15px; }
  .stage-tag { font-size: 11px; padding: 3px 6px 3px 8px; }
  .boss-tag { font-size: 10px; padding: 3px 5px; }
  .crate-actions { width: 34px; }
  .book-tabs { left: 8px; right: 32px; gap: 3px; }
  .book-tabs.is-offset { left: 42px; }
  .book-tab { padding: 0 6px; font-size: 11px; }
  .book-clip { width: 34px; height: 34px; left: 6px; }
  .toast-mvp { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
