@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@500;700&display=swap");
/* ==========================================================================
   三合匯 SHIFTME ｜ 暖米生活（Warm Linen）
   全站樣式表的明亮版本（前台、會員中心、後台共用），選擇器與版面規則與 app.css 一一對應。
   --------------------------------------------------------------------------
   設計概念
     把整個站當成一間「質感生活選物店」：亞麻米白的店面、紙張般的貨架卡、
     陶土橘的價格吊牌、鼠尾草綠的「已完成」章、琥珀色的小細節。
     看起來像值得信任的購物網站，而不是理財 App：沒有發光、沒有玻璃、沒有大面積黑金。

   色彩角色
     底    亞麻米白 #f6f1e7（頁面）／紙白 #fffdf8（卡片）／米灰 #efe7d8（表頭、凹槽軌道）
     字    暖墨 #2b2620（內文 13:1）／#5b5247（次要 6.8:1）／#6c6154（提示 ≥4.9:1）
     主色  陶土橘 #c8553d：主要按鈕、價格、選中狀態；當文字用時加深為 #9e3f2b（≥5.3:1）
     成功  鼠尾草綠 #5f7f6a：成交、入帳、正向；文字用 #466553（≥5.2:1）
     點綴  琥珀 #d9a441：Logo、商品佔位字、進度條起點、圈存與「未成交已退回」；文字用 #7d5810
     相框  墨藍 #1b2638：Logo 圖示底、商品照片框、倒數計時牌。
           商品照片本身是深海軍藍＋金色輪廓光，所以讓「深色」只出現在這些刻意框起來的地方，
           像選物店牆上的裱框畫，明亮頁面上反而顯得高級。

   字體
     標題：Noto Serif TC（Google Fonts，500／700）→ 蘋方宋體 → 思源宋體 → 新細明體 → serif。
     內文與數字：系統無襯線（蘋方、Segoe UI＋正黑、Roboto＋思源黑體），離線也不會換字閃動。
     全站數字 tabular-nums；倒數與價格用無襯線的等寬數字，跳動時不會左右晃。

   質感來源
     1. 紙：卡片是紙白，上緣一道白色內高光，下方兩層暖棕色柔影（不是灰黑）。
     2. 線：分隔線是很淡的米褐色；頁首下緣一條「陶土／琥珀／鼠尾草」三段色線＝三重身分。
     3. 印刷：進行中的一局與首頁即時卡是「票券雙框」，外框之內再一道琥珀細線。
     4. 標記：卡片標題前的小菱形取自 Logo 中心的菱形。

   可讀性與無障礙
     內文對比 ≥ 4.5:1；輸入框邊線對卡面 ≥ 3:1；所有互動元素有 2px 深墨綠 :focus-visible；
     按鈕、輸入框、選單項目高度 ≥ 44px；color-scheme: light。

   目錄
     1 設計變數   2 基礎        3 版型與頁首   4 卡片與格線   5 表單
     6 按鈕與訊息 7 表格標籤分頁 8 首頁與商品   9 會員中心     10 進行中的一局
     11 後台      12 斷點        13 使用者偏好  14 圖示、首頁主視覺、商品頁
   ========================================================================== */


/* ---------- 1. 設計變數 ---------- */
:root {
  color-scheme: light;

  /* 底色：亞麻與紙 */
  --bg: #f6f1e7;
  --bg-top: #faf6ee;
  --bg-solid: #fffdf8;                /* 不透明的面：後台卡片、下拉選單 */
  --bg-well: #fffefb;                 /* 輸入框 */
  --paper: #fffdf8;
  --paper-2: #fbf7ef;
  --sand: #efe7d8;                    /* 表頭、軌道、分段控制底 */

  /* 面（沿用原本的變數名，內容換成紙） */
  --glass: var(--paper);
  --glass-soft: var(--paper-2);
  --hairline: #e3d8c6;                /* 卡片外框 */
  --line: #e8dfcf;                    /* 分隔線（通知頁的行內樣式也會用到這個名字） */
  --shine: inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow: 0 1px 2px rgba(84, 58, 30, .06), 0 14px 30px -20px rgba(84, 58, 30, .32);
  --shadow-lift: 0 2px 4px rgba(84, 58, 30, .06), 0 22px 40px -22px rgba(84, 58, 30, .42);

  /* 文字 */
  --text: #2b2620;
  --text-2: #5b5247;
  --text-3: #6c6154;

  /* 陶土橘：主色 */
  --terra: #c8553d;
  --terra-btn: #b44a33;               /* 按鈕底（白字 5.3:1） */
  --terra-deep: #9e3f2b;              /* 當文字用：價格、選中 */
  --terra-tint: #f9ece5;
  --terra-a: 200, 85, 61;

  /* 鼠尾草綠：成功 */
  --sage: #5f7f6a;
  --sage-deep: #466553;
  --sage-ink: #2f5240;
  --sage-tint: #e9efe9;
  --sage-a: 95, 127, 106;

  /* 琥珀：點綴（沿用 gold 變數名，讓舊的規則都有對應） */
  --gold-1: #7d5810;                  /* 琥珀當文字 */
  --gold-2: #8a5f12;
  --gold-3: #d9a441;
  --gold-ink: #ffffff;
  --gold-a: 217, 164, 65;
  --amber: #d9a441;
  --amber-tint: #f8edd5;
  --gold-grad: linear-gradient(180deg, #bc5139 0%, #a8432e 100%);           /* 主要按鈕（白字頂端 4.7:1、底端 6:1） */
  --gold-text: linear-gradient(180deg, #b44a33 0%, #8f3a27 100%);           /* 陶土漸層字（兩端都 ≥5:1） */
  --brass-text: linear-gradient(180deg, #fbe9bb 0%, #e8bf68 52%, #c48f34 100%);   /* 墨藍底上的琥珀字 */

  /* 墨藍相框 */
  --frame: #1b2638;
  --frame-grad: linear-gradient(160deg, #24324a 0%, #1b2638 55%, #141c2b 100%);
  --frame-text: #f3d48a;              /* 墨藍上的琥珀字 10.5:1 */

  /* 語意色（沿用原本的變數名） */
  --teal: var(--sage-deep);
  --teal-a: var(--sage-a);
  --teal-ink: #ffffff;
  --coral: #a4402c;
  --coral-a: 200, 85, 61;
  --coral-ink: #ffffff;
  --ink-green: #2f4a3d;

  /* 表單 */
  --field-line: #8f8270;              /* 對紙白 3.7:1 */
  --focus: #2f4a3d;

  /* 間距（4px 格線） */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --gutter: 16px;

  /* 圓角與尺寸：比原本收斂一點，像紙卡而不是 App 圖示 */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-pill: 999px;
  --tap: 44px;
  --brand-row: 54px;
  --bar-h: 64px;

  /* 動效 */
  --fast: .16s;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* 字型 */
  --font-cjk: "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei UI", "Microsoft JhengHei";
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, var(--font-cjk), system-ui, sans-serif;
  --font-num: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, var(--font-cjk), sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", "Noto Serif CJK TC", "PMingLiU", serif;
  --font-head: var(--font-serif);
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}


/* ---------- 2. 基礎 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--bar-h) + var(--s-5));
  scrollbar-color: #cbbfab transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 環境：很淡的暖光與一層若有似無的亞麻織紋，固定在視窗上 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 100% -8%, rgba(var(--gold-a), .14), transparent 70%),
    radial-gradient(50% 40% at -6% 4%, rgba(var(--terra-a), .06), transparent 70%),
    radial-gradient(70% 50% at 50% 115%, rgba(var(--sage-a), .08), transparent 70%),
    repeating-linear-gradient(0deg, rgba(120, 96, 60, .018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120, 96, 60, .014) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 40%, #f3ede1 100%);
}

::selection { background: rgba(var(--gold-a), .35); color: var(--text); }

h1, h2, h3 { margin: 0 0 .6em; font-family: var(--font-head); font-weight: 700; line-height: 1.35; letter-spacing: .03em; text-wrap: balance; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1875rem; }
h3 { font-size: .9375rem; letter-spacing: .05em; color: var(--sage-deep); }
p { margin: 0 0 .9em; }
img { max-width: 100%; }
button { font: inherit; }

a {
  color: var(--terra-deep);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(var(--terra-a), .45);
  transition: color var(--fast), text-decoration-color var(--fast);
}
a:where(:hover) { color: #7f3121; text-decoration-color: currentColor; }

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--sand);
  color: var(--terra-deep);
  font-family: var(--font-mono);
  font-size: .85em;
  overflow-wrap: anywhere;
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* 小工具 */
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.muted strong { color: var(--text); }
.small { font-size: .875rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.inline-form { display: inline; }


/* ---------- 3. 版型與頁首 ---------- */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
main { flex: 1 0 auto; padding: var(--s-5) 0 56px; }

footer {
  padding: var(--s-5) 0 32px;
  border-top: 1px solid var(--line);
  background: rgba(239, 231, 216, .45);
  color: var(--text-3);
  font-size: .8125rem;
}
footer a { color: var(--text-2); }

/* 頁首（手機優先）：第一列品牌、第二列選單；往下捲時品牌列滑出 */
.topbar {
  position: sticky;
  top: calc(var(--brand-row) * -1);
  z-index: 20;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 253, 248, .9);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  box-shadow: 0 8px 20px -18px rgba(84, 58, 30, .45);
}
.topbar::after {                      /* 頁首下緣的三段色線：陶土／琥珀／鼠尾草＝三重身分 */
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 2px;
  background: linear-gradient(90deg, var(--terra) 0 33.33%, var(--amber) 33.33% 66.66%, var(--sage) 66.66% 100%);
  opacity: .8;
  pointer-events: none;
}
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; padding: 0; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: var(--brand-row);
  padding: 0 var(--gutter);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.15;
  white-space: nowrap;
  text-decoration: none;
}
.brand:focus-visible { outline-offset: -4px; }
.brand svg {                          /* 金色 Logo 放在墨藍小方塊裡，外圈一道琥珀細線 */
  flex: none;
  width: 38px;
  height: 38px;
  padding: 6px;
  border-radius: 10px;
  background: var(--frame-grad);
  box-shadow: inset 0 0 0 1px rgba(var(--gold-a), .55), inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 2px var(--paper), 0 0 0 3px rgba(var(--gold-a), .45), 0 6px 14px -8px rgba(27, 38, 56, .6);
}
.brand small {
  display: block;
  margin-top: 3px;
  color: var(--gold-2);
  font-family: var(--font);
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .28em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 0 100%;
  min-width: 0;
  padding: 0 10px var(--s-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav > a, .topbar nav > .inline-form { display: flex; flex: 1 0 auto; }
.topbar nav .inline-form button { width: 100%; }
.topbar nav a, .topbar nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--text-2);
  font-size: .9375rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--fast), color var(--fast);
}
.topbar nav a:hover, .topbar nav button:hover { background: rgba(43, 38, 32, .055); color: var(--text); }
.topbar nav a:focus-visible, .topbar nav button:focus-visible { outline-offset: -3px; }
.topbar nav a.on, .topbar nav a[aria-current="page"] {
  background: var(--terra-tint);
  box-shadow: inset 0 0 0 1px rgba(var(--terra-a), .35);
  color: var(--terra-deep);
}
.topbar nav > a:last-child {          /* 未登入時最後一項是「註冊」：陶土實心膠囊當作行動呼籲 */
  background: var(--terra-btn);
  box-shadow: 0 6px 14px -8px rgba(var(--terra-a), .7);
  color: #fff;
}
.topbar nav > a:last-child:hover { background: #9e3f2b; color: #fff; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--terra-btn);
  box-shadow: 0 0 0 2px var(--paper);
  color: #fff;
  font-size: .6875rem;
  font-weight: 800;
  line-height: 1;
}


/* ---------- 4. 卡片與格線 ---------- */
.card {
  position: relative;
  margin-bottom: var(--s-4);
  padding: var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shine), var(--shadow);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card > h2::before {                  /* 卡片標題前的小菱形：取自 Logo 中心 */
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 12px 0 2px;
  border-radius: 1px;
  background: var(--terra);
  box-shadow: 0 0 0 3px rgba(var(--terra-a), .14);
  transform: rotate(45deg);
  vertical-align: .14em;
}
.card .card {                         /* 巢狀卡（訂單列表）：更淺的一層 */
  margin-bottom: var(--s-3);
  padding: 14px var(--s-4);
  border-radius: var(--r-md);
  background: var(--paper-2);
  box-shadow: none;
}

.grid { display: grid; gap: var(--s-4); margin-bottom: var(--s-4); }
.grid > .card, .grid > div > .card:last-child { margin-bottom: 0; }
.cols-2, .cols-3, .cols-4 { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
.cols-2, .cols-3 { --cols: 1; }
.cols-4 { --cols: 2; gap: var(--s-3); }

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.split .products-side { order: -1; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px var(--s-3); }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line); }

details {
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--paper-2);
}
details > summary {
  position: relative;
  display: block;
  min-height: var(--tap);
  padding: 10px 14px 10px 40px;
  border-radius: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 17px;
  width: 8px;
  height: 8px;
  border: solid var(--terra);
  border-width: 0 2px 2px 0;
  transform: rotate(-45deg);
  transition: transform var(--fast) var(--ease);
}
details[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
details > summary:hover { background: rgba(43, 38, 32, .035); }
details > :not(summary) { margin-left: 14px; margin-right: 14px; margin-bottom: 14px; }


/* ---------- 5. 表單 ---------- */
label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: .875rem; font-weight: 600; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; color: var(--text-2); }

input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=url], input[type=search], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--field-line);
  border-radius: var(--r-sm);
  background-color: var(--bg-well);
  box-shadow: inset 0 1px 2px rgba(84, 58, 30, .06);
  color: var(--text);
  font: inherit;
  line-height: 1.4;
  transition: border-color var(--fast), background-color var(--fast), box-shadow var(--fast);
}
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: #6c6154; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--terra-btn);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(var(--terra-a), .16);
  outline-offset: 1px;
}
input[readonly] { background-color: var(--paper-2); color: var(--text-2); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
textarea { min-height: 96px; line-height: 1.6; resize: vertical; }
td input[type=text] { min-height: var(--tap) !important; }

/* 自動填入：蓋掉瀏覽器的藍／黃底，改成很淡的琥珀紙色 */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus,
textarea:-webkit-autofill, select:-webkit-autofill {
  border-color: rgba(var(--gold-a), .9);
  box-shadow: inset 0 0 0 1000px #fcf4e2;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 99999s ease-out;
}
input:autofill, textarea:autofill, select:autofill {
  border-color: rgba(var(--gold-a), .9);
  box-shadow: inset 0 0 0 1000px #fcf4e2;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
}

/* 日期／時間 */
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; }
input::-webkit-date-and-time-value { text-align: left; }
input::-webkit-calendar-picker-indicator { padding: 4px; border-radius: 6px; opacity: .75; cursor: pointer; }
input::-webkit-calendar-picker-indicator:hover { background-color: rgba(43, 38, 32, .07); opacity: 1; }

/* 下拉：箭頭用兩個漸層三角形拼出來 */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: right 21px top 50%, right 15px top 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
  cursor: pointer;
}
select option { background: var(--bg-solid); color: var(--text); }

input[type=file] {
  width: 100%;
  min-height: var(--tap);
  padding: 5px;
  border: 1px dashed var(--field-line);
  border-radius: var(--r-sm);
  background-color: var(--bg-well);
  color: var(--text-2);
  font: inherit;
  font-size: .875rem;
}
input[type=file]::file-selector-button {
  min-height: 32px;
  margin-right: var(--s-3);
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--sand);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* 核取方塊與單選：勾選後填陶土色、白色勾 */
input[type=checkbox], input[type=radio] {
  -webkit-appearance: none;
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--field-line);
  border-radius: 6px;
  background-color: #fff;
  vertical-align: -5px;
  cursor: pointer;
  transition: border-color var(--fast), background-color var(--fast), box-shadow var(--fast);
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::before, input[type=radio]::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--gold-ink);
  transform: scale(0);
  transition: transform .12s var(--ease);
}
input[type=checkbox]::before { clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%); }
input[type=radio]::before { width: 10px; height: 10px; border-radius: 50%; }
input[type=checkbox]:checked, input[type=radio]:checked {
  border-color: transparent;
  background: var(--terra-btn);
  box-shadow: 0 0 0 4px rgba(var(--terra-a), .14);
}
input[type=checkbox]:checked::before, input[type=radio]:checked::before { transform: scale(1); }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: 0;
  color: var(--text);
  font-size: .9375rem;
  font-weight: 400;
  line-height: 1.6;
  cursor: pointer;
}
.check input { margin-top: 1px; }
fieldset .check {
  align-items: center;
  min-height: var(--tap);
  padding: var(--s-2) 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  transition: border-color var(--fast), background-color var(--fast);
}
fieldset .check input { margin-top: 0; }
fieldset .check:hover { border-color: rgba(var(--terra-a), .5); }
fieldset .check:has(input:checked) { border-color: rgba(var(--terra-a), .7); background: var(--terra-tint); }

.field { margin-bottom: 14px; }
.hint { margin-top: 6px; color: var(--text-3); font-size: .8125rem; line-height: 1.5; }
.field .error { margin-top: 6px; color: var(--coral); font-size: .8125rem; font-weight: 600; }
form > .grid, form.grid { gap: var(--s-3) 14px; }
form > .grid { margin-bottom: 14px; }
.grid > .field { margin-bottom: 0; }
form.row > div:has(> label) { flex: 1 1 140px; max-width: 240px; }

.copybox { display: flex; gap: var(--s-2); }
.copybox input { flex: 1; min-width: 0; color: var(--terra-deep); font-size: .875rem; text-overflow: ellipsis; }
.copybox .btn { flex: none; }


/* ---------- 6. 按鈕與訊息 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--tap);
  padding: 10px 22px;
  border: 1px solid #9a3d2a;
  border-radius: var(--r-pill);
  background: var(--gold-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 1px rgba(84, 40, 20, .12), 0 8px 18px -10px rgba(var(--terra-a), .8);
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .04em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform var(--fast) var(--ease), filter var(--fast), box-shadow var(--fast), background-color var(--fast), border-color var(--fast), color var(--fast);
}
.btn:hover { filter: brightness(.94); color: #fff; }
.btn:active { transform: translateY(1px) scale(.985); filter: brightness(.9); }

.btn.green {
  border-color: #3a5646;
  background: linear-gradient(180deg, #557563 0%, #405d4c 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 1px rgba(30, 50, 40, .12), 0 8px 18px -10px rgba(var(--sage-a), .8);
  color: var(--teal-ink);
}
.btn.green:hover { color: var(--teal-ink); }

.btn.ghost {
  border-color: #bfb19b;
  background: var(--paper);
  box-shadow: var(--shine), 0 1px 2px rgba(84, 58, 30, .06);
  color: var(--text);
}
.btn.ghost:hover { border-color: var(--terra); background: var(--terra-tint); color: var(--terra-deep); filter: none; }

.btn.block { width: 100%; }
.btn.sm { padding: var(--s-2) var(--s-4); font-size: .875rem; font-weight: 600; }
.btn[disabled], .btn:disabled { opacity: .5; filter: grayscale(.6); box-shadow: none; transform: none; cursor: not-allowed; }

.flash {
  position: relative;
  margin: 0 0 var(--s-4);
  padding: var(--s-3) var(--s-4) var(--s-3) 46px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--paper-2);
  color: var(--text);
  font-size: .9375rem;
  line-height: 1.55;
}
.flash::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 13px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: currentColor;
}
.flash::after { content: ""; position: absolute; }
.flash.ok { border-color: rgba(var(--sage-a), .45); background: var(--sage-tint); color: var(--sage-ink); }
.flash.ok::after {                    /* 勾 */
  left: 21px;
  top: 17px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.flash.err { border-color: rgba(var(--terra-a), .45); background: var(--terra-tint); color: #8f3a28; }
.flash.err::after {                   /* 驚嘆號 */
  left: 23px;
  top: 17px;
  width: 2px;
  height: 12px;
  background: linear-gradient(#fff 0 7px, transparent 7px 9px, #fff 9px 12px);
}
.flash a { color: inherit; font-weight: 700; text-decoration-color: currentColor; }
.flash strong { color: inherit; }


/* ---------- 7. 表格、標籤、分頁 ---------- */
.table-wrap { overflow-x: auto; scrollbar-width: thin; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
th, td { padding: 11px var(--s-3); border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th {
  border-bottom: 0;
  background: var(--sand);
  color: var(--text-2);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  white-space: nowrap;
}
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td[colspan] { padding: var(--s-6) var(--s-3); }
.table-wrap td { word-break: keep-all; }
.table-wrap td[colspan] { word-break: normal; }
.card > table td:first-child { color: var(--text-2); }
.plus { color: var(--sage-deep); font-weight: 600; }
.minus { color: var(--coral); font-weight: 600; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: #f1ebdf;
  box-shadow: inset 0 0 0 1px #e0d5c2;
  color: #4f473d;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}
.tag.green, .tag.coral, .tag.amber { background: rgba(var(--tag-a), .13); box-shadow: inset 0 0 0 1px rgba(var(--tag-a), .38); }
.tag.green::before, .tag.coral::before, .tag.amber::before {   /* 狀態點 */
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.tag.green { --tag-a: var(--sage-a); color: var(--sage-ink); }
.tag.coral { --tag-a: var(--terra-a); color: #93392a; }
.tag.amber { --tag-a: var(--gold-a); color: #6e4e0c; }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; color: var(--text-2); font-size: .875rem; }
.pager a, .pager .muted {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid #bfb19b;
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.pager a:hover { border-color: var(--terra); background: var(--terra-tint); color: var(--terra-deep); }
.pager .muted { border-color: var(--line); background: none; color: var(--text-3); }


/* ---------- 8. 首頁與商品 ---------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: var(--s-4);
  padding: var(--s-5);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background:
    radial-gradient(80% 120% at 100% 0%, rgba(var(--gold-a), .2), transparent 58%),
    radial-gradient(80% 110% at 0% 100%, rgba(var(--sage-a), .12), transparent 60%),
    linear-gradient(135deg, #fffdf8 0%, #fbf5ea 100%);
  box-shadow: var(--shine), var(--shadow);
}
.hero::before {                       /* 右上角的同心圓細線：像陶盤上的轆轤紋 */
  content: "";
  position: absolute;
  z-index: -1;
  top: -120px;
  right: -90px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 15px, rgba(var(--terra-a), .14) 15px 16px);
  -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 70%);
  mask-image: radial-gradient(circle, #000 25%, transparent 70%);
}
.hero h1 { margin-bottom: .35em; color: var(--terra-deep); font-size: clamp(1.5rem, 6.6vw, 2.125rem); letter-spacing: .05em; }
.hero p { max-width: 44em; margin: 0; color: var(--text-2); font-size: .9375rem; }

.products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.product {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-md);
  color: var(--text);
}
a.product, .product.empty { border: 1px solid var(--hairline); background: var(--paper); box-shadow: var(--shine), var(--shadow); }
a.product { text-decoration: none; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
a.product:active { transform: scale(.985); }

/* 商品圖＝刻意的墨藍相框：四周留一圈紙白「卡紙」，內緣一道琥珀細線，
   和棚拍照的深海軍藍背景接在一起。沒有圖時中間是琥珀色的商品名第一個字。 */
.product .pic {
  --pic-art:
    linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .06) 46%, transparent 54%),
    radial-gradient(circle closest-side, transparent 65.5%, rgba(var(--gold-a), .42) 66.5%, rgba(var(--gold-a), .42) 68%, transparent 69%, transparent 80.5%, rgba(var(--gold-a), .16) 81.5%, rgba(var(--gold-a), .16) 82.5%, transparent 83.5%),
    radial-gradient(circle closest-side, rgba(var(--gold-a), .14), transparent 62%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 7px),
    radial-gradient(120% 90% at 50% -10%, rgba(74, 98, 150, .35), transparent 62%),
    linear-gradient(160deg, #24324a 0%, #1b2638 65%, #131a28 100%);
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 7px 7px 0;
  border-bottom: 0;
  border-radius: calc(var(--r-md) - 6px);
  background: var(--pic-art);
  color: var(--frame-text);
  font-family: var(--font-serif);
  font-size: 2.75rem;
  font-size: clamp(2.5rem, 32cqi, 6.5rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .2), 0 0 24px rgba(var(--gold-a), .35);
}
.product .pic::after {                /* 相框內緣的琥珀細線＋上緣微光 */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(var(--gold-a), .32), inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 -24px 32px -24px rgba(8, 12, 22, .5);
  pointer-events: none;
}
.product .pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product .body { display: flex; flex: 1; flex-direction: column; gap: var(--s-1); padding: var(--s-3) var(--s-3) 14px; }
.product .name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.45;
}
.product .price { color: var(--terra-deep); font-family: var(--font-num); font-size: 1.25rem; font-weight: 800; letter-spacing: 0; }
.product .price s { margin-left: 6px; color: var(--text-3); font-size: .8125rem; font-weight: 400; letter-spacing: 0; }
.product .when { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) 6px; margin-top: auto; padding-top: var(--s-2); border-top: 1px dashed var(--line); color: var(--text-2); font-size: .75rem; }
.product:not(a):not(.empty) { border: 0; }

/* 敬請期待：紙上鉛筆斜紋＋一只琥珀線條時鐘 */
.product.empty {
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 190px;
  padding: var(--s-5) var(--s-2);
  border-style: dashed;
  border-color: #d6c9b4;
  background:
    radial-gradient(circle closest-side at 50% 40%, rgba(var(--gold-a), .12), transparent 70%),
    repeating-linear-gradient(135deg, rgba(120, 96, 60, .045) 0 1px, transparent 1px 8px),
    var(--paper-2);
  box-shadow: none;
  color: var(--text-2);
  font-size: .8125rem;
  letter-spacing: .3em;
  text-indent: .3em;
  text-align: center;
}
.product.empty::before {
  content: "";
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--gold-2);
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--gold-2) 0 2px, transparent 2.6px),
    linear-gradient(var(--gold-2), var(--gold-2)) 50% 30.6% / 1.5px 28% no-repeat,
    linear-gradient(var(--gold-2), var(--gold-2)) 64.1% 50% / 22% 1.5px no-repeat,
    var(--paper);
  box-shadow: 0 0 0 6px rgba(var(--gold-a), .12);
}
.product.empty::after {
  content: "COMING SOON";
  content: "COMING SOON" / "";
  color: var(--text-3);
  font-size: .625rem;
  letter-spacing: .28em;
  text-indent: .28em;
}

.scroll-hint { margin: 18px 0 0; text-align: center; }
.scroll-hint a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid rgba(var(--terra-a), .45);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--terra-deep);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}


/* ---------- 9. 會員中心 ---------- */
/* 身分切換：米灰軌道上的三段式分段控制；選中的那一段是一張浮起的紙卡，
   底部一條身分代表色（陶土／琥珀／鼠尾草）。 */
.roles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-1);
  margin-bottom: var(--s-4);
  padding: 5px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--sand);
  box-shadow: inset 0 1px 2px rgba(84, 58, 30, .08);
}
.roles a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: var(--s-2) var(--s-1);
  border-radius: 13px;
  color: var(--text-2);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color var(--fast), color var(--fast), box-shadow var(--fast);
}
.roles a small { display: block; margin-top: 3px; color: var(--role); font-size: .6875rem; font-weight: 700; letter-spacing: .06em; }
.roles a.r1 { --role: var(--terra-deep); }
.roles a.r2 { --role: var(--gold-1); }
.roles a.r3 { --role: var(--sage-deep); }
.roles a:hover { background: rgba(255, 253, 248, .6); color: var(--text); }
.roles a.on {
  background: var(--paper);
  box-shadow: inset 0 -3px 0 var(--role), 0 1px 2px rgba(84, 58, 30, .1), 0 8px 18px -12px rgba(84, 58, 30, .45);
  color: var(--text);
}
.roles a.on small { color: var(--role); }

/* 儀表卡 */
.stat {
  position: relative;
  min-width: 0;
  padding: 14px var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shine), 0 1px 2px rgba(84, 58, 30, .05);
}
.stat .k { color: var(--text-2); font-size: .75rem; font-weight: 700; letter-spacing: .08em; }
.stat .v { margin-top: 2px; font-family: var(--font-num); font-size: clamp(1.375rem, 6vw, 1.75rem); font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.stat .v small { margin-left: 2px; color: var(--text-3); font-family: var(--font); font-size: .75rem; font-weight: 500; letter-spacing: 0; }
.stat > .small, .stat > a { display: inline-flex; align-items: center; margin-top: 6px; font-size: .75rem; }
.stat > a { color: var(--terra-deep); font-weight: 700; text-decoration: none; }
.stat > a::before { content: "›"; order: 1; margin-left: var(--s-1); font-size: 1.1em; line-height: 1; }
.stat > a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.stat > a:focus-visible { outline: none; }
.stat > a:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; }
.stat:has(> a):hover { border-color: rgba(var(--terra-a), .5); box-shadow: var(--shine), var(--shadow); }

/* 每一頁的第一張儀表卡是主要餘額：琥珀紙、陶土數字，像一張集點卡 */
body:not(.admin) .cols-4 > .stat:first-child {
  border-color: rgba(var(--gold-a), .6);
  background:
    radial-gradient(110% 120% at 100% 0%, rgba(var(--gold-a), .28), transparent 60%),
    repeating-linear-gradient(135deg, rgba(var(--gold-a), .06) 0 1px, transparent 1px 6px),
    linear-gradient(160deg, #fffaf0, #f8edd5);
  box-shadow: var(--shine), 0 14px 28px -20px rgba(150, 105, 30, .55);
}
body:not(.admin) .cols-4 > .stat:first-child .v { color: var(--terra-deep); }
body:not(.admin) .cols-4 > .stat:first-child .v small { color: var(--text-2); }

.card .stat { border: 0; border-radius: 0; background: none; box-shadow: none; text-align: right; }


/* ---------- 10. 進行中的一局 ---------- */
/* 票券雙框：外框之內再一道琥珀細線；右上角一抹暖光 */
.live {
  border-color: rgba(var(--gold-a), .6);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(var(--gold-a), .16), transparent 55%),
    radial-gradient(100% 80% at 0% 100%, rgba(var(--sage-a), .08), transparent 60%),
    linear-gradient(180deg, #fffdf8, #fcf7ec);
  box-shadow: inset 0 0 0 5px var(--paper), inset 0 0 0 6px rgba(var(--gold-a), .4), var(--shadow-lift);
}
.live h2 { font-size: 1.3125rem; }
.live .row:first-child { flex-wrap: nowrap; align-items: flex-start; }
.live .row:first-child > :first-child { flex: 1 1 auto; min-width: 0; }
.live .row:first-child > .right { flex: none; }
.live .row .small strong { margin-left: 2px; color: var(--terra-deep); font-family: var(--font-num); font-size: 1.1875rem; }

.live .tag.amber::before { animation: live-pulse 1.8s ease-out infinite; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--gold-a), .8); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(var(--gold-a), 0); }
}

/* 倒數：墨藍計時牌上的琥珀數字（和 Logo、商品相框同一個深色） */
.live .timer {
  display: inline-block;
  padding: .14em .3em .12em;
  border-radius: 12px;
  background: var(--frame-grad);
  box-shadow: inset 0 0 0 1px rgba(var(--gold-a), .4), inset 0 1px 0 rgba(255, 255, 255, .1), 0 10px 22px -12px rgba(27, 38, 56, .7);
  color: var(--frame-text);
  font-family: var(--font-num);
  font-size: clamp(2.25rem, 10vw, 3rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  text-shadow: none;
}
.live .timer + .small { margin-top: 8px; font-size: .6875rem; letter-spacing: .24em; }

.live .bar {
  height: 10px;
  margin: var(--s-4) 0 14px;
  border-radius: var(--r-pill);
  background: var(--sand);
  box-shadow: inset 0 1px 2px rgba(84, 58, 30, .14);
  overflow: hidden;
}
.live .bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), #d27a42 60%, var(--terra));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: width 1s linear;
}
.live .btn.sm { padding: 10px var(--s-6); font-size: 1rem; font-weight: 700; }

.seats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.seats span {
  min-height: 40px;
  padding: 10px var(--s-1);
  border-radius: var(--r-sm);
  background: var(--sage-tint);
  box-shadow: inset 0 0 0 1px rgba(var(--sage-a), .3);
  color: var(--sage-ink);
  font-size: .78125rem;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seats span.free { background: none; box-shadow: none; outline: 1px dashed #c9bba5; outline-offset: -1px; color: var(--text-3); font-weight: 500; }
.seats span.me {
  background: var(--terra-btn);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 6px 14px -8px rgba(var(--terra-a), .9);
  color: #fff;
  font-weight: 800;
}

.result {
  margin-top: 14px;
  padding: var(--s-3) 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  font-size: .9375rem;
  line-height: 1.6;
}
.result.won { border-color: rgba(var(--sage-a), .45); background: var(--sage-tint); color: var(--sage-ink); }
.result.lost { border-color: rgba(var(--gold-a), .55); background: var(--amber-tint); color: #6e4e0c; }


/* ---------- 11. 後台：同一套品牌色，但以表格的清楚為優先 ---------- */
body.admin::before { background: linear-gradient(180deg, #f8f4ec 0%, var(--bg) 40%); }
.admin .wrap { max-width: 1320px; }
.admin .card, .admin .stat { background: var(--bg-solid); }
.admin .card .card { background: var(--paper-2); }
.admin th { background: #ece3d3; color: #3f382f; font-size: .78125rem; letter-spacing: .03em; }
.admin td { border-bottom-color: #e3d8c6; }
.admin tbody tr:nth-child(even) td { background: #faf6ee; }
.admin tbody tr:hover td { background: #fbf0dc; }


/* ---------- 12. 斷點（手機優先，往上加） ---------- */
@media (min-width: 561px) {
  .card { padding: var(--s-5); }
  .cols-2, .cols-3 { --cols: 2; }
  main > .wrap > .cols-2 { --cols: 1; }
  .cols-4 { gap: var(--s-4); }
  .products { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .hero { padding: var(--s-6); }
}

@media (min-width: 641px) {
  .topbar { top: 0; }
  .topbar .wrap { flex-wrap: nowrap; gap: var(--s-4); min-height: var(--bar-h); padding: 0 var(--gutter); }
  .brand { height: auto; padding: 0; }
  .topbar nav { flex: 0 1 auto; margin-left: auto; padding: 0; }
  .topbar nav > a, .topbar nav > .inline-form { flex: none; }
  .topbar nav a, .topbar nav button { padding: 0 14px; }
}

@media (max-width: 1023px) {
  .admin .topbar nav {
    padding-right: var(--s-6);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
}

@media (min-width: 861px) {
  :root { --gutter: 24px; }
  main { padding-top: var(--s-6); }
  .card { padding: var(--s-6); }
  .card .card { padding: var(--s-4) var(--s-5); }
  main > .wrap > .cols-2 { --cols: 2; }
  .cols-3 { --cols: 3; }
  .cols-4 { --cols: 4; }
  .split { grid-template-columns: 360px minmax(0, 1fr); gap: var(--s-6); }
  .split .products-side { order: 0; }
  .products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .scroll-hint { display: none; }
  .stat { padding: var(--s-4) var(--s-5); }
}

@media (min-width: 861px) and (min-height: 720px) {
  .split .auth-side { position: sticky; top: calc(var(--bar-h) + var(--s-5)); }
}


/* ---------- 13. 使用者偏好 ---------- */
@media (hover: hover) {
  a.product:hover {
    transform: translateY(-3px);
    border-color: #d6c6ac;
    box-shadow: var(--shine), var(--shadow-lift);
  }
  tbody tr:hover td { background: #fbf6ec; }
  .admin tbody tr:hover td { background: #fbf0dc; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* 漸層字：主視覺標題用陶土漸層（兩端都 ≥5:1）；倒數維持計時牌；
   商品佔位字在墨藍相框上用琥珀漸層。不支援時維持上面設定的純色。 */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1, .live .timer {
    background: var(--gold-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
  }
  .live .timer {                      /* 字是琥珀漸層，底仍是墨藍計時牌 */
    background: var(--brass-text), var(--frame-grad);
    -webkit-background-clip: text, border-box;
    background-clip: text, border-box;
    filter: none;
  }
  .product .pic {
    background: linear-gradient(180deg, #fbe9bb 30%, #e8bf68 50%, #c48f34 72%), var(--pic-art);
    -webkit-background-clip: text, border-box, border-box, border-box, border-box, border-box, border-box;
    background-clip: text, border-box, border-box, border-box, border-box, border-box, border-box;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
  }
}

/* 漸層外框：琥珀→陶土→鼠尾草的 1px 邊。不支援時維持上面設定的琥珀邊。 */
@supports ((-webkit-mask-composite: xor) or (mask-composite: exclude)) {
  .live { border-color: transparent; }
  .live::before {
    content: "";
    position: absolute;
    inset: -1px;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(var(--gold-a), .95), rgba(var(--terra-a), .5) 40%, rgba(var(--gold-a), .35) 70%, rgba(var(--sage-a), .7));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
  }
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topbar { background: rgba(255, 253, 248, .98); }
}

@media (prefers-contrast: more) {
  :root { --hairline: #b5a690; --line: #c4b6a0; --text-2: #463f36; --text-3: #544b40; --field-line: #6c6154; }
}

@media (forced-colors: active) {
  .hero h1, .live .timer, .product .pic { -webkit-text-fill-color: currentColor; }
  input[type=checkbox], input[type=radio] { -webkit-appearance: auto; appearance: auto; }
  .btn, .tag, .seats span, .roles a.on { border: 1px solid; }
}


/* ---------- 14. 圖示、首頁主視覺、商品頁 ---------- */
.icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.2em;
}

.eyebrow { margin: 0 0 6px; color: var(--sage-deep); font-size: .6875rem; font-weight: 700; letter-spacing: .28em; }
.gold-text { color: var(--terra-deep); }

/* 首頁主視覺：左邊品牌標語，右邊即時局次票券 */
.home-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  gap: var(--s-5);
  margin-bottom: var(--s-6);
  padding: 28px var(--s-5);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background:
    radial-gradient(70% 110% at 100% 0%, rgba(var(--gold-a), .26), transparent 60%),
    radial-gradient(60% 90% at 78% 100%, rgba(var(--terra-a), .1), transparent 65%),
    radial-gradient(80% 120% at 0% 100%, rgba(var(--sage-a), .14), transparent 60%),
    repeating-linear-gradient(0deg, rgba(120, 96, 60, .02) 0 1px, transparent 1px 3px),
    linear-gradient(135deg, #fffdf8 0%, #fbf4e6 100%);
  box-shadow: var(--shine), var(--shadow-lift);
}
.home-hero::before {                  /* 右上角的同心圓細線（陶盤轆轤紋） */
  content: "";
  position: absolute;
  z-index: -1;
  top: -180px;
  right: -140px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 17px, rgba(var(--terra-a), .13) 17px 18px);
  -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 70%);
  mask-image: radial-gradient(circle, #000 25%, transparent 70%);
}
.home-hero h1 { margin: 0 0 .5em; color: var(--text); font-size: clamp(1.75rem, 7vw, 2.75rem); line-height: 1.3; letter-spacing: .05em; }
.home-hero h1 .gold-text { font-size: .72em; letter-spacing: .06em; }
.home-hero .lead { max-width: 34em; margin: 0; color: var(--text-2); font-size: 1rem; line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-5); }
.hero-actions .btn { min-width: 148px; }

.hero-live {                          /* 即時局次＝一張票券：紙白、雙框、浮起 */
  align-self: center;
  padding: var(--s-4) 18px;
  border: 1px solid rgba(var(--gold-a), .6);
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px rgba(var(--gold-a), .35), var(--shadow-lift);
}
.hero-live-head { display: flex; align-items: center; gap: var(--s-2); padding-bottom: 12px; border-bottom: 1px dashed #dccfb9; color: var(--text-2); font-size: .8125rem; font-weight: 700; letter-spacing: .06em; }
.live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--terra); animation: live-pulse-coral 1.8s ease-out infinite; }
@keyframes live-pulse-coral {
  0% { box-shadow: 0 0 0 0 rgba(var(--terra-a), .65); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(var(--terra-a), 0); }
}
.hero-live-timer {                    /* 小型墨藍計時牌 */
  margin-left: auto;
  padding: 6px 10px 5px;
  border-radius: 9px;
  background: var(--frame-grad);
  box-shadow: inset 0 0 0 1px rgba(var(--gold-a), .4), 0 6px 14px -8px rgba(27, 38, 56, .7);
  color: var(--frame-text);
  font-family: var(--font-num);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
}
.hero-live-body { display: flex; align-items: center; gap: var(--s-3); margin-top: 14px; }
.hero-live-pic {
  flex: none;
  width: 96px;
  aspect-ratio: 3 / 2;
  border-radius: var(--r-sm);
  background: var(--frame-grad) center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(var(--gold-a), .35), 0 0 0 3px var(--paper), 0 0 0 4px var(--hairline);
}
.hero-live-name { font-weight: 700; line-height: 1.45; }
.hero-live-meta { margin-top: 2px; }
.hero-live-meta strong { color: var(--terra-deep); font-family: var(--font-num); font-size: 1.25rem; font-weight: 800; }
.hero-live-meta s { margin-left: 4px; color: var(--text-3); font-size: .8125rem; }
.hero-live-foot { color: var(--text-2); }

/* 細進度條（首頁即時卡、商品頁販售進度） */
.live-bar {
  height: 6px;
  margin: 14px 0 10px;
  border-radius: var(--r-pill);
  background: var(--sand);
  box-shadow: inset 0 1px 1px rgba(84, 58, 30, .12);
  overflow: hidden;
}
.live-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), #d27a42 60%, var(--terra));
  transition: width 1s linear;
}

/* 區塊標題 */
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-4); }
.section-head h2 { margin: 0; font-size: 1.3125rem; }
.center-head { justify-content: center; text-align: center; }

/* 首頁登入卡：已登入時的兩個餘額 */
.mini-balances { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); margin: 0 0 var(--s-4); }
.mini-balances > div {
  display: flex;
  flex-direction: column;
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.mini-balances strong { color: var(--terra-deep); font-family: var(--font-num); font-size: 1.375rem; line-height: 1.3; }

/* 三重身分介紹 */
.role-section, .steps-section { margin-top: 56px; }
.role-cards { display: grid; gap: var(--s-4); }
.role-card {
  padding: var(--s-5);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--role-line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shine), var(--shadow);
}
.role-card h3 { margin: 14px 0 6px; color: var(--text); font-size: 1.125rem; letter-spacing: .06em; }
.role-card p { margin: 0; color: var(--text-2); font-size: .9375rem; line-height: 1.8; }
.role-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(var(--role-a), .13);
  box-shadow: inset 0 0 0 1px rgba(var(--role-a), .35);
  color: var(--role);
}
.role-icon .icon { width: 24px; height: 24px; }
.role-card { --role: var(--gold-1); --role-a: var(--gold-a); --role-line: var(--amber); }
.role-card:nth-child(1) { --role: var(--terra-deep); --role-a: var(--terra-a); --role-line: var(--terra); }
.role-card:nth-child(3) { --role: var(--sage-deep); --role-a: var(--sage-a); --role-line: var(--sage); }

/* 參加步驟：陶土細框圓圈裡的襯線數字 */
.steps { display: grid; gap: var(--s-3); margin: 0; padding: 0; list-style: none; }
.step {
  position: relative;
  padding: 18px var(--s-5) 18px 74px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--paper-2);
}
.step-no {
  position: absolute;
  left: var(--s-5);
  top: 18px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--terra);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--paper-2), 0 0 0 4px rgba(var(--terra-a), .25);
  color: var(--terra-deep);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 700;
}
.step h3 { margin: 0 0 4px; color: var(--text); font-size: 1rem; letter-spacing: .04em; }
.step p { margin: 0; color: var(--text-2); font-size: .875rem; line-height: 1.75; }

/* 商品內頁 */
.crumbs { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); color: var(--text-3); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--terra-deep); text-decoration: underline; }
.product-detail { display: grid; gap: var(--s-6); }
.pd-pic {                             /* 大相框：紙白卡紙＋墨藍畫心＋琥珀內線 */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  border: 10px solid var(--paper);
  border-radius: var(--r-lg);
  background: var(--frame-grad);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-lift);
  color: var(--frame-text);
  font-family: var(--font-serif);
  font-size: 5rem;
  font-weight: 700;
}
.pd-pic::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: calc(var(--r-lg) - 10px);
  box-shadow: inset 0 0 0 1px rgba(var(--gold-a), .35);
  pointer-events: none;
}
.pd-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pd-info h1 { margin-bottom: .4em; font-size: clamp(1.5rem, 5vw, 2rem); letter-spacing: .04em; }
.pd-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: var(--s-5); padding-bottom: var(--s-4); border-bottom: 1px solid var(--line); }
.pd-price strong { color: var(--terra-deep); font-family: var(--font-num); font-size: 2.375rem; font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.pd-price .unit { color: var(--text-2); font-weight: 600; }
.pd-price s { color: var(--text-3); }
.pd-facts {
  margin: 0 0 var(--s-5);
  padding: var(--s-1) var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shine);
  list-style: none;
}
.pd-facts li { display: flex; align-items: center; gap: var(--s-3); padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .9375rem; }
.pd-facts li:last-child { border-bottom: 0; }
.pd-facts .icon { width: 20px; height: 20px; color: var(--sage-deep); }
.pd-facts strong { color: var(--text); }
.pd-desc { margin-bottom: var(--s-5); color: var(--text-2); line-height: 1.9; white-space: pre-line; }
.pd-sub { margin: var(--s-5) 0 var(--s-2); font-size: 1.0625rem; }
.pd-date { padding: var(--s-3) 0 2px; border-bottom: 1px solid var(--line); }
.pd-date .live-bar { margin: 10px 0 var(--s-2); }
.pd-cta { margin-top: var(--s-5); }

/* 登入、註冊等單張卡片頁：卡片上方的品牌標誌 */
.auth-brand { display: flex; justify-content: center; margin-bottom: var(--s-3); }
.auth-brand svg {
  width: 60px;
  height: 60px;
  padding: 10px;
  border-radius: 16px;
  background: var(--frame-grad);
  box-shadow: inset 0 0 0 1px rgba(var(--gold-a), .55), inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 3px var(--paper), 0 0 0 4px rgba(var(--gold-a), .45), 0 14px 28px -14px rgba(27, 38, 56, .6);
}
.auth-card > h1 { text-align: center; }
.auth-card > h1::before { display: none; }

/* 身分分頁與儀表卡上的圖示 */
.roles a { min-height: 64px; }
.roles a .icon { width: 20px; height: 20px; margin-bottom: 3px; color: var(--role); }
.roles a.on .icon { color: var(--role); }
.stat .k { display: flex; align-items: center; gap: 6px; }
.stat .k .icon { width: 15px; height: 15px; color: var(--sage-deep); }

@media (min-width: 561px) {
  .home-hero { padding: 36px 32px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 861px) {
  .home-hero { grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); align-items: center; gap: 40px; padding: 44px; }
  .role-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .step { padding: 68px var(--s-5) var(--s-5); }
  .product-detail { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: 40px; }
  .pd-media { position: sticky; top: calc(var(--bar-h) + var(--s-5)); }
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .gold-text, .pd-price strong {
    background: var(--gold-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .hero-live-timer {                  /* 字是琥珀漸層，底仍是墨藍計時牌 */
    background: var(--brass-text), var(--frame-grad);
    -webkit-background-clip: text, border-box;
    background-clip: text, border-box;
    -webkit-text-fill-color: transparent;
  }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}
@media (forced-colors: active) {
  .gold-text, .hero-live-timer, .pd-price strong { -webkit-text-fill-color: currentColor; }
}


/* ---------- 開獎動畫（會員中心・消費者） ---------- */
.draw-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--s-4);
  background: rgba(27, 38, 56, .58);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: draw-fade .25s ease-out;
}
.draw-overlay.hide { display: none !important; }
.draw-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: var(--s-5);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 0 0 6px rgba(255, 253, 248, .35), 0 30px 60px -20px rgba(20, 28, 43, .6);
  animation: draw-pop .35s cubic-bezier(.2, .9, .3, 1.2);
}
.draw-head { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-4); }
.draw-pic {
  flex: none;
  width: 104px;
  aspect-ratio: 3 / 2;
  border: 4px solid var(--paper);
  border-radius: 12px;
  background: var(--frame-grad) center / cover no-repeat;
  box-shadow: 0 0 0 1px var(--hairline), 0 8px 18px -10px rgba(20, 28, 43, .6);
}
.draw-kicker { margin: 0 0 2px; color: var(--terra-deep); font-size: .75rem; font-weight: 700; letter-spacing: .2em; }
.draw-head h2 { margin: 0; font-size: 1.5rem; }
.draw-head h2::before { display: none; }
.draw-product { margin: 2px 0 0; color: var(--text-2); font-size: .9375rem; }

.draw-seats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.draw-seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 82px;
  padding: 10px 4px 8px;
  border: 1.5px solid var(--hairline);
  border-radius: 14px;
  background: var(--paper-2);
  text-align: center;
  transition: transform .12s ease, border-color .12s, background-color .2s, opacity .3s;
}
.draw-seat .no { color: var(--text-3); font-size: .6875rem; font-weight: 700; letter-spacing: .1em; }
.draw-seat .nm { max-width: 100%; overflow: hidden; font-size: .8125rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.draw-seat .st { min-height: 1.4em; font-size: .75rem; font-weight: 700; }
.draw-seat.me { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.draw-seat.hot {
  transform: translateY(-3px) scale(1.04);
  border-color: var(--terra);
  background: var(--terra-tint);
  box-shadow: 0 0 0 4px rgba(var(--terra-a), .18), 0 10px 20px -10px rgba(var(--terra-a), .7);
}
.draw-seat.win {
  border-color: var(--sage-deep);
  background: var(--sage-deep);
  color: #fff;
  animation: draw-stamp .45s cubic-bezier(.2, .9, .3, 1.3);
}
.draw-seat.win .no, .draw-seat.win .st { color: #fff; }
.draw-seat.win::after {               /* 成交印章 */
  content: "";
  position: absolute;
  top: -8px;
  right: -6px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--amber) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.draw-seat.lose { opacity: .72; }
.draw-seat.lose .st { color: var(--gold-1); }

.draw-msg {
  margin: var(--s-4) 0;
  padding: var(--s-3) var(--s-4);
  border-radius: 12px;
  background: var(--sand);
  color: var(--text);
  font-size: .9375rem;
  line-height: 1.6;
  text-align: center;
}
.draw-msg.won { background: var(--sage-tint); color: var(--sage-ink); font-weight: 700; }
.draw-msg.lost { background: var(--amber-tint); color: var(--gold-1); }

@keyframes draw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw-pop { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes draw-stamp { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

@media (max-width: 420px) {
  .draw-seats { gap: 6px; }
  .draw-seat { min-height: 74px; padding: 8px 2px 6px; }
  .draw-seat .nm { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .draw-overlay, .draw-card, .draw-seat.win { animation: none; }
}
