/* 深夜吧台（c10 彩蛋小遊戲）。顏色只用官網角色表：夜 #111830、藍 #25316D、代表色 #9ED1ED（店長琥珀與吧台燈）、紙 #F1F4F8、ink #141B33、sub #4E587A、淡 #C9D2E8、線 #DCE2EB、白。
   行距：內文 1.8、標題 1.25。 */
:root { --night: #111830; --blue: #25316D; --rep: #9ED1ED; --paper: #F1F4F8; --ink: #141B33; --sub: #4E587A; --soft: #C9D2E8; --line: #DCE2EB; --hud: 60px; }
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--night); color: var(--soft); font: 400 17px/1.8 "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, .btn { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
[hidden] { display: none !important; }

.g { position: fixed; inset: 0; display: grid; grid-template-rows: var(--hud) 1fr; }
.g.dark-wall { background: linear-gradient(180deg, #111830 0%, #25316D 100%); }
.g.landing-wall { background: radial-gradient(circle at 82% 18%, #25316D 0 7%, transparent 7.2%), linear-gradient(180deg, #25316D 0%, #111830 100%); }

/* ---------- HUD ---------- */
.hud { display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--night); border-bottom: 1px solid #1F2A52; color: #fff; min-width: 0; }
.hud-back { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 900; text-decoration: none; }
.hud-stat { flex: none; display: flex; align-items: baseline; gap: 6px; line-height: 1.25; }
.hud-stat span { font-size: 14px; color: var(--soft); }
.hud-stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.hud-stat small { color: var(--soft); }
.hud-time { flex: 1; min-width: 60px; height: 12px; border-radius: 6px; background: #25316D; overflow: hidden; }
.hud-time i { display: block; height: 100%; width: 100%; background: var(--rep); border-radius: 6px; }
.hud-btns { flex: none; display: flex; gap: 6px; }
.hud-btns button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--blue); color: #fff; font-weight: 700; font-size: 15px; line-height: 1.25; }
.hud-btns button:hover { background: #34428A; }
.hud-btns button[aria-expanded="true"] { background: #fff; color: var(--ink); }

/* ---------- 舞台 ---------- */
.stage { position: relative; min-height: 0; display: grid; grid-template-columns: minmax(210px, 27vw) 1fr; grid-template-rows: 1fr auto; gap: 14px 18px; padding: 16px 18px 16px; }
.host { grid-column: 1; grid-row: 1 / 3; position: relative; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-top: 110px; container-type: size; }
/* 吧台檯面：蓋住立繪下緣（腰帶以下），不跟著立繪跳動 */
.host-bar { position: absolute; left: -18px; right: -18px; bottom: -16px; height: calc(min(40cqw, (100cqh - 110px) * .25) + 16px); min-height: 40px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, #3A4A86 0 10px, var(--rep) 10px 12px, #1A2447 12px 100%);
  box-shadow: 0 -8px 18px rgba(0,0,0,.35); }
.host-bar::after { content: ""; position: absolute; left: 0; right: 0; top: 12px; bottom: 0; background: repeating-linear-gradient(90deg, transparent 0 58px, rgba(158,209,237,.10) 58px 60px); }
.host-bar .cup { position: absolute; bottom: calc(100% - 4px); left: 14%; width: 26px; height: 22px; background: #F1F4F8; border-radius: 0 0 8px 8px; }
.host-bar .cup::after { content: ""; position: absolute; right: -8px; top: 4px; width: 8px; height: 10px; border: 3px solid #F1F4F8; border-left: 0; border-radius: 0 6px 6px 0; }
.host-bar .cup.c2 { left: auto; right: 16%; width: 20px; height: 26px; border-radius: 3px 3px 6px 6px; background: var(--rep); }
.host-bar .cup.c2::after { display: none; }
.host-fig { position: relative; width: 100%; max-height: 100%; aspect-ratio: 530 / 850; flex: none; transform-origin: 50% 100%; }
.host-fig img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; transform-origin: 50% 100%; animation: breathe 3.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: none; } 50% { transform: translateY(-2px) scaleY(1.008); } }
.host-fig.r-hop { animation: r-hop .5s cubic-bezier(.3, 1.6, .5, 1); }
.host-fig.r-shake { animation: r-shake .45s; }
.host-fig.r-jolt { animation: r-jolt .4s ease-out; }
.host-fig.r-dip { animation: r-dip .9s ease-in-out; }
@keyframes r-hop { 0% { transform: none; } 35% { transform: translateY(-14px) scale(1.02); } 100% { transform: none; } }
@keyframes r-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px) rotate(-1deg); } 40% { transform: translateX(7px) rotate(1deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes r-jolt { 0% { transform: none; } 25% { transform: scale(1.04) translateY(-6px); } 100% { transform: none; } }
@keyframes r-dip { 0%, 100% { transform: none; } 40%, 70% { transform: translateY(6px) scaleY(.99); } }
/* 頭上特效（座標＝立繪框的百分比，頭在上方中間） */
.host-fx { position: absolute; inset: 0; pointer-events: none; }
.fx { position: absolute; font-style: normal; font-weight: 900; line-height: 1; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.fx-note { left: 70%; top: 8%; font-size: 34px; color: var(--rep); animation: fx-up 1.2s ease-out forwards; }
.fx-st { font-size: 22px; color: #fff; animation: fx-tw 1s ease-out forwards; }
.fx-st.s1 { left: 22%; top: 12%; } .fx-st.s2 { left: 78%; top: 24%; animation-delay: .12s; } .fx-st.s3 { left: 30%; top: 2%; animation-delay: .22s; }
.fx-drop { left: 68%; top: 12%; width: 16px; height: 22px; background: var(--rep); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; clip-path: polygon(50% 0, 100% 60%, 85% 95%, 50% 100%, 15% 95%, 0 60%); box-shadow: inset -3px -3px 0 rgba(255,255,255,.5); animation: fx-drip 1.2s ease-in forwards; }
.fx-x { left: 24%; top: 6%; font-size: 40px; animation: fx-pop 1s ease-out forwards; }
.fx-bang { left: 66%; top: 0; font-size: 46px; color: #fff; animation: fx-pop 1s ease-out forwards; }
.fx-dots { left: 64%; top: 6%; font-size: 40px; color: var(--soft); animation: fx-up 1.3s ease-out forwards; }
@keyframes fx-up { 0% { opacity: 0; transform: translateY(10px) scale(.6); } 25% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-26px); } }
@keyframes fx-tw { 0% { opacity: 0; transform: scale(0) rotate(0); } 35% { opacity: 1; transform: scale(1.2) rotate(40deg); } 100% { opacity: 0; transform: scale(.4) rotate(90deg); } }
@keyframes fx-drip { 0% { opacity: 0; transform: translateY(-6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(26px); } }
@keyframes fx-pop { 0% { opacity: 0; transform: scale(.3); } 25% { opacity: 1; transform: scale(1.25); } 45% { transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
/* 工作檯／座位特效層 */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.spot { position: absolute; width: 0; height: 0; }
.spot .ring { position: absolute; left: -40px; top: -40px; width: 80px; height: 80px; border-radius: 50%; box-shadow: 0 0 0 4px var(--rep); animation: ring .6s ease-out forwards; }
.spot-pop .ring { left: -22px; top: -22px; width: 44px; height: 44px; box-shadow: 0 0 0 3px #fff; animation-duration: .4s; }
.spot-ng .ring { box-shadow: 0 0 0 4px #fff; }
.spot b { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap; font-size: 26px; font-weight: 900; color: var(--ink); background: #fff; padding: 2px 12px; border-radius: 999px; box-shadow: 0 0 0 3px var(--rep); animation: stamp .9s ease-out forwards; }
.spot-ng b { font-size: 34px; padding: 0 14px; box-shadow: 0 0 0 3px var(--ink); }
.spot-coin b { color: var(--ink); background: var(--rep); box-shadow: none; animation: coin .9s ease-out forwards; }
.spot .sp { position: absolute; left: -8px; top: -12px; font-size: 22px; font-style: normal; color: #fff; text-shadow: 0 2px 0 var(--ink); animation: fly .8s ease-out forwards; }
.spot .sp.a { --dx: -70px; --dy: -46px; } .spot .sp.b { --dx: 72px; --dy: -40px; } .spot .sp.c { --dx: -52px; --dy: 40px; } .spot .sp.d { --dx: 60px; --dy: 44px; }
@keyframes ring { 0% { opacity: 1; transform: scale(.3); } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes stamp { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(.95); } 40% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%); } }
@keyframes coin { 0% { opacity: 0; transform: translate(-50%, -30%); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -180%); } }
@keyframes fly { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(120deg) scale(.5); } }
.seats { grid-column: 2; grid-row: 1; }
.bench { grid-column: 2; grid-row: 2; }
/* 店長的話：桌機疊在立繪上方那一格 */
.host-say { grid-column: 1; grid-row: 1; align-self: start; z-index: 3; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #fff; color: var(--ink); font-weight: 700; font-size: 16px; line-height: 1.6; box-shadow: 0 0 0 2px var(--rep); }
.host-say p { margin: 0; text-wrap: pretty; }
.host-face { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: var(--blue); box-shadow: 0 0 0 2px var(--rep); }
.host-face img { position: absolute; max-width: none; height: auto; width: 360%; left: -118%; top: -58%; }

/* 座位 */
.seats { min-height: 0; display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.seat { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; min-height: 0; padding: 14px 12px 12px; border-radius: 16px; border: 0; background: #1A2447; color: #fff; text-align: center; box-shadow: inset 0 0 0 2px #2E3A68; }
.seat.empty { background: transparent; box-shadow: inset 0 0 0 2px #2E3A68; color: var(--sub); justify-content: center; cursor: default; }
.seat.empty::before { content: attr(aria-label); font-size: 15px; color: #4E587A; }
button.seat:not(.empty):hover { box-shadow: inset 0 0 0 3px var(--rep); }
.seat.ready { box-shadow: inset 0 0 0 3px var(--rep); }
.seat .sil { width: 64px; height: 64px; flex: none; }
.seat .who { font-size: 15px; line-height: 1.25; color: var(--soft); }
.seat .order { width: 100%; padding: 8px 10px; border-radius: 12px; background: #fff; color: var(--ink); line-height: 1.25; }
.seat .order b { display: block; font-size: 19px; font-weight: 900; }
.seat .order small { display: block; margin-top: 3px; font-size: 13px; color: var(--sub); }
.seat.alc .order { background: var(--paper); box-shadow: inset 0 0 0 2px var(--sub); }
.seat .act { font-size: 14px; font-weight: 700; line-height: 1.25; color: var(--rep); }
.seat .pat { width: 100%; height: 8px; border-radius: 4px; background: #2E3A68; overflow: hidden; flex: none; }
.seat .pat i { display: block; height: 100%; background: var(--rep); border-radius: 4px; }
.seat .pat.low i { background: #fff; }

/* 工作檯 */
.bench { min-width: 0; display: grid; gap: 10px; }
.slots { display: grid; grid-template-columns: repeat(var(--b, 1), minmax(0, 1fr)); gap: 10px; }
.slot { display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 8px 10px; border-radius: 14px; background: var(--paper); color: var(--ink); }
.slot .pick { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-width: 0; font-size: 15px; line-height: 1.25; }
.slot .pick em { font-style: normal; padding: 4px 8px; border-radius: 8px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.slot .pick .ph { color: var(--sub); }
.slot.done { background: var(--rep); }
.slot.done .pick b { font-size: 18px; font-weight: 900; }
.slot .clr { flex: none; min-width: 44px; min-height: 44px; border: 0; border-radius: 10px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; box-shadow: inset 0 0 0 2px var(--line); }
.ings { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.ing { min-height: 48px; padding: 4px 8px; border: 0; border-radius: 12px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 700; line-height: 1.25; box-shadow: 0 3px 0 var(--blue); }
.ing:hover { background: var(--paper); }
.ing:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--blue); }

/* 菜單（右側抽屜） */
.menu-ref { position: absolute; right: 12px; top: 12px; z-index: 6; width: min(320px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; padding: 14px 16px; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 10px 30px rgba(17,24,48,.5); }
.menu-ref h2 { font-size: 19px; line-height: 1.25; margin-bottom: 6px; }
.menu-ref ul { list-style: none; padding: 0; }
.menu-ref li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.6; }
.menu-ref li b { font-weight: 900; }
.menu-note { margin-top: 8px; font-size: 13px; line-height: 1.8; color: var(--sub); }

/* 提示 */
.toast { position: fixed; left: 50%; top: calc(var(--hud) + 10px); transform: translateX(-50%); z-index: 30; padding: 6px 16px; border-radius: 20px; background: var(--rep); color: var(--ink); font-weight: 900; font-size: 16px; line-height: 1.6; opacity: 0; pointer-events: none; transition: opacity .2s; white-space: nowrap; }
.toast.on { opacity: 1; }

/* ---------- 覆蓋畫面 ---------- */
.scr { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(17,24,48,.86); overflow: auto; }
.scr.talk { background: rgba(17,24,48,.6); }
.card { width: min(640px, 100%); max-height: 100%; overflow: auto; padding: 24px 24px 22px; border-radius: 18px; background: #fff; color: var(--ink); box-shadow: 0 0 0 3px var(--rep); }
.card h1, .card h2 { font-size: 30px; font-weight: 900; line-height: 1.25; margin-bottom: 10px; }
.card h3 { margin: 16px 0 8px; font-size: 19px; line-height: 1.25; display: flex; justify-content: space-between; align-items: baseline; }
.card h3 small { font-size: 15px; color: var(--sub); font-weight: 700; }
.card p { line-height: 1.8; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 900; font-size: 17px; line-height: 1.25; text-decoration: none; }
.btn:hover { background: var(--blue); }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.ghost:hover { background: var(--paper); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.t-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.title-card { text-align: left; }
.t-logo { width: min(320px, 70%); height: auto; display: block; margin-bottom: 8px; filter: drop-shadow(0 0 0 #111830); background: var(--night); padding: 8px 12px; border-radius: 10px; }
.t-lead { font-size: 18px; }
.t-note, .help-keys { margin-top: 14px; font-size: 14px; color: var(--sub); }
.help { padding-left: 1.3em; display: grid; gap: 6px; margin: 6px 0 4px; line-height: 1.8; }
.talk-card { width: min(560px, 100%); }
.k-who { font-size: 15px; color: var(--sub); }
.k-q { font-size: 22px; font-weight: 900; line-height: 1.6 !important; margin: 2px 0 10px; }
.k-hint { font-size: 14px; color: var(--sub); }
.k-opts { display: grid; gap: 8px; margin-top: 8px; }
.k-opts button { min-height: 52px; padding: 8px 14px; border: 0; border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 17px; font-weight: 700; line-height: 1.6; text-align: left; box-shadow: inset 0 0 0 2px var(--line); }
.k-opts button:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 6px 0 4px; }
.sum div { padding: 8px 10px; border-radius: 12px; background: var(--paper); }
.sum dt { font-size: 13px; color: var(--sub); line-height: 1.25; }
.sum dd { margin: 0; font-size: 24px; font-weight: 900; line-height: 1.25; font-variant-numeric: tabular-nums; }
.e-line, .fin-line { margin-top: 10px; font-weight: 700; }
.shop { list-style: none; padding: 0; display: grid; gap: 8px; }
.shop li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 12px; box-shadow: inset 0 0 0 2px var(--line); }
.shop li div { min-width: 0; line-height: 1.25; }
.shop li b { display: block; font-size: 16px; }
.shop li small { display: block; margin-top: 2px; font-size: 13px; color: var(--sub); line-height: 1.6; }
.shop li button { flex: none; min-height: 44px; min-width: 88px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; }
.shop li button[disabled] { background: var(--line); color: var(--sub); cursor: not-allowed; }
.shop li.owned button { background: var(--rep); color: var(--ink); }
#bNext { margin-top: 14px; width: 100%; }
.fin-card { text-align: left; }
.fin-fig { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; position: relative; background: var(--blue); box-shadow: 0 0 0 3px var(--rep); margin-bottom: 10px; }
.fin-fig img { position: absolute; width: 183%; max-width: none; left: -33%; top: -17%; }
.fin-tag { font-size: 14px; color: var(--sub); }

/* 動畫（減少動態時全部關掉） */
.seat.in { animation: seat-in .35s ease-out; }
@keyframes seat-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.seat.served { animation: served .5s ease-out; }
@keyframes served { 0% { box-shadow: inset 0 0 0 6px var(--rep); } 100% { box-shadow: inset 0 0 0 2px #2E3A68; } }
.slot.bad { animation: bad .35s; }
@keyframes bad { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
html.still *, html.still *::before, html.still *::after { animation: none !important; transition: none !important; }

/* ---------- 手機直拿 ---------- */
@media (max-width: 700px) and (orientation: portrait) {
  :root { --hud: 104px; }
  .hud { flex-wrap: wrap; gap: 6px 10px; padding: 6px 10px; align-content: center; }
  .hud-back { min-height: 40px; padding: 0 10px; font-size: 15px; }
  .hud-time { order: 9; flex-basis: 100%; height: 10px; }
  .hud-stat b { font-size: 19px; }
  .hud-btns { margin-left: auto; }
  .hud-btns button { padding: 0 8px; font-size: 14px; min-height: 40px; }
  .stage { grid-template-columns: 96px 1fr; grid-template-rows: auto 1fr auto; gap: 10px; padding: 10px; }
  .host { grid-column: 1; grid-row: 1; padding-top: 0; justify-content: flex-end; }
  .host { container-type: normal; } .host-bar { display: none; } .host-fig { height: auto; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 12px; background: #1A2447; } .host-fig img { object-fit: cover; object-position: 50% 0; }
  .host-say { grid-column: 2; grid-row: 1; align-self: end; font-size: 15px; padding: 8px 10px; }
  .seats { grid-column: 1 / -1; grid-row: 2; }
  .bench { grid-column: 1 / -1; grid-row: 3; }
  .host-face { width: 40px; height: 40px; }
  .seats { gap: 8px; }
  .seat { padding: 8px 6px; gap: 4px; }
  .seat .sil { width: 40px; height: 40px; }
  .seat .who { font-size: 13px; }
  .seat .order { padding: 6px; }
  .seat .order b { font-size: 16px; }
  .seat .order small, .seat .act { font-size: 12px; }
  .ings { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .ing { font-size: 15px; padding: 2px 4px; }
  .slot { min-height: 50px; }
  .sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 18px 16px; }
  .card h1, .card h2 { font-size: 26px; }
}

/* ---------- 橫拿手機／很矮的畫面 ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --hud: 50px; }
  .hud { gap: 10px; }
  .hud-back { min-height: 40px; }
  .hud-btns button { min-height: 40px; padding: 0 10px; }
  .stage { grid-template-columns: 70px minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 8px 10px; padding: 8px 10px; }
  .host { grid-column: 1; grid-row: 1 / 3; padding-top: 0; }
  .host { container-type: normal; } .host-bar { display: none; } .host-fig { height: auto; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 12px; background: #1A2447; } .host-fig img { object-fit: cover; object-position: 50% 0; }
  .host-say { grid-column: 2 / 4; grid-row: 1; padding: 4px 10px; font-size: 14px; line-height: 1.5; }
  .host-face { width: 32px; height: 32px; }
  .seats { grid-column: 2; grid-row: 2; }
  .bench { grid-column: 3; grid-row: 2; }
  .seats { gap: 8px; }
  .seat { padding: 8px 6px; gap: 4px; }
  .seat .sil { width: 36px; height: 36px; }
  .seat .who { font-size: 12px; }
  .seat .order b { font-size: 15px; }
  .seat .order small, .seat .act { font-size: 12px; }
  .bench { align-content: start; overflow: auto; }
  .ings { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .ing { min-height: 40px; font-size: 14px; padding: 2px 4px; }
  .slot { min-height: 46px; padding: 4px 6px; gap: 4px; }
  .slot .pick { font-size: 13px; }
  .slot .pick em { padding: 2px 5px; }
  .slot .clr { min-width: 40px; min-height: 40px; }
  .slots { grid-template-columns: repeat(var(--b, 1), minmax(0, 1fr)); gap: 6px; }
  .sum { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card { padding: 14px 16px; }
  .card h1, .card h2 { font-size: 22px; }
  .fin-fig { width: 72px; height: 72px; }
}

/* 吧台檯面：座位卡片靠下站在一條藍色檯面上，空的時候不會變成一大片空框 */
.seats { align-items: end; padding-bottom: 14px; border-bottom: 10px solid #25316D; border-radius: 0 0 6px 6px; }
.seat { max-height: 100%; }
.seat.empty { min-height: 140px; }
@media (max-width: 700px) and (orientation: portrait) { .seats { padding-bottom: 8px; border-bottom-width: 6px; } .seat.empty { min-height: 110px; } }
@media (max-height: 500px) and (orientation: landscape) { .seats { padding-bottom: 6px; border-bottom-width: 6px; } .seat.empty { min-height: 90px; } }

/* 打烊結算：升級清單在寬畫面排兩欄，「開始下一夜」黏在卡片底部，矮畫面也一定按得到 */
.end-card { width: min(760px, 100%); }
#bNext { position: sticky; bottom: 0; box-shadow: 0 -10px 0 #fff; }
@media (min-width: 701px) { .shop { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-height: 700px) { .end-card h2 { font-size: 24px; margin-bottom: 4px; } .sum dd { font-size: 20px; } .e-line { margin-top: 4px; } .card h3 { margin: 8px 0 6px; } .shop li { padding: 6px 8px; } }

/* ---------- 桌機：吧台後牆（茶罐、菜單板、吊燈；純裝飾，不放酒瓶，不吃點擊） ---------- */
.backwall { display: none; }
@media (min-width: 701px) and (min-height: 540px) {
  /* 牆面底色鋪滿座位列那一格（跟座位列同寬同高），座位坐在牆前面；道具只畫在座位上方剩下的空間，不夠高就不畫 */
  .backwall { display: block; grid-column: 2; grid-row: 1; z-index: 0; pointer-events: none; min-height: 0; position: relative; container-type: size; border-radius: 18px; overflow: hidden;
    background: repeating-linear-gradient(180deg, transparent 0 69px, #1F2A52 69px 71px), linear-gradient(180deg, #16203F 0%, #131B38 100%); }
  .backwall svg { position: absolute; left: 0; right: 0; top: 0; bottom: 220px; width: 100%; height: calc(100% - 220px); display: block; }
  .backwall .c-ginger, .backwall .c-yuzu { display: none; }
  .has-ginger .backwall .c-ginger, .has-yuzu .backwall .c-yuzu { display: inline; }
  @container (max-height: 399px) { .backwall svg { display: none; } }
  .seats { position: relative; z-index: 1; }
  .host, .host-say { z-index: 2; }
}

/* ---------- 打烊結算：內容超出螢幕時卡片內捲動，「開始下一夜」釘在底部一定點得到（手機橫拿） ---------- */
.end-card { overscroll-behavior: contain; }
#bNext { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 0 0 10px #fff; }
@media (max-height: 500px) and (orientation: landscape) {
  .scr { padding: 8px 12px; }
  .card { max-height: calc(100dvh - 16px); }
  .end-card { padding: 10px 14px 10px; }
  .end-card h2 { font-size: 20px; margin-bottom: 4px; }
  .end-card .sum div { padding: 4px 8px; }
  .end-card .sum dd { font-size: 20px; }
  .end-card .e-line { margin-top: 4px; font-size: 15px; line-height: 1.5; }
  .end-card h3 { margin: 8px 0 6px; font-size: 16px; }
  .end-card .shop { grid-template-columns: 1fr 1fr; gap: 6px; }
  .end-card .shop li { padding: 4px 8px; }
  .end-card .shop li button { min-height: 40px; min-width: 76px; }
  #bNext { margin-top: 18px; min-height: 44px; }
  .fin-card { padding-bottom: 10px; }
}

/* 結算卡片底部漸層：提示「往下還有」，不讓釘在底部的按鈕蓋住最後一項 */
#bNext::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 18px; margin-bottom: 10px; background: linear-gradient(rgba(255,255,255,0), #fff); pointer-events: none; }

/* ---------- 瀏海／圓角螢幕的安全邊界（橫拿的「回雜誌」、直拿最底排食材） ---------- */
.hud { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
.stage { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); padding-bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px)); }
.scr { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
@media (max-width: 700px) and (orientation: portrait) {
  .hud { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .stage { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: max(10px, calc(env(safe-area-inset-bottom) + 6px)); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .hud { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .stage { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .scr { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
/* 11/26 複審：橫拿工作檯固定高度，做好時只顯示品名，食材位置不跳 */
@media (max-height: 500px) and (orientation: landscape) {
  .slot { height: 46px; min-height: 46px; overflow: hidden; }
  .slot .pick { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
  .slot.done .pick b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
  .slot.done .pick span { display: none; }
}

@media (prefers-reduced-motion: reduce) { .host-fig img, .host-fig { animation: none !important; } .fx-layer, .host-fx { display: none; } }
html.still .host-fig img, html.still .host-fig { animation: none !important; }

/* ---------- 語言切換（中／日／EN）：固定在畫面右上、HUD 按鈕列的右邊；放在 HUD 外面，標題／說明／暫停等覆蓋畫面開著時也按得到 ---------- */
.kl-host { position: fixed; z-index: 60; top: calc((var(--hud) - 44px) / 2); right: max(14px, env(safe-area-inset-right)); }
.kl-lang { display: flex; }
.kl-lang button { min-width: 44px; min-height: 44px; padding: 0 8px; border: 2px solid #4E587A; margin-left: -2px; background: var(--night); color: #fff; font: 700 16px/1 "Noto Sans TC", sans-serif; cursor: pointer; }
.kl-lang button:first-child { margin-left: 0; }
.kl-lang button:hover { background: var(--blue); }
.kl-lang button[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: #fff; position: relative; z-index: 1; }
.kl-lang button:focus-visible { outline: 3px solid var(--rep); outline-offset: 2px; position: relative; z-index: 2; }
.hud { padding-right: calc(max(14px, env(safe-area-inset-right)) + 144px); }
@media (max-width: 700px) and (orientation: portrait) {
  .hud { padding-right: max(10px, env(safe-area-inset-right)); align-content: flex-start; padding-top: 6px; }
  .hud-time { order: 9; flex: 1 1 0; min-width: 0; flex-basis: 0; }
  .hud::after { content: ""; order: 10; flex: 0 0 134px; height: 44px; }
  .kl-host { top: 52px; right: max(10px, env(safe-area-inset-right)); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .kl-host { top: 3px; }
  .kl-lang button { min-height: 44px; }
}
/* 日文／英文比中文長：後牆菜單、罐子標籤、招牌縮字，不要超出框（SVG 文字） */
html:not([lang="zh-Hant"]) .backwall .bw-items text { font-size: 17px; }
html[lang="en"] .backwall .bw-items text { font-size: 16px; }
html:not([lang="zh-Hant"]) .backwall g[stroke-dasharray] { display: none; }
html:not([lang="zh-Hant"]) .backwall .jt { font-size: 11px; }
html[lang="en"] .backwall .bw-title { font-size: 21px; }
html[lang="en"] .backwall .bw-sign { font-size: 17px; letter-spacing: 0; }
html[lang="ja"] .backwall .bw-title { font-size: 22px; }

/* 黑板菜單：新菜單解鎖才出現 */
.backwall .m-ginger, .backwall .m-yuzu { display: none; }
.has-ginger .backwall .m-ginger, .has-yuzu .backwall .m-yuzu { display: inline; }
/* 覆蓋畫面（標題、結算、結局…）：右上語言切換固定在上面，卡片往下讓出位置，不蓋到標題字 */
@media (max-width: 700px) and (orientation: portrait) { .scr { padding-top: 100px; } }
@media (max-height: 500px) and (orientation: landscape) { .scr { padding-top: 56px; } }
