/* ==========================================================================
   快點集 SnapCard — 設計系統
   基調：紙感、暖色、大字。手機優先，單手可操作，尖峰時段不用瞇眼找按鈕。
   ========================================================================== */

/* ── 字型 ─────────────────────────────────────────────────────────────────
   全站使用 jf open 粉圓 2.1（justfont，SIL OFL 1.1，可商用）。
   本地檔只含站上實際出現的 750 個字元（126 KB）；店名、顧客姓名這種動態文字
   若超出子集，會自動落到 app.js 掛上的 Google Fonts「Huninn」逐段補字，
   兩者是同一套字，混排看不出接縫。都拿不到時才回系統字。

   粉圓只有一個字重，粗體由瀏覽器合成——所以 @font-face 一定要宣告
   font-weight: 400，寫成 100 900 會讓瀏覽器以為有粗體而停止合成，全站變細。
   ------------------------------------------------------------------------ */
@font-face {
  font-family: "Huninn UI";
  src: url("/fonts/huninn-ui.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --accent:      #FF5A3C;
  --accent-deep: #E03E20;
  --accent-soft: #FFEDE8;
  --ink:         #17130F;
  --ink-2:       #4A423B;
  --ink-3:       #8B8078;
  --paper:       #FBF7F1;
  --paper-2:     #FFFFFF;
  --line:        #E8E0D5;
  --ok:          #1F9D63;
  --ok-soft:     #E4F5EC;
  --warn:        #B8770B;
  --warn-soft:   #FDF2DC;
  --danger:      #C6392B;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  --shadow-1: 0 1px 2px rgba(23, 19, 15, .06), 0 2px 8px rgba(23, 19, 15, .04);
  --shadow-2: 0 2px 6px rgba(23, 19, 15, .08), 0 12px 32px rgba(23, 19, 15, .10);
  --shadow-3: 0 8px 24px rgba(23, 19, 15, .14), 0 32px 64px rgba(23, 19, 15, .12);

  --font: "Huninn UI", "Huninn", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei UI",
          "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  /* 店家代碼也跟著換：粉圓的數字是等寬的，代碼又只有單行 8 碼，
     字母不等寬不影響閱讀，原本的 letter-spacing 仍然照舊 */
  --mono: "Huninn UI", "Huninn", "SF Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --w: min(560px, 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-soft: #3A211B;
    --ink:    #F5EFE8;
    --ink-2:  #C3B8AD;
    --ink-3:  #8B8078;
    --paper:  #14110F;
    --paper-2:#1E1A17;
    --line:   #302A25;
    --ok-soft:  #10281D;
    --warn-soft:#2C2312;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --shadow-2: 0 2px 6px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
    --shadow-3: 0 8px 24px rgba(0,0,0,.5), 0 32px 64px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.02em; font-weight: 800; }
p { margin: 0 0 1em; }
a { color: inherit; }

/* ── 版面 ─────────────────────────────────────────────────────────────── */

.wrap {
  width: var(--w);
  margin-inline: auto;
  padding: 20px 20px 48px;
}
.wrap--wide { --w: min(900px, 100%); }

.stack   { display: grid; gap: 16px; }
.stack-s { display: grid; gap: 8px; }
.stack-l { display: grid; gap: 28px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ── 品牌與頁首 ───────────────────────────────────────────────────────── */

.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 800; }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__name { font-size: 17px; letter-spacing: -.02em; }
.brand__name small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .16em; color: var(--ink-3); text-transform: uppercase; margin-top: 1px; }
/* 字標（jf open 粉圓，向量）——高度對齊原本 17px 的中文字級 */
.brand__type { display: block; height: 19px; width: auto; color: var(--ink); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

/* ── 元件：卡片 / 按鈕 / 表單 ─────────────────────────────────────────── */

.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
}

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: inherit; font-weight: 700; font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--accent { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(255, 90, 60, .34); }
.btn--accent:hover { background: var(--accent-deep); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink-3); }
.btn--block { width: 100%; }
.btn--lg { min-height: 62px; font-size: 18px; }
.btn--sm { min-height: 40px; font-size: 14px; padding: 0 16px; }

/* Logo 上傳：左邊是縮圖，右邊是按鈕。<label for> 當按鈕用，
   原生的 file input 藏起來——它在各家瀏覽器長得都不一樣，沒法統一。 */
.upload { display: flex; align-items: center; gap: 14px; }
.upload__thumb {
  width: 60px; height: 60px; flex: none;
  border-radius: var(--r-md);
  background: var(--accent-soft); color: var(--accent);
  border: 1.5px solid var(--line);
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px;
  overflow: hidden;
}
.upload__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.upload__acts > label { cursor: pointer; }

.field { display: grid; gap: 6px; }
.field > label { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.field > .hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
input[type="text"], input[type="email"], input[type="number"], select {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }

/* 單選卡：比原生 radio 好按，店主用手機設定也不會點歪 */
.choices { display: grid; gap: 8px; }
.choice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper-2); cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.choice:hover { border-color: var(--ink-3); }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.choice span { display: grid; gap: 2px; }
.choice b { font-size: 15px; }
.choice small { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-deep);
}
.pill--ok   { background: var(--ok-soft);   color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }

.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink-2);
  padding: 12px 14px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13.5px;
}

/* ── 集點卡本體 ───────────────────────────────────────────────────────── */

.loyalty {
  --brand: var(--accent);
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 22px;
  color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--brand) 62%, #fff 0%) 0%, transparent 60%),
    linear-gradient(150deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 72%, #17130F) 100%);
  box-shadow: var(--shadow-2);
}
.loyalty::after {
  /* 打孔票根的紙感細節 */
  content: "";
  position: absolute; inset: auto 0 68px 0;
  border-top: 2px dashed rgba(255, 255, 255, .28);
}
.loyalty__head { display: flex; align-items: center; gap: 12px; }
.loyalty__logo {
  width: 46px; height: 46px; flex: none; border-radius: 14px;
  background: rgba(255, 255, 255, .2);
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px;
  overflow: hidden;
}
.loyalty__logo img { width: 100%; height: 100%; object-fit: cover; }
.loyalty__name { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.loyalty__reward { font-size: 13px; opacity: .82; }

.dots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 22px 0 18px;
}
.dot {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .38);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  color: rgba(255, 255, 255, .5);
  transition: transform .3s cubic-bezier(.2, 1.5, .4, 1), background .3s, color .3s;
}
.dot--on {
  background: #fff;
  border-color: #fff;
  color: var(--brand);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
}
.dot--pop { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop {
  0%   { transform: scale(.4) rotate(-14deg); opacity: .2; }
  60%  { transform: scale(1.22) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.dots--many { grid-template-columns: repeat(10, 1fr); gap: 6px; }
.dots--many .dot { font-size: 10px; }

.loyalty__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.loyalty__count { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.loyalty__count small { font-size: 15px; font-weight: 700; opacity: .7; }
.loyalty__msg { font-size: 13px; opacity: .85; text-align: right; max-width: 55%; }

.loyalty--full { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: var(--shadow-2); }
  50%      { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 30%, transparent), var(--shadow-2); }
}

/* ── 個人動態碼 ───────────────────────────────────────────────────────── */

.mycode { display: grid; gap: 14px; justify-items: center; text-align: center; }
.mycode__frame {
  position: relative;
  background: #fff;
  padding: 16px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  line-height: 0;
}
.mycode__frame svg { width: min(64vw, 260px); height: auto; display: block; }
.mycode__timer { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.ring { width: 18px; height: 18px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: var(--line); }
.ring .bar   { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .95s linear; }

/* ── 我的所有卡 ───────────────────────────────────────────────────────── */

.cardlist { display: grid; gap: 12px; }
.minicard {
  --brand: var(--accent);
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--paper-2);
  border: 1px solid var(--line);
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: transform .14s ease, box-shadow .2s ease;
}
.minicard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.minicard__logo {
  width: 46px; height: 46px; flex: none; border-radius: 13px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  overflow: hidden;
}
.minicard__logo img { width: 100%; height: 100%; object-fit: cover; }
.minicard__name { font-weight: 700; }
.minicard__meta { font-size: 12.5px; color: var(--ink-3); }
.minibar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 6px; }
.minibar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .5s ease; }
.minicard__pts { font-weight: 800; font-size: 15px; white-space: nowrap; }

/* ── 空狀態 ───────────────────────────────────────────────────────────── */

.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ── 店家後台：掃碼畫面 ───────────────────────────────────────────────── */

.scanner {
  position: fixed; inset: 0;
  background: #0B0908;
  color: #fff;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.scanner__bar {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
}
.modeswitch {
  display: flex; padding: 4px; gap: 4px;
  background: rgba(255, 255, 255, .1);
  border-radius: 999px;
}
.modeswitch button {
  appearance: none; border: 0; cursor: pointer;
  padding: 9px 20px; border-radius: 999px;
  background: transparent; color: rgba(255, 255, 255, .66);
  font: inherit; font-weight: 800; font-size: 15px;
  transition: background .2s, color .2s;
}
.modeswitch button[aria-pressed="true"] { background: #fff; color: #17130F; }
.modeswitch button.redeem[aria-pressed="true"] { background: var(--accent); color: #fff; }

.iconbtn {
  appearance: none; cursor: pointer;
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .1); color: #fff;
}
.iconbtn:hover { background: rgba(255, 255, 255, .18); }

.stage { position: relative; flex: 1; min-height: 0; }
.stage video, .stage canvas.feed {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #000;
}
.viewfinder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  pointer-events: none;
}
.viewfinder__box {
  position: relative;
  width: min(72vw, 320px);
  aspect-ratio: 1;
  border-radius: 28px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55);
}
.viewfinder__box::before, .viewfinder__box::after,
.viewfinder__box i::before, .viewfinder__box i::after {
  content: ""; position: absolute; width: 40px; height: 40px;
  border: 4px solid #fff; border-radius: 14px 0 0 0;
}
.viewfinder__box::before { top: -2px; left: -2px; border-width: 4px 0 0 4px; }
.viewfinder__box::after  { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-radius: 0 14px 0 0; }
.viewfinder__box i::before { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-radius: 0 0 0 14px; }
.viewfinder__box i::after  { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-radius: 0 0 14px 0; }
.viewfinder__hint {
  position: relative; z-index: 1;
  max-width: 30ch; padding: 0 20px;
  text-align: center; font-size: 15px; font-weight: 700;
  color: rgba(255, 255, 255, .86);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .8);
}
.scanline {
  position: absolute; left: 8%; right: 8%; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 2.6s ease-in-out infinite;
}
@keyframes sweep {
  0%, 100% { top: 12%; opacity: .35; }
  50%      { top: 86%; opacity: 1; }
}

/* 掃描結果：大字回饋（規格 §4.2） */
.result {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center; padding: 24px;
  background: rgba(11, 9, 8, .93);
  backdrop-filter: blur(6px);
  animation: rise .22s ease-out;
  text-align: center;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.result__inner { display: grid; gap: 14px; justify-items: center; max-width: 420px; }
.result__badge {
  width: 88px; height: 88px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 42px; font-weight: 800;
  background: var(--ok); color: #fff;
  animation: pop .45s cubic-bezier(.2, 1.6, .4, 1);
}
.result__badge--warn { background: var(--warn); }
.result__badge--bad  { background: var(--danger); }
.result__title { font-size: clamp(30px, 9vw, 44px); font-weight: 800; letter-spacing: -.03em; }
.result__name  { font-size: 20px; font-weight: 700; opacity: .92; }
.result__sub   { font-size: 15px; color: rgba(255, 255, 255, .7); }
.result__dots { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; max-width: 300px; }
.result__dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); }
.result__dots i.on { background: #fff; border-color: #fff; }
.result__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.result .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }

/* 金額制：掃碼後的數字鍵盤（規格外新增，店員單手可按） */
.amount { width: min(340px, 100%); gap: 10px; }
.amount__label { font-size: 15px; color: rgba(255, 255, 255, .7); font-weight: 700; }
.amount__display {
  display: flex; align-items: baseline; justify-content: center; gap: 4px;
  font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.amount__cur { font-size: 26px; opacity: .6; }
.amount__display > span:last-child { font-size: clamp(44px, 13vw, 62px); line-height: 1.05; }
.amount__hint { font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, .55); }

.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: 100%; margin-top: 4px;
}
.keypad button {
  appearance: none; cursor: pointer; font: inherit;
  min-height: 58px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .09); color: #fff;
  font-size: 23px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background .12s ease, transform .1s ease;
}
.keypad button:active { background: rgba(255, 255, 255, .22); transform: scale(.96); }

.scanner__foot {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  font-size: 13px; color: rgba(255, 255, 255, .55);
}
.scanner__foot a { color: rgba(255, 255, 255, .8); }

.manual { display: flex; gap: 8px; width: min(420px, 100%); }
.manual input {
  background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff;
  font-family: var(--mono); letter-spacing: .06em;
}
.manual input::placeholder { color: rgba(255, 255, 255, .4); }

/* ── 儀表板 ───────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--shadow-1);
}
.stat__label { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.stat__value { font-size: 40px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; margin-top: 2px; }
.stat__foot  { font-size: 12px; color: var(--ink-3); }
.stat--accent .stat__value { color: var(--accent); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }

.feed { display: grid; gap: 2px; }
.feed__row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.feed__row:last-child { border-bottom: 0; }
.feed__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.feed__dot--redeem { background: var(--ok); }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; }
.tabs a {
  flex: 1; text-align: center; text-decoration: none;
  padding: 10px 8px; border-radius: 999px;
  font-size: 14px; font-weight: 700; color: var(--ink-2);
}
.tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* ── 立牌 ─────────────────────────────────────────────────────────────── */

.signage-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* 成品是 50 × 75 mm——店家拿到的壓克力立牌內襯尺寸。
   所有內部尺寸都寫成 --u 的倍數：螢幕預覽把 --u 放大看得清楚，
   列印時 --u = 1mm，同一份版面兩邊完全一致，不必維護兩套數字。 */
.sign {
  --u: 2.6mm;
  --brand: #FF5A3C;
  width:  calc(50 * var(--u));
  height: calc(75 * var(--u));
  background: #fff;
  color: #17130F;               /* 紙是白的，不跟著深色模式走 */
  overflow: hidden;
}
.sign__body {
  height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: calc(1.7 * var(--u));
  padding: calc(3.4 * var(--u));
  text-align: center;
}
.sign__lockup {
  display: flex; align-items: center; justify-content: center;
  gap: calc(1.1 * var(--u));
  font-size: calc(2.9 * var(--u)); font-weight: 800; white-space: nowrap;
}
.sign__wordmark { height: calc(3.7 * var(--u)); width: auto; display: block; color: #17130F; }
/* 獎勵文字上限 30 字，寫滿會擠到三行、把下面的步驟推出卡片外（卡片是 overflow:hidden，
   會無聲被裁掉）。夾成兩行，版面就永遠關得起來。 */
.sign__reward {
  font-size: calc(2.6 * var(--u)); color: #4A423B;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.sign__qr { width: calc(35 * var(--u)); line-height: 0; }
.sign__qr svg { width: 100%; height: auto; display: block; }
.sign__lead { font-size: calc(3 * var(--u)); font-weight: 800; color: var(--brand); }
.sign__steps {
  display: grid; gap: calc(1 * var(--u));
  font-size: calc(2.3 * var(--u)); line-height: 1.4; color: #4A423B;
}
.sign__steps b { color: var(--brand); }

/* 一張 A4 上放一張卡，沿虛線裁下。虛線畫在卡片外側，裁完才是足尺。 */
.sign-sheet { display: grid; justify-items: center; gap: 14px; }
.cut-guide { border: .25mm dashed #9A9A9A; line-height: 0; background: #fff; }
.cut-note { margin: 0; font-size: 12px; color: #8B8078; }

/* ── 店員手冊（列印用 A4）─────────────────────────────────────────────── */

.manual-sheet {
  background: #fff; color: #17130F;
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 30px; box-shadow: var(--shadow-2);
  display: grid; gap: 20px;
}
.manual-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding-bottom: 16px; border-bottom: 3px solid #17130F;
}
.manual-eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent);
}
.manual-title { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.manual-rule { font-size: 14px; color: #4A423B; margin: 4px 0 0; }
.manual-qr { flex: none; width: 104px; text-align: center; line-height: 1.35; }
.manual-qr svg { width: 100%; height: auto; display: block; }
.manual-qr span { display: block; margin-top: 5px; font-size: 10px; color: #8B8078; }

.manual-block { display: grid; gap: 9px; break-inside: avoid; }
.manual-block h3 {
  display: flex; align-items: center; gap: 9px;
  font-size: 18px; font-weight: 800;
}
.manual-block .num {
  width: 27px; height: 27px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 15px;
}
.manual-block--dont .num { background: #C6392B; }

/* 「兩個碼」對照表：這欄的內容會換行，不能沿用故障排除表的 nowrap */
.manual-block--codes .num { background: #17130F; }
.manual-block--codes .manual-table td:first-child { white-space: normal; width: 46%; }
.manual-table .dim { color: #8B8078; font-weight: 400; }

.steps { margin: 0; padding-left: 1.35em; display: grid; gap: 6px; font-size: 15px; }
.steps b { background: #FFEDE8; padding: 1px 5px; border-radius: 4px; }
.manual-tip {
  margin: 2px 0 0; padding: 9px 12px; border-radius: 8px;
  background: #F5F1EA; font-size: 13px; color: #4A423B;
}
.manual-tip--warn { background: #FDF2DC; color: #8A5A08; font-weight: 700; }

.manual-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.manual-table th, .manual-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid #E8E0D5; vertical-align: top;
}
.manual-table th {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: #8B8078; border-bottom-width: 2px; border-bottom-color: #17130F;
}
.manual-table td:first-child { white-space: nowrap; }

.donts { margin: 0; padding-left: 1.25em; display: grid; gap: 5px; font-size: 14.5px; color: #4A423B; }
.donts b { color: #C6392B; }

.manual-foot {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid #E8E0D5;
  font-size: 11px; color: #8B8078;
}

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .no-print, .topbar, .tabs { display: none !important; }
  .wrap { width: 100%; padding: 0; }
  .sign { --u: 1mm; break-inside: avoid; }
  .sign-sheet { width: 210mm; height: 297mm; align-content: center; gap: 8mm; }
  .cut-note { font-size: 9pt; color: #666; }

  .manual-sheet {
    border: 0; border-radius: 0; box-shadow: none; padding: 0;
    page-break-after: auto;
  }
}

/* ── 首頁 ─────────────────────────────────────────────────────────────── */

.hero { padding: 44px 0 30px; }
.hero h1 { font-size: clamp(32px, 9vw, 46px); letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 17px; color: var(--ink-2); margin-top: 14px; }

.marks { display: grid; gap: 10px; margin: 26px 0; }
.mark { display: flex; gap: 11px; align-items: flex-start; font-size: 15px; }
.mark svg { flex: none; margin-top: 3px; color: var(--accent); }

.split { display: grid; gap: 12px; }
@media (min-width: 680px) { .split { grid-template-columns: 1fr 1fr; } }
.door {
  display: grid; gap: 6px;
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--paper-2);
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: transform .15s ease, box-shadow .25s ease, border-color .2s;
}
.door:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--accent); }
.door strong { font-size: 18px; }
.door span { font-size: 14px; color: var(--ink-3); }
.door .go { font-size: 14px; font-weight: 800; color: var(--accent); }

.foot { margin-top: 42px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); display: flex; gap: 14px; flex-wrap: wrap; }

/* ── 提示條 ───────────────────────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper);
  padding: 13px 20px; border-radius: 999px;
  font-size: 14.5px; font-weight: 700;
  box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast--bad { background: var(--danger); color: #fff; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
  margin: 32px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
