/* ==================================================================
   吃完振作肉桂捲介面
   ================================================================== */

:root {
  --bg:        #fbf5ec;
  --bg-warm:   #f4e9da;
  --panel:     #ffffff;
  --ink:       #3b2a1c;
  --ink-soft:  #7c6754;
  --muted:     #a08c78;
  --line:      #ecdcc8;
  --line-soft: #f5ebdd;
  --accent:    #c2661f;
  --accent-dk: #9c4f14;
  --accent-bg: #fdf0e2;
  --ok:        #2f8f5b;
  --danger:    #c0392b;
  --shadow-sm: 0 1px 2px rgba(90, 60, 30, .08), 0 2px 6px rgba(90, 60, 30, .06);
  --shadow-md: 0 4px 14px rgba(90, 60, 30, .12);
  --shadow-lg: 0 18px 40px rgba(90, 60, 30, .22);
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%,  rgba(255, 255, 255, .9), transparent 45%),
    radial-gradient(circle at 88% 4%,  rgba(244, 233, 218, .8), transparent 40%);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang TC",
               "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  padding-bottom: 190px;                  /* 讓出底部結帳列 */
  -webkit-text-size-adjust: 100%;
}

body.is-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: .01em; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── 頂部 ─────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px clamp(14px, 3vw, 32px);
  background: rgba(255, 253, 249, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 22px;
  background: var(--accent-bg);
  border: 1px solid var(--line);
  border-radius: 50%;
}
/* 真的 logo 圖是去背的線稿，不要圓框也不要底色，直接放在頁首上 */
img.brand-mark {
  object-fit: contain;
  background: none;
  border: 0;
  border-radius: 0;
}

.topbar h1 { font-size: 19px; }
.brand-sub { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ── 最新消息 ─────────────────────────────────── */
/**
 * 排在頁首「下面」，不在頁首裡面 —— 頁首是釘住的，消息放進去就會一直佔著
 * 畫面上方（手機更嚴重）。放外面的話往下捲就收走了，
 * 所以也不用再限制行數，內容多長就顯示多長。
 *
 * 左右對齊下面的面板：寬度扣掉跟 .layout 一樣的內距再置中。
 */
.topbar-news {
  box-sizing: border-box;
  width: calc(100% - 2 * clamp(14px, 2.4vw, 26px));
  max-width: calc(1400px - 2 * 26px);
  margin: clamp(12px, 1.8vw, 18px) auto 0;
  padding: 9px 14px;
  border: 1.5px solid var(--accent);
  border-left-width: 4px;
  border-radius: var(--r-sm);
  background: var(--accent-bg);
}
.news-title {
  display: block;
  font-size: 11.5px; font-weight: 700;
  color: var(--accent-dk);
  letter-spacing: .04em;
}
.news-text {
  margin: 2px 0 0;
  font-size: 13px; line-height: 1.55;
}

.topbar-total { text-align: right; line-height: 1.25; }
.topbar-total .label { display: block; font-size: 11.5px; color: var(--muted); }
.topbar-total .money { font-size: 20px; color: var(--accent-dk); }

/* ── 迷你盒子列 ───────────────────────────────── */
/**
 * 手機專用。桌機的盒子就在右邊看得到，多這一列只是佔空間，所以直接不顯示
 * （不用 [hidden] 屬性 —— 之後有人加了 display 就會蓋掉它，用 media query 比較保險）。
 * 真正的樣式在最下面的響應式區塊裡。
 */
.minibox { display: none; }

/* ── 版面 ─────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: start;
  padding: clamp(14px, 2.4vw, 26px);
  max-width: 1400px;
  margin: 0 auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(14px, 2vw, 20px);
}

.col-right {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2vw, 24px);
  min-width: 0;
}

/* 頁首高度是量出來的（order.js 寫進 --topbar-h），寫死的話字級一改就對不上 */
.panel-flavors { position: sticky; top: calc(var(--topbar-h, 76px) + 8px); }

.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 4px;
}
.panel-head h2 { font-size: 16px; }
.panel-head .count { font-size: 12.5px; color: var(--muted); }
.panel-hint { margin: 2px 0 14px; font-size: 12.5px; color: var(--muted); }

/* ── 口味卡 ───────────────────────────────────── */
.flavor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
}

.flavor {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 9px;
  background: linear-gradient(180deg, #fff, #fffaf2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: grab;
  text-align: center;
  /* 觸控不拖曳，所以這裡不能擋捲動；manipulation 只是順便拿掉點兩下放大的延遲 */
  touch-action: manipulation;
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.flavor:hover  { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #dcc4a4; }
.flavor:active { cursor: grabbing; }
.flavor:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.flavor.is-source { opacity: .4; }

.flavor img {
  width: 76px; height: 76px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(120, 80, 40, .2));
}

/* 還沒上傳照片的品項：用色塊頂著，不要出現破圖 */
.nophoto {
  display: grid; place-items: center;
  background: var(--accent-bg);
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--accent-dk);
  font-weight: 700;
  letter-spacing: .5px;
  pointer-events: none;
  overflow: hidden;
}
.flavor .nophoto { width: 76px; height: 76px; font-size: 20px; }
.slot   .nophoto { width: 100%; height: 100%; font-size: 22px; }

.flavor-name  { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
/* 品名的英文自成一行（切在哪由 order.js 的 splitName 決定，不是靠瀏覽器折行） */
.flavor-en {
  display: block;
  font-size: 10.5px; font-weight: 600;
  color: var(--muted);
  line-height: 1.25;
  letter-spacing: .02em;
}
.flavor-desc  { font-size: 11px; color: var(--muted); line-height: 1.35;
                display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
                overflow: hidden; }
.flavor-price { font-size: 13px; font-weight: 700; color: var(--accent-dk); }

/*
 * 有設限量的口味，卡片左上角標「剩 3」。
 * 線上訂購頁賣完的口味根本不會出現（index.php 濾掉了），所以「已售完」這個
 * 狀態實際上只有現場點單看得到 —— 那邊不擋庫存，靠店家看這個數字判斷。
 */
.flavor-stock {
  position: absolute; top: 6px; left: 6px;
  padding: 2px 7px;
  font-size: 11px; font-weight: 700; line-height: 1.5;
  color: var(--accent-dk);
  background: var(--accent-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.flavor-stock.is-out { color: #fff; background: #b04a3a; border-color: #b04a3a; }

/* 加購卡片版的同一顆標記 —— 排在品名旁邊，不像口味卡那樣疊在圖上 */
.addon-stock {
  display: inline-block; margin-left: 8px; padding: 2px 7px;
  font-size: 11px; font-weight: 700; line-height: 1.5;
  vertical-align: 2px;
  color: var(--accent-dk);
  background: var(--accent-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.addon-stock.is-out { color: #fff; background: #b04a3a; border-color: #b04a3a; }
/* 賣完的（只有現場看得到）整張卡片壓暗，但還是點得下去 —— 現場不擋庫存 */
.flavor.is-out { opacity: .55; }

.flavor-quick {
  position: absolute; top: 5px; right: 5px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  font-size: 21px; line-height: 1; font-weight: 700;
  color: var(--accent-dk);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  box-shadow: 0 1px 3px rgba(120, 80, 40, .16);
  transition: opacity .14s, background .14s, transform .1s;
}
.flavor:hover .flavor-quick,
.flavor-quick:focus-visible { opacity: 1; }
.flavor-quick:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.flavor-quick:active { transform: scale(.9); }

/* ── 盒子 ─────────────────────────────────────── */
.box-list { display: flex; flex-direction: column; gap: 14px; }

.box {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #fffdf9, #fdf7ee);
  padding: 12px 14px 14px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.box.is-full   { border-color: #bfe0cc; background: linear-gradient(180deg, #fcfffd, #f3fbf6); }
.box.is-over   { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194, 102, 31, .14); }
.box.is-reject { animation: shake .35s; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.box-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 11px; flex-wrap: wrap;
}
.box-title { font-size: 14.5px; font-weight: 700; }

.box-progress {
  font-size: 12px; font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.box.is-full .box-progress { background: #dff2e6; color: var(--ok); }

.box-spacer { flex: 1 1 auto; }
.box-sub { font-size: 13px; font-weight: 700; color: var(--accent-dk); }

.box-tool {
  background: none; border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: var(--r-sm);
  font-size: 12px; padding: 3px 9px; cursor: pointer;
  transition: .14s;
}
.box-tool:hover { background: #fff0e6; color: var(--accent-dk); border-color: #e3c4a5; }
.box-tool.danger:hover { background: #fdecea; color: var(--danger); border-color: #f0c2bc; }
.box-tool:disabled { opacity: .35; cursor: not-allowed; }

.slots {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
}

.slot {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  padding: 0;
  background: rgba(255, 255, 255, .55);
  border: 2px dashed #e0cdb4;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  color: #cbb69c;
  transition: border-color .14s, background .14s, transform .14s, box-shadow .14s;
}
.slot:hover { border-color: #cfae86; background: #fffaf2; }
.slot:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.slot.is-empty::after { content: '＋'; font-size: 20px; line-height: 1; }

.slot.is-filled {
  border: 1px solid transparent;
  background: transparent;
  cursor: grab;
  touch-action: manipulation;
}
.slot.is-filled:hover { transform: translateY(-2px); }

.slot.is-target {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-bg);
  transform: scale(1.07);
  box-shadow: 0 0 0 4px rgba(194, 102, 31, .16);
}
.slot.is-source { opacity: .35; }

.slot img {
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(120, 80, 40, .22));
}

.slot .remove {
  position: absolute; top: -4px; right: -4px;
  width: 21px; height: 21px;
  display: grid; place-items: center;
  font-size: 12px; line-height: 1;
  color: #fff; background: var(--danger);
  border: 2px solid #fff; border-radius: 50%;
  cursor: pointer; opacity: 0;
  transition: opacity .14s, transform .14s;
}
.slot.is-filled:hover .remove,
.slot .remove:focus-visible { opacity: 1; }
.slot .remove:hover { transform: scale(1.14); }

@keyframes pop {
  0%   { transform: scale(.3) rotate(-25deg); opacity: 0; }
  60%  { transform: scale(1.14) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.slot.just-added img { animation: pop .34s cubic-bezier(.2, 1.4, .5, 1); }

/* ── 新增盒子 ─────────────────────────────────── */
.add-box-wrap {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-top: 14px;
}
.add-box-hint { font-size: 12.5px; color: var(--muted); }

/* ── 訂購資料表單 ─────────────────────────────── */
.req { color: var(--danger); font-weight: 700; }
.opt { color: var(--muted); font-weight: 400; font-size: 11.5px; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-top: 12px;
}
.field-wide { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
/* 上面那行的 display 會蓋掉瀏覽器內建的 [hidden]{display:none}，
   沒有這一行的話 el.hidden = true 設了也沒用，欄位照樣看得見、也填得下去 */
.field[hidden] { display: none; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }

.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  width: 100%;
  transition: border-color .14s, box-shadow .14s;
}
.field textarea { resize: vertical; min-height: 54px; line-height: 1.5; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194, 102, 31, .15);
}
.field input::placeholder,
.field textarea::placeholder { color: #c9b7a3; }

.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--danger); background: #fffafa; }
.field.has-error > label { color: var(--danger); }

.field-error { margin: 0; font-size: 11.5px; color: var(--danger); min-height: 0; }
.field-error:empty { display: none; }

.field-hint { margin: 0; font-size: 11.5px; color: var(--muted); }
.field-hint:empty { display: none; }

/* 付款方式 */
.pay-options { display: flex; gap: 10px; flex-wrap: wrap; }

.pay-opt {
  /* wrap 是給取貨方式用的：運費與免運提示會換到名稱底下各自一行 */
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 15px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: #fffdfa;
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  transition: .14s;
  flex: 1 1 160px;
}
.pay-opt:hover { border-color: #dcbc96; background: var(--accent-bg); }
.pay-opt input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.pay-opt.is-on { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 3px rgba(194, 102, 31, .12); }
.pay-opt:focus-within { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ── LINE 加好友 ──────────────────────────────── */
.line-link {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 11px;
  border: 1.5px solid #bfe6cd;
  border-radius: var(--r-sm);
  background: #f2fbf5;
  color: #046134;
  font-size: 14px; font-weight: 700;
  text-decoration: none;
  transition: .14s;
}
.line-link:hover { border-color: #06C755; background: #e6f8ed; }
.line-link:focus-visible { outline: 2.5px solid #06C755; outline-offset: 2px; }
.line-icon { width: 26px; height: 26px; flex: none; display: block; }
.line-arrow { color: var(--muted); font-weight: 400; font-size: 12px; }

/* Instagram：外框跟 LINE 那顆一樣，只換成 IG 的紫紅色系 */
.ig-link {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 11px;
  border: 1.5px solid #efc9dd;
  border-radius: var(--r-sm);
  background: #fdf3f8;
  color: #a3246a;
  font-size: 14px; font-weight: 700;
  text-decoration: none;
  transition: .14s;
}
.ig-link:hover { border-color: #D62976; background: #fbe9f2; }
.ig-link:focus-visible { outline: 2.5px solid #D62976; outline-offset: 2px; }
.ig-icon { width: 26px; height: 26px; flex: none; display: block; }

/* 兩顆並排；窄的時候自己換行 */
.line-link, .ig-link { margin-right: 10px; }
.line-link + .ig-link { margin-top: 0; }
.shop-info + .ig-link { margin-top: 18px; }

/* ── 口味一覽（伺服器直接輸出的文字版，給人也給搜尋引擎看）──── */

/*
 * 預設是收起來的（<details> 沒有 open 屬性）。
 * 內容照樣在 HTML 裡，搜尋引擎讀得到 —— 收的只是畫面。
 */
.panel-menu > summary.menu-head {
  cursor: pointer; margin-bottom: 0;
  list-style: none;                     /* Firefox 的三角形 */
  padding: 4px 0;
}
.panel-menu > summary.menu-head::-webkit-details-marker { display: none; }
.panel-menu > summary.menu-head:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px;
}
.panel-menu > summary .count { margin-left: auto; }
.panel-menu[open] > summary.menu-head { margin-bottom: 4px; }
.panel-menu[open] > summary .addon-caret { transform: rotate(-135deg) translate(-3px, -2px); }

/* 收起來時整區只剩一行標題，上下留白跟著縮 */
.panel-menu:not([open]) { padding-top: 10px; padding-bottom: 10px; }

.menu-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.menu-item:first-child { border-top: 0; }
.menu-img {
  width: 56px; height: 56px; flex: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(120, 80, 40, .18));
}
.menu-text { flex: 1 1 auto; min-width: 0; }
.menu-name { font-size: 14px; line-height: 1.35; }
.menu-en {
  display: block;
  font-size: 10.5px; font-weight: 600;
  color: var(--muted); letter-spacing: .02em;
}
.menu-desc { margin: 2px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.menu-price {
  flex: none; font-weight: 700; font-size: 14px;
  color: var(--accent-dk);
  font-variant-numeric: tabular-nums;
}

/* ── 店家說明 ─────────────────────────────────── */
/* 店面照片：一排放得下就並排，放不下自動換行；只有一張時整排橫幅 */
.shop-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.shop-photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}
.shop-photos.is-single { grid-template-columns: 1fr; }
.shop-photos.is-single img { aspect-ratio: 16 / 9; }

.shop-info { font-size: 14px; line-height: 1.85; }
.shop-info p { margin: 0 0 14px; }
.shop-info p:last-child { margin-bottom: 0; }

/* 說明文字底下的 LINE 按鈕，跟內文拉開一點距離 */
.shop-info + .line-link { margin-top: 18px; }

/* ── 加購（自成一區，每種規格各自填數量）─────────── */

/*
 * 收合（只有現場點單會掛上 .is-collapsible）。
 *
 * 收起來的是內容，不是整個 section —— #addonOptions-<id> 那些容器要一直留在
 * DOM 裡，order.js 開頁時就把事件委派綁在上面，容器沒了展開後就按不動。
 * 也刻意不用 [hidden]：.addon-list 自己有 display:flex，會蓋掉瀏覽器內建的
 * [hidden]{display:none}（這個坑 README 記過），所以走 class。
 */
.addon-head { display: block; margin: 0; }   /* 這顆 h2 兼作 .panel-head，清掉預設邊距 */

.addon-toggle {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%; padding: 4px 0;               /* 現場多半用手機／平板，把可按範圍撐開一點 */
  border: 0; background: none; font: inherit; color: inherit;
  text-align: left; cursor: pointer;
}
.addon-toggle-title { font-size: 16px; font-weight: 700; }
.addon-toggle .count { margin-left: auto; }
.addon-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* 已經點了東西就把那行字點亮，收著的時候才看得出來有內容 */
.addon-toggle .count.is-on { color: var(--accent); font-weight: 700; }

/* 箭頭：收著朝下（可以展開），展開朝上 */
.addon-caret {
  flex: 0 0 auto; width: 9px; height: 9px; margin-left: 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -3px);
  transition: transform .15s ease;
}
.panel-addons.is-collapsible:not(.is-collapsed) .addon-caret {
  transform: rotate(-135deg) translate(-3px, -2px);
}

.panel-addons.is-collapsed .panel-hint,
.panel-addons.is-collapsed .addon-list { display: none; }

/* 收著時整個 section 只剩一條標題，上下留白跟著縮，才不會是一塊空盒子 */
.panel-addons.is-collapsed { padding-top: 10px; padding-bottom: 10px; }
.panel-addons.is-collapsed .panel-head { margin-bottom: 0; }

.addon-list { display: flex; flex-direction: column; gap: 16px; }

/* 兩種以上加購商品時，中間拉一條線，看得出是不同的商品 */
.addon-card + .addon-card { padding-top: 16px; border-top: 1px solid var(--line); }

.addon-name { font-size: 14.5px; margin: 0 0 2px; }
.addon-desc { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.addon-row { display: flex; align-items: flex-start; gap: 14px; }
.addon-row .addon-options { flex: 1 1 auto; }

.addon-options { display: flex; flex-direction: column; gap: 8px; }

.addon-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: #fffdfa;
  font-size: 14px;
  transition: .14s;
}
.addon-item.is-on { border-color: var(--accent); background: var(--accent-bg); }
.addon-item-name  { font-weight: 700; }
.addon-item-price { color: var(--muted); font-size: 12.5px; }
.addon-item-sub {
  margin-left: auto;
  min-width: 64px; text-align: right;
  font-weight: 700; color: var(--accent-dk);
  font-variant-numeric: tabular-nums;
}

.qty { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.addon-item-sub + .qty { margin-left: 0; }
.qty-btn {
  width: 32px; height: 32px; flex: none;
  font: inherit; font-size: 16px; line-height: 1;
  color: var(--accent-dk);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}
.qty-btn:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.qty-input {
  width: 54px; flex: none;
  text-align: center;
  font: inherit; font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 6px 2px !important;
}

@media (max-width: 520px) {
  .addon-item { flex-wrap: wrap; }
  .addon-item-sub { min-width: 0; }
}
/* 加購自成一區、橫向空間夠，圖放得比左邊的口味卡大一些 */
.addon-img {
  width: 132px; height: 132px; flex: none;
  object-fit: contain;
  filter: drop-shadow(0 4px 7px rgba(120, 80, 40, .22));
}
@media (max-width: 520px) {
  .addon-row { flex-direction: column; align-items: stretch; }
  .addon-img { align-self: center; width: 118px; height: 118px; }
}

/* ── 取貨方式 ─────────────────────────────────── */
/* 已達免運門檻：提示改成綠字，讓人一眼看到省下來了 */
.pay-opt.is-free .ship-lock { color: var(--ok); font-weight: 700; }
.checkout .line.is-free .money { color: var(--ok); }

.pay-opt.is-locked {
  opacity: .55;
  cursor: not-allowed;
  background: #f7f2ea;
  border-style: dashed;
}
.pay-opt.is-locked:hover { border-color: var(--line); background: #f7f2ea; }
.pay-opt.is-locked input { cursor: not-allowed; }

/**
 * 運費與提示各自獨立一行，排在取貨方式名稱底下。
 *
 * .pay-opt 是 flex，所以這兩個要 flex: 0 0 100% 才會換行；左邊留 24px
 * （radio 16px ＋ gap 8px）跟名稱對齊，不然會頂到圓鈕正下方看起來歪掉。
 */
.ship-fee,
.ship-lock {
  flex: 0 0 100%;
  margin-left: 24px;
  font-size: 11.5px; font-weight: 600; font-style: normal;
  line-height: 1.3;
}
.ship-fee { color: var(--ink-soft); }
.ship-lock { color: var(--danger); }
.ship-lock:empty { display: none; }
/* 專案裡踩過好幾次的坑：有自己 display 的元素會蓋掉瀏覽器內建的 [hidden] */
.ship-fee[hidden] { display: none; }
/* 已經滿額免運：牌價劃掉，讓客人看得到省下多少，而不是整行消失 */
.pay-opt.is-free .ship-fee { text-decoration: line-through; color: var(--muted); }

.ship-note {
  margin: 8px 0 0;
  font-size: 12.5px; line-height: 1.6;
  color: var(--ink-soft);
  background: var(--accent-bg);
  border-radius: var(--r-sm);
  padding: 8px 11px;
}
.ship-note[hidden] { display: none; }

.pay-detail {
  margin-top: 10px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--bg-warm);
  display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap;
}
.pay-detail[hidden] { display: none; }
.pay-detail img {
  width: 148px; height: 148px;
  border-radius: var(--r-sm);
  background: #fff;
  border: 1px solid var(--line);
}
.pay-detail .pay-info { flex: 1 1 200px; min-width: 0; font-size: 13px; }
.pay-detail .pay-info h4 { margin: 0 0 6px; font-size: 13.5px; }
.pay-detail dl { margin: 0 0 8px; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; }
.pay-detail dt { color: var(--muted); font-size: 12.5px; }
.pay-detail dd {
  margin: 0; font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
  word-break: break-all;
}
.pay-detail .pay-note { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }

.copy-btn {
  font: inherit; font-size: 12px; font-weight: 700;
  color: var(--accent-dk);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 4px 10px; margin-top: 4px; cursor: pointer;
  transition: .14s;
}
.copy-btn:hover { background: var(--accent-bg); border-color: var(--accent); }

/* ── 按鈕 ─────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 700;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 9px 18px;
  transition: transform .12s, background .14s, box-shadow .14s, opacity .14s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.btn-add {
  background: #fff; color: var(--accent-dk);
  border: 1.5px dashed #dcbc96;
}
.btn-add:hover:not(:disabled) { background: var(--accent-bg); border-color: var(--accent); }

.btn-submit {
  background: linear-gradient(180deg, #d0742a, var(--accent-dk));
  color: #fff;
  box-shadow: 0 4px 12px rgba(156, 79, 20, .3);
  padding: 12px 30px;
  font-size: 15.5px;
}
.btn-submit:hover:not(:disabled) { box-shadow: 0 6px 18px rgba(156, 79, 20, .38); }

.btn-ghost {
  background: #fff; color: var(--ink-soft); border-color: var(--line);
}
.btn-ghost:hover { background: var(--bg-warm); }

/* ── 底部結帳列 ───────────────────────────────── */
.checkout {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 25;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding: 12px clamp(14px, 3vw, 32px) calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 249, .94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 22px rgba(90, 60, 30, .08);
}

.checkout-lines { min-width: 240px; flex: 1 1 260px; max-width: 420px; }
.checkout .line {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 13px; color: var(--ink-soft);
  padding: 1px 0;
}
/**
 * 上面那個 display 會蓋掉瀏覽器內建的 [hidden]{display:none}，所以要自己補
 * ——「加購」「運費」這兩行平常是 hidden 的，只有真的有加購／有運費才顯示。
 *
 * 沒有這一行的話：加了一杯咖啡再把它刪掉，那一行不會消失，而且裡面的字
 * 還停在「義式咖啡 美式×1」（groups 空的時候 JS 不會去更新它的文字），
 * 看起來就像刪不掉。金額是對的，錯的只有這行沒有隱藏起來。
 */
.checkout .line[hidden] { display: none; }
.checkout .line em { font-style: normal; font-weight: 700; color: var(--ink); }
.checkout .line-total {
  margin-top: 5px; padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: 15px; font-weight: 700; color: var(--ink);
}
.money-lg { font-size: 25px; color: var(--accent-dk); line-height: 1.15; }

@keyframes bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.13); }
  100% { transform: scale(1); }
}
.money.is-bump { animation: bump .3s ease-out; }

.checkout-action { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.submit-hint { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 230px; }

/**
 * 送不出去的時候，這一行字是「為什麼按鈕是灰的」唯一的解釋。
 * 用預設的 12.5px 小灰字，客人只會看到一顆按不下去的按鈕，然後離開 ——
 * 所以擋住的時候放大、加粗、套上強調色的框，讓它跟按鈕一樣顯眼。
 */
.submit-hint.is-blocked {
  max-width: 280px;
  padding: 7px 11px;
  border: 1.5px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-bg);
  color: var(--accent-dk);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

/* 金額變動的浮動提示 */
.delta {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  animation: floatUp .95s ease-out forwards;
}
.delta.up   { color: var(--ok); }
.delta.down { color: var(--danger); }
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 4px) scale(.85); }
  18%  { opacity: 1; transform: translate(-50%, -6px) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -42px) scale(1); }
}

/* ── 拖曳分身 ─────────────────────────────────── */
#ghostLayer { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.ghost {
  position: fixed;
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(90, 60, 30, .4));
  transform: scale(1.1) rotate(-6deg);
}
.ghost.nophoto { font-size: 24px; background: var(--panel); }

/* ── Toast ────────────────────────────────────── */
#toastLayer {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  top: 78px; z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 9px 17px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s ease-out, toastOut .3s ease-in 1.7s forwards;
}
.toast.warn { background: var(--danger); }
.toast.good { background: var(--ok); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-12px); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(-12px); } }

/* ── 收據 ─────────────────────────────────────── */
.receipt {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  max-width: 460px; width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  font-family: inherit;
}
.receipt::backdrop { background: rgba(60, 40, 20, .45); backdrop-filter: blur(2px); }
.receipt h3 { font-size: 17px; margin-bottom: 12px; }
.receipt-box { border-top: 1px dashed var(--line); padding: 9px 0; }
.receipt-box h4 { margin: 0 0 4px; font-size: 13.5px; }
.receipt-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; color: var(--ink-soft); padding: 1px 0;
}
.receipt-total {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 2px solid var(--line); margin-top: 10px; padding-top: 10px;
  font-weight: 700;
}
.receipt-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.receipt-who {
  background: var(--bg-warm);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.receipt-who .receipt-row { color: var(--ink); }
.receipt-who .receipt-row span:first-child { color: var(--muted); }

.receipt-pay {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap;
}
.receipt-pay img { width: 120px; height: 120px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.receipt-pay .pay-info { flex: 1 1 180px; min-width: 0; font-size: 13px; }
/* 轉帳末三碼那一行：獨佔一行，跟 QR 與帳號資訊分開 */
.receipt-note { flex: 1 1 100%; margin: 0; font-size: 13px; font-weight: 700; color: var(--accent-dk); }

.receipt-msg {
  margin: 14px 0 0; padding: 11px 13px;
  border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.6;
}
.receipt-msg[hidden] { display: none; }
.receipt-msg.ok   { background: #e9f7ef; color: #1e6b42; border: 1px solid #bfe0cc; }
.receipt-msg.bad  { background: #fdecea; color: #9c2b1f; border: 1px solid #f0c2bc; }
.receipt-msg.info { background: var(--bg-warm); color: var(--ink-soft); border: 1px solid var(--line); }
.receipt-msg strong { font-size: 15px; letter-spacing: .04em; }

.btn.is-busy { position: relative; color: transparent; pointer-events: none; }
.btn.is-busy::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 響應式 ───────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .panel-flavors { position: static; }
  .flavor-grid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .flavor img,
  .flavor .nophoto { width: 62px; height: 62px; }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /**
   * 手機上只有「頁首（店名＋目前金額）」與底下那條迷你盒子列是釘住的，
   * 兩條都很矮。最新消息與結帳列都跟著頁面捲：
   * 消息看過就收走，結帳明細與送出鍵放在頁面最下面，填完往下拉就按得到。
   * 這樣中間留給選口味的高度才夠。
   */
  .checkout {
    position: static;
    margin-top: clamp(14px, 2.4vw, 26px);
    backdrop-filter: none;
    box-shadow: none;
  }
  /* 不再有浮在上面的結帳列，就不用留那塊空白 */
  body { padding-bottom: 0; }
  /**
   * 結帳列改成排在頁面最後面之後，「店家資訊」會卡在訂購資料與送出鍵中間 ——
   * 填完資料還要滑過一整區店面照片才按得到送出。把它移到訂購資料前面，
   * 讓「填表 → 送出」黏在一起。（桌機不動，那邊送出鍵本來就浮在下面。）
   */
  .panel-customer { order: 1; }
  /* 提示訊息落在頁首與迷你盒子列下面，不要蓋住它們 */
  #toastLayer { top: calc(var(--topbar-h, 60px) + 58px); }

  /**
   * 迷你盒子列 —— 貼在釘住的頁首正下方，所以它也必須夠小。
   * 一列 6 個小圈圈示意目前這一盒，左邊標幾分之幾；點有東西的圈圈就移除。
   *
   * 用 sticky（不是 fixed）：捲到最上面時它就是版面裡的一列，不會蓋住內容；
   * 往下捲才黏在頁首下面。頂端要讓開頁首，高度由 order.js 量出來寫進 --topbar-h。
   */
  .minibox {
    position: sticky;
    top: var(--topbar-h, 60px);
    z-index: 28;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px clamp(10px, 3vw, 18px);
    background: rgba(255, 253, 249, .93);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 3px 12px rgba(90, 60, 30, .07);
    transition: opacity .18s;
  }

  /**
   * 真正的大盒子捲進畫面時就功成身退，免得上下各一份。
   * 用 visibility 藏、不要用 display —— 它在版面裡佔的那一列要留著，
   * 不然藏起來的瞬間下面的內容會整個往上跳一格。
   */
  .minibox.is-idle {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .minibox-label {
    flex: none;
    font-size: 12px; font-weight: 700;
    color: var(--accent-dk);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  /* 圈圈跟著寬度縮，窄螢幕也塞得下六個 */
  .minibox-slots {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 270px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }

  .mini-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    max-width: 38px;
    display: grid; place-items: center;
    padding: 0;
    border-radius: 50%;
    font: inherit;
  }
  .mini-slot.is-empty {
    background: rgba(255, 255, 255, .55);
    border: 1.5px dashed #e0cdb4;
  }
  .mini-slot.is-filled {
    background: none;
    border: 0;
    cursor: pointer;
    touch-action: manipulation;
  }
  .mini-slot img {
    width: 100%; height: 100%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(120, 80, 40, .25));
  }
  .mini-slot .nophoto {
    width: 100%; height: 100%;
    font-size: 10px; line-height: 1.1;
    border-radius: 50%;
    overflow: hidden;
  }
  .mini-slot:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
  .mini-slot.just-added img { animation: pop .34s cubic-bezier(.2, 1.4, .5, 1); }

  /* 小小的 ✕：手機沒有 hover，不畫出來就沒人知道點下去會刪掉 */
  .mini-x {
    position: absolute; top: -3px; right: -3px;
    width: 15px; height: 15px;
    display: grid; place-items: center;
    font-size: 9px; line-height: 1;
    color: #fff; background: var(--danger);
    border: 1.5px solid #fff; border-radius: 50%;
    pointer-events: none;          /* 點到 ✕ 也算點到格子本身 */
  }
}

@media (max-width: 900px) {
  /* 手機的消息框收窄一點，字也小一級 */
  .topbar-news { padding: 7px 11px; }
  .news-text { font-size: 12.5px; }
}


/* ── 爆單公告 ─────────────────────────────────
   後台勾了「爆單」之後，線上訂購頁的下單介面整個不輸出，只剩這一塊。
   它要取代的是一整頁的介面，所以刻意做得大、置中、一眼看完就懂，
   不是頁首那種掃過去的小條（.topbar-news）。 */
.busy-note {
  box-sizing: border-box;
  width: calc(100% - 2 * clamp(14px, 2.4vw, 26px));
  max-width: 720px;
  margin: clamp(18px, 3vw, 34px) auto 0;
  padding: clamp(20px, 3.4vw, 30px) clamp(18px, 3vw, 28px);
  border: 2px solid var(--accent);
  border-radius: var(--r-lg);
  background: var(--accent-bg);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.busy-title {
  display: block;
  color: var(--accent-dk);
  font-size: clamp(22px, 4.4vw, 30px);
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1.3;
}
.busy-text {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: clamp(15px, 2.2vw, 17px);
  line-height: 1.75;
}

/* 爆單時沒有底部結帳列，那 190px 的讓位就變成一大片空白 */
body.is-busy { padding-bottom: 40px; }
/* 也沒有左邊的口味卡格子，剩下的內容不該還被擠在右半邊 */
.layout.is-busy { grid-template-columns: 1fr; }

@media (max-width: 560px) {
  .topbar { padding: 10px 14px; }
  .brand-mark { width: 36px; height: 36px; font-size: 18px; }
  .topbar h1 { font-size: 16.5px; }
  .checkout { gap: 10px; padding-top: 10px; }
  .checkout-action { width: 100%; }
  .checkout-action .btn-submit { flex: 1 1 auto; }
  .submit-hint { max-width: none; flex: 1 1 100%; order: -1; }
  .submit-hint.is-blocked { max-width: none; }
}

/* 觸控裝置沒有 hover，這些按鈕要直接顯示出來 */
/* 觸控裝置：沒有 hover 可以用，＋ 號是主要的操作方式，
   所以永遠顯示、再放大一點，並做成實心按鈕讓人一眼認出可以按 */
@media (hover: none) {
  .flavor-quick {
    opacity: 1;
    width: 40px; height: 40px;
    font-size: 25px;
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 2px 6px rgba(120, 80, 40, .3);
  }
  .slot.is-filled .remove { opacity: .92; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── 冷熱切換 ─────────────────────────────── */
/*
  一顆按鈕顯示目前狀態，點一下就換成另一種 —— 現場是站著單手操作，
  只有兩個選項時一次點擊永遠比「展開再選」快。
  尺寸對齊 .qty-btn（32px 高），這一列的按鈕才不會高高低低。
*/
.temp-btn {
  flex: none; height: 32px; min-width: 46px; padding: 0 12px;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1;
  border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; transition: .14s;
}
.temp-btn.is-hot { background: #fbe4d8; color: #a8410f; border-color: #f0c3ab; }
.temp-btn.is-ice { background: #dceaf5; color: #14608f; border-color: #b6d4e8; }
.temp-btn:hover  { filter: brightness(.97); }
.temp-btn:active { transform: translateY(1px); }
.temp-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/*
  固定溫度（紅茶氣泡飲只有冷的）。它是一個標示，不是控制項 ——
  用 <span> 畫、不給游標與互動效果，客人才不會一直去點它。
*/
.temp-btn.is-fixed {
  cursor: default; display: inline-flex; align-items: center; justify-content: center;
  opacity: .85;
}
.temp-btn.is-fixed:hover  { filter: none; }
.temp-btn.is-fixed:active { transform: none; }

/* 現場點單站著操作，點擊目標放大一點（跟 .flavor-add 同一個理由） */
.is-pos .temp-btn { height: 36px; min-width: 52px; font-size: 14px; }
