:root {
  color-scheme: dark;
  --brown: #2B1A14; --milk: #E9C9A0; --jade: #2F8F6B; --orange: #FF5A36;
  --brown-2: #4a2f22; --milk-2: #f4e2c6; --milk-3: #d9b382; --jade-d: #1f6b4f;
  --paper: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .17 0 0 0 0 .1 0 0 0 0 .08 0 0 0 .09 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  --glow: 0;
  --d: 'Fraunces', Georgia, serif; --b: 'Lexend', 'Trebuchet MS', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--brown); overflow: hidden; touch-action: none; }
body { font-family: var(--b); color: var(--brown); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
input { font: inherit; -webkit-user-select: text; user-select: text; }

#stage { position: fixed; left: 50%; top: 50%; width: 1180px; height: 820px; transform-origin: 50% 50%; overflow: hidden; background: var(--brown); }
.screen { position: absolute; inset: 0; display: none; }
.screen.on { display: block; }
.bg { position: absolute; inset: 0; background-size: cover; background-position: center; }

/* ---------- buttons: hand-painted signboard style ---------- */
.btn { min-height: 64px; padding: 0 28px; border: 3px solid var(--brown); border-radius: 14px; background: var(--orange); color: #fff8ef;
  font-family: var(--d); font-weight: 800; font-style: italic; font-size: 24px; font-variation-settings: 'SOFT' 100, 'opsz' 72;
  box-shadow: 0 5px 0 var(--brown); transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--brown); }
.btn:disabled { background: #b8a081; color: #f2e6d3; box-shadow: 0 3px 0 var(--brown); opacity: .8; }
.btn.big { min-height: 76px; font-size: 30px; padding: 0 40px; }
.btn.small { min-height: 64px; font-size: 19px; padding: 0 18px; }
.btn.ghost { background: var(--milk-2); color: var(--brown); }
.btn.on { background: var(--jade); }

/* ---------- HUD ---------- */
.hud { position: absolute; left: 0; right: 0; top: 0; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  background: linear-gradient(var(--brown), rgba(43,26,20,.85)); color: var(--milk); z-index: 5; border-bottom: 3px solid #1a0f0b; }
.hud.slim { background: rgba(43,26,20,.7); }
.lanterns { display: flex; gap: 6px; align-items: flex-start; height: 56px; }
.lantern { width: 34px; height: 48px; margin-top: -2px; }
.lantern.lit { filter: drop-shadow(0 0 8px rgba(255,90,54,.75)); animation: sway 4s ease-in-out infinite; transform-origin: 50% 0; }
.lantern.lit:nth-child(2n) { animation-delay: -1.7s; }
@keyframes sway { 50% { transform: rotate(4deg); } }
.hud-mid { display: flex; align-items: center; gap: 18px; font-family: var(--d); font-style: italic; font-weight: 700; font-size: 24px; }
.timebar { width: 220px; height: 12px; border: 2px solid var(--milk); border-radius: 8px; overflow: hidden; }
.timebar i { display: block; height: 100%; width: 100%; background: var(--orange); }
.coins { display: flex; align-items: center; gap: 10px; font-family: var(--d); font-weight: 900; font-size: 30px; min-width: 120px; justify-content: flex-end; }
.coin { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd98a, #e0a03a 60%, #a86a1e); border: 2.5px solid var(--brown); }

/* ---------- TITLE ---------- */
#scr-title .bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(43,26,20,.82) 0%, rgba(43,26,20,.35) 46%, rgba(43,26,20,0) 70%); }
.title-sign { position: absolute; left: 70px; top: 120px; width: 470px; color: var(--milk); }
.ts-small { font-family: var(--d); font-style: italic; font-size: 24px; opacity: .85; margin-bottom: 4px; }
.title-sign h1 { margin: 0 0 34px; font-family: var(--d); font-weight: 900; font-size: 118px; line-height: .86; letter-spacing: -2px; font-variation-settings: 'SOFT' 100, 'opsz' 144; color: var(--milk); }
.title-sign h1 em { color: var(--orange); font-style: italic; }
.ts-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
#tap-to-start { position: absolute; inset: 0; background: rgba(43,26,20,.35); border: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 70px; z-index: 9; }
#tap-to-start span { font-family: var(--d); font-style: italic; font-size: 26px; color: var(--milk); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .4; } }

/* ---------- CREATOR ---------- */
#scr-create { background: var(--milk) var(--paper); }
.create-left { position: absolute; left: 40px; top: 40px; width: 380px; bottom: 50px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.create-preview { width: 300px; height: 400px; border: 3px solid var(--brown); border-radius: 18px; background: var(--jade) var(--paper); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.field { width: 100%; display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.field input { height: 64px; border: 3px solid var(--brown); border-radius: 12px; padding: 0 16px; font-size: 24px; background: #fffaf2; color: var(--brown); font-family: var(--d); font-style: italic; font-weight: 700; }
.create-right { position: absolute; left: 450px; right: 40px; top: 36px; bottom: 50px; display: flex; flex-direction: column; }
.create-right h2 { margin: 0 0 12px; font-family: var(--d); font-style: italic; font-weight: 900; font-size: 44px; font-variation-settings: 'SOFT' 100; }
.create-opts { flex: 1; overflow-y: auto; padding-right: 6px; }
.c-row { margin-bottom: 14px; }
.c-label { font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; color: var(--jade-d); }
.c-items { display: flex; flex-wrap: wrap; gap: 8px; }
.c-item { min-width: 64px; height: 64px; border: 3px solid var(--brown); border-radius: 12px; background: #fffaf2; padding: 0 12px; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.c-item.on { background: var(--orange); color: #fff; box-shadow: inset 0 0 0 3px #fff8ef; }
.c-item:has(.sw) { min-width: 0; width: 60px; height: 60px; padding: 0; }
.sw { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--brown); display: block; }
#create-go { margin-top: 14px; align-self: flex-end; }

/* ---------- RUSH ---------- */
.rush-bg { background-position: center 18%; }
#rush-customers { position: absolute; left: 0; right: 0; top: 64px; height: 340px; z-index: 2; }
.customer { position: absolute; top: 0; width: 240px; height: 340px; transition: transform .45s cubic-bezier(.3,1.4,.5,1), opacity .4s; }
.customer.enter { transform: translateY(60px); opacity: 0; }
.customer.leave { transform: translateX(40px); opacity: 0; }
.customer.leave.sad { transform: translateY(40px); }
.ticket { position: absolute; left: 16px; top: 6px; width: 208px; background: #fffaf2 var(--paper); border: 3px solid var(--brown); border-radius: 12px; padding: 6px 8px 8px; z-index: 2; transform: rotate(-1.5deg); }
.customer:nth-child(2n) .ticket { transform: rotate(1.5deg); }
.tk-row { display: flex; justify-content: space-between; }
.tk-row img { width: 60px; height: 60px; border-radius: 10px; border: 2px solid var(--brown); background: var(--milk); }
.tk-meta { display: flex; justify-content: space-between; margin-top: 4px; font-weight: 600; font-size: 17px; }
.tk-ice { color: var(--jade-d); } .tk-sweet { color: var(--orange); }
.patience { height: 8px; margin-top: 6px; border-radius: 6px; background: #e6d6bd; overflow: hidden; }
.patience i { display: block; height: 100%; background: var(--jade); transition: width .2s linear; }
.customer.grumpy .patience i { background: var(--orange); }
.customer.grumpy .cust-frame { animation: fidget .5s ease-in-out infinite; }
@keyframes fidget { 50% { transform: translateX(3px); } }
.cust-frame { position: absolute; left: 20px; top: 116px; width: 200px; height: 230px; overflow: hidden; border-radius: 100px 100px 0 0; border: 3px solid var(--brown); border-bottom: 0; background: var(--milk); }
.cust-frame img { width: 100%; height: auto; display: block; }
.regular .cust-frame { border-color: var(--orange); border-width: 4px; }
.cust-name { position: absolute; left: 50%; top: 104px; transform: translateX(-50%); background: var(--orange); color: #fff; font-family: var(--d); font-style: italic; font-weight: 800; font-size: 18px; padding: 2px 12px; border-radius: 10px; border: 2px solid var(--brown); z-index: 3; }
.customer.pulse .cust-frame { animation: pulse .9s ease; }
@keyframes pulse { 30% { box-shadow: 0 0 0 8px rgba(255,90,54,.45); } }
.bark { position: absolute; left: 50%; top: 270px; transform: translateX(-50%); width: 220px; background: var(--brown); color: var(--milk); font-size: 17px; line-height: 1.3; padding: 8px 12px; border-radius: 12px; z-index: 4; text-align: center; animation: pop .25s ease; }
@keyframes pop { from { transform: translateX(-50%) scale(.8); opacity: 0; } }
.coin-doodle { position: absolute; top: 300px; z-index: 3; transform: rotate(-8deg); }

#rush-station, #make-station { position: absolute; left: 0; right: 0; top: 404px; height: 416px; z-index: 3; }
.station { background: #6b4528 var(--paper); border-top: 6px solid var(--brown); }
.station::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 2px, transparent 2px 90px); pointer-events: none; }
.shelves { position: absolute; left: 14px; top: 10px; width: 580px; }
.shelf { display: flex; align-items: center; height: 98px; }
.shelf-label { width: 64px; font-family: var(--d); font-style: italic; font-weight: 800; font-size: 15px; line-height: 1.05; color: var(--milk); }
.bins { display: flex; gap: 6px; }
.bin { width: 80px; height: 92px; border: 3px solid var(--brown); border-radius: 12px; background: var(--milk); padding: 2px; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.bin img { width: 56px; height: 56px; border-radius: 8px; pointer-events: none; }
.bin span { font-size: 11.5px; font-weight: 500; line-height: 1.08; margin-top: 2px; text-align: center; pointer-events: none; }
.bin.on { background: var(--orange); color: #fff; transform: translateY(-3px); box-shadow: 0 3px 0 var(--brown); }
.bin:active { transform: scale(.95); }
.finish { position: absolute; left: 14px; top: 308px; display: flex; gap: 18px; }
.seg { display: flex; align-items: center; gap: 5px; }
.seg-label { width: 56px; font-family: var(--d); font-style: italic; font-weight: 800; color: var(--milk); font-size: 18px; text-align: right; padding-right: 4px; }
.seg-b { width: 64px; height: 60px; border: 3px solid var(--brown); border-radius: 10px; background: var(--milk); font-weight: 600; font-size: 16px; }
.seg-b.on { background: var(--jade); color: #fff; }
.cup-wrap { position: absolute; left: 612px; top: 12px; width: 170px; display: flex; flex-direction: column; align-items: center; }
.cup-box { width: 170px; height: 250px; display: flex; align-items: flex-end; justify-content: center; background: radial-gradient(ellipse at 50% 92%, rgba(0,0,0,.25), transparent 60%); touch-action: none; }
.cup-box.tipping { animation: tip .5s ease; }
@keyframes tip { 40% { transform: translateX(60px) rotate(40deg); opacity: .2; } 41% { transform: translateX(-30px); } }
.tip-out { margin-top: 8px; height: 64px; width: 150px; border: 3px solid var(--brown); border-radius: 12px; background: var(--milk-2); font-weight: 600; }
.tip-out:disabled { opacity: .45; }
.shake-area { position: absolute; left: 800px; top: 10px; right: 14px; display: flex; gap: 12px; justify-content: center; }
.shaker { width: 170px; height: 350px; border: 3px dashed rgba(233,201,160,.5); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 14px; touch-action: none; }
.shaker.can { border-color: var(--orange); border-style: solid; background: rgba(255,90,54,.12); }
.shaker.has { border-style: solid; border-color: var(--milk); }
.shaker.ready { background: rgba(47,143,107,.25); border-color: var(--jade); }
.shaker.sel { box-shadow: 0 0 0 4px var(--orange); }
.shaker.jig .shaker-body { animation: jig .16s ease; }
@keyframes jig { 30% { transform: translateX(-14px) rotate(-8deg); } 70% { transform: translateX(14px) rotate(8deg); } }
.shaker-hint { margin-top: 8px; color: var(--milk); font-weight: 500; font-size: 15px; text-align: center; min-height: 40px; }
.shaker-body { pointer-events: none; }

/* coach marks + banners */
.coach { position: absolute; left: 330px; top: 150px; width: 520px; z-index: 20; background: #fffaf2 var(--paper); border: 4px solid var(--brown); border-radius: 18px; padding: 22px 26px; box-shadow: 8px 8px 0 var(--brown); }
.coach p { margin: 0 0 16px; font-size: 22px; line-height: 1.4; }
.banner, .daycard { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-2deg); z-index: 30; background: var(--orange); color: #fff8ef; border: 4px solid var(--brown); border-radius: 20px; padding: 24px 50px; text-align: center; box-shadow: 10px 10px 0 var(--brown); }
.banner b { display: block; font-family: var(--d); font-style: italic; font-weight: 900; font-size: 64px; line-height: 1; }
.banner span { font-size: 22px; }
.daycard { background: var(--brown); color: var(--milk); opacity: 0; transition: opacity .45s; box-shadow: 10px 10px 0 var(--orange); }
.daycard.in { opacity: 1; }
.dc-date { font-weight: 600; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--milk); opacity: .85; margin-bottom: 6px; }
.dc-wx { margin: 16px auto 0; max-width: 460px; display: flex; flex-direction: column; gap: 2px; background: #fffaf2 var(--paper); color: var(--brown); border: 3px solid var(--brown); border-radius: 12px; padding: 10px 18px; box-shadow: 4px 4px 0 var(--orange); transform: rotate(1.5deg); }
.dc-wx b { font-family: var(--d); font-style: italic; font-weight: 800; font-size: 22px; }
.dc-wx span { font-size: 16px; }
canvas.wx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dc-day { font-family: var(--d); font-style: italic; font-weight: 900; font-size: 78px; line-height: 1; color: var(--orange); }
.dc-shop { font-family: var(--d); font-weight: 700; font-size: 30px; }
.dc-sub { margin-top: 8px; font-size: 19px; opacity: .8; }
.toast { position: absolute; left: 50%; top: 80px; transform: translate(-50%, -20px); opacity: 0; transition: .3s; z-index: 40; background: var(--brown); color: var(--milk); padding: 12px 22px; border-radius: 12px; font-weight: 500; font-size: 19px; border: 2px solid var(--milk); }
.toast.in { opacity: 1; transform: translate(-50%, 0); }
.float { position: absolute; z-index: 30; font-family: var(--d); font-weight: 900; font-size: 30px; color: #fff8ef; -webkit-text-stroke: 1.5px var(--brown); animation: rise 1.3s ease-out forwards; pointer-events: none; }
.float.gold { color: #ffd166; }
@keyframes rise { to { transform: translateY(-70px); opacity: 0; } }

/* ---------- STORY ---------- */
#story-bg::after { content: ''; position: absolute; inset: 0; background: rgba(43,26,20,.18); }
#story-cast { position: absolute; inset: 64px 0 0 0; z-index: 2; }
.actor { position: absolute; top: 20px; width: 420px; transition: left .5s ease, transform .5s ease, opacity .5s, filter .3s; }
.actor.enter { opacity: 0; transform: translateY(30px); }
.actor-frame { width: 420px; height: 560px; border: 5px solid var(--brown); border-radius: 210px 210px 24px 24px; overflow: hidden; background: var(--milk); box-shadow: 10px 10px 0 rgba(43,26,20,.6); }
.actor-frame img { width: 100%; display: block; }
.actor:not(.speaking) { filter: brightness(.72) saturate(.85); }
.actor.small { width: 360px; } .actor.small .actor-frame { width: 360px; height: 480px; }
.dialog { position: absolute; left: 40px; right: 40px; top: 576px; height: 200px; z-index: 6; background: #fffaf2 var(--paper); border: 4px solid var(--brown); border-radius: 20px; padding: 26px 34px 20px; display: none; box-shadow: 8px 8px 0 var(--brown); }
.dialog.on { display: block; }
.d-name { position: absolute; left: 28px; top: -24px; padding: 4px 18px; border: 3px solid var(--brown); border-radius: 12px; color: #fff; font-family: var(--d); font-style: italic; font-weight: 900; font-size: 26px; background: var(--jade); }
.dialog.narr .d-name, .dialog.narr .d-name:empty { display: none; }
.d-text { font-size: 27px; line-height: 1.42; }
.dialog.narr .d-text { font-family: var(--d); font-style: italic; font-size: 27px; color: #5a3b2c; }
.dialog.you { border-color: var(--orange); }
.dialog.you .d-name { background: var(--orange) !important; }
.d-more { position: absolute; right: 24px; bottom: 12px; font-size: 26px; color: var(--orange); opacity: 0; }
.dialog.done .d-more { opacity: 1; animation: breathe 1.4s infinite; }
.make { position: absolute; inset: 0; z-index: 8; display: none; }
.make.on { display: block; }
.make-top { position: absolute; left: 30px; right: 30px; top: 88px; height: 290px; display: flex; align-items: center; gap: 24px; }
.make-top img { width: 216px; height: 288px; object-fit: cover; border: 4px solid var(--brown); border-radius: 108px 108px 16px 16px; background: var(--milk); }
.make-hint { flex: 1; background: #fffaf2 var(--paper); border: 4px solid var(--brown); border-radius: 18px; padding: 22px 26px; font-size: 26px; line-height: 1.4; box-shadow: 6px 6px 0 var(--brown); }
.make-btns { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.nb-quick { position: relative; width: 620px; background: #f7ecd6 var(--paper); color: var(--brown); border-radius: 6px; padding: 30px 36px; text-align: left; transform: rotate(-.6deg); box-shadow: 10px 10px 0 #120a07; border-left: 14px solid #e2cfae; }
.nb-quick h3 { margin: 0 0 4px; font-family: var(--d); font-style: italic; font-weight: 900; font-size: 36px; }
.nb-quick p { margin: 0 0 16px; font-size: 17px; }
.nb-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.nb-list button { text-align: left; border: 3px solid var(--brown); border-radius: 8px; background: #fffaf2; padding: 12px 16px; font-family: var(--d); font-style: italic; font-weight: 700; font-size: 22px; color: var(--brown); }
.nb-list button small { display: block; font-family: var(--b); font-style: normal; font-weight: 500; font-size: 15px; color: var(--jade-d); margin-top: 2px; }
.make-hint b { font-family: var(--d); font-style: italic; }

/* lantern moment + notebook pages */
.lantern-moment, .page-ov { position: absolute; inset: 0; z-index: 50; background: rgba(43,26,20,.86); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--milk); opacity: 0; transition: opacity .5s; text-align: center; }
.lantern-moment.in, .page-ov.in { opacity: 1; }
.lm-lantern { transform: scale(4); margin-bottom: 120px; filter: drop-shadow(0 0 10px rgba(255,90,54,.9)); animation: sway 3s ease-in-out infinite; transform-origin: 50% 0; }
.lantern-moment h2 { font-family: var(--d); font-style: italic; font-weight: 900; font-size: 56px; margin: 0; }
.lantern-moment p { font-size: 22px; margin: 8px 0 28px; }
.page { position: relative; width: 640px; max-height: 740px; overflow: hidden; background: #f7ecd6 var(--paper); color: var(--brown); border-radius: 6px; padding: 40px 50px 30px; text-align: left; transform: rotate(-1deg); box-shadow: 10px 10px 0 #120a07; border-left: 14px solid #e2cfae;
  background-image: var(--paper), repeating-linear-gradient(transparent 0 37px, rgba(47,143,107,.22) 37px 38px); }
.page::after { content: ''; position: absolute; right: -2px; top: 0; bottom: 0; width: 18px; background: repeating-linear-gradient(180deg, #f7ecd6 0 10px, transparent 10px 16px); }
.page-new { font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: 14px; color: var(--orange); }
.page h3 { margin: 4px 0 8px; font-family: var(--d); font-style: italic; font-weight: 900; font-size: 40px; line-height: 1.05; }
.page-recipe { font-weight: 600; color: var(--jade-d); margin-bottom: 10px; font-size: 18px; }
.page-body p { font-family: var(--d); font-style: italic; font-size: 22px; line-height: 1.55; margin: 0 0 10px; }
.page-sign { font-family: var(--d); font-style: italic; font-weight: 800; font-size: 26px; text-align: right; margin: 6px 0 16px; color: #8a4a22; }

/* ---------- EVENING ---------- */
#eve-bg::after { content: ''; position: absolute; inset: 0; background: rgba(43,26,20,.35); }
.eve-board { position: absolute; left: 40px; right: 40px; top: 84px; bottom: 44px; background: var(--milk) var(--paper); border: 4px solid var(--brown); border-radius: 22px; box-shadow: 10px 10px 0 var(--brown); display: flex; flex-direction: column; padding: 0 28px 20px; }
.eve-tabs { display: flex; gap: 6px; margin-top: -4px; }
.eve-tab { height: 64px; padding: 0 20px; border: 4px solid var(--brown); border-top: 0; border-radius: 0 0 14px 14px; background: var(--milk-3); font-family: var(--d); font-style: italic; font-weight: 800; font-size: 21px; }
.eve-tab.on { background: var(--orange); color: #fff; }
.eve-body { flex: 1; overflow-y: auto; padding: 16px 4px; }
#eve-next { align-self: flex-end; }
.eve-body h2 { font-family: var(--d); font-style: italic; font-weight: 900; font-size: 40px; margin: 0 0 14px; }
.ld-grid { display: flex; gap: 14px; margin-bottom: 18px; }
.ld-grid div { flex: 1; border: 3px solid var(--brown); border-radius: 14px; padding: 12px 16px; background: #fffaf2; }
.ld-grid b { display: block; font-family: var(--d); font-weight: 900; font-size: 46px; line-height: 1; color: var(--jade-d); }
.ld-table { border-collapse: collapse; font-size: 22px; width: 420px; float: left; margin-right: 30px; }
.ld-table td { padding: 6px 0; border-bottom: 2px dashed rgba(43,26,20,.25); }
.ld-table td:last-child { text-align: right; font-weight: 600; }
.ld-table .tot td { font-family: var(--d); font-weight: 900; font-size: 28px; border-bottom: 0; }
.ld-read { font-family: var(--d); font-style: italic; font-size: 24px; line-height: 1.45; overflow: hidden; margin: 0 0 10px; }
.price-big { font-family: var(--d); font-weight: 900; font-size: 64px; }
.price-big span { color: var(--orange); }
#price-range { width: 100%; height: 64px; -webkit-appearance: none; appearance: none; background: transparent; }
#price-range::-webkit-slider-runnable-track { height: 16px; border-radius: 10px; border: 3px solid var(--brown); background: linear-gradient(90deg, var(--jade), var(--milk-2) 50%, var(--orange)); }
#price-range::-webkit-slider-thumb { -webkit-appearance: none; width: 56px; height: 56px; margin-top: -23px; border-radius: 50%; background: #fffaf2; border: 4px solid var(--brown); }
.price-scale { display: flex; justify-content: space-between; font-weight: 600; }
.price-note { font-family: var(--d); font-style: italic; font-size: 26px; margin: 18px 0 6px; }
.price-tip { font-size: 18px; opacity: .8; }
.shop-item { display: flex; align-items: center; gap: 20px; padding: 12px 0; border-bottom: 2px dashed rgba(43,26,20,.25); }
.shop-item > div { flex: 1; }
.shop-item h4, .set-item h4 { margin: 0 0 2px; font-family: var(--d); font-style: italic; font-weight: 800; font-size: 24px; }
.shop-item p, .set-item p { margin: 0; font-size: 17px; }
.shop-item.owned { opacity: .6; }
.shop-item .btn { min-width: 150px; }
.wardrobe { display: flex; gap: 24px; }
.wd-preview { width: 260px; text-align: center; }
.wd-preview .avatar { border: 3px solid var(--brown); border-radius: 18px; background: var(--jade) var(--paper); }
.wd-look { font-family: var(--d); font-style: italic; font-weight: 700; font-size: 19px; margin-top: 8px; }
.wd-sets { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-item { border: 3px solid var(--brown); border-radius: 14px; padding: 12px 14px; background: #fffaf2; }
.set-item.locked { background: transparent; border-style: dashed; }
.set-acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.set-acts .btn { font-size: 17px; padding: 0 14px; }
.lock { font-size: 15px; font-weight: 600; color: var(--jade-d); }
.nb-sub { margin: -8px 0 16px; font-size: 18px; }
.nb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.nb-page { height: 120px; border: 3px solid var(--brown); border-radius: 6px; background: #f7ecd6 var(--paper); font-family: var(--d); font-style: italic; font-size: 22px; padding: 10px; transform: rotate(-1deg); }
.nb-page:nth-child(2n) { transform: rotate(1.2deg); }
.nb-page.missing { background: transparent; border-style: dashed; color: rgba(43,26,20,.5); }

/* ---------- END ---------- */
#end-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(43,26,20,.9) 0%, rgba(43,26,20,.5) 60%, rgba(43,26,20,.15)); }
.end-body { position: absolute; left: 70px; top: 60px; width: 620px; bottom: 50px; color: var(--milk); overflow-y: auto; }
.end-lanterns { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 20px; }
.end-body h1 { font-family: var(--d); font-style: italic; font-weight: 900; font-size: 68px; line-height: 1; margin: 0 0 20px; color: var(--orange); }
.end-body p { font-size: 22px; line-height: 1.55; }
.end-stats { font-weight: 600; opacity: .8; font-size: 18px !important; }

/* ---------- decor overlays (shop scenes) ---------- */
.decor-layer { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
body[data-decor="rain"] .decor-layer { background: repeating-linear-gradient(100deg, transparent 0 22px, rgba(220,235,240,.16) 22px 23px); animation: rain .5s linear infinite; }
@keyframes rain { to { background-position: -40px 120px; } }
body[data-decor="moon"] .decor-layer { background:
  radial-gradient(circle at 18% 22%, #ffe9b8 0 26px, transparent 27px), radial-gradient(circle at 84% 18%, #ffe9b8 0 18px, transparent 19px), radial-gradient(circle at 60% 26%, #ffe9b8 0 12px, transparent 13px); filter: drop-shadow(0 0 12px rgba(255,220,150,.6)); }
body[data-decor="sketch"] .decor-layer { background:
  linear-gradient(#fffaf2,#fffaf2) 70px 120px / 90px 110px no-repeat, linear-gradient(#fffaf2,#fffaf2) 1020px 110px / 100px 80px no-repeat; opacity: .85; }
body[data-decor="dancer"] .decor-layer { background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.12) 50%, transparent 60%); }
body[data-decor="lin"] .bg { filter: sepia(.45) saturate(.9); }
.cat { display: none; }
body[data-cat="1"] .cat { display: block; position: absolute; left: 24px; top: 330px; width: 136px; height: 80px; z-index: 4; background: url(../assets/ui/dumpling.webp) center/contain no-repeat; }

.scroll { -webkit-overflow-scrolling: touch; touch-action: pan-y; }

.lantern.warm svg ellipse:nth-of-type(1) { fill: #9a4a2c; }
.lantern.warm { filter: drop-shadow(0 0 4px rgba(255,90,54,.35)); }

.make.on ~ #story-cast, #scr-story.making #story-cast { visibility: hidden; }
.price-scale { position: relative; height: 24px; }
.price-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.price-scale span:first-child { transform: none; left: 0; } .price-scale span:last-child { transform: none; right: 0; }
.confirm-new { background: var(--milk-2); color: var(--brown); border: 3px solid var(--brown); border-radius: 14px; padding: 14px 18px; box-shadow: 6px 6px 0 var(--brown); }
.confirm-new p { margin: 0 0 10px; font-size: 19px; font-weight: 500; }
.confirm-new div { display: flex; gap: 10px; }
.btn:focus-visible, .bin:focus-visible, .seg-b:focus-visible, .c-item:focus-visible { outline: 4px solid #ffd166; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.dialog.choosing { cursor: default; }
.dialog.choosing .d-more { display: none; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: -6px; }
.choice { min-height: 64px; text-align: left; padding: 10px 20px; border: 3px solid var(--brown); border-radius: 14px; background: var(--milk); font-size: 22px; line-height: 1.3; font-weight: 500; }
.choice:active { background: var(--orange); color: #fff; }
.dialog.choosing { height: auto; min-height: 200px; top: auto; bottom: 44px; }

.player-frame { overflow: hidden; }
.player-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.create-preview { background: var(--milk); align-items: stretch; }
.hs-thumb { width: 44px; height: 44px; object-fit: cover; object-position: 50% 8%; border-radius: 8px; margin-right: 8px; background: var(--milk); }
.wd-portrait { width: 240px; height: 320px; border: 3px solid var(--brown); border-radius: 120px 120px 16px 16px; background: var(--milk); }
.dialog.choosing { display: flex; gap: 18px; }
.dialog.choosing .d-text { display: flex; gap: 18px; width: 100%; }
.choice-me { flex: none; width: 120px; height: 160px; border: 3px solid var(--brown); border-radius: 60px 60px 12px 12px; background: var(--milk); }
.choices { flex: 1; }

/* ---------- customers: one row along the counter (tablet) ---------- */
.customer[data-slot="0"] { left: 200px; } .customer[data-slot="1"] { left: 520px; } .customer[data-slot="2"] { left: 840px; }

/* ---------- phone held sideways: 1240x560 stage, set by fitStage() ----------
   customers stack in a column on the left, the drink station fills the right */
body.turn-me::after { content: 'Turn your phone sideways to open the shop'; position: fixed; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center; padding: 40px; text-align: center;
  background: var(--brown) var(--paper); color: var(--milk); font-family: var(--d); font-style: italic; font-weight: 800; font-size: 28px; line-height: 1.25; }
body.turn-me #stage { visibility: hidden; }

body.phone .hud { height: 52px; padding: 0 16px; }
body.phone .lanterns { height: 46px; gap: 4px; } body.phone .lantern { width: 28px; height: 40px; }
body.phone .hud-mid { font-size: 21px; gap: 14px; } body.phone .timebar { width: 180px; }
body.phone .coins { font-size: 26px; }

/* title */
body.phone .title-sign { left: 56px; top: 54px; width: 460px; }
body.phone .title-sign h1 { font-size: 92px; margin-bottom: 22px; }
body.phone .ts-small { font-size: 21px; }
body.phone .ts-actions { gap: 12px; }
body.phone #tap-to-start { padding-bottom: 26px; }

/* creator */
body.phone .create-left { left: 24px; top: 18px; bottom: 18px; width: 290px; gap: 8px; }
body.phone .create-preview { width: 186px; height: 248px; flex: none; }
body.phone .field input { height: 56px; font-size: 21px; }
body.phone .field span { font-size: 15px; }
body.phone .create-right { left: 340px; right: 24px; top: 14px; bottom: 16px; }
body.phone .create-right h2 { font-size: 34px; margin-bottom: 8px; }
body.phone #create-go { margin-top: 10px; }

/* rush: customer column */
body.phone .rush-bg { right: auto; width: 268px; background-position: 57% 30%; }
body.phone #rush-customers { left: 0; right: auto; width: 268px; top: 52px; height: 508px; }
body.phone .customer { left: 8px !important; width: 252px; height: 160px; }
body.phone .customer[data-slot="0"] { top: 6px; } body.phone .customer[data-slot="1"] { top: 174px; } body.phone .customer[data-slot="2"] { top: 342px; }
body.phone .customer.enter { transform: translateX(-40px); }
body.phone .customer.leave { transform: translateX(-60px); }
body.phone .cust-frame { left: 0; top: 12px; width: 96px; height: 140px; border-radius: 48px 48px 10px 10px; border-bottom: 3px solid var(--brown); }
body.phone .regular .cust-frame { border-bottom-width: 4px; border-color: var(--orange); }
body.phone .cust-frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 10%; }
body.phone .cust-name { left: 48px; top: 0; font-size: 16px; padding: 1px 10px; }
body.phone .ticket { left: 102px; top: 14px; width: 150px; padding: 6px 7px 8px; }
body.phone .tk-row img { width: 42px; height: 42px; border-radius: 8px; }
body.phone .tk-meta { font-size: 15px; }
body.phone .bark { left: 102px; top: 96px; transform: none; width: 150px; font-size: 15px; padding: 6px 9px; }
body.phone .bark { animation: none; }
body.phone .coin-doodle { top: auto; }
body.phone .cat { display: none !important; }

/* rush + story: the drink station on the right */
body.phone #rush-station, body.phone #make-station { left: 268px; right: 0; top: 52px; height: 508px; border-top: 0; border-left: 6px solid var(--brown); }
body.phone .shelves { left: 10px; top: 8px; width: 560px; }
body.phone .shelf { height: 94px; }
body.phone .shelf-label { width: 56px; font-size: 14px; }
body.phone .bins { gap: 5px; }
body.phone .bin { width: 78px; height: 88px; }
body.phone .bin img { width: 54px; height: 54px; }
body.phone .finish { left: 10px; top: 296px; flex-direction: column; gap: 10px; }
body.phone .seg-label { width: 56px; text-align: left; font-size: 17px; }
body.phone .seg-b { width: 82px; height: 64px; font-size: 17px; }
body.phone .cup-wrap { left: 580px; top: 14px; width: 150px; }
body.phone .cup-box { width: 150px; height: 300px; }
body.phone .cup-box svg { max-width: 100%; }
body.phone .tip-out { width: 140px; }
body.phone .shake-area { left: 740px; right: 8px; top: 10px; gap: 8px; }
body.phone .shaker { flex: 1; max-width: 160px; width: auto; height: 484px; padding-bottom: 12px; }
body.phone .shaker svg { max-width: 100%; height: auto; }
body.phone .shaker-hint { font-size: 14px; }
body.phone .coach { left: 290px; top: 70px; width: 560px; padding: 18px 22px; }
body.phone .coach p { font-size: 20px; margin-bottom: 12px; }

/* banners, cards, toasts */
body.phone .banner, body.phone .daycard { top: 50%; padding: 18px 40px; }
body.phone .banner b { font-size: 54px; }
body.phone .dc-day { font-size: 62px; }
body.phone .dc-shop { font-size: 26px; }
body.phone .dc-wx { margin-top: 12px; }
body.phone .toast { top: 62px; }

/* story */
body.phone #story-cast { inset: 52px 0 0 0; }
body.phone .actor { top: 6px; width: 290px; }
body.phone .actor-frame { width: 290px; height: 380px; border-radius: 145px 145px 20px 20px; box-shadow: 8px 8px 0 rgba(43,26,20,.6); }
body.phone .actor.small { width: 250px; } body.phone .actor.small .actor-frame { width: 250px; height: 330px; }
body.phone .dialog { left: 28px; right: 28px; top: 384px; height: 162px; padding: 22px 30px 16px; }
body.phone .d-name { font-size: 22px; top: -22px; }
body.phone .d-text, body.phone .dialog.narr .d-text { font-size: 23px; line-height: 1.38; }
body.phone .dialog.choosing { top: auto; bottom: 12px; height: auto; min-height: 0; padding: 18px 24px 16px; }
body.phone .choices { gap: 8px; margin-top: 0; }
body.phone .choice { min-height: 58px; font-size: 20px; padding: 8px 18px; }
body.phone .choice-me { width: 92px; height: 124px; border-radius: 46px 46px 10px 10px; }

/* drink making in a scene: the asker sits in the left column */
body.phone .make-top { left: 0; right: auto; width: 268px; top: 52px; height: 508px; flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 12px 12px; background: rgba(43,26,20,.55); }
body.phone .make-top img { width: 116px; height: 150px; align-self: center; flex: none; border-radius: 58px 58px 12px 12px; }
body.phone .make-hint { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; font-size: 17px; line-height: 1.35; box-shadow: 4px 4px 0 var(--brown); }
body.phone .make-btns { flex-direction: row; gap: 8px; }
body.phone .make-btns .btn { flex: 1; padding: 0 10px; min-height: 60px; font-size: 20px; }

/* lantern moment, notebook pages */
body.phone .lm-lantern { transform: scale(3); margin-bottom: 76px; }
body.phone .lantern-moment h2 { font-size: 46px; }
body.phone .lantern-moment p { font-size: 20px; margin-bottom: 18px; }
body.phone .page { width: 760px; max-height: 530px; overflow-y: auto; padding: 24px 40px 20px; touch-action: pan-y; }
body.phone .page h3 { font-size: 34px; }
body.phone .page-body p { font-size: 20px; line-height: 1.5; }
body.phone .nb-quick { width: 700px; max-height: 530px; overflow-y: auto; padding: 22px 30px; touch-action: pan-y; }
body.phone .nb-quick h3 { font-size: 30px; }

/* evening board */
body.phone .eve-board { left: 24px; right: 24px; top: 60px; bottom: 10px; padding: 0 22px 12px; }
body.phone .eve-tab { height: 58px; font-size: 19px; padding: 0 16px; }
body.phone .eve-body { padding: 12px 4px; }
body.phone .eve-body h2 { font-size: 32px; margin-bottom: 10px; }
body.phone #eve-next { min-height: 64px; font-size: 24px; }
body.phone .ld-grid b { font-size: 38px; }
body.phone .ld-table { font-size: 19px; }
body.phone .ld-read { font-size: 21px; }
body.phone .wd-portrait { width: 180px; height: 240px; border-radius: 90px 90px 14px 14px; }
body.phone .wd-preview { width: 200px; }

/* ending */
body.phone .end-body { left: 56px; top: 30px; bottom: 24px; width: 640px; }
body.phone .end-body h1 { font-size: 54px; }
body.phone .end-body p { font-size: 20px; }

/* tablet: keep Tip out clear of the sweetness row */
body:not(.phone) .cup-box { height: 226px; }
body:not(.phone) .cup-box svg { max-height: 100%; }
body:not(.phone) .tip-out { height: 56px; }

/* the notch and home bar: fitStage() measures this box and keeps the stage inside it */
#safe-probe { position: fixed; inset: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); visibility: hidden; pointer-events: none; }

/* one-tap shake: the shaker rocks for a moment, then the sealed cup appears */
.shaker.shaking { border-style: solid; border-color: var(--orange); background: rgba(255,90,54,.12); }
.shaker.shaking .shaker-body { animation: shakeit .15s ease-in-out infinite alternate; transform-origin: 50% 70%; }
@keyframes shakeit { from { transform: translate(-10px, 4px) rotate(-12deg); } to { transform: translate(10px, -10px) rotate(12deg); } }
.shaker.ready .shaker-body { animation: settle .35s ease-out; }
@keyframes settle { from { transform: scale(.85); } 60% { transform: scale(1.06); } }

/* dialog box hugs its text: anchored to the bottom, only as tall as the line needs */
.dialog { top: auto; bottom: 34px; height: auto; min-height: 120px; padding: 24px 34px 22px; }
.d-text, .dialog.narr .d-text { font-size: 30px; line-height: 1.38; }
.d-more { bottom: 8px; }
body.phone .dialog { top: auto; bottom: 12px; height: auto; min-height: 96px; padding: 20px 30px 16px; }
body.phone .d-text, body.phone .dialog.narr .d-text { font-size: 25px; line-height: 1.34; }
body.phone .dialog.choosing .d-text { font-size: inherit; }
.dialog.choosing .d-text { font-size: inherit; }

/* painted cup + shaker */
.cup-box .cup-svg { height: 100%; width: auto; max-width: 100%; }
.shaker-img { display: block; height: 210px; width: auto; pointer-events: none; -webkit-user-drag: none; }
.shaker .cup-svg { height: 210px; width: auto; }
body.phone .shaker-img { height: 250px; }
body.phone .shaker .cup-svg { height: 250px; }
.cup-box { background: radial-gradient(ellipse 60% 10% at 50% 96%, rgba(0,0,0,.28), transparent 70%); }

/* ---------- feedback note ---------- */
.note-btn { position: absolute; z-index: 8; min-height: 44px; padding: 0 18px; border-radius: 22px; font-family: var(--b); font-weight: 500; font-size: 17px; cursor: pointer; }
.note-btn.on-title { right: 28px; bottom: 24px; background: rgba(43,26,20,.72); color: var(--milk); border: 2px solid var(--milk-3); }
.note-btn.on-eve { left: 28px; bottom: 26px; background: transparent; color: var(--brown); border: 2px dashed var(--brown-2); }
.note-btn:active { transform: translateY(2px); }
.note-ov { position: absolute; inset: 0; z-index: 60; background: rgba(43,26,20,.78); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .3s; }
.note-ov.in { opacity: 1; }
.note-card { position: relative; width: 700px; background: #fffaf2 var(--paper); border: 4px solid var(--brown); border-radius: 18px; box-shadow: 10px 10px 0 var(--brown); padding: 30px 34px 26px; color: var(--brown); transform: rotate(-.6deg); }
.note-card::before { content: ''; position: absolute; top: -16px; left: 50%; width: 120px; height: 30px; margin-left: -60px; background: var(--orange); opacity: .85; transform: rotate(2deg); border-radius: 3px; }
.note-card h3 { margin: 0 0 6px; font-family: var(--d); font-weight: 900; font-size: 38px; line-height: 1; }
.note-card h3 em { color: var(--orange); font-style: italic; }
.note-sub { margin: 0 0 16px; font-size: 19px; }
.note-x { position: absolute; top: 10px; right: 12px; width: 48px; height: 48px; border: 0; background: none; font-size: 36px; line-height: 1; color: var(--brown); cursor: pointer; }
.note-kinds { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.note-kind { min-height: 48px; padding: 0 16px; border: 3px solid var(--brown); border-radius: 12px; background: #fffaf2; color: var(--brown); font-family: var(--b); font-weight: 500; font-size: 17px; cursor: pointer; }
.note-kind.on { background: var(--jade); color: #fff8ef; }
#note-text { display: block; width: 100%; box-sizing: border-box; border: 3px solid var(--brown); border-radius: 12px; padding: 12px 16px; font: 400 21px/1.4 var(--b); color: var(--brown); background: #fff; resize: none; -webkit-user-select: text; user-select: text; }
#note-text:focus { outline: 4px solid #ffd166; outline-offset: 1px; }
.note-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.note-warn { font-size: 15px; font-style: italic; color: var(--brown-2); max-width: 320px; }
.note-card #note-done { margin-top: 6px; }
body.phone .note-card { width: 760px; padding: 20px 28px 18px; }
body.phone .note-card h3 { font-size: 32px; }
body.phone .note-sub { margin-bottom: 10px; font-size: 17px; }
body.phone .note-kinds { margin-bottom: 10px; }
body.phone #note-text { font-size: 19px; height: 120px; }
body.phone .note-btn.on-eve { left: 22px; bottom: 14px; }
.toast { z-index: 70; }

.note-who { display: flex; gap: 12px; margin-top: 12px; }
.note-who label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 500; }
.note-who label:last-child { flex: 1.4; }
.note-who i { font-weight: 300; color: var(--brown-2); }
.note-who input { height: 48px; border: 3px solid var(--brown); border-radius: 12px; padding: 0 12px; font: 400 19px var(--b); color: var(--brown); background: #fff; min-width: 0; }
.note-who input:focus { outline: 4px solid #ffd166; outline-offset: 1px; }
body.phone #note-text { height: 84px; }
body.phone .note-who { margin-top: 8px; }
body.phone .note-who input { height: 44px; }
body.phone .note-card .note-sub { display: none; }
