/* Self-hosted fonts (user's pick 2026-11-02, option 2; OFL, see fonts/OFL.txt; rebuild with tools/font-subset.py).
   Chinese files are subsets: characters missing from them fall back to the system fonts in the stack. */
@font-face { font-family: "Lora"; src: url("../fonts/lora-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("../fonts/lora-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("../fonts/lora-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Noto Serif SC"; src: url("../fonts/notoserifsc-400-sub.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Serif SC"; src: url("../fonts/notoserifsc-700-sub.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Ma Shan Zheng"; src: url("../fonts/mashanzheng-sub.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --font-body: "Lora", "Noto Serif SC", "Georgia", "Songti SC", "Source Han Serif SC", "STSong", serif;
  /* Titles, names and buttons: Lora for Latin, Ma Shan Zheng brush for Chinese. */
  --font-display: "Lora", "Ma Shan Zheng", "Noto Serif SC", "Georgia", "Songti SC", serif;
  --bg: #f4ead8;
  --paper: #fffaf0;
  --ink: #3b2f2f;
  --muted: #8a7a6a;
  --accent: #b23a48;
  --gold: #d4a017;
  --jade: #4f8a6e;
  --cell: #ead9bd;
  --cell-alt: #e3cfaf;
  --shadow: 0 2px 6px rgba(59, 47, 47, 0.18);
  --board: #c8ad85;
  --card: #fff;
  --lvl-bg: rgba(255, 250, 240, 0.85);
  --have: #cfe6d6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overscroll-behavior: none;
}

button {
  font: inherit;
  font-family: var(--font-display);
  cursor: pointer;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 6px 10px;
}
button:disabled { background: #c9b8a3; cursor: default; }
button.icon { background: transparent; color: var(--ink); font-size: 22px; padding: 2px 6px; }
button.mini { padding: 0 7px; font-size: 14px; background: var(--jade); }
button.danger { background: #7a1f2b; width: 100%; margin-top: 8px; }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
}
/* M7: fit one screen. The board shrinks to the height left over, so short phones don't scroll. */
#app { height: 100vh; height: 100dvh; min-height: 0; }
#app > * { flex: 0 0 auto; }
#app > #board-wrap {
  flex: 1 1 0; min-height: 240px; container-type: size;
  display: flex; justify-content: center; align-items: flex-start;
}

/* HUD */
#hud { display: flex; align-items: center; gap: 10px; }
#hud .stat { background: var(--paper); border-radius: 20px; padding: 4px 10px; box-shadow: var(--shadow); white-space: nowrap; }
#hud .stat small { color: var(--muted); font-size: 11px; }
#hud .stat:first-child { flex: 1; }

@media (max-width: 400px) {
  #hud { gap: 6px; }
  #hud .stat { padding: 4px 8px; }
  #hud button.icon { font-size: 20px; padding: 2px 3px; }
}

/* Chapter bar */
#chapter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(90deg, #3d2c3e, #5b3f5c);
  color: #fdf3e0; border-radius: 12px; padding: 8px 10px;
}
#chapter-title { font-weight: bold; font-size: 14px; }
#chapter-progress { font-size: 12px; opacity: 0.8; }
#renovate { font-size: 12px; max-width: 48%; background: #6e5a70; }
#renovate.affordable { background: var(--gold); color: var(--ink); animation: glow 1.4s ease-in-out infinite alternate; }
#renovate.complete { background: var(--jade); color: #fff; opacity: 0.85; }
.task { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid rgba(0,0,0,0.08); }
.task-emoji { font-size: 24px; }
.task-name { flex: 1; }
.task.done .task-name { text-decoration: line-through; opacity: 0.6; }
.task-done { color: var(--jade); font-weight: bold; }
.task-buy { background: #6e5a70; }
.task-buy.affordable { background: var(--gold); color: var(--ink); }
.task-hint { font-size: 12px; opacity: 0.75; margin-top: 10px; }
@keyframes glow { to { box-shadow: 0 0 12px var(--gold); } }

/* Orders */
/* #orders layout: see "Orders as a counter scene" below */
.order {
  position: relative; flex: 0 0 auto; min-width: 104px;
  background: var(--paper); border-radius: 12px; padding: 6px 8px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.order.story { border: 2px solid var(--accent); }
.order-items { display: flex; gap: 4px; }
.need { font-size: 22px; background: var(--cell); border-radius: 8px; padding: 2px 4px; opacity: 0.55; }
.need.have { opacity: 1; background: var(--have); }
.serve { font-size: 12px; padding: 4px 8px; width: 100%; }
.order-heart { position: absolute; top: -6px; right: -4px; color: var(--accent); font-size: 16px; }
.order.big { border: 2px solid var(--gold); }
.order-big {
  position: absolute; top: -7px; right: 6px; font-size: 10px; font-family: var(--font-body);
  background: var(--gold); color: var(--ink); border-radius: 6px; padding: 0 5px;
}

/* Board */
#board {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
  background: var(--board); padding: 4px; border-radius: 12px;
  touch-action: none;
  width: 100%;
  /* 9 rows of 7: height ≈ 9/7 of width, plus padding and gaps (32px tall, 26px wide) */
  width: min(100cqw, (100cqh - 32px) * 7 / 9 + 26px);
}
.cell { aspect-ratio: 1; background: var(--cell); border-radius: 6px; position: relative; }
.cell:nth-child(odd) { background: var(--cell-alt); }
.cell.selected { outline: 3px solid var(--gold); outline-offset: -3px; }
.item {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: clamp(20px, 7vw, 32px); position: relative; cursor: grab;
  font-size: clamp(18px, min(10cqw, 8cqh), 32px); /* M7: follows the board size */
}
.item.gen { background: radial-gradient(circle, #fff6d8 0%, transparent 70%); border-radius: 6px; }
.item.gen::after { content: ""; position: absolute; inset: 2px; border: 2px dashed var(--gold); border-radius: 6px; }
.item.dragging { opacity: 0.25; }
.item .lvl {
  position: absolute; bottom: 1px; right: 3px; font-size: 9px; font-family: var(--font-body);
  color: var(--ink); background: var(--lvl-bg); border-radius: 6px; padding: 0 3px;
}
.item .check {
  position: absolute; top: 1px; left: 2px; font-size: 10px; font-family: var(--font-body);
  color: #fff; background: var(--jade); border-radius: 50%; width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
}
/* M7: closed screens (hidden tiles): a folding wooden screen; the item isn't shown */
.cell.closed { background: #8a6b4a; cursor: help; }
.screen {
  position: absolute; inset: 0; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 0 calc(50% - 1px), rgba(0,0,0,0.35) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    repeating-linear-gradient(0deg, rgba(255,240,210,0.16) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #9b7a55, #7a5c3c);
  box-shadow: inset 0 0 0 2px rgba(60,40,20,0.45);
}
.item.opened { animation: spawn 0.4s ease-out; }
/* Locked tiles: a dusty cloth over the item */
.cell.locked .item { cursor: help; }
.cell.locked .item > :not(.cloth) { visibility: hidden; }
.cloth {
  position: absolute; inset: 0; border-radius: 6px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.10) 0 4px, transparent 4px 9px),
    rgba(120, 104, 88, 0.62);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.25);
}
.item.special { background: radial-gradient(circle, rgba(212,160,23,0.35) 0%, transparent 65%); border-radius: 6px; }
.item.pop { animation: pop 0.35s ease-out; }
.item.spawn { animation: spawn 0.3s ease-out; }
@keyframes pop { 0% { transform: scale(0.4); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes spawn { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1); } }

.ghost {
  position: fixed; pointer-events: none; z-index: 50; font-size: 40px;
  transform: translate(-50%, -60%) scale(1.15); filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

/* Info bar */
#info {
  display: flex; align-items: center; gap: 8px; height: 76px;
  background: var(--paper); border-radius: 12px; padding: 6px 10px; box-shadow: var(--shadow);
}
.info-hint { font-size: 13px; color: var(--muted); text-align: center; width: 100%; }
.info-emoji { font-size: 34px; }
.info-text { flex: 1; min-width: 0; max-height: 100%; overflow-y: auto; }
.info-name { font-weight: bold; font-size: 14px; }
.info-desc { font-size: 12px; color: var(--muted); }
/* M7: fixed height so selecting an item doesn't resize the board; actions stack on the right */
.info-actions { display: flex; flex-direction: column; gap: 3px; }
.info-actions button { font-size: 11px; padding: 3px 8px; white-space: nowrap; }
.sell { background: var(--gold); color: var(--ink); }
.store { background: #6e5a70; }
.use { background: var(--jade); }

/* Storage modal */
.storage-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.slot {
  aspect-ratio: 1; font-size: 30px; background: var(--cell); color: var(--ink);
  border: 2px dashed var(--cell-alt); padding: 0;
}
.slot:disabled { background: var(--cell); }
.slot.full { border: 2px solid var(--gold); background: var(--card); }
.buy-slot { width: 100%; background: #6e5a70; }
.buy-slot.affordable { background: var(--gold); color: var(--ink); }

/* Toasts */
/* 2026-11-02 (user): toasts sit at the bottom, over the help bar, so they never cover the
   orders at the top. On the home screen they sit just above the Cook button; while the
   colour picker (a bottom sheet) is open they move to the top. Only the newest toast shows,
   clamped to 2 lines, so it fits inside the help bar and never covers the board. */
#toasts {
  position: fixed; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  width: min(92vw, 440px); z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; pointer-events: none;
}
.toast {
  background: rgba(59, 47, 47, 0.92); color: #fdf3e0; padding: 8px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.35; box-shadow: var(--shadow); transition: opacity 0.5s, transform 0.5s;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.toast.out { opacity: 0; transform: translateY(8px); }
body.home #toasts { bottom: 84px; }
body:has(#style-sheet:not([hidden])) #toasts { top: 50px; bottom: auto; }
body:has(#style-sheet:not([hidden])) .toast.out { transform: translateY(-8px); }

/* Overlays */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(30, 20, 35, 0.55);
}
.overlay[hidden] { display: none; }
.panel {
  position: relative; background: var(--paper); border-radius: 16px; padding: 20px;
  width: min(92vw, 420px); max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow); text-align: center;
}
.panel h1 { margin: 4px 0; color: var(--accent); }
.panel .sub { margin-top: 0; color: var(--muted); font-style: italic; }
.panel label { display: block; margin: 16px 0 6px; font-size: 13px; color: var(--muted); }
.panel input {
  font: inherit; font-size: 18px; text-align: center; width: 100%; padding: 8px;
  border: 2px solid var(--cell-alt); border-radius: 10px; background: var(--card); color: var(--ink);
}
#name-go { margin-top: 14px; width: 100%; padding: 10px; font-size: 18px; }
.close { position: absolute; top: 8px; right: 8px; }
.moon { font-size: 48px; }
#modal-body { text-align: left; }

/* Chapter card */
#chapter-card { background: radial-gradient(circle at 50% 35%, #4a3a5c, #1c1424); color: #fdf3e0; cursor: pointer; }
.chapter-card-inner { text-align: center; padding: 20px; animation: fadein 0.8s; }
.chapter-card-inner h2 { font-size: 24px; letter-spacing: 0.5px; }
.tap { opacity: 0.6; font-size: 13px; animation: blink 1.6s infinite; }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } }
@keyframes blink { 50% { opacity: 0.2; } }

/* Dialogue */
#dialogue { align-items: flex-end; cursor: pointer; background: linear-gradient(transparent 30%, rgba(30, 20, 35, 0.7)); }
/* Story backdrop (a scene line with `bg`): full-screen picture behind the dialogue, e.g. the prologue's office. */
#dlg-backdrop { position: absolute; inset: 0; background: #111 center / cover no-repeat; }
#dlg-backdrop .bd-layer { position: absolute; inset: 0; background: center / cover no-repeat; animation: bdfade 0.6s; }
@keyframes bdfade { from { opacity: 0; } }
#dlg-backdrop::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(transparent 45%, rgba(20, 14, 24, 0.75)); }
#dlg-backdrop[hidden] { display: none; }
#dlg-box {
  position: relative; z-index: 2; /* above the backdrop's dark shade (::after, z-index 1) */ width: min(96vw, 480px); margin-bottom: 12px;
  background: var(--paper); border-radius: 16px; padding: 30px 16px 14px; box-shadow: 0 -2px 18px rgba(0,0,0,0.3);
  animation: fadein 0.25s;
}
#dlg-box.narration { background: #2f2433; color: #fdf3e0; font-style: italic; }
#dlg-portrait {
  position: absolute; top: -64px; left: 14px; font-size: 70px; line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.35));
}
#dlg-name {
  position: absolute; top: -14px; left: 96px; color: #fff; padding: 3px 12px; border-radius: 12px;
  font-weight: bold; font-size: 14px;
}
#dlg-text { margin: 0; font-size: 16px; line-height: 1.45; min-height: 46px; }
#dlg-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
#dlg-choices:empty { display: none; }
.choice { background: var(--card); color: var(--ink); border: 2px solid var(--accent); text-align: left; padding: 8px 12px; font-style: normal; }
.choice:hover { background: #fde8ea; }
#dlg-next { text-align: right; color: var(--muted); font-size: 12px; animation: blink 1.2s infinite; }

/* First Taste: the dish on a plate above the dialogue; each tap bites a piece out of it (js/game.js dishStage). */
#dialogue.eating { background: radial-gradient(circle at 50% 28%, #6b4a33, #2a1d22 60%, #160f14); }
#dlg-dish {
  position: absolute; z-index: 2; left: 50%; top: 9%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
#dlg-dish[hidden] { display: none; }
.dish-plate {
  position: relative; width: 280px; height: 280px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, #fffaf0 52%, #efe2c8 54%, #fffaf0 60%, #e2d1b0 70%, transparent 71%);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4));
}
.dish-plate .dish-food { width: 230px; height: 230px; font-size: 150px; line-height: 230px; text-align: center; transition: opacity 0.4s, transform 0.4s; -webkit-mask-composite: source-in; mask-composite: intersect; }
.dish-plate.ready { animation: dishwobble 1.4s ease-in-out infinite; }
.dish-plate.chomp .dish-food { animation: chomp 0.3s; }
.dish-plate.clean .dish-food { opacity: 0; transform: scale(0.7); }
/* Painted stages: stacked pictures; each new one fades in over the last. */
.dish-plate.painted .dish-food { grid-area: 1 / 1; width: 250px; height: 250px; }
.dish-plate.painted.clean .dish-food { opacity: 1; transform: none; }
.dish-plate .dish-food.stage-in { animation: bdfade 0.3s; }
@keyframes dishwobble { 50% { transform: scale(1.04) rotate(-2deg); } }
@keyframes chomp { 40% { transform: scale(0.9) rotate(4deg); } }
.dish-crumbs { position: absolute; inset: 0; pointer-events: none; }
.crumb { position: absolute; left: 50%; top: 45%; width: 7px; height: 7px; border-radius: 50%; background: #d9a55b; animation: crumb 0.7s ease-out forwards; }
.crumb:nth-child(2n) { background: #f4dfb5; width: 5px; height: 5px; }
@keyframes crumb { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.dish-name { color: #fff; font-family: var(--font-display); font-size: 18px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6); }
.dish-pips { display: flex; gap: 6px; }
.dish-pips .pip { width: 14px; height: 14px; border-radius: 50%; background: var(--who); border: 2px solid #fff; transition: background 0.3s, opacity 0.3s; }
.dish-pips .pip.on { background: transparent; opacity: 0.5; }
.dish-hint { color: #fff; font-size: 14px; animation: blink 1.2s infinite; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.dish-hint[hidden] { display: none; }
.dish-done { color: #ffe9a8; font-family: var(--font-display); font-size: 20px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6); animation: fadein 0.4s; }
/* Short phones: a smaller plate so it clears the dialogue box and portrait (scaled, so the bite sizes still fit). */
@media (max-height: 700px) {
  #dlg-dish { top: 3%; transform: translateX(-50%) scale(0.78); transform-origin: top center; }
}
.gift-dish { font-size: 12px; }
.gift-dish.on { font-weight: bold; }

/* Hearts modal */
.heart-card { border-left: 4px solid; padding: 8px 10px; margin-bottom: 12px; background: var(--card); border-radius: 8px; }
.heart-head { display: flex; align-items: center; gap: 10px; }
.heart-portrait { font-size: 32px; }
.heart-name { font-weight: bold; }
.heart-title { font-size: 12px; color: var(--muted); }
.heart-count { margin-left: auto; color: var(--accent); font-weight: bold; }
.memory { font-size: 13px; line-height: 1.4; margin: 8px 0 0; }
.memory.locked { color: var(--muted); font-style: italic; }

/* Dark mode: night-time restaurant. Follows the OS setting unless a page sets data-theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1a24; --paper: #2d2633; --ink: #f2e6d4; --muted: #b3a493;
    --cell: #3a3140; --cell-alt: #342c3a; --board: #4a3d4f; --card: #3a3140;
    --lvl-bg: rgba(45, 38, 51, 0.85); --have: #2f4a3c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #1f1a24; --paper: #2d2633; --ink: #f2e6d4; --muted: #b3a493;
    --cell: #3a3140; --cell-alt: #342c3a; --board: #4a3d4f; --card: #3a3140;
    --lvl-bg: rgba(45, 38, 51, 0.85); --have: #2f4a3c; color-scheme: dark;
}

/* Art slots: emoji placeholder or image (see art/README.md) */
img.art { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.item img.art { width: 86%; height: 86%; }
.need img.art { width: 24px; height: 24px; }
.order-portrait img.art, .heart-portrait img.art { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: 50% 12%; background: #3a2e3a; }
/* Painted busts: zoom the circle onto the head (busts are 330×420, head in the top third). */
.order-portrait:has(img.art), .heart-portrait:has(img.art) { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #3a2e3a; flex: none; }
.order-portrait img.art, .heart-portrait img.art { width: 60px; height: 76px; max-width: none; border-radius: 0; object-fit: fill; margin: -2px 0 0 -14px; }
.info-emoji img.art { width: 40px; height: 40px; }
.slot img.art { width: 70%; height: 70%; margin: auto; }
.ghost img.art { width: 52px; height: 52px; }
.task-emoji img.art { width: 28px; height: 28px; }
#dlg-portrait img.art { width: 110px; height: 140px; object-fit: contain; object-position: bottom; }
#dlg-portrait:has(img.art) { top: -132px; }
.track-mark img.art { width: 16px; height: 16px; }

/* Chapter progress track */
.track { padding: 6px 8px 2px; }
.track:empty { display: none; }
.track-bar { position: relative; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.25); margin: 6px 0 4px; }
.track-fill { height: 100%; border-radius: 3px; background: var(--gold); transition: width 0.6s ease; }
.track-mark {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1;
}
.track-mark:last-child { transform: translate(-100%, -50%); }
.track-mark.claimed { background: var(--gold); filter: saturate(0.6); }
.track-mark.claimed::after { content: "✓"; position: absolute; right: -5px; bottom: -6px; font-size: 10px; color: #fff; background: var(--jade); border-radius: 50%; width: 12px; height: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--font-body); }
#chapter-bar > div:first-child { flex: 1; min-width: 0; }
#chapter-track { padding: 2px 4px 0; }
#scene-track .track-bar { background: var(--cell); }

/* Restaurant home screen: a 9:16 stage, contain-fit in the space under the HUD */
body.home #app > #chapter-bar, body.home #app > #orders, body.home #app > #board-wrap, body.home #app > #info { display: none; }
#app > #home {
  flex: 1 1 0; min-height: 0; container-type: size;
  display: flex; justify-content: center; align-items: center;
}
#app > #home[hidden] { display: none; } /* must beat `#app > #home` above */
#stage-box {
  position: relative; aspect-ratio: 9 / 16; width: min(100cqw, calc(100cqh * 9 / 16));
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); container-type: inline-size;
}
#stage { position: absolute; inset: 0; }
#stage .stage-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Placeholder room drawn in CSS until a background image exists */
#stage.placeholder {
  background:
    linear-gradient(180deg, transparent 0 58%, rgba(0,0,0,0.12) 58% 59%, transparent 59%),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.05) 0 2px, transparent 2px 40px) 0 0 / 100% 58% no-repeat,
    linear-gradient(180deg, #b98b5e 0 58%, #8a6142 58% 100%);
}
/* Order slip: a hanging wooden tag (our own design), bottom left */
#slip {
  position: absolute; left: 3%; bottom: 2.5%; width: 60%;
  background: linear-gradient(180deg, #e9cf9f, #d8b47c); color: #3b2414; /* fixed dark ink: the tag stays light in dark mode */
  border: 2px solid #7a5631; border-radius: 6px 6px 14px 6px; padding: 6px 8px 7px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35); font-size: 12px; text-align: left;
}
#slip::before, #slip::after {
  content: ""; position: absolute; top: -9px; width: 2px; height: 9px; background: #5b3d22;
}
#slip::before { left: 18%; } #slip::after { right: 18%; }
.slip-title { font-weight: bold; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-line, .slip-hint { font-size: 11px; opacity: 0.85; margin-top: 2px; }
#slip .track { margin: 3px 0 2px; }
#slip .track-bar { background: rgba(255,255,255,0.45); }
.slip-next { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.slip-task { flex: 1; min-width: 0; font-size: 11px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slip-buy { background: #6e5a70; font-size: 12px; padding: 4px 8px; white-space: nowrap; }
.slip-buy.affordable { background: var(--gold); color: #3b2414; animation: glow 1.4s ease-in-out infinite alternate; }
#cook {
  position: absolute; right: 3%; bottom: 2.5%; width: 31%; aspect-ratio: 1.15;
  font-size: clamp(16px, 6.2cqw, 24px); font-weight: bold; border-radius: 16px;
  background: linear-gradient(180deg, #c8463f, #962c2b); border: 2px solid #f0c36b;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
/* Style picker: a bottom sheet so the room stays visible for the live preview */
.overlay.sheet { align-items: flex-end; background: rgba(30, 20, 35, 0.2); }
.sheet-panel { width: min(100vw, 480px); border-radius: 16px 16px 0 0; padding: 14px 14px 18px; }
.sheet-panel h2 { margin: 0 26px 10px; font-size: 16px; }
#style-swatches { display: flex; gap: 8px; margin-bottom: 12px; }
.swatch {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card); color: var(--ink); border: 2px solid var(--cell-alt); padding: 8px 4px;
}
.swatch.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.swatch .obj { font-size: 34px; line-height: 1; }
.swatch .art { max-width: 56px; }
.swatch .dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.3); }
.swatch-name { font-size: 12px; }
#style-ok { width: 100%; padding: 10px; font-size: 17px; }
.spot {
  position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center; cursor: default;
}
.spot { cursor: pointer; }
.spot .obj { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.spot .art { max-width: 100%; max-height: 100%; }
.spot .art.emoji { font-size: calc(var(--w, 14) * 0.62cqw); line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); }
.spot.shabby:not(.next) { opacity: 0.55; cursor: default; }
/* Marker for a repair that has no painted art yet: a soft lantern-coloured ring */
.spot.hotspot { border-radius: 50%; border: 2px dashed rgba(255, 214, 140, 0.85);
  background: radial-gradient(circle, rgba(255, 200, 120, 0.28), transparent 70%);
  animation: glow 1.4s ease-in-out infinite alternate; }
.spot.hotspot::after { content: none; }
.swatch .dot { width: 28px; height: 28px; }
.swatch:has(.swatch-crop) .dot { width: 14px; height: 14px; }
.swatch-crop { width: 100%; aspect-ratio: 1; border-radius: 8px; background-repeat: no-repeat; }
#stage-box { container-type: size; }
.tint-layer { position: absolute; inset: 0; background-size: 100% 100%; pointer-events: none; }
.spot.tap-area { cursor: pointer; }
.spot.tap-area::after { content: none; }
#stage .stage-bg.fade-out { animation: fadeout 1.1s ease-in 0.2s forwards; }
@keyframes fadeout { to { opacity: 0; } }
.spot.next { z-index: 3; }
.spot.next .obj { animation: bob 1.6s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-4%); } }
.auto-shabby { filter: grayscale(1) sepia(0.6) brightness(0.75) blur(0.4px); opacity: 0.7; }
.spot.shabby::after {
  content: "🕸️"; position: absolute; top: -4px; left: -4px; font-size: 16px; opacity: 0.8; pointer-events: none;
}
.price {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: #6e5a70; color: #fff; font: 11px sans-serif; padding: 2px 6px; border-radius: 10px;
}
.price.affordable { background: var(--gold); color: var(--ink); animation: glow 1.4s ease-in-out infinite alternate; }
.spot.reveal > .art { animation: reveal 0.9s ease-out; }
.puff { position: absolute; inset: 0; pointer-events: none; }
.puff span {
  position: absolute; left: 50%; top: 50%; width: 34%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,235,215,0.95), rgba(200,185,160,0.6) 60%, transparent 70%);
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(0.4);
  animation: puff 0.9s ease-out forwards;
}
@keyframes puff {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(0.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-120%) scale(1.6); }
}
@keyframes reveal {
  0%, 30% { opacity: 0; transform: scale(0.5); }
  70% { opacity: 1; transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Language switch (title screen toggle + menu buttons) */
.panel { position: relative; }
.lang-toggle { position: absolute; top: 8px; left: 8px; z-index: 2; font-size: 13px; padding: 4px 10px; background: transparent; color: var(--ink); border: 1px solid var(--muted); }
.lang-row { display: flex; gap: 8px; margin-bottom: 12px; }
.lang-row .lang { flex: 1; background: transparent; color: var(--ink); border: 1px solid var(--muted); }
.lang-row .lang.on { background: var(--jade); color: #fff; border-color: var(--jade); }
.sound-toggle { display: block; width: 100%; background: transparent; color: var(--ink); border: 1px solid var(--muted); margin-bottom: 4px; }
.lang-label { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
:lang(zh) .panel .sub { font-style: normal; }

/* M7: compact top bars on short screens, so the board keeps more room */
@media (max-height: 760px) {
  #app { gap: 6px; padding-top: 6px; padding-bottom: 8px; }
  #chapter-bar { padding: 6px 10px; }
  #chapter-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
  .order { padding: 4px 6px; gap: 3px; }
  .need { font-size: 19px; }
  .serve { padding: 3px 6px; }
  #info { height: 68px; }
}

/* Start screen (key art). The picture is art/scene/title.webp; without it a dark gradient shows. */
#title-screen {
  z-index: 45; flex-direction: column; justify-content: space-between; align-items: center;
  padding: max(48px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  background: #1d1626 url("../art/scene/title.webp") center / cover no-repeat;
}
#title-screen::before { /* readable title on top, buttons at the bottom */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(15, 10, 20, 0.65), transparent 32%, transparent 70%, rgba(15, 10, 20, 0.75));
}
#title-screen .lang-toggle { top: 12px; left: 12px; color: #fff4e0; border-color: rgba(255, 244, 224, 0.6); }
.title-top, .title-bottom { position: relative; text-align: center; width: min(92vw, 420px); }
#title-name { margin: 0; color: #ffe2b0; font-size: clamp(34px, 10vw, 48px); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }
#title-sub { margin: 4px 0 0; color: #f5e6d0; font-style: italic; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }
:lang(zh) #title-sub { font-style: normal; }
.title-bottom { display: flex; flex-direction: column; gap: 10px; }
.title-bottom button { width: 100%; padding: 12px; font-size: 20px; border-radius: 14px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
.title-bottom button[hidden] { display: none; }
#title-start.secondary { font-size: 16px; padding: 9px; background: rgba(30, 20, 35, 0.6); color: #fff4e0; border: 1px solid rgba(255, 244, 224, 0.5); }
#name-entry { z-index: 46; }

/* Orders as a counter scene (2026-11-02): every customer stands behind the counter as a
   half-body figure (art/char/*.webp, 330x420, transparent) with their dishes plated on the counter; the lane
   swipes when more than 3 are waiting. Background = the current room painting, dimmed. */
#orders {
  position: relative; display: block; overflow: hidden; padding: 0;
  height: 150px; border-radius: 12px; box-shadow: var(--shadow);
  background: linear-gradient(180deg, #6b5442, #3d2f2a);
}
#orders .counter-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; filter: brightness(1.08) saturate(1.1) blur(1.5px); transform: scale(1.04); }
#orders .counter-top, .patron::after {
  position: absolute; left: 0; right: 0; bottom: 0; height: 26px; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, #c8955c 0, #a4703d 4px, #7d5228 100%);
  border-top: 2px solid #e2b77c;
}
/* Right-edge fade when more customers are off-screen (swipe). */
#orders::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 22px; z-index: 5; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(30, 22, 18, 0.55)); opacity: 0; transition: opacity 0.2s;
}
#orders.more::after { opacity: 1; }
#orders .lane { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; z-index: 2; scrollbar-width: none; overscroll-behavior-x: contain; }
#orders .lane::-webkit-scrollbar { display: none; }
.patron { position: relative; flex: 0 0 118px; height: 100%; }
.patron::after { content: ""; z-index: 2; } /* this customer's stretch of counter, in front of the figure */
.patron-figure, .patron-name { z-index: 1; }
.patron-name { z-index: 3; }
.patron-figure { position: absolute; left: -2px; bottom: 12px; width: 88px; height: 118px; pointer-events: none; transform-origin: 50% 100%; }
.patron.arrive .patron-figure { animation: step-up 0.45s ease-out both; }
@keyframes step-up { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bubble-in { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
#orders img.figure { width: 100%; height: 100%; object-fit: contain; object-position: 50% 0; background: none; border-radius: 0; margin: 0; }
#orders span.figure { display: flex; align-items: flex-end; justify-content: center; height: 100%; line-height: 1; font-size: 46px; padding-bottom: 34px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }
.patron-name {
  position: absolute; left: 0; width: 88px; bottom: 1px; z-index: 4; text-align: center; pointer-events: none;
  font-size: 10px; color: #fdf3e0; text-shadow: 0 1px 2px rgba(0,0,0,0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Plated dishes on the counter (2026-11-02, user: "as plated", not in a speech bubble). */
.plates {
  position: absolute; left: 0; width: 112px; bottom: 15px; z-index: 4;
  display: flex; justify-content: center; align-items: flex-end; gap: 1px; pointer-events: none;
}
#orders .plate {
  position: relative; width: 35px; height: 32px; padding: 0; background: none; border-radius: 0;
  display: flex; align-items: flex-end; justify-content: center; font-size: 23px; line-height: 1; opacity: 1;
}
#orders .plate::before { /* the plate: a porcelain ellipse with a blue rim, under the dish */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px; border-radius: 50%; z-index: -1;
  background: radial-gradient(ellipse at 50% 40%, #fffdf7 0 45%, #efe6d6 62%, #7d97b8 66%, #f4ede0 72%, #d8cbb6 100%);
  box-shadow: 0 2px 2px rgba(0,0,0,0.35);
}
#orders .plate > .art { position: relative; margin-bottom: 4px; filter: grayscale(0.5) drop-shadow(0 0 1px #fff); opacity: 0.6; }
#orders .plate.have > .art { filter: none; opacity: 1; }
#orders .plate img.art { width: 28px; height: 28px; }
#orders .tag {
  position: absolute; right: 3px; top: 3px; z-index: 4; width: auto; min-width: 38px; max-width: 80px;
  font-size: 11px; padding: 3px 6px; border-radius: 10px; white-space: nowrap;
  background: rgba(45, 36, 30, 0.78); color: #fdf3e0; border: 1px solid rgba(255,255,255,0.25);
}
#orders .tag.story { border-color: var(--accent); }
#orders .tag.big { border-color: var(--gold); }
#orders .tag:not(:disabled) { background: var(--jade); color: #fff; font-weight: bold; animation: ready-glow 1.2s ease-in-out infinite alternate; }
.patron.arrive .tag, .patron.arrive .plates { animation: bubble-in 0.35s 0.25s ease-out both; }
.patron .order-heart { position: absolute; top: 26px; right: 6px; z-index: 4; color: #ff8fa0; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.patron .order-big { position: absolute; top: 44px; right: 6px; left: auto; z-index: 4; font-size: 10px; padding: 0 3px; }
@keyframes ready-glow { from { box-shadow: 0 0 0 0 transparent; } to { box-shadow: 0 0 0 2px #bfe8cf, 0 0 10px var(--jade); } }
@media (max-height: 760px) {
  #orders { height: 134px; }
  .patron-figure { height: 104px; width: 82px; }
  .patron-name { width: 82px; }
  .plates { bottom: 14px; }
  #orders .plate { width: 33px; height: 29px; font-size: 21px; }
  #orders .plate img.art { width: 25px; height: 25px; }
  #orders .tag { top: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .patron.arrive .patron-figure, .patron.arrive .tag, .patron.arrive .plates, #orders .tag { animation: none; }
}

/* Painted board (2026-11-02, user: "revamp the merge board in the same art style"; free, CSS only).
   Warm carved-wood frame with a gold inlay line, rice-paper tiles set into the wood, closed tiles as
   lattice windows, dusty cloths as folded linen, level numbers as small red seals. */
:root {
  --wood-1: #7a4a26; --wood-2: #5a331a; --wood-3: #3f2312; --inlay: #d9a95a;
  --tile-1: #f8ecd2; --tile-2: #ecd6ae; --tile-edge: rgba(90, 51, 26, 0.35);
}
#board {
  gap: 3px; padding: 6px; border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255,220,170,0.05) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--wood-1), var(--wood-2) 60%, var(--wood-3));
  box-shadow: inset 0 0 0 2px var(--inlay), inset 0 0 0 4px var(--wood-3), 0 4px 10px rgba(40, 20, 8, 0.35);
}
.cell, .cell:nth-child(odd) {
  border-radius: 4px;
  background: radial-gradient(ellipse at 50% 35%, var(--tile-1) 0 45%, var(--tile-2) 100%);
  box-shadow: inset 0 1px 2px var(--tile-edge), inset 0 -1px 0 rgba(255,255,255,0.35);
}
.cell.selected { outline: none; box-shadow: inset 0 0 0 2px var(--gold), 0 0 8px 1px rgba(240, 190, 80, 0.85); z-index: 1; }
/* Generators: a gold-rimmed lacquer dish instead of the dashed box. */
.item.gen { background: radial-gradient(circle at 50% 45%, #fff3cf 0 30%, rgba(214,160,60,0.35) 62%, transparent 72%); border-radius: 4px; }
.item.gen::after { inset: 2px; border: 2px solid rgba(201, 146, 52, 0.9); border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,240,200,0.7); }
.item.special { background: radial-gradient(circle, rgba(232,180,60,0.45) 0%, transparent 62%); border-radius: 4px; }
.item > .art:not(.figure) { filter: drop-shadow(0 1px 1px rgba(60, 30, 10, 0.35)); }
/* Level as a small red seal. */
.item .lvl {
  bottom: 1px; right: 1px; min-width: 12px; padding: 0 2px; border-radius: 2px; text-align: center;
  font: bold 9px/12px Georgia, serif; color: #fff4e4; background: #a8323f; box-shadow: 0 0 0 1px rgba(255,235,210,0.6);
}
.item .check { background: var(--jade); box-shadow: 0 0 0 1px #e8f5ee; }
/* Closed tiles: a small paper window in a carved frame (outer frame, inner frame, cross bars). */
.cell.closed { background: var(--wood-2); }
.screen {
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 0 calc(50% - 1.5px), #6b3d1c calc(50% - 1.5px) calc(50% + 1.5px), transparent 0),
    linear-gradient(0deg, transparent 0 calc(50% - 1.5px), #6b3d1c calc(50% - 1.5px) calc(50% + 1.5px), transparent 0),
    radial-gradient(circle at 50% 50%, #f6e3bb 0 35%, #dcb882 100%);
  box-shadow: inset 0 0 0 3px #6b3d1c, inset 0 0 0 6px #e9cf9f, inset 0 0 0 7.5px #6b3d1c, inset 0 0 8px rgba(0,0,0,0.3);
}
/* Dusty cloths: folded, faded linen. */
.cloth {
  border-radius: 4px;
  background:
    linear-gradient(115deg, transparent 0 30%, rgba(255,255,255,0.18) 32%, transparent 36% 62%, rgba(0,0,0,0.12) 64%, transparent 68%),
    radial-gradient(circle at 30% 70%, rgba(255,255,255,0.08) 0 1px, transparent 2px) 0 0 / 7px 7px,
    linear-gradient(180deg, rgba(176, 148, 108, 0.92), rgba(136, 110, 80, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255,240,220,0.25), inset 0 -3px 6px rgba(0,0,0,0.25);
}
/* Info bar as a paper slip on a wooden rail. */
#info {
  background: linear-gradient(180deg, #fffaf0, #f3e4c6); border-radius: 8px;
  box-shadow: inset 0 3px 0 var(--wood-1), inset 0 4px 0 var(--inlay), 0 2px 6px rgba(59, 47, 47, 0.2);
  padding-top: 9px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wood-1: #5a3620; --wood-2: #3e2415; --wood-3: #26150b; --inlay: #a8803f;
    --tile-1: #4a3a35; --tile-2: #362a28; --tile-edge: rgba(0, 0, 0, 0.5);
  }
  :root:not([data-theme="light"]) #info { background: linear-gradient(180deg, #3a2f33, #2d2629); }
}
:root[data-theme="dark"] {
  --wood-1: #5a3620; --wood-2: #3e2415; --wood-3: #26150b; --inlay: #a8803f;
  --tile-1: #4a3a35; --tile-2: #362a28; --tile-edge: rgba(0, 0, 0, 0.5);
}
/* Painted tiles (2026-11-02, user picked Niji options 2 + 2, art/jobs/board-tiles.json, $0.24):
   closed tiles = a painted wooden shutter, dusty cloths = a painted bundle tied with red string.
   Cut out with tools/tile-cutout.py (free). The CSS-drawn versions above stay as the fallback. */
.cell.closed { background: radial-gradient(ellipse at 50% 35%, var(--tile-1) 0 45%, var(--tile-2) 100%); }
.screen {
  background: url("../art/board/closed.webp") center / 100% 100% no-repeat;
  box-shadow: none; filter: drop-shadow(0 1px 1px rgba(60, 30, 10, 0.35));
}
.cloth {
  background: url("../art/board/cloth.webp") center / 96% 96% no-repeat;
  box-shadow: none; filter: drop-shadow(0 1px 1px rgba(60, 30, 10, 0.3));
}

/* Display font (titles, names, buttons) */
h1, h2, #title-name, #chapter-title, #dlg-name, .patron-name, #renovate, #cook { font-family: var(--font-display); }
/* Tap anywhere on a ready customer to serve (user's request 2026-11-02). */
.patron.ready { cursor: pointer; }
.patron.ready:active .patron-figure { transform: scale(0.97); }

/* Painted empty tile + board frame (2026-11-03, user picked Niji tile 2 + frame 2, art/jobs/board-frame.json, $0.24).
   The frame is a 9-slice border-image (source 464×616, wood + inlay ≈ 34 px, slice 46 to keep the corner carving);
   its cream centre fills behind the tiles. The CSS wood above stays as the fallback. */
#board {
  border: 11px solid transparent; padding: 1px; border-radius: 0;
  border-image: url("../art/board/frame.webp") 46 fill / 11px stretch;
  box-shadow: 0 4px 10px rgba(40, 20, 8, 0.35);
  /* 2 × (11 + 1) px frame + 6 gaps of 3 px wide; 2 × 12 + 8 gaps tall */
  width: min(100cqw, (100cqh - 48px) * 7 / 9 + 42px);
}
.cell, .cell:nth-child(odd), .cell.closed {
  background: url("../art/board/empty.webp") center / 100% 100% no-repeat;
  box-shadow: none;
}

/* ---------- Painted UI chrome (2026-11-03, user: "UI still looks like emoji and amateur") ----------
   Painted icons in art/ui/ (Niji sheet + 2 Nano Banana fixes, art/jobs/ui-chrome.json).
   The panels are CSS (the Niji panel sheet failed 3 times): walnut wood with a gold inlay,
   red lacquer with a gold rim, honey paper. Fixed colours, like the board: same in dark mode. */
:root {
  --walnut-1: #7a4e2a; --walnut-2: #5a361b; --walnut-3: #3f2512;
  --inlay: #d9ad5b; --lacquer-1: #c64a3c; --lacquer-2: #8f2724;
  --paper-1: #f8ecd2; --paper-2: #ecd7ad; --ink-wood: #3b2414;
}
img.ic { display: inline-block; height: 1.25em; width: auto; vertical-align: -0.28em; margin: 0 0.05em; pointer-events: none; }

/* Top bar: a carved walnut rail with a gold inlay line */
#hud {
  background:
    repeating-linear-gradient(92deg, rgba(255,255,255,0.035) 0 3px, transparent 3px 11px),
    linear-gradient(180deg, var(--walnut-1), var(--walnut-2) 60%, var(--walnut-3));
  border-radius: 14px; padding: 5px 6px;
  box-shadow: inset 0 0 0 1.5px var(--inlay), inset 0 0 0 3.5px var(--walnut-3), inset 0 2px 0 4px rgba(255,255,255,0.08), 0 3px 8px rgba(40,22,10,0.35);
}
#hud .stat {
  background: linear-gradient(180deg, var(--paper-1), var(--paper-2));
  color: var(--ink-wood); border: 1.5px solid var(--walnut-3);
  box-shadow: inset 0 0 0 1px rgba(217,173,91,0.7), 0 1px 2px rgba(0,0,0,0.3);
  display: flex; align-items: center; gap: 3px; padding: 2px 9px 2px 4px;
}
#hud .stat small { color: #7a5a3a; }
img.hud-ic { width: 26px; height: 26px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35)); }
#hud button.icon { padding: 0 2px; line-height: 0; }
img.hud-btn { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.45)); transition: transform 0.12s; }
#hud button.icon:active img.hud-btn { transform: scale(0.9); }
#hud button.mini {
  background: radial-gradient(circle at 50% 35%, #6fae8c, #3f7458); color: #fff8e6;
  border: 1.5px solid var(--inlay); border-radius: 50%; width: 22px; height: 22px; padding: 0; line-height: 18px; font-weight: bold;
}
@media (max-width: 400px) {

  img.hud-ic { width: 23px; height: 23px; }
}

/* Chapter bar: a walnut plaque (was plain purple) */
#chapter-bar {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 13px),
    linear-gradient(180deg, var(--walnut-1), var(--walnut-2) 55%, var(--walnut-3));
  color: #fbeed2;
  box-shadow: inset 0 0 0 1.5px var(--inlay), inset 0 0 0 3.5px var(--walnut-3), 0 3px 8px rgba(40,22,10,0.3);
}
#chapter-title { text-shadow: 0 1px 1px rgba(0,0,0,0.5); }
#chapter-bar .track-bar { background: rgba(0,0,0,0.3); box-shadow: inset 0 1px 2px rgba(0,0,0,0.4); }

/* Red lacquer buttons with a gold rim (Home, buy buttons, store) */
#renovate, .slip-buy, .task-buy, .buy-slot, .store {
  background: linear-gradient(180deg, var(--lacquer-1), var(--lacquer-2));
  color: #fff4dc; border: 1.5px solid var(--inlay);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 2px 3px rgba(0,0,0,0.3);
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
}
#renovate.affordable, .slip-buy.affordable { background: linear-gradient(180deg, #f3cf72, #d19a2e); color: var(--ink-wood); text-shadow: none; }
#renovate.complete { background: linear-gradient(180deg, #5f9b7c, #3d6e55); }

/* Price and coin tags: walnut pills with a gold edge (were purple) */
.price, #orders .tag {
  background: linear-gradient(180deg, var(--walnut-1), var(--walnut-3));
  color: #fbeed2; border: 1.5px solid var(--inlay);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.price.affordable { background: linear-gradient(180deg, #f3cf72, #d19a2e); color: var(--ink-wood); }
#orders .tag:not(:disabled) { background: linear-gradient(180deg, #5f9b7c, #3d6e55); }
#orders .tag.story { border-color: #f08a7a; }

/* Order slip: honey paper tag with a walnut edge and a gold inner line */
#slip {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.35), transparent 60%),
    linear-gradient(180deg, var(--paper-1), var(--paper-2));
  border: 2px solid var(--walnut-2);
  box-shadow: inset 0 0 0 1.5px rgba(217,173,91,0.8), 0 4px 10px rgba(0,0,0,0.35);
}
#slip::before, #slip::after { background: var(--walnut-3); width: 2px; }
#slip .track-bar { background: rgba(90,54,27,0.2); }

/* Cook: a red lacquer plaque with a gold rim and the painted wok */
#cook {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(255,255,255,0.22), transparent 55%),
    linear-gradient(180deg, var(--lacquer-1), var(--lacquer-2));
  border: 3px solid var(--inlay); border-radius: 18px; color: #fff4dc;
  box-shadow: inset 0 0 0 2px #7a1f1c, inset 0 0 0 4px rgba(217,173,91,0.45), 0 5px 12px rgba(0,0,0,0.45);
  text-shadow: 0 2px 2px rgba(0,0,0,0.4); padding: 4px;
}
#cook img.cook-ic { width: 56%; height: auto; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4)); pointer-events: none; }
#cook:active { transform: translateY(1px) scale(0.98); }

/* ---------- Bigger board (2026-11-04, user: "a lot of space, the board should be bigger") ----------
   The 7×9 board is limited by the height left over, so the bars around it get slimmer:
   chapter plaque on fewer lines, a shorter counter, a shorter info slip, smaller gaps. */
#app { gap: 5px; padding-top: 5px; padding-bottom: 6px; }
#hud { padding: 3px 6px; }
#chapter-bar { padding: 4px 8px 3px; gap: 6px; }
#chapter-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
#chapter-progress { font-size: 11px; line-height: 1.2; }
#chapter-bar > div:first-child { min-width: 0; flex: 1; }
#chapter-track { padding: 0 4px; }
#chapter-bar .track-bar { margin: 7px 0 6px; height: 5px; }
#chapter-bar .track-mark img.art { width: 13px; height: 13px; }
#renovate { padding: 4px 10px; }
#orders { height: 124px; }
.patron-figure { height: 96px; width: 78px; }
.patron-name { width: 78px; }
#info { height: 54px; padding: 7px 8px 4px; gap: 6px; }
.info-hint { font-size: 12px; line-height: 1.25; }
.info-emoji { font-size: 28px; }
.info-name { font-size: 13px; }
.info-desc { font-size: 11px; line-height: 1.2; }
.info-actions { display: grid; grid-template-columns: auto auto; gap: 3px; align-content: center; }
.info-actions button { font-size: 11px; padding: 3px 7px; }
@media (max-height: 760px) {
  #orders { height: 116px; }
  .patron-figure { height: 90px; width: 72px; }
  .patron-name { width: 72px; }
  .plates { bottom: 12px; }
}

/* ---------- Full-screen board (2026-11-04, user: board should fill the screen) ----------
   Our own layout: the top bar floats over the customer scene, the chapter bar becomes a round
   progress badge (tap: chapter card), Home sits beside the info slip, and the board takes the
   rest. Painted panels (Niji set 3, art/jobs/ui-chrome.json): art/ui/plaque.webp (lacquer
   plaque: Cook, Home), art/ui/tag.webp (paper tag: info slip, order slip), art/ui/rod.webp (counter edge). */
:root { --hud-h: 40px; }
#app { gap: 4px; padding: 4px 6px 6px; }
#hud { position: relative; z-index: 6; height: var(--hud-h); gap: 5px; }
body.home #hud { height: auto; }
body:not(.home) #chapter-bar { display: none; }
body:not(.home) #hud {
  background: linear-gradient(180deg, rgba(40,24,12,0.55), rgba(40,24,12,0)); box-shadow: none; border-radius: 0;
  margin: -4px -6px 0; padding: 4px 6px 2px;
}
body:not(.home) #orders {
  margin: calc(-1 * var(--hud-h) - 4px) -6px 0; height: calc(var(--hud-h) + 4px + var(--scene-h, 106px));
  border-radius: 0 0 14px 14px;
}
body:not(.home) #orders .tag { top: calc(var(--hud-h) + 6px); }
body:not(.home) .patron .order-heart { top: calc(var(--hud-h) + 28px); }
body:not(.home) .patron .order-big { top: calc(var(--hud-h) + 46px); }
/* --scene-h: set by fitCounter() in game.js (shorter counter on short screens); figures scale with it */
body:not(.home) .patron-figure { height: calc(var(--scene-h, 106px) * 0.868); width: calc(var(--scene-h, 106px) * 0.698); }
body:not(.home) .patron-name { width: 74px; left: max(0px, calc(var(--scene-h, 106px) * 0.349 - 37px)); }
#orders .counter-top { border-top: none; background: url("../art/ui/rod.webp") top / 100% 9px no-repeat, linear-gradient(180deg, #c8955c 0, #a4703d 4px, #7d5228 100%); }

/* Round chapter badge: a walnut disc with a gold progress ring */
#chapter-badge {
  flex: none; width: 38px; height: 38px; padding: 0; border-radius: 50%; line-height: 1;
  background:
    radial-gradient(circle, #6a4122 0 60%, transparent 62%),
    conic-gradient(var(--inlay) calc(var(--p, 0) * 1%), rgba(30,16,6,0.55) 0);
  border: 2px solid var(--walnut-3); box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  color: #fbeed2; font-family: var(--font-display); font-weight: bold; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.chapter-modal-track { margin: 6px 0 12px; }
.chapter-modal-track .track-bar { background: rgba(90,54,27,0.2); }
.chapter-home { width: 100%; margin-top: 6px; }

/* Bottom bar: Home plaque + info slip */
#bottom-bar { display: flex; align-items: stretch; gap: 5px; flex: 0 0 auto; }
body.home #bottom-bar { display: none; }
#bottom-bar #info { flex: 1; min-width: 0; }
#bottom-bar #renovate {
  flex: none; width: 58px; max-width: none; height: 58px; padding: 10px 2px 0; font-size: 13px;
  background: url("../art/ui/plaque.webp") center / 100% 100% no-repeat; border: none; box-shadow: none;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); color: #fff4dc; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
#bottom-bar #renovate.affordable { background: url("../art/ui/plaque.webp") center / 100% 100% no-repeat; color: #fff4dc; animation: plaque-glow 1.4s ease-in-out infinite alternate; }
#bottom-bar #renovate.complete { background: url("../art/ui/plaque.webp") center / 100% 100% no-repeat; opacity: 0.85; }
@keyframes plaque-glow { from { filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); } to { filter: drop-shadow(0 0 6px #ffd76a) drop-shadow(0 0 2px #ffd76a); } }

/* Paper-tag panels (9-slice; the painted tag is 400×262 with a ≈ 22 px wood edge) */
#info {
  height: 58px; background: none; box-shadow: none; border-radius: 0;
  border: 9px solid transparent; border-image: url("../art/ui/tag.webp") 34 fill / 9px stretch;
  padding: 0 4px; color: var(--ink-wood);
}
#info .info-hint, #info .info-desc { color: #6d5238; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #info { background: none; } }
:root[data-theme="dark"] #info { background: none; }
#slip {
  background: none; box-shadow: none; border-radius: 0;
  border: 9px solid transparent; border-image: url("../art/ui/tag.webp") 34 fill / 9px stretch;
  padding: 0 3px; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.35));
}
#slip::before, #slip::after { top: -16px; height: 10px; }

/* Cook: the painted lacquer plaque with the wok */
#cook {
  aspect-ratio: 0.98; width: 30%; padding: 13% 4px 4px;
  background: url("../art/ui/plaque.webp") center / 100% 100% no-repeat; border: none; border-radius: 0;
  box-shadow: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.45));
}
#cook img.cook-ic { width: 52%; }
#toasts { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
/* Top bar must fit 7 things on a 360 px phone */
#hud .stat:first-child { min-width: 0; overflow: hidden; }
#hud .stat { padding: 2px 7px 2px 3px; }
#energy-timer { font-size: 10px; }
img.hud-btn { width: 32px; height: 32px; }
img.hud-ic { width: 23px; height: 23px; }
@media (max-width: 380px) {
  #hud { gap: 3px; }
  img.hud-btn { width: 29px; height: 29px; }
  #chapter-badge { width: 34px; height: 34px; font-size: 15px; }
  #hud .stat { font-size: 14px; }
}

/* ---------- Heroine dusting idle (2026-11-04, user's request; 2 painted frames) ---------- */
.idle-hero { position: absolute; left: 50%; bottom: 25%; height: 30%; width: 17%; z-index: 2; pointer-events: none; }
.idle-flip { position: absolute; inset: 0; }
.idle-flip.right { transform: scaleX(-1); }
.idle-walk {
  position: absolute; inset: 0; transform-origin: 50% 100%;
  animation: idle-breathe 2.4s ease-in-out infinite alternate; filter: drop-shadow(0 4px 3px rgba(0,0,0,0.35));
}
.idle-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.idle-puffs { position: absolute; width: 0; height: 0; }
@keyframes idle-breathe { from { transform: none; } to { transform: translateY(-1px) scaleY(1.006); } }
.idle-dust {
  position: absolute; top: 0; left: 0; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,246,225,0.95), rgba(255,246,225,0) 70%);
  animation: idle-puff 1.8s ease-out infinite; opacity: 0;
}
.idle-dust.d2 { animation-delay: 0.6s; left: 8px; top: -5px; }
.idle-dust.d3 { animation-delay: 1.2s; left: -6px; top: 6px; }
@keyframes idle-puff { 0% { opacity: 0; transform: translate(0,0) scale(0.6); } 20% { opacity: 0.9; } 100% { opacity: 0; transform: translate(-14px,-18px) scale(1.8); } }
@media (prefers-reduced-motion: reduce) {
  .idle-walk, .idle-dust { animation: none; }
  .idle-dust { opacity: 0; }
}

/* Name box: empty with a random suggestion + a Random button (2026-11-04) */
.name-row { display: flex; gap: 6px; align-items: stretch; }
.name-row input { flex: 1; min-width: 0; }
.name-row input::placeholder { color: #a08f7c; opacity: 1; }
.name-random { flex: none; background: linear-gradient(180deg, var(--lacquer-1), var(--lacquer-2)); color: #fff4dc; border: 1.5px solid var(--inlay); padding: 6px 12px; }

/* Painted chapter card (2026-11-04): title backdrop softened behind a honey paper slip with a
   red seal; fixed colours, same in dark mode like the other painted chrome. */
#chapter-card { background: #f3e2c0; color: #3b2414; overflow: hidden; }
#chapter-card .cc-bg {
  position: absolute; inset: -12px;
  background: url("../art/scene/title.webp") center / cover no-repeat;
  filter: blur(3px) saturate(1.05) brightness(1.04);
  animation: cc-drift 14s ease-in-out infinite alternate;
}
#chapter-card .cc-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 55% at 50% 50%, rgba(255, 244, 220, 0.55), rgba(255, 236, 200, 0.12) 70%, rgba(120, 60, 20, 0.18));
}
#chapter-card .chapter-card-inner { position: relative; z-index: 1; width: min(88vw, 380px); padding: 0; }
.cc-slip {
  position: relative; padding: 34px 26px 28px; border-radius: 6px;
  background: linear-gradient(180deg, #fff7e4, #f6e4bd);
  border: 2px solid #8a5a2b; outline: 4px solid rgba(255, 247, 228, 0.85); outline-offset: 0;
  box-shadow: 0 0 0 7px #6b3f1e, 0 0 0 9px #d9a441, 0 14px 30px rgba(70, 35, 10, 0.45);
}
.cc-slip::before, .cc-slip::after { /* gold corner knots */
  content: ""; position: absolute; top: 8px; width: 14px; height: 14px; border: 2px solid #c9922f; transform: rotate(45deg);
}
.cc-slip::before { left: 8px; } .cc-slip::after { right: 8px; }
.cc-seal {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%) rotate(-4deg);
  width: 50px; height: 50px; border-radius: 10px; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #d4473a, #a8231b); color: #fff1dc;
  font-family: "Ma Shan Zheng", var(--font-display); font-size: 30px; line-height: 1;
  box-shadow: 0 0 0 2px #fff1dc inset, 0 0 0 3px #a8231b, 0 4px 8px rgba(80, 20, 10, 0.35);
}
.cc-label { display: block; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: #a8231b; margin-bottom: 8px; }
.cc-label:empty { display: none; }
#chapter-card .chapter-card-inner h2 { margin: 0; font-size: 26px; line-height: 1.25; color: #3b2414; letter-spacing: 0.5px; }
.cc-rule { display: block; width: 60%; height: 2px; margin: 16px auto 0; background: linear-gradient(90deg, transparent, #c9922f, transparent); }
#chapter-card .tap {
  display: inline-block; margin-top: 22px; padding: 6px 18px; border-radius: 999px; opacity: 1;
  background: rgba(59, 36, 20, 0.78); color: #fff1dc; font-size: 14px; letter-spacing: 1px;
  animation: cc-pulse 1.6s ease-in-out infinite;
}
@keyframes cc-drift { from { transform: scale(1.04) translateY(0); } to { transform: scale(1.1) translateY(-8px); } }
@keyframes cc-pulse { 50% { opacity: 0.65; } }
@media (prefers-reduced-motion: reduce) { #chapter-card .cc-bg, #chapter-card .tap { animation: none; } }

/* Counter wall (2026-11-04, user: plain clean painted texture, not the blurred room). Niji pick 4,
   art/jobs/counter-wall.json. Same in dark mode, like the other painted art. */
#orders { background: #f6e6c4 url("../art/scene/counter-wall.webp") center 30% / cover no-repeat; }

/* Date scene button in the 💕 Hearts panel (2026-11-04). */
.date-btn { display: block; width: 100%; margin: 8px 0 4px; padding: 8px 10px; border-radius: 10px; border: 2px solid; background: #fff4e6; color: #a8231b; font: inherit; font-weight: 700; text-align: left; }
.date-btn.locked { background: transparent; color: var(--muted); font-weight: 400; opacity: 0.8; }

/* Romance gameplay (2026-11-04): gift picker, gift meter, heart track, perk line. */
.info-actions .gift { background: #fbe3e8; color: #a8231b; border-color: #d98c99; }
.gift-pick { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 10px; padding: 8px 10px; border: 2px solid; border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; text-align: left; }
.gift-pick.closed { opacity: 0.6; }
.gift-txt { flex: 1; min-width: 0; }
.gift-loves { font-size: 12px; color: var(--muted); }
.gift-meter { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.gift-bar { position: relative; flex: 1; height: 8px; border-radius: 4px; background: rgba(168, 35, 27, 0.15); overflow: hidden; }
.gift-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #d6455d; border-radius: 4px; }
.gift-add { position: absolute; top: 0; bottom: 0; background: #f2a0ad; animation: gift-blink 1s ease-in-out infinite alternate; }
@keyframes gift-blink { from { opacity: 0.5; } to { opacity: 1; } }
.gift-heart { color: #d6455d; font-size: 13px; }
.gift-done { font-size: 12px; color: #2f7d4f; }
.gift-note { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.heart-track { position: relative; height: 6px; margin: 14px 8px 12px; border-radius: 3px; background: rgba(0, 0, 0, 0.1); }
.heart-track-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.heart-dot { position: absolute; top: 50%; transform: translate(-50%, -50%); min-width: 18px; height: 18px; padding: 0 3px; border-radius: 9px; background: var(--card); border: 2px solid rgba(0, 0, 0, 0.2); font-size: 10px; line-height: 14px; text-align: center; color: var(--muted); box-sizing: border-box; }
.heart-dot.on { border-color: #d6455d; color: #d6455d; font-weight: 700; }
.heart-gift { margin: 4px 0; }
.heart-perk { font-size: 12px; margin: 6px 0 0; }
.heart-perk.locked { color: var(--muted); }
.patron.request .patron-name { color: #a8231b; }
@media (prefers-reduced-motion: reduce) { .gift-add { animation: none; } }

/* User (phone screenshot, 2026-11-04): the lattice wall "looks weird" and faded dishes were hard to see.
   Wall: the plain CSS wall was "too plain"; now the painted shelf wall below (art/scene/counter-wall.webp kept, unused).
   Dishes: always full colour with a dark outline; a green tick marks the ones already on the board. */
/* User 2026-11-04: the top bar hid the wall's shelf ("that line is still weird"), so the whole counter is one
   painted picture (art/jobs/counter-room.json, option 2), anchored to the bottom; the CSS counter band is off. */
#orders { background: #f8e6c2 url("../art/scene/counter-room.webp") center bottom / cover no-repeat; }
#orders .counter-top { background: transparent; box-shadow: none; }
#orders .patron::after { display: none; }
#orders .plate > .art { filter: drop-shadow(0 0 1px #5a3a22) drop-shadow(0 1px 1px rgba(0,0,0,0.35)); opacity: 1; }
#orders .plate img.art { width: 31px; height: 31px; }
#orders .plate.have::after {
  content: "✓"; position: absolute; right: -2px; top: -4px; z-index: 2; width: 14px; height: 14px; border-radius: 50%;
  background: #2f8a4f; color: #fff; font: 700 10px/14px sans-serif; text-align: center; box-shadow: 0 0 0 1.5px #fff;
}
@media (max-height: 700px) { #orders .plate img.art { width: 28px; height: 28px; } }
/* User 2026-11-04: customers looked faded on the painted counter (Young Chen most). Thin dark outline,
   soft shadow and a little more contrast so they stand off the cream wall. */
#orders .patron-figure .art { filter: drop-shadow(0 0 0.6px #4a2e18) drop-shadow(0 0 0.6px #4a2e18) drop-shadow(0 3px 4px rgba(60, 35, 15, 0.35)) contrast(1.08) saturate(1.12); }

/* ---------- Daily tasks, weekly streak, Order Rush (2026-11-04, A4 + A5; user's pick: info bar +
   home slip + counter ribbon, CSS only, existing walnut / honey / lacquer style) ---------- */
.daily-bar { position: relative; height: 5px; border-radius: 3px; background: rgba(90, 54, 27, 0.18); overflow: hidden; }
.daily-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #e9b949, #d19a2e); border-radius: 3px; }
#info .info-daily {
  all: unset; box-sizing: border-box; cursor: pointer; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
  color: inherit; font: inherit;
}
.info-daily-top { display: flex; align-items: center; justify-content: space-between; }
.info-daily-more { font-size: 18px; line-height: 1; color: var(--accent); }
.info-daily-next .info-desc { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.slip-pills { display: flex; gap: 4px; margin: 3px 0 1px; }
.slip-pill {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; white-space: nowrap;
  background: rgba(90, 54, 27, 0.12); color: #3b2414; border: 1px solid rgba(90, 54, 27, 0.35); box-shadow: none; text-shadow: none;
}
.slip-pill.done { background: #cfe6d6; }
.slip-pill.rush { background: linear-gradient(180deg, #c64a3c, #8f2724); color: #fff3dc; border-color: #d9ad5b; }
.rush-ribbon {
  position: absolute; z-index: 4; left: 0; bottom: 26px; padding: 3px 10px 3px 8px; font-size: 11px; font-weight: bold;
  color: #fff3dc; background: linear-gradient(180deg, #c64a3c, #8f2724); border: 1px solid #d9ad5b; border-left: 0;
  border-radius: 0 12px 12px 0; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}
.daily-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.daily-count { font-weight: bold; font-size: 15px; }
.daily-set { font-size: 12px; color: var(--muted); }
.daily-set.on { color: var(--jade); font-weight: bold; }
.daily-list { display: flex; flex-direction: column; gap: 6px; }
.daily-task { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--card); border-radius: 8px; border-left: 4px solid var(--gold); }
.daily-task.done { border-left-color: var(--jade); opacity: 0.75; }
.daily-task.done .daily-fill { background: var(--jade); }
.daily-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.daily-name { font-size: 13px; }
.daily-num { font-size: 11px; color: var(--muted); white-space: nowrap; }
.daily-reward { font-size: 12px; white-space: nowrap; min-width: 28px; text-align: right; }
.daily-week { margin-top: 12px; padding: 8px; border-radius: 8px; background: var(--card); border-left: 4px solid var(--accent); }
.daily-week .task-hint { margin-top: 4px; }
.rush-open { display: block; width: 100%; margin-top: 10px; background: linear-gradient(180deg, #c64a3c, #8f2724); color: #fff3dc; }
.rush-track { position: relative; margin: 34px 8px 26px; }
.rush-track .daily-bar { height: 8px; }
.rush-mark { position: absolute; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; }
.rush-mark::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid #d19a2e; order: 1; }
.rush-mark.on::before { background: #d19a2e; }
.rush-gift { position: absolute; bottom: 16px; font-size: 14px; white-space: nowrap; }
.rush-n { position: absolute; top: 16px; font-size: 11px; color: var(--muted); }
.rush-mark.on .rush-gift { opacity: 0.5; }

/* A2 board friction (2026-11-04): bonus bubbles, generator charges/rest, merge hint, gems in the HUD. */
.cell.bubbled .item > .art { opacity: 0.8; transform: scale(0.82); }
.item .bubble {
  position: absolute; inset: 1px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.85) 0 7%, rgba(255,255,255,0) 14%),
    radial-gradient(circle at 50% 50%, rgba(190,230,255,0.05) 0 55%, rgba(150,205,240,0.45) 78%, rgba(120,180,230,0.7) 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.85), 0 0 0 1.5px rgba(70,150,215,0.85), 0 0 6px rgba(90,170,235,0.8);
  animation: bob 2.4s ease-in-out infinite;
}
.item .bubble-time, .item .gen-rest, .item .gen-left {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; pointer-events: none;
  font: bold 9px/12px Georgia, serif; padding: 0 3px; border-radius: 6px; white-space: nowrap;
}
.item .bubble-time { color: #fff; background: rgba(40, 110, 170, 0.85); }
.item .gen-left { left: auto; right: 0; transform: none; color: #3b2414; background: rgba(255,240,205,0.92); box-shadow: 0 0 0 1px rgba(107,61,28,0.6); }
.item .gen-rest { color: #fff4e4; background: rgba(60, 40, 25, 0.88); }
.cell.resting .item > .art { filter: grayscale(0.7) brightness(0.8); }
.cell.hint .item { animation: wiggle 0.9s ease-in-out infinite; }
.cell.hint { box-shadow: inset 0 0 0 2px rgba(255, 215, 90, 0.9); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg) scale(1.05); } 75% { transform: rotate(8deg) scale(1.05); } }
.hud-gem { font-size: 15px; line-height: 26px; margin-left: 5px; padding-left: 5px; border-left: 1px solid rgba(107,61,28,0.35); }
@media (max-width: 400px) {
  /* room for 💎 next to the coins on a 375 px phone */
  #hud { padding: 4px 4px 2px; }
  #hud .stat { padding-right: 5px; }
  #hud button.icon { padding: 0 1px; }
  img.hud-btn { width: 29px; height: 29px; }
  .hud-gem { margin-left: 3px; padding-left: 3px; font-size: 14px; }
  /* energy timer under the number, so the pill stays narrow */
  #hud .stat.nrg { display: grid; grid-template-columns: auto 1fr auto; column-gap: 3px; row-gap: 0; padding-top: 1px; padding-bottom: 1px; }
  #hud .stat.nrg .hud-ic { grid-row: 1 / 3; }
  #hud .stat.nrg #energy { grid-column: 2; line-height: 14px; }
  #hud .stat.nrg #energy-timer { grid-column: 2; grid-row: 2; font-size: 9.5px; line-height: 11px; }
  #hud .stat.nrg #buy-energy { grid-column: 3; grid-row: 1 / 3; align-self: center; }
}
/* A1 debug panel (?debug only). */
#modal-body.debug { text-align: left; font-size: 12px; }
#modal-body.debug h3 { font-size: 14px; margin: 10px 0 4px; }
.debug .dbg-note { margin: 4px 0; opacity: 0.8; }
.debug .dbg-counts { border-collapse: collapse; width: 100%; }
.debug .dbg-counts td { padding: 1px 4px; border-bottom: 1px solid rgba(107, 61, 28, 0.15); }
.debug .dbg-counts td.num { text-align: right; font-variant-numeric: tabular-nums; }
.debug .dbg-pre { white-space: pre-wrap; word-break: break-all; font: 10px/1.35 ui-monospace, Menlo, monospace; background: rgba(0, 0, 0, 0.05); padding: 6px; border-radius: 6px; max-height: 160px; overflow: auto; margin: 4px 0; }
.debug .dbg-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.debug .dbg-row button { font-size: 12px; padding: 6px 10px; }
.debug .dbg-text { width: 100%; box-sizing: border-box; min-height: 70px; font: 11px/1.35 ui-monospace, Menlo, monospace; }
.debug .dbg-select { flex: 1; min-width: 0; font-size: 12px; }
/* Romance Rendezvous (A5) */
.slip-pill.rdv { background: linear-gradient(180deg, #d9708a, #a3405c); color: #fff3f5; border-color: #e8b9c4; }
.slip-pill.rdv.done { background: #cfe6d6; color: #3b2414; border-color: rgba(90, 54, 27, 0.35); }
.rdv-open { background: linear-gradient(180deg, #d9708a, #a3405c); }
.rdv-pick.armed { outline: 3px solid #d9708a; outline-offset: 1px; }
.rdv-btn { margin-top: 6px; }
/* Inline item pictures and portrait faces in UI text (2026-11-04: replaces emoji in pop-ups). */
img.ic.pic { height: 1.5em; vertical-align: -0.4em; }
img.ic.face { width: 1.6em; height: 1.6em; object-fit: cover; object-position: 50% 8%; border-radius: 50%; vertical-align: -0.45em; background: #f5e9d4; box-shadow: 0 0 0 1px rgba(107, 61, 28, 0.45); margin: 0 0.15em; }

/* User 2026-11-05 (phone screenshot): the info slip wrapped "Ginger Tonic · Lv 1/3" over two lines,
   cut the description and pushed Store off the slip. Name on one line, buttons may shrink. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
#info .info-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
#info .info-actions { flex: 0 1 auto; min-width: 0; max-width: 58%; }
#info .info-actions button { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#info { height: 62px; } /* 2026-11-05: room for name + 2–3 lines without scrolling (was 54) */
/* 2026-11-05: more room for the text: smaller item picture, tighter buttons */
#info { gap: 5px; padding-left: 6px; padding-right: 6px; }
#info .info-emoji img.art { width: 32px; height: 32px; }
#info .info-actions { gap: 3px; }
#info .info-actions button { font-size: 10.5px; padding: 3px 5px; }
#info .info-desc { line-height: 1.15; } #info .info-name { line-height: 1.2; }

/* User 2026-11-05: Home is a small plaque in the top bar (card "Small plaque in top bar").
   Info slip (user, after trying a floating slip that covered the portraits: card "Thin bar back at
   bottom"): an always-visible thin bar under the board, 2 lines; name and text run on in one
   paragraph so 2 lines hold more. renderInfo() shrinks the text / drops the flavour line if needed. */
#app > #info { flex: 0 0 auto; height: 48px; border-width: 7px; border-image-width: 7px; padding: 0 4px; gap: 5px; }
#app > #info .info-emoji img.art { width: 28px; height: 28px; }
#app > #info .info-text { line-height: 1.15; }
#app > #info .info-name { display: inline; font-size: 12px; white-space: normal; }
#app > #info .info-name::after { content: " · "; font-weight: normal; }
#app > #info .info-desc { display: inline; font-size: 11px; line-height: 1.15; }
#app > #info .info-hint { font-size: 11px; line-height: 1.15; }
#app > #info .info-actions { display: flex; flex-direction: row; gap: 3px; align-items: center; }
#app > #info .info-actions button { font-size: 10.5px; padding: 3px 5px; }
#app > #info .info-daily { padding: 0; }
/* 3 buttons (Drink/Open, Store, Sell): two short rows so the text keeps its width */
#app > #info .info-actions:has(> :nth-child(3)) { display: grid; grid-template-columns: auto auto; gap: 2px 3px; }
#app > #info .info-actions:has(> :nth-child(3)) button { padding: 1px 5px; line-height: 1.25; }
#hud #renovate {
  flex: none; width: 34px; height: 34px; max-width: none; padding: 7px 0 0; margin: 0;
  font-size: 9.5px; line-height: 1; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden;
  background: url("../art/ui/plaque.webp") center / 100% 100% no-repeat; border: none; border-radius: 0; box-shadow: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.45)); color: #fff4dc; text-shadow: 0 1px 1px rgba(0,0,0,0.6);
}
#hud #renovate.affordable { background: url("../art/ui/plaque.webp") center / 100% 100% no-repeat; color: #fff4dc; animation: plaque-glow 1.4s ease-in-out infinite alternate; }
#hud #renovate.complete { background: url("../art/ui/plaque.webp") center / 100% 100% no-repeat; opacity: 0.85; }
#hud #renovate:active { transform: scale(0.92); }
body.home #hud #renovate { display: none; }
#toasts { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
/* Phones up to 440 px: the extra Home plaque needs ~30 px, taken from gaps and icons; the energy
   timer ("full" / countdown) sits under the number (user 2026-11-05: keep the timer). */
#hud .stat.nrg { min-width: 0; overflow: hidden; }
@media (max-width: 440px) {
  #hud { gap: 3px; padding-left: 4px; padding-right: 4px; }
  #hud .stat.nrg { display: grid; grid-template-columns: auto 1fr auto; column-gap: 3px; row-gap: 0; padding-top: 1px; padding-bottom: 1px; }
  #hud .stat.nrg .hud-ic { grid-row: 1 / 3; }
  #hud .stat.nrg #energy { grid-column: 2; font-size: 13.5px; line-height: 14px; }
  #hud .stat.nrg #energy-timer { display: block; grid-column: 2; grid-row: 2; font-size: 9.5px; line-height: 11px; text-align: center; }
  #hud .stat.nrg #buy-energy { grid-column: 3; grid-row: 1 / 3; align-self: center; }
  #chapter-badge { width: 34px; height: 34px; font-size: 15px; }
  #hud button.icon { padding: 0 1px; }
  #hud img.hud-btn { width: 30px; height: 30px; }
  #hud #renovate { width: 31px; height: 31px; padding-top: 6px; font-size: 9px; }
}
@media (max-width: 380px) {
  #hud { gap: 2px; }
  #hud img.hud-ic { width: 20px; height: 20px; }
  #hud img.hud-btn { width: 27px; height: 27px; }
  #hud #renovate { width: 29px; height: 29px; font-size: 8.5px; }
  #hud #energy { font-size: 13px; }
  #hud #buy-energy { width: 19px; min-width: 0; padding: 0; }
  #hud .stat.nrg { column-gap: 2px; padding-left: 2px; padding-right: 4px; }
  #chapter-badge { width: 31px; height: 31px; font-size: 14px; }
}
/* User 2026-11-05 (phone screenshot): Auntie Fang and Scribe Hu "are cut", check all characters.
   Most source paintings are themselves cut at the side (arms, desks), so a wider crop can't fix them all.
   Every counter figure gets a soft fade at its left and right edges instead of a hard cut. */
#orders .patron-figure .art {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%);
}
/* User 2026-11-05: the Home plaque "looks odd and not intuitive"; Settings "can just be a gear icon".
   Home = painted house (art/ui/home.webp), Menu = painted gear (art/ui/gear.webp); job art/jobs/icons-ui3.json, sheet 3. */
#hud #renovate, #hud #renovate.affordable, #hud #renovate.complete {
  width: auto; height: auto; padding: 0 1px; background: none; filter: none; opacity: 1; animation: none;
}
/* User 2026-11-05: the glow round the boxy house looked like "a yellow flashing box".
   A repair you can afford is now a small red dot on the house instead. */
#hud #renovate { position: relative; overflow: visible; } /* the old plaque rule clipped the dot */
#hud #renovate.affordable::after {
  content: ""; position: absolute; top: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%;
  background: #d8342a; box-shadow: 0 0 0 1.5px #fff4dc; pointer-events: none;
}
