:root {
  --paper: #f3e8d2; --paper2: #fbf5e6; --ink: #2a1b12; --red: #cf3b22; --red-d: #8a2414;
  --mustard: #e2a41d; --green: #4f7a52; --line: rgba(42, 27, 18, .16);
  --edge: 16px;                 /* 操作區離螢幕左右邊緣的距離 */
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  --mono: "Courier New", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", monospace;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
@media (pointer: coarse) { :root { --edge: 28px; } }

* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; overflow: hidden; background: #1d120b; color: var(--ink); font-family: var(--font);
  overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; -webkit-user-select: none; user-select: none; }
img { -webkit-user-drag: none; pointer-events: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* 螢幕左右邊緣不收觸控，避免誤觸系統返回手勢 */
.edge-guard { display: none; position: fixed; top: 0; bottom: 0; width: 24px; z-index: 90; touch-action: none; }
.edge-guard.l { left: 0; } .edge-guard.r { right: 0; }
@media (pointer: coarse) { .edge-guard { display: block; } }

/* ---------- 按鈕 ---------- */
.btn {
  min-height: 46px; padding: 0 18px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper2);
  font-weight: 800; font-size: 15px; letter-spacing: .04em; box-shadow: 0 4px 0 var(--ink);
  transition: transform .06s, box-shadow .06s; white-space: nowrap;
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--red); color: #fff6e4; box-shadow: 0 4px 0 var(--red-d); border-color: var(--red-d); }
.btn.primary:active { box-shadow: 0 0 0 var(--red-d); }
.btn.ghost { background: transparent; box-shadow: none; border-style: dashed; font-weight: 700; }
.btn.ghost:active { transform: none; background: rgba(42, 27, 18, .08); }
.btn.big { min-height: 56px; font-size: 18px; width: 100%; }
.btn:disabled { opacity: .38; pointer-events: none; }
.btn small { font-size: 12px; font-weight: 700; opacity: .6; margin-left: 8px; }

/* ---------- 主選單 ---------- */
.screen { position: fixed; inset: 0; z-index: 40; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center;
  background-image: radial-gradient(rgba(42, 27, 18, .05) 1px, transparent 1.4px); background-size: 7px 7px; }
.gingham { position: absolute; top: 0; left: 0; right: 0; height: calc(34px + var(--sat));
  background: repeating-linear-gradient(90deg, rgba(207, 59, 34, .55) 0 17px, transparent 17px 34px), repeating-linear-gradient(0deg, rgba(207, 59, 34, .55) 0 17px, transparent 17px 34px), #fbf5e6;
  border-bottom: 3px solid var(--ink); }
.gingham.bottom { top: auto; bottom: 0; height: calc(34px + var(--sab)); border-bottom: 0; border-top: 3px solid var(--ink); }
.menu-body { width: min(100% - var(--edge) * 2 - 16px, 380px); display: flex; flex-direction: column; gap: 22px; }
.logo { position: relative; padding-top: 18px; }
.logo h1 { font-size: clamp(60px, 19vw, 92px); line-height: .98; font-weight: 900; letter-spacing: -.02em; }
.logo h1 span { display: block; font-size: .5em; color: var(--red); letter-spacing: .12em; margin-bottom: .1em; }
.logo-tag { position: absolute; top: 0; right: 0; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 800; letter-spacing: .3em; padding: 5px 6px 5px 10px; }
.seal { position: absolute; right: 2px; bottom: 4px; width: 82px; height: 82px; border-radius: 50%; border: 3px solid var(--red); color: var(--red);
  display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(12deg); font-weight: 900; font-size: 19px; line-height: 1.12;
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--red); opacity: .9; }
.seal i { font-style: normal; letter-spacing: .1em; }
.tagline { font-size: 15px; line-height: 1.7; font-weight: 600; border-left: 4px solid var(--mustard); padding-left: 12px; }
.menu-btns { display: flex; flex-direction: column; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 .btn { padding: 0 8px; font-size: 16px; }
.row2 .btn small { display: block; margin: 0; }
.row2.row3 { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.row2.row3 .btn { font-size: 15px; padding: 0 4px; }
#coach { position: fixed; z-index: 26; left: var(--edge); top: calc(62px + var(--sat)); width: min(340px, calc(100% - var(--edge) * 2)); background: #fffdf6; border: 2px solid var(--ink);
  border-left: 8px solid var(--mustard); border-radius: 10px; padding: 12px 14px; box-shadow: 0 4px 0 var(--ink); display: flex; flex-direction: column; gap: 10px; }
#coach p { font-size: 14px; line-height: 1.65; font-weight: 700; }
#coach .btn { align-self: flex-end; min-height: 38px; font-size: 14px; }
.ac { background: #e9dcc2; border: 2px dashed var(--ink); border-radius: 10px; padding: 10px 12px; opacity: .6; }
.ac b { font-size: 16px; font-weight: 900; } .ac p { font-size: 12.5px; font-weight: 600; margin-top: 3px; line-height: 1.5; }
.ac.got { background: #ffe7a6; border-style: solid; opacity: 1; box-shadow: 0 3px 0 var(--ink); }
.ac.got b::before { content: "★ "; color: var(--red); }
.receipt .achline { font-family: var(--font); font-size: 12.5px; font-weight: 800; color: var(--red); margin-bottom: 8px; text-align: center; }
.daily-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 12px; background: #ffe7a6; white-space: normal; }
.daily-btn small { margin: 0; font-size: 12px; line-height: 1.3; opacity: .75; }
.timer { pointer-events: none; font-family: var(--mono); font-size: 13px; padding: 0 12px; }
.timer.late { background: var(--red); color: #fff6e4; }
.card.taboo { background: repeating-linear-gradient(-45deg, #fbf5e6 0 10px, #f3d9c8 10px 20px); }
.card .warn { position: absolute; bottom: -7px; right: -5px; background: var(--ink); color: #ffe7a6; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 3px; transform: rotate(-6deg); }
.card.need { outline: 3px dashed var(--red); outline-offset: 2px; }
.code-row { display: flex; gap: 10px; border-top: 2px dashed var(--line); padding-top: 14px; }
.code-row input { flex: 1; min-width: 0; height: 46px; border: 2px solid var(--ink); border-radius: 12px; background: #fffdf6; padding: 0 12px; font: 700 16px var(--mono); color: var(--ink);
  -webkit-user-select: text; user-select: text; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dx { position: relative; background: var(--paper2); border: 2px solid var(--ink); border-radius: 10px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; }
.dx b { font-size: 16px; font-weight: 900; }
.dx p { font-size: 12.5px; line-height: 1.55; font-weight: 600; opacity: .82; }
.dx em { position: absolute; top: 8px; right: 10px; font: 900 14px var(--mono); font-style: normal; color: var(--green); }
.dx.bad em { color: var(--red); }
.dx.good { border-left: 8px solid var(--green); } .dx.bad { border-left: 8px solid var(--red); }
.dx-ic { display: flex; align-items: center; gap: 4px; height: 46px; }
.dx-ic img { height: 44px; width: auto; max-width: 52px; object-fit: contain; }
.dx-ic s { text-decoration: none; font-weight: 900; opacity: .5; font-size: 13px; }
.swatch.mini { width: 34px; height: 34px; border-width: 3px; display: inline-block; flex: none; }
.swatch.sauce.mini { width: 30px; height: 30px; border-width: 2px; margin: 0; }
.dchip { font-style: normal; font-size: 12px; font-weight: 800; border: 2px solid var(--ink); border-radius: 4px; padding: 2px 6px; }
.dx.lock { background: #e9dcc2; border-style: dashed; }
.dx.lock img { filter: brightness(0); opacity: .28; }
.dx.lock .swatch { background: #5a4a3c; opacity: .4; }
.dx.lock b { letter-spacing: .2em; opacity: .55; }
.nut { font-family: var(--font); border: 2px solid var(--ink); padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; font-size: 12px; font-weight: 700; }
.nut b { grid-column: 1 / -1; font-size: 13px; border-bottom: 3px solid var(--ink); padding-bottom: 3px; margin-bottom: 3px; }
.nut span { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(42, 27, 18, .25); }
.nut i { font-style: normal; font-weight: 900; }
.receipt .code { display: block; width: 100%; font: 700 12px var(--mono); padding: 8px 4px; text-align: center; border: 2px dashed rgba(42, 27, 18, .4); margin-bottom: 8px; }
.receipt .code b { font-size: 15px; letter-spacing: .08em; } .receipt .code u { color: var(--red); }
.receipt .daily { font-family: var(--font); font-size: 12px; font-weight: 800; margin-top: 8px; color: var(--red); }
.receipt .daily.ok { color: var(--green); }
.stamp.void { border-style: dashed; filter: grayscale(.3); }
.tags u { text-decoration: none; background: var(--mustard); color: var(--ink); font-size: 10px; padding: 0 4px; margin-left: 5px; border-radius: 2px; }
.cm em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--red); margin-left: 4px; }
.cm p { margin-top: 3px; }
.cm.in { animation: cmIn .4s ease-out both; animation-delay: calc(.6s + var(--i) * .45s); }
@keyframes cmIn { 0% { opacity: 0; transform: translateX(-14px) rotate(-1.5deg); } 60% { transform: translateX(4px) rotate(.6deg); } 100% { opacity: 1; transform: none; } }
.more { position: absolute; right: calc(var(--edge) + 8px); bottom: calc(46px + var(--sab)); font-size: 13px; font-weight: 800; color: var(--ink); text-decoration: none;
  padding: 8px 2px; border-bottom: 2px solid var(--ink); letter-spacing: .06em; }
.more b { margin-left: 6px; color: var(--red); }
.more.inline { position: static; align-self: flex-end; margin-top: 4px; }
@media (max-height: 700px) { .menu-body { gap: 10px; } .logo h1 { font-size: 52px; } .tagline { display: none; } .btn.big { min-height: 46px; font-size: 16px; } }

/* PC 橫式：主選單靠右，左邊留給慢慢旋轉的泡麵 */
@media (min-width: 761px) and (orientation: landscape) {
  #menu { left: auto; width: min(460px, 44vw); border-left: 3px solid var(--ink); box-shadow: -10px 0 30px rgba(0, 0, 0, .35); }
  #menu .more { position: static; align-self: flex-end; margin: 12px 40px 0 0; }
  #menu .menu-body { gap: 16px; }
  #menu .logo h1 { font-size: clamp(52px, 6.4vw, 84px); }
}

/* ---------- 遊戲 HUD ---------- */
.topbar { position: fixed; z-index: 20; top: calc(10px + var(--sat)); left: var(--edge); display: flex; gap: 10px; }
.chip-btn { height: 40px; padding: 0 14px 0 12px; display: flex; align-items: center; gap: 8px; border-radius: 20px; background: rgba(251, 245, 230, .94); border: 2px solid var(--ink);
  font-weight: 800; font-size: 14px; }
.chip-btn:active { background: var(--mustard); }
.ico-pause { width: 10px; height: 12px; border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); }
.ico-cam { width: 16px; height: 12px; border: 2px solid var(--ink); border-radius: 3px; position: relative; }
.ico-cam::after { content: ""; position: absolute; inset: 1.5px 3.5px; border: 2px solid var(--ink); border-radius: 50%; }

#panel { position: fixed; z-index: 20; right: 0; top: 0; bottom: 0; width: 400px; background: var(--paper); border-left: 3px solid var(--ink);
  display: flex; flex-direction: column; background-image: radial-gradient(rgba(42, 27, 18, .05) 1px, transparent 1.4px); background-size: 7px 7px; }
.panel-head { padding: 18px 22px 10px; }
.steps { display: flex; gap: 6px; margin-bottom: 10px; }
.steps i { font-style: normal; font: 800 12px var(--mono); padding: 3px 8px; border: 2px solid var(--ink); border-radius: 4px; opacity: .35; }
.steps i.on { opacity: 1; background: var(--ink); color: var(--paper); }
.steps i.done { opacity: .8; }
#panelTitle { font-size: 26px; font-weight: 900; letter-spacing: .02em; }
#panelNote { font-size: 13px; font-weight: 600; opacity: .7; margin-top: 3px; min-height: 1.4em; }
.grid-wrap { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 22px 14px; touch-action: pan-y; scrollbar-width: thin; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.panel-foot { display: flex; gap: 10px; padding: 12px 22px calc(16px + var(--sab)); border-top: 2px dashed var(--line); }
.panel-foot .primary { flex: 1; }

.card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; background: var(--paper2); border: 2px solid var(--ink);
  border-radius: 10px; box-shadow: 0 3px 0 var(--ink); transition: transform .06s, box-shadow .06s; min-width: 0; }
.card:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.card.sel { background: #ffe7a6; }
.card.sel::after { content: ""; position: absolute; top: -2px; right: -2px; width: 22px; height: 22px; background: var(--red); border-radius: 0 9px 0 10px;
  clip-path: polygon(0 0, 100% 0, 100% 100%); }
.card .nm { font-size: 13px; font-weight: 800; text-align: center; line-height: 1.25; }
.card .sb { font-size: 11px; font-weight: 600; opacity: .62; text-align: center; line-height: 1.25; }
.card img { width: 100%; max-width: 78px; aspect-ratio: 1; object-fit: contain; }
.card .cnt { position: absolute; top: -8px; left: -8px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; background: var(--red); color: #fff; font: 800 13px/20px var(--mono);
  border: 2px solid var(--ink); text-align: center; }
.card.off { opacity: .45; }
.card.active { outline: 4px solid var(--red); outline-offset: 2px; transform: translateY(-2px); }
.seg button { padding: 9px 10px; }
/* 前置步驟 */
.grid.prepbox { display: block; }
.prep { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.prep p { font-size: 15px; font-weight: 700; line-height: 1.6; }
.prep p b { color: var(--red); }
.prep-steps { list-style: none; padding: 0; display: flex; gap: 6px; counter-reset: ps; }
.prep-steps li { flex: 1; counter-increment: ps; font-size: 12px; font-weight: 800; text-align: center; padding: 7px 2px; border: 2px solid var(--ink); border-radius: 8px; opacity: .4; background: var(--paper2); }
.prep-steps li::before { content: counter(ps) ". "; }
.prep-steps li.on { opacity: 1; background: #ffe7a6; }
.prep-steps li.done { opacity: .85; background: var(--ink); color: var(--paper); }
#tear { -webkit-appearance: none; appearance: none; width: 100%; height: 52px; border: 2px solid var(--ink); border-radius: 26px; touch-action: none; cursor: grab;
  background: repeating-linear-gradient(90deg, var(--paper2) 0 14px, #eadfc6 14px 16px); }
#tear::-webkit-slider-thumb { -webkit-appearance: none; width: 64px; height: 44px; border-radius: 22px; background: var(--red); border: 2px solid var(--red-d); box-shadow: 0 3px 0 var(--red-d); }
#tear::-moz-range-thumb { width: 64px; height: 44px; border-radius: 22px; background: var(--red); border: 2px solid var(--red-d); }
.pour-row { display: flex; gap: 14px; align-items: stretch; }
.pour-row .btn { flex: 1; min-height: 120px; touch-action: none; }
.meter { position: relative; width: 44px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper2); overflow: hidden; flex: none; }
.meter i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(#9fd3e6, #5aa8c8); }
.meter b { position: absolute; left: 0; right: 0; bottom: 83.3%; height: 3px; background: var(--red); }
.clock { font: 900 64px/1 var(--mono); text-align: center; letter-spacing: .04em; padding: 10px 0; border: 3px solid var(--ink); border-radius: 12px; background: #1d120b; color: #ffd27a; }
.clock.over { color: #ff8a6a; }
.receipt .tex { font-family: var(--font); font-size: 12.5px; line-height: 1.55; font-weight: 600; margin-top: 8px; padding: 6px 8px; border-left: 4px solid var(--mustard); background: #fbf3dc; }
.receipt .tex b { font-weight: 900; }
.prep-res { background: var(--paper2); border: 2px dashed var(--ink); border-radius: 10px; padding: 12px 14px; }
.card img.packimg { max-width: 128px; height: 112px; aspect-ratio: auto; filter: drop-shadow(0 3px 0 rgba(42, 27, 18, .28)); }

/* 包裝示意（純 CSS） */
.pack { position: relative; width: 84px; height: 78px; display: flex; align-items: center; justify-content: center; color: var(--fg); font-weight: 900; font-size: 13px; text-align: center; line-height: 1.15; }
.pack::before { content: ""; position: absolute; inset: 0; background: var(--bg); z-index: 0; }
.pack span { position: relative; z-index: 1; padding: 0 8px; }
.pack.cup::before { clip-path: polygon(4% 8%, 96% 8%, 82% 100%, 18% 100%); border-top: 8px solid var(--ac); }
.pack.cup span { margin-top: 10px; }
.pack.bag::before { inset: 4px 2px; border-radius: 6px; border-top: 7px dashed var(--ac); border-bottom: 7px dashed var(--ac); }
.swatch { width: 58px; height: 58px; border-radius: 50%; border: 5px solid #f7f1e5; box-shadow: 0 0 0 2px var(--ink), inset 0 6px 10px rgba(0, 0, 0, .22), inset 0 -3px 6px rgba(255, 255, 255, .25);
  background: var(--c); position: relative; overflow: hidden; }
.swatch::after { content: ""; position: absolute; left: 18%; top: 14%; width: 34%; height: 16%; border-radius: 50%; background: rgba(255, 255, 255, .45); transform: rotate(-24deg); }
.swatch.sauce { width: 50px; height: 50px; margin: 4px 0; border: 2px solid var(--ink); box-shadow: inset -5px -6px 0 rgba(0, 0, 0, .16); border-radius: 58% 42% 55% 45% / 46% 56% 44% 54%; }

/* 開動列 */
#eatbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; padding: 0 var(--edge) calc(16px + var(--sab)); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.eat-btns { display: flex; gap: 10px; pointer-events: auto; flex-wrap: wrap; justify-content: center; }
.hint { font-size: 13px; font-weight: 700; color: #fbf1dc; background: rgba(29, 18, 11, .72); padding: 7px 14px; border-radius: 999px; text-align: center; }

/* 拍照 */
#photoUi { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 0 var(--edge) calc(22px + var(--sab)); display: flex; flex-direction: column; align-items: center; gap: 14px; pointer-events: none; }
.photo-btns { display: flex; align-items: center; gap: 28px; pointer-events: auto; }
.photo-spacer { width: 76px; }
.shutter { width: 72px; height: 72px; border-radius: 50%; background: #fbf5e6; border: 4px solid var(--ink); box-shadow: 0 0 0 4px #fbf5e6, 0 0 0 6px var(--ink); }
.shutter:active { background: var(--red); }
#flash { position: fixed; inset: 0; z-index: 80; background: #fff; opacity: 0; pointer-events: none; }
#flash.go { animation: flash .35s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }

/* ---------- 彈出層 ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 12, 7, .72); display: flex; align-items: center; justify-content: center;
  padding: calc(14px + var(--sat)) calc(var(--edge) + 4px) calc(14px + var(--sab)); }
.sheet { width: min(100%, 440px); max-height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 22px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 14px; touch-action: pan-y; }
.sheet.narrow { width: min(100%, 340px); }
.sheet.wide { width: min(100%, 720px); }
.sheet h2 { font-size: 24px; font-weight: 900; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.center { text-align: center; } .muted { opacity: .65; font-size: 14px; font-weight: 600; } .small { font-size: 12px; line-height: 1.6; }
.col-btns { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.x { width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: 50%; position: relative; background: var(--paper2); flex: none; }
.x::before, .x::after { content: ""; position: absolute; left: 9px; right: 9px; top: 17px; height: 3px; background: var(--ink); transform: rotate(45deg); }
.x::after { transform: rotate(-45deg); }
.sheet > * { flex: none; }
.sheet-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.sheet-btns .btn { flex: 1 1 40%; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 800; padding: 8px 0; border-bottom: 2px dashed var(--line); }
.seg { display: flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.seg button { padding: 9px 13px; font-weight: 800; font-size: 14px; background: var(--paper2); }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.on { background: var(--ink); color: var(--paper); }
.toggle { width: 56px; height: 32px; border: 2px solid var(--ink); border-radius: 16px; background: var(--paper2); position: relative; flex: none; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.toggle[aria-checked="true"] { background: var(--mustard); }
.toggle[aria-checked="true"] i { transform: translateX(24px); }

/* 評審單（收據樣式） */
.receipt-sheet { padding: 14px; background: #6b4a30; border-color: #2a1b12; }
.receipt { background: #fffdf6; color: #2a1b12; padding: 20px 18px 22px; font-family: var(--mono); font-size: 13px; line-height: 1.6; position: relative;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 51% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 14px 51% repeat-x;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 51% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 14px 51% repeat-x; }
.receipt h3 { font-family: var(--font); font-size: 21px; font-weight: 900; text-align: center; letter-spacing: .2em; margin-top: 4px; }
.receipt .no { text-align: center; font-size: 11px; opacity: .6; letter-spacing: .1em; }
.receipt hr { border: 0; border-top: 2px dashed rgba(42, 27, 18, .35); margin: 10px 0; }
.receipt .dish { font-family: var(--font); font-weight: 900; font-size: 18px; line-height: 1.35; padding-right: 96px; min-height: 76px; }
.receipt .items { font-size: 12px; opacity: .8; margin-top: 4px; padding-right: 96px; font-family: var(--font); font-weight: 600; }
.stamp { position: absolute; right: 16px; top: 78px; width: 92px; height: 92px; border-radius: 50%; border: 4px solid var(--red); color: var(--red); transform: rotate(-9deg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--font); box-shadow: inset 0 0 0 3px #fffdf6, inset 0 0 0 5px var(--red); }
.stamp b { font-size: 38px; font-weight: 900; line-height: 1; } .stamp small { font-size: 11px; font-weight: 800; letter-spacing: .2em; }
.stamp.in { animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1) both .25s; }
@keyframes stamp { from { transform: rotate(-9deg) scale(2.2); opacity: 0; } to { transform: rotate(-9deg) scale(1); opacity: 1; } }
.title-row { text-align: center; font-family: var(--font); }
.title-row small { display: block; font-size: 11px; opacity: .6; letter-spacing: .3em; }
.title-row b { font-size: 22px; font-weight: 900; color: var(--red); letter-spacing: .08em; }
.bar-row { display: grid; grid-template-columns: 4.2em 1fr 2.2em; align-items: center; gap: 8px; font-family: var(--font); font-weight: 800; font-size: 13px; margin: 5px 0; }
.bar { height: 10px; border: 2px solid var(--ink); border-radius: 2px; background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(42, 27, 18, .12) 9px 10px); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); width: var(--v); }
.bar.warn i { background: var(--red); }
.bar-row span:last-child { text-align: right; font-family: var(--mono); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; font-family: var(--font); }
.tags i { font-style: normal; font-size: 12px; font-weight: 800; padding: 2px 8px; border: 2px solid var(--green); color: var(--green); border-radius: 4px; }
.tags i.bad { border-color: var(--red); color: var(--red); }
.cm { font-family: var(--font); font-size: 14px; line-height: 1.65; margin: 9px 0; }
.cm small { display: block; font-size: 11px; font-weight: 700; opacity: .6; margin: 2px 0 1px; }
.receipt .foot { font-family: var(--font); font-size: 11px; line-height: 1.6; opacity: .6; text-align: center; }
.cm b { display: inline-block; font-size: 11px; background: var(--ink); color: #fffdf6; padding: 1px 7px; margin-right: 6px; letter-spacing: .08em; vertical-align: 2px; }

/* 收藏櫃 */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0 10px; min-height: 120px; }
.jar { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 4px 10px; border-bottom: 10px solid #7a5232; box-shadow: 0 3px 0 #3d2616; margin-bottom: 14px; }
.jar .lid { width: 66px; height: 66px; border-radius: 50%; background: var(--c); border: 6px solid #f7f1e5; box-shadow: 0 0 0 2px var(--ink), inset 0 5px 9px rgba(0, 0, 0, .25);
  display: flex; align-items: center; justify-content: center; font: 900 22px var(--mono); color: #fff; text-shadow: 0 1px 0 #000, 0 0 5px rgba(0, 0, 0, .7); }
.jar .nm { font-size: 12px; font-weight: 800; text-align: center; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.jar:active .lid { transform: scale(.94); }
.empty { grid-column: 1 / -1; text-align: center; padding: 34px 10px; font-weight: 700; opacity: .6; line-height: 1.8; }

#toast { position: fixed; z-index: 95; left: 50%; top: calc(62px + var(--sat)); transform: translate(-50%, -20px); background: var(--ink); color: var(--paper); font-weight: 800; font-size: 14px;
  padding: 9px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - var(--edge) * 2 - 20px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 手機直式：獨立版面，面板在下方，所有操作內縮避開邊緣 ---------- */
@media (max-width: 760px), (orientation: portrait) {
  #panel { left: 0; top: auto; width: auto; height: min(47dvh, 400px); border-left: 0; border-top: 3px solid var(--ink); border-radius: 18px 18px 0 0; }
  .panel-head { padding: 12px calc(var(--edge) + 2px) 6px; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 10px; }
  .steps { grid-column: 1 / -1; margin-bottom: 6px; }
  .steps { gap: 4px; }
  .steps i { white-space: nowrap; font-size: 11px; padding: 3px 5px; border-width: 1.5px; }
  #panelTitle { font-size: 21px; }
  #panelNote { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .grid-wrap { padding: 8px calc(var(--edge) + 2px) 12px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 9px 8px; }
  .grid.two { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 8px 3px 6px; gap: 4px; }
  .card .nm { font-size: 12px; } .card .sb { display: none; }
  .grid.two .card .sb { display: block; }
  .swatch { width: 46px; height: 46px; border-width: 4px; } .swatch.sauce { width: 40px; height: 40px; }
  .card img.packimg { height: 92px; }
  .panel-foot { padding: 10px calc(var(--edge) + 2px) calc(12px + var(--sab)); gap: 8px; }
  .panel-foot .btn { padding: 0 12px; font-size: 14px; }
  .eat-btns .btn { padding: 0 13px; font-size: 14px; }
}
