* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* === 莊敬品牌色系（依官方 A02 色票）=== */
  --brand-yellow:     #FFCD00;  /* PANTONE 116C — 暖黃 */
  --brand-green-pure: #30B700;  /* PANTONE 2421C — 純品牌綠 */
  --brand-green-sage: #A1D884;  /* PANTONE 359C — 草綠輔助色 */
  --brand-orange:     #FF6720;  /* PANTONE 165C — 橘 */
  --brand-black:      #101820;  /* PANTONE Black 6C */

  /* === 衍生變數（保留 token 名讓 100+ 處 var() 自動套色）=== */
  --green-deep:  #2E9F00;  /* hover/active 略深 */
  --green-main:  #30B700;  /* CTA 主色 */
  --green-light: #A1D884;  /* 柔和區塊 */
  --green-bg:    #F1F8E9;  /* 極淡草綠底 */

  --gold:        #FFCD00;
  --gold-light:  #FFF59D;

  --green-text:  #1F8500;  /* 在白底可讀的深綠（4.75:1 AA pass）— 用於連結、強調文字 */
  --orange-text: #BF360C;  /* 在白底可讀的深橘（5.52:1 AA pass）— 用於警示、限時文字 */
  --orange-soft-bg: #FFF3E8;  /* 淡橘底（取代以前的 #FFEBEE 粉紅底）*/
  --pink-soft-bg: #FFF8E1;   /* 生日溫暖底色，淡黃取代以前的粉紅 */

  --bg:          #FAFAF5;  /* 米白頁面底 */
  --card:        #FFFFFF;
  --text:        #101820;
  --text-sub:    #5F6B66;
  --text-muted:  #A5AFB9;
  --border:      #E8EFE0;  /* 淡綠調分隔線 */
  --danger:      #FF6720;  /* 用品牌橘取代紅 */

  --shadow-sm: 0 2px 8px rgba(16,24,32,0.04);
  --shadow-md: 0 4px 16px rgba(16,24,32,0.06);
  --shadow-lg: 0 8px 32px rgba(16,24,32,0.10);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  font-size: var(--base-font, 17px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== A11y：字體放大（每階 +25%，有感）===== */
/* body 寫死 17px 會覆蓋 html 的百分比，所以這裡明確把 body + 常見元素一起放大 */
html[data-fontsize="large"]   { font-size: 120%; }
html[data-fontsize="xlarge"]  { font-size: 145%; }

html[data-fontsize="large"]  body { font-size: 20px; }
html[data-fontsize="xlarge"] body { font-size: 24px; }

/* 主要互動元件用 px 寫死，要明確 override 才會有感 */
html[data-fontsize="large"]  .menu-item,
html[data-fontsize="large"]  .btn-primary,
html[data-fontsize="large"]  .btn-secondary,
html[data-fontsize="large"]  .nav-item,
html[data-fontsize="large"]  .toast,
html[data-fontsize="large"]  .reward-name,
html[data-fontsize="large"]  .coupon-name,
html[data-fontsize="large"]  .celebrate-msg,
html[data-fontsize="large"]  h2,
html[data-fontsize="large"]  h3 { font-size: 1.15em; }

html[data-fontsize="xlarge"] .menu-item,
html[data-fontsize="xlarge"] .btn-primary,
html[data-fontsize="xlarge"] .btn-secondary,
html[data-fontsize="xlarge"] .nav-item,
html[data-fontsize="xlarge"] .toast,
html[data-fontsize="xlarge"] .reward-name,
html[data-fontsize="xlarge"] .coupon-name,
html[data-fontsize="xlarge"] .celebrate-msg,
html[data-fontsize="xlarge"] h2,
html[data-fontsize="xlarge"] h3 { font-size: 1.3em; }

/* ===== A11y：高對比模式（黃底黑字，最強對比）===== */
html[data-contrast="high"] body {
  background: #FFEB3B !important;
}
html[data-contrast="high"] .page,
html[data-contrast="high"] .content {
  background: #FFEB3B !important;
}
html[data-contrast="high"] .points-card,
html[data-contrast="high"] .credits-progress-card,
html[data-contrast="high"] .checkin-card,
html[data-contrast="high"] .block,
html[data-contrast="high"] .menu-item,
html[data-contrast="high"] .task-item,
html[data-contrast="high"] .slot-banner,
html[data-contrast="high"] .reward-card,
html[data-contrast="high"] .coupon-row {
  background: #FFFFFF !important;
  border: 3px solid #000 !important;
  color: #000 !important;
  box-shadow: 4px 4px 0 #000 !important;
}
html[data-contrast="high"] .points-card,
html[data-contrast="high"] .points-card * {
  background: #000 !important;
  color: #FFEB3B !important;
}
html[data-contrast="high"] .topbar {
  background: #000 !important;
  color: #FFEB3B !important;
  border-bottom: 3px solid #FFEB3B;
}
html[data-contrast="high"] .topbar * { color: #FFEB3B !important; }
html[data-contrast="high"] .bottom-nav {
  background: #000 !important;
  border-top: 3px solid #FFEB3B;
}
html[data-contrast="high"] .nav-item { color: #FFEB3B !important; }
html[data-contrast="high"] .nav-item.active { color: #FFFFFF !important; font-weight: 900; }
html[data-contrast="high"] .btn-primary {
  background: #000 !important; color: #FFEB3B !important;
  border: 3px solid #FFEB3B !important;
  font-weight: 900 !important;
}
html[data-contrast="high"] .btn-secondary {
  background: #FFEB3B !important; color: #000 !important;
  border: 3px solid #000 !important;
}
html[data-contrast="high"] *, html[data-contrast="high"] body {
  text-shadow: none !important;
}

/* ===== A11y：觸控區放大 ===== */
.btn-primary, .btn-secondary, .menu-item, .nav-item, .task-action,
.btn-checkin, .checkin-btn, .slot-spin-btn, .reward-card, .reward-mini {
  min-height: 48px;
}
html[data-fontsize="large"] .btn-primary,
html[data-fontsize="large"] .btn-secondary,
html[data-fontsize="large"] .menu-item,
html[data-fontsize="large"] .checkin-btn,
html[data-fontsize="xlarge"] .btn-primary,
html[data-fontsize="xlarge"] .btn-secondary,
html[data-fontsize="xlarge"] .menu-item,
html[data-fontsize="xlarge"] .checkin-btn { min-height: 56px; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.page {
  display: none;
  min-height: 100vh;
  position: relative;
  padding-bottom: 70px;
}
.page.active { display: block; }

.content {
  padding: 16px;
}

.bottom-spacer {
  height: 40px;
}

/* ========== 登入頁 ========== */
#page-login {
  background: linear-gradient(180deg, #FFF8E1 0%, var(--brand-green-sage) 100%);
  min-height: 100vh;
  padding-bottom: 0;
}

.login-wrap {
  padding: 60px 28px 40px;
  text-align: center;
  color: var(--brand-black);  /* WCAG: 黑字配草綠底（11.1:1 AAA）*/
}

.brand-mark {
  font-size: 80px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

.brand-title {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 4px;
  letter-spacing: 1px;
  color: var(--brand-black);  /* 11.1:1 對比 */
}

.brand-sub {
  font-size: 16px;
  opacity: 0.75;
  margin-bottom: 40px;
  color: var(--brand-black);  /* 8:1 對比（opacity 後仍 >4.5）*/
}

.login-form {
  background: white;
  color: var(--text);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  text-align: left;
}

.login-form label {
  display: block;
  margin-bottom: 16px;
}

.login-form label > span {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 17px;
  background: #FAFAFA;
  transition: border 0.15s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--green-text);
  background: white;
}

.hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 16px;
  line-height: 1.7;
}

.btn-line-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: #06C755;
  color: white;
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 800;  /* 加粗 700→800 提升白字可讀性 */
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(6,199,85,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.18);  /* 微陰影強化白字輪廓（LINE 品牌色綠 + 白字邊緣對比技巧）*/
  transition: transform 0.1s, background 0.15s;
}
.btn-line-login:active { transform: scale(0.98); background: #05A847; }

/* Hero LINE 按鈕（登入頁主視覺） */
.btn-line-hero {
  padding: 22px;
  font-size: 22px;
  border-radius: 16px;
  margin-bottom: 8px;
  box-shadow: 0 6px 20px rgba(6,199,85,0.4);
}
.login-hero-hint {
  text-align: center;
  font-size: 14px;
  color: var(--green-text);  /* WCAG: 深綠 4.75:1（原 #06C755 只有 2.29:1）*/
  font-weight: 700;
  margin-bottom: 24px;
}
.login-fallback {
  text-align: center;
  font-size: 14px;
  color: var(--text-sub);
  margin-top: 16px;
}
.login-fallback a {
  color: var(--green-text);  /* WCAG: 深綠 4.75:1（原 #30B700 只有 2.64:1）*/
  text-decoration: underline;
  margin-left: 4px;
  font-weight: 700;  /* 加粗強化可讀 */
}

/* 主畫面頂部黃色提醒條 */
.bind-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, #FFE082, #FFCA28);
  color: #6F4F00;
  padding: 12px 16px;
  margin: 0;
  cursor: pointer;
  border-bottom: 2px solid #FF8F00;
  animation: bindPulse 2.5s ease-in-out infinite;
}
@keyframes bindPulse {
  0%, 100% { background: linear-gradient(90deg, #FFE082, #FFCA28); }
  50% { background: linear-gradient(90deg, #FFCA28, #FFA000); }
}
.bind-banner-icon { font-size: 24px; }
.bind-banner-text { flex: 1; }
.bind-banner-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
}
.bind-banner-text small {
  display: block;
  font-size: 12px;
  color: #8F6300;
  margin-top: 2px;
}
.bind-banner-cta {
  background: #BF360C;
  color: #fff;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* 加 OA 好友提醒（LINE 綠系，跟黃色補手機條視覺區隔）*/
.friendship-banner {
  background: linear-gradient(90deg, #C8E6C9, #81C784);
  color: #1B5E20;
  border-bottom: 2px solid #2E7D32;
  animation: none;
}
.friendship-banner .bind-banner-text small {
  color: #2E7D32;
}
.friendship-banner .bind-banner-cta {
  background: #00B900;
}

/* ⚡ 限時搶購 banner */
.flash-sale-banners {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flash-sale-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  background: linear-gradient(135deg, #FF6720 0%, #D34A1E 100%);
  color: #fff;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 2px solid #8B0000;
  position: relative;
  overflow: hidden;
  animation: flashPulse 1.8s ease-in-out infinite;
}
.flash-sale-banner.sold-out,
.flash-sale-banner.claimed {
  animation: none;
  background: #757575;
  border-bottom-color: #424242;
  cursor: default;
}
@keyframes flashPulse {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(255,255,0,0); }
  50% { box-shadow: inset 0 -3px 8px 0 rgba(255,255,0,0.5); }
}
.flash-sale-img {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #fff;
  flex-shrink: 0;
}
.flash-sale-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  flex-shrink: 0;
}
.flash-sale-text { flex: 1; min-width: 0; }
.flash-sale-text .fs-title {
  font-size: 14px;
  font-weight: 900;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flash-sale-text .fs-price {
  font-size: 13px;
  font-weight: 700;
}
.flash-sale-text .fs-price s { opacity: 0.7; }
.flash-sale-text .fs-quota {
  font-size: 11px;
  opacity: 0.95;
  margin-top: 2px;
}
.flash-sale-cta {
  background: #FFEB3B;
  color: var(--orange-text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  flex-shrink: 0;
  animation: ctaJump 1s ease-in-out infinite;
}
@keyframes ctaJump {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.flash-sale-banner.sold-out .flash-sale-cta,
.flash-sale-banner.claimed .flash-sale-cta {
  background: #BDBDBD;
  color: #424242;
  animation: none;
}

/* 集氣拼團模式 */
.flash-sale-banner.group-buy {
  background: linear-gradient(135deg, #1976D2 0%, #0D47A1 100%);
  border-bottom-color: #002171;
}
.flash-sale-banner.group-buy.joined {
  background: linear-gradient(135deg, #30B700 0%, #2E9F00 100%);
  border-bottom-color: #003D00;
}
.flash-sale-banner.group-buy .flash-sale-cta {
  background: #FFEB3B;
  color: #0D47A1;
}
.flash-sale-banner.group-buy.joined .flash-sale-cta {
  background: #fff;
  color: #2E9F00;
}

/* 倒數計時器 */
.fs-countdown {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.fs-countdown.urgent {
  background: #FFEB3B;
  color: var(--orange-text);
  animation: countdownPulse 0.6s ease-in-out infinite;
}
@keyframes countdownPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* 社會證明動態條 */
.fs-social-proof {
  font-size: 10px;
  opacity: 0.92;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

/* ⚡ 福利集氣牆入口（首頁 banner 下方） */
.flash-wall-entry {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin: 12px 16px;
  background: linear-gradient(135deg, #FF8A65 0%, #FF6720 100%);
  color: #fff;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(255,82,82,0.3);
}
.flash-wall-entry-icon { font-size: 26px; }
.flash-wall-entry-text { flex: 1; }
.flash-wall-entry-title { font-size: 15px; font-weight: 900; }
.flash-wall-entry-sub { font-size: 12px; opacity: 0.95; margin-top: 2px; }
.flash-wall-entry-arrow { font-size: 20px; }

/* 集氣牆 modal 內 tabs */
.fw-tabs {
  display: flex;
  gap: 4px;
  background: #f0f0f0;
  border-radius: 12px;
  padding: 4px;
  margin: 14px 0 10px;
}
.fw-tab {
  flex: 1;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-sub);
}
.fw-tab.active {
  background: #fff;
  color: var(--orange-text);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* 集氣牆內的卡片 */
.fw-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 2px solid var(--orange-soft-bg);
  border-radius: 12px;
  margin-bottom: 8px;
  text-align: left;
}
.fw-card.upcoming { border-color: #E1D5FF; background: #F5F0FF; }
.fw-card.ended { border-color: #E0E0E0; background: #FAFAFA; opacity: 0.85; }
.fw-card.group-buy { border-color: #BBDEFB; background: #E3F2FD; }
.fw-card-img {
  width: 64px; height: 64px;
  object-fit: cover; border-radius: 8px;
  flex-shrink: 0;
}
.fw-card-icon {
  width: 64px; height: 64px;
  background: var(--orange-soft-bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}
.fw-card-body { flex: 1; min-width: 0; }
.fw-card-title { font-size: 14px; font-weight: 900; margin-bottom: 2px; }
.fw-card-price { font-size: 13px; color: var(--text-sub); }
.fw-card-meta { font-size: 11px; color: var(--text-sub); margin-top: 4px; }
.fw-card-cta {
  background: linear-gradient(135deg, #FF6720, #D34A1E);
  color: #fff; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 900; align-self: center;
  flex-shrink: 0; cursor: pointer; border: none;
}
.fw-card-cta.disabled { background: #BDBDBD; color: #757575; cursor: default; }
.fw-card-cta.gb { background: linear-gradient(135deg, #1976D2, #0D47A1); }
.fw-card-cta.joined { background: #fff; color: #2E9F00; border: 2px solid #30B700; }

/* 🗳️ 投票區塊 */
.poll-card { padding: 14px; background: linear-gradient(135deg, #EEF2FF 0%, #C7D2FE 100%); border-radius: 12px; }
.poll-question { font-size: 16px; font-weight: 900; color: #312E81; margin-bottom: 10px; }
.poll-option {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  background: #fff; border: 2px solid #E0E7FF;
  border-radius: 10px; cursor: pointer;
  transition: all 0.15s;
}
.poll-option:hover { border-color: #6366F1; transform: translateY(-1px); }
.poll-option.disabled { cursor: default; opacity: 0.85; }
.poll-option.selected { background: linear-gradient(135deg,#6366F1,#3730A3); color: #fff; border-color: #3730A3; }
.poll-option-id {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: #6366F1; color: #fff; font-weight: 900; font-size: 13px;
  flex-shrink: 0;
}
.poll-option.selected .poll-option-id { background: #fff; color: #3730A3; }
.poll-option-text { flex: 1; font-size: 14px; font-weight: 600; }
.poll-option-bar {
  width: 80px; height: 8px; background: #E5E7EB; border-radius: 4px; overflow: hidden;
  flex-shrink: 0;
}
.poll-option-bar > div { height: 100%; background: linear-gradient(90deg,#6366F1,#3730A3); transition: width 0.3s; }
.poll-option.selected .poll-option-bar { background: rgba(255,255,255,0.3); }
.poll-option.selected .poll-option-bar > div { background: #fff; }
.poll-option-pct { font-size: 12px; font-weight: 700; min-width: 36px; text-align: right; }
.poll-meta { font-size: 11px; color: #4338CA; margin-top: 8px; opacity: 0.85; }

/* 🌟 許願池 */
.wish-row {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px; background: #fff;
  border: 2px solid #FEF3C7; border-radius: 10px;
  margin-bottom: 6px;
}
.wish-row.fulfilled { opacity: 0.6; background: #F5F5F5; border-color: #E0E0E0; }
.wish-row-content { flex: 1; min-width: 0; }
.wish-row-name { font-size: 14px; font-weight: 700; color: #92400E; }
.wish-row.fulfilled .wish-row-name { color: #757575; }
.wish-row-meta { font-size: 11px; color: #B45309; opacity: 0.85; margin-top: 2px; }
.wish-like-btn {
  background: linear-gradient(135deg,#FCD34D,#F59E0B);
  color: #fff; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 900; white-space: nowrap;
}
.wish-like-btn.liked { background: #fff; color: #92400E; border: 2px solid #FCD34D; }
.wish-like-btn[disabled] { opacity: 0.5; cursor: default; }

/* 🎂 生日 banner — 暖黃慶祝色（取代粉紅，對齊品牌）*/
.birthday-banner {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, #FFF59D, #FFCD00);
  color: var(--brand-black);
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 2px solid #E0AC00;
  animation: bdayShine 2s ease-in-out infinite;
}
@keyframes bdayShine {
  0%, 100% { background: linear-gradient(90deg, #FFF59D, #FFCD00); }
  50% { background: linear-gradient(90deg, #FFCD00, #FFB300); }
}
.birthday-banner-icon { font-size: 26px; }
.birthday-banner-text { flex: 1; }
.birthday-banner-text strong { display: block; font-size: 15px; font-weight: 800; }
.birthday-banner-text small { display: block; font-size: 12px; opacity: 0.85; margin-top: 2px; }
.birthday-banner-cta {
  background: var(--brand-black); color: var(--gold);
  padding: 6px 12px; border-radius: 16px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
}

/* ⏰ 到期提醒 banner */
.expiry-banner {
  display: flex; align-items: center; gap: 12px;
  background: #FFF3E0; color: #BF360C;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #FFCCBC;
}
.expiry-banner-icon { font-size: 22px; }
.expiry-banner-text { flex: 1; }
.expiry-banner-text strong { display: block; font-size: 14px; font-weight: 700; }
.expiry-banner-text small { display: block; font-size: 12px; color: #8F4400; margin-top: 2px; }

/* Modal 鎖定背景：禁止點外面關閉 */
.modal.modal-locked {
  pointer-events: auto;
}
.modal.modal-locked > .modal-content {
  pointer-events: auto;
}

.login-divider {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 16px 0;
  position: relative;
}
.login-divider::before, .login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: var(--border);
}
.login-divider::before { left: 0; }
.login-divider::after { right: 0; }
.login-divider span { background: white; padding: 0 12px; }

/* ========== 按鈕 ========== */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--green-main);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 700;
  transition: transform 0.1s, background 0.15s;
}
.btn-primary:active { transform: scale(0.98); background: var(--green-deep); }

.btn-large { padding: 16px; font-size: 18px; }

.btn-secondary {
  display: block;
  width: 100%;
  padding: 14px;
  background: white;
  color: var(--green-text);
  border: 2px solid var(--green-main);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
}
.btn-secondary:active { background: var(--green-bg); }

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.btn-back {
  width: 36px;
  height: 36px;
  font-size: 24px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-link {
  color: var(--green-text);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 0;
}

.btn-link-light {
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  padding: 4px 0;
}

/* ========== Topbar ========== */
.topbar {
  background: linear-gradient(180deg, var(--brand-green-sage) 0%, #C8E6B0 100%);
  color: var(--brand-black);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.store-tag {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 2px;
}

.user-greet {
  font-size: 19px;
  font-weight: 700;
}

.topbar-page {
  background: white;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
  text-align: center;
}

.topbar-right {
  min-width: 36px;
  text-align: right;
}

.points-mini {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  background: #FFF8E1;
  padding: 6px 10px;
  border-radius: 999px;
}

/* ========== 積分卡 ========== */
.points-card {
  background: linear-gradient(135deg, var(--brand-green-sage) 0%, #8BC366 100%);
  color: var(--brand-black);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.points-card::before {
  content: '🍀';
  position: absolute;
  right: -10px;
  top: -10px;
  font-size: 100px;
  opacity: 0.1;
  transform: rotate(20deg);
}

.points-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.points-value {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.points-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.streak-pill {
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.streak-pill strong { font-weight: 900; font-size: 15px; margin: 0 2px; }

.credits-progress-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.credits-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}
.credits-progress-head > span:first-child { color: var(--text); }
.credits-progress-num { color: var(--gold); font-size: 13px; font-weight: 900; }
.credits-progress-bar {
  background: #F0F0F0;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 6px;
}
.credits-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, #FF6F00 100%);
  border-radius: 6px;
  transition: width 0.5s ease-out;
}
.credits-progress-hint {
  font-size: 11px;
  color: var(--text-sub);
}

.points-expire {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.2);
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.points-expire.warn {
  background: #FFF3E0;
  color: #E65100;
  margin: 12px -20px -24px;
  padding: 10px 20px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: 2px solid #FFB74D;
  font-weight: 700;
  opacity: 1;
}

.expiring-card {
  background: #FFF8E1;
  border: 2px solid #FFB300;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.expiring-head {
  font-weight: 900;
  color: #E65100;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.expiring-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed #FFD54F;
  font-size: 14px;
}
.expiring-row:first-of-type { border-top: none; padding-top: 4px; }
.expiring-row .expiring-icon { font-size: 24px; }
.expiring-row .expiring-meta { flex: 1; }
.expiring-row .expiring-days { color: var(--danger); font-weight: 900; font-size: 13px; }

.announce-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border-left: 4px solid var(--green-main);
  background: #F8F9FA;
}
.announce-item.promo  { border-left-color: var(--gold);   background: #FFF8E1; }
.announce-item.urgent { border-left-color: var(--danger); background: var(--orange-soft-bg); }
.announce-item.pickup { border-left-color: #1A237E;       background: #E8EAF6; }
.announce-title { font-weight: 900; font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.announce-body { font-size: 14px; color: var(--text); line-height: 1.5; white-space: pre-wrap; }
.announce-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ========== 打卡卡片 ========== */
.checkin-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.checkin-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--gold) 0%, #FF9800 100%);
  color: white;
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 12px rgba(255,152,0,0.3);
  transition: transform 0.1s;
}
.checkin-btn:active:not(:disabled) { transform: scale(0.98); }
.checkin-btn:disabled {
  background: #BDBDBD;
  box-shadow: none;
  cursor: not-allowed;
}

.checkin-btn-icon { font-size: 32px; }
.checkin-btn-main { flex: 1; text-align: left; }
.checkin-btn-title { font-size: 18px; font-weight: 900; }
.checkin-btn-sub { font-size: 12px; opacity: 0.95; margin-top: 2px; }
.checkin-btn-arrow { font-size: 22px; }

.streak-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 14px;
}

.streak-day {
  aspect-ratio: 1;
  border-radius: 8px;
  background: #F0F0F0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  position: relative;
}
.streak-day.done {
  background: var(--green-bg);
  color: var(--green-deep);
  font-weight: 700;
}
.streak-day.done::before {
  content: '✓';
  font-size: 16px;
  font-weight: 900;
}
.streak-day.done .streak-label { display: none; }
.streak-day.today {
  background: var(--gold-light);
  color: #E65100;
  border: 2px solid var(--gold);
  font-weight: 900;
}

/* ========== 區塊 ========== */
.block {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.block-head h2 {
  font-size: 17px;
  font-weight: 900;
}

.block-sub {
  font-size: 12px;
  color: var(--text-sub);
}

/* ========== 任務列表 ========== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #FAFAFA;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.task-item.done {
  background: var(--green-bg);
  border-color: var(--green-light);
}

.task-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.task-body { flex: 1; }
.task-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}
.task-desc {
  font-size: 12px;
  color: var(--text-sub);
}

.task-reward {
  background: var(--gold-light);
  color: #E65100;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.task-action {
  background: var(--green-main);
  color: white;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.task-done-mark {
  color: var(--green-text);
  font-size: 24px;
  font-weight: 900;
}

/* ========== 兌換熱門列 ========== */
.reward-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.reward-mini {
  background: #FAFAFA;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
}
.reward-mini-icon { font-size: 32px; margin-bottom: 6px; }
.reward-mini-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
}
.reward-mini-name { font-size: 12px; font-weight: 700; line-height: 1.3; min-height: 32px; }
.reward-mini-cost {
  margin-top: 6px;
  font-size: 13px;
  color: var(--gold);
  font-weight: 900;
}

/* ========== 兌換中心 ========== */
.notice-bar {
  background: #FFF3E0;
  border: 1px solid #FFB74D;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.notice-bar > span:first-child { font-size: 22px; }
.notice-bar strong { display: block; font-size: 14px; color: #E65100; }
.notice-bar p { font-size: 12px; color: #BF360C; margin-top: 2px; }

.reward-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.reward-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform 0.1s;
}
.reward-card:active { transform: scale(0.98); }

.reward-card.locked {
  opacity: 0.5;
  filter: saturate(0.4);
}

.reward-icon { font-size: 50px; margin-bottom: 8px; }
.reward-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 8px;
  background: #f5f5f5;
}
.reward-name { font-size: 14px; font-weight: 700; margin-bottom: 8px; min-height: 40px; }
.reward-cost {
  background: var(--gold-light);
  color: #E65100;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  display: inline-block;
}
.reward-cost.reward-exclusive {
  background: linear-gradient(135deg, var(--gold), #FFB300);  /* 暖黃漸層取代粉紅，呼應品牌色 */
  color: var(--brand-black);
}
.reward-card.exclusive {
  border: 2px dashed var(--gold);
}

/* ========== 我的券 ========== */
.tab-row {
  display: flex;
  background: white;
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.tab-item {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
}
.tab-item.active {
  background: var(--green-main);
  color: white;
}

.coupons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coupon-row {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  position: relative;
}
/* ⚡ 限時搶購券特殊樣式 */
.coupon-row.flash-urgent { border: 2px solid #FF6720; box-shadow: 0 4px 12px rgba(255,82,82,0.25); animation: flashUrgentPulse 1.5s ease-in-out infinite; }
.coupon-row.flash-normal { border: 2px solid #FFB74D; }
.coupon-row.flash-expired { border: 2px dashed #BDBDBD; opacity: 0.55; }
@keyframes flashUrgentPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(255,82,82,0.25); }
  50% { box-shadow: 0 4px 20px rgba(255,82,82,0.55); }
}
.coupon-row-urgency {
  font-size: 12px;
  font-weight: 800;
  margin: 6px 0;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}
.coupon-row-urgency.urgent { background: var(--orange-soft-bg); color: var(--orange-text); }
.coupon-row-urgency.normal { background: #FFF3E0; color: #E65100; }
.coupon-row-urgency.expired { background: #ECEFF1; color: #607D8B; text-decoration: line-through; }
.coupon-row::before, .coupon-row::after {
  content: '';
  width: 16px;
  height: 16px;
  background: var(--bg);
  border-radius: 50%;
  position: absolute;
  left: 110px;
  z-index: 1;
}
.coupon-row::before { top: -8px; }
.coupon-row::after { bottom: -8px; }

.coupon-row.used { opacity: 0.5; filter: grayscale(0.5); }

.coupon-left {
  width: 110px;
  background: linear-gradient(135deg, var(--green-main), var(--green-deep));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
}

.coupon-right {
  flex: 1;
  padding: 14px;
  border-left: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.coupon-row-name { font-size: 16px; font-weight: 900; margin-bottom: 2px; }
.coupon-row-code { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; font-family: monospace; }
.coupon-row-meta { font-size: 12px; color: var(--text-muted); }
.coupon-row-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
}
.coupon-row-status.unused { background: var(--gold-light); color: #E65100; }
.coupon-row-status.used { background: #E0E0E0; color: var(--text-muted); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 64px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 14px; }

/* ========== 我的（profile） ========== */
.profile-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.profile-name { font-size: 19px; font-weight: 900; margin-bottom: 4px; }
.profile-meta { font-size: 13px; color: var(--text-sub); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 26px; font-weight: 900; color: var(--green-text); }
.stat-label { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

.menu-list {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr 24px;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  text-align: left;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #FAFAFA; }
.menu-item > span:first-child { font-size: 22px; text-align: center; }
.menu-arrow { color: var(--text-muted); font-size: 20px; text-align: right; }

/* 重點 menu item（如：到貨通知綁定）— 多一個淺色強調背景 */
.menu-item-highlight {
  background: linear-gradient(90deg, #E3F2FD 0%, #FFFFFF 60%);
  border-left: 4px solid #0084FF;
}
.menu-item-highlight:active { background: linear-gradient(90deg, #BBDEFB 0%, #F5F5F5 60%); }

.version-tag {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 24px;
}

/* ========== 歷史 ========== */
.history-list {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-action { font-size: 15px; font-weight: 700; }
.history-date { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.history-points {
  font-size: 17px;
  font-weight: 900;
}
.history-points.gain { color: var(--green-text); }
.history-points.loss { color: var(--danger); }

/* ========== 底部導航 ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: white;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.nav-item {
  padding: 10px 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-muted);
  position: relative;
}
.nav-item.active { color: var(--green-text); font-weight: 700; }
.nav-icon { font-size: 22px; }

/* ⚡ 搶好康 tab — 紅色強調 */
.nav-item.nav-flash { color: var(--orange-text); }
.nav-item.nav-flash.active { color: var(--orange-text); font-weight: 900; }
.nav-item.nav-flash .nav-icon {
  filter: drop-shadow(0 0 2px rgba(255, 82, 82, 0.4));
}
.nav-item.nav-flash:not(.active) .nav-icon {
  animation: navFlashPulse 2.5s ease-in-out infinite;
}
@keyframes navFlashPulse {
  0%, 90%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255,82,82,0)); }
  92%, 96% { transform: scale(1.15); filter: drop-shadow(0 0 6px rgba(255,82,82,0.7)); }
}
.nav-flash-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  background: #FF6720;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ========== Modals ========== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}
.modal.show { display: flex; }

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-content h2 {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 12px;
}

.modal-celebrate { background: linear-gradient(180deg, #FFFFFF 0%, var(--gold-light) 100%); }

.confetti-emoji {
  font-size: 64px;
  margin-bottom: 8px;
  animation: bounce 0.6s ease-out;
}

.celebrate-points {
  font-size: 56px;
  font-weight: 900;
  color: var(--gold);
  margin: 12px 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}
.celebrate-plus { font-size: 36px; }
.celebrate-unit { font-size: 24px; color: var(--text); }

.celebrate-msg {
  font-size: 15px;
  color: var(--text-sub);
  margin-bottom: 20px;
  line-height: 1.6;
}

.celebrate-bonus {
  background: var(--green-bg);
  color: var(--green-deep);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

/* ========== Redeem modal ========== */
.redeem-preview {
  background: var(--green-bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 16px 0;
}
.redeem-icon { font-size: 56px; margin-bottom: 8px; }
.redeem-name { font-size: 18px; font-weight: 900; margin-bottom: 6px; }
.redeem-cost { font-size: 16px; color: var(--gold); font-weight: 900; }

.redeem-warn {
  background: #FFF3E0;
  border: 1px solid #FFB74D;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  color: #BF360C;
  text-align: left;
}

/* ========== Coupon modal ========== */
.coupon-card {
  background: linear-gradient(135deg, var(--green-main), var(--green-deep));
  color: white;
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}
.coupon-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  text-align: left;
}
.coupon-icon { font-size: 40px; }
.coupon-name { font-size: 17px; font-weight: 900; }
.coupon-code { font-size: 12px; opacity: 0.85; font-family: monospace; }

.coupon-qr {
  background: white;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: center;
}
.coupon-qr canvas, .coupon-qr img { display: block; }

.coupon-foot {
  margin-top: 12px;
  font-size: 12px;
  opacity: 0.85;
}

/* ========== Invite modal ========== */
.invite-code-box {
  background: var(--green-bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
}
.invite-code-label {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.invite-code {
  font-size: 28px;
  font-weight: 900;
  font-family: monospace;
  color: var(--green-deep);
  letter-spacing: 2px;
  margin-bottom: 10px;
}

/* ========== Onboarding ========== */
.onboard-step {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.onboard-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 16px;
}
.onboard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #E0E0E0;
  transition: all 0.2s;
}
.onboard-dot.active {
  background: var(--green-main);
  width: 24px;
  border-radius: 5px;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  max-width: 90%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== 拉霸轉盤 ========== */
.slot-banner {
  background: linear-gradient(135deg, #FF6F00, #FFB300);
  color: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 16px rgba(255,111,0,0.3);
  cursor: pointer;
  transition: transform 0.1s;
}
.slot-banner:active { transform: scale(0.98); }
.slot-banner.disabled {
  background: #BDBDBD;
  box-shadow: none;
  cursor: default;
}
.slot-banner-icon { font-size: 38px; }
.slot-banner-main { flex: 1; }
.slot-banner-title { font-size: 17px; font-weight: 900; }
.slot-banner-sub { font-size: 12px; opacity: 0.95; margin-top: 2px; }
.slot-banner-arrow { font-size: 22px; }

.slot-machine {
  background: linear-gradient(180deg, #FFD54F, #FFA000);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.15);
}

.slot-reels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #1A1A1A;
  padding: 16px;
  border-radius: 12px;
  border: 4px solid #5D4037;
  margin-bottom: 16px;
  position: relative;
}
.slot-reels.win {
  animation: slot-glow 0.6s ease-in-out infinite alternate;
}

.slot-reel {
  background: white;
  border-radius: 10px;
  height: 90px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.1);
}

.slot-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: none;
}

.slot-strip > div {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  flex-shrink: 0;
}

@keyframes slot-glow {
  from { box-shadow: 0 0 0 rgba(255,179,0,0); }
  to   { box-shadow: 0 0 32px 8px rgba(255,179,0,0.85); }
}

.slot-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  z-index: 10;
}
.slot-confetti span {
  display: inline-block;
  font-size: 28px;
  animation: confetti-fall 1.4s ease-out forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(-30px) rotate(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(140px) rotate(360deg); opacity: 0; }
}

.slot-info {
  text-align: center;
  font-size: 13px;
  color: #5D4037;
  font-weight: 700;
  margin-bottom: 12px;
}

.slot-spin-btn {
  display: block;
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--danger), #D34A1E);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 4px;
  box-shadow: 0 4px 12px rgba(229,57,53,0.4);
  transition: transform 0.1s;
}
.slot-spin-btn:active:not(:disabled) { transform: scale(0.97); }
.slot-spin-btn:disabled { background: #BDBDBD; box-shadow: none; cursor: not-allowed; }

.slot-result {
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  margin-top: 12px;
  min-height: 28px;
  color: var(--green-deep);
}

.slot-prize-table {
  background: rgba(255,255,255,0.5);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12px;
  color: #5D4037;
  margin-top: 12px;
}
.slot-prize-table div { display: flex; justify-content: space-between; padding: 2px 0; }

@keyframes slotSpin {
  from { transform: translateY(0); }
  to { transform: translateY(-90px); }
}

/* ========== 店員後台 ========== */
body.staff-app {
  background: #ECEFF1;
}

.staff-header {
  background: linear-gradient(135deg, #1A237E, #283593);
  color: white;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.staff-header-title { font-size: 18px; font-weight: 900; }
.staff-header-sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.staff-tab-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: white;
  border-bottom: 1px solid var(--border);
}
.staff-tab-row-5 {
  grid-template-columns: repeat(5, 1fr);
}
.staff-tab-row-5 .staff-tab,
.staff-tab-row-6 .staff-tab {
  font-size: 12px;
  padding: 12px 4px;
}
.staff-tab-row-6 {
  grid-template-columns: repeat(6, 1fr);
}
.staff-tab {
  padding: 14px 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  border-bottom: 3px solid transparent;
}
.staff-tab.active {
  color: #1A237E;
  border-bottom-color: #1A237E;
  font-weight: 900;
}

.staff-section {
  padding: 16px;
}

.staff-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.staff-action-btn {
  display: block;
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #1A237E, #283593);
  color: white;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}
.staff-action-btn.green {
  background: linear-gradient(135deg, var(--green-main), var(--green-deep));
}
.staff-action-btn.amber {
  background: linear-gradient(135deg, var(--gold), #FF6F00);
}

/* 消費登錄 / +1 取貨 模式切換按鈕 */
.staff-mode-btn {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid var(--border);
  background: #FAFAFA;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.staff-mode-btn.active {
  background: linear-gradient(135deg, var(--green-main), var(--green-deep));
  color: #fff;
  border-color: var(--green-deep);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.staff-mode-btn:not(.active):hover {
  background: #F0F0F0;
}

.staff-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.staff-stat {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.staff-stat-num {
  font-size: 24px;
  font-weight: 900;
  color: #1A237E;
}
/* ========== 開盲盒遊戲（3 天 milestone）========== */
.gb-box {
  aspect-ratio: 1;
  background: linear-gradient(160deg, #FFD54F, #FF8F00);
  border: 4px solid #FFE082;
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.25), 0 10px 24px rgba(0,0,0,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.3s;
  animation: gbBounce 1.6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.gb-box:nth-child(2) { --delay: 0.2s; }
.gb-box:nth-child(3) { --delay: 0.4s; }
.gb-box-emoji {
  font-size: 56px;
  line-height: 1;
}
.gb-box:active { transform: translateY(3px) scale(0.96); }
.gb-box.shake {
  animation: gbShake 0.4s ease-in-out 3;
}
.gb-box.open {
  background: linear-gradient(160deg, #fff, #FFE082);
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 32px rgba(255,235,59,0.8);
}
@keyframes gbBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes gbShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px) rotate(-3deg); }
  75% { transform: translateX(6px) rotate(3deg); }
}

/* ========== 月度大轉盤（30 天 milestone）========== */
.lw-stage {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto;
}
.lw-pointer {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 32px;
  color: #FFE082;
  z-index: 3;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.4));
}
.lw-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 0 6px #FFE082, 0 0 0 8px #B71C1C, 0 12px 30px rgba(0,0,0,0.4);
}
.lw-labels {
  position: absolute;
  inset: 0;
}
.lw-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: 0 0;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
  white-space: nowrap;
  margin-left: -20px;
}
.lw-hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: #FFE082;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 2;
}

/* ========== 比大小遊戲 ========== */
.hl-card-stage {
  perspective: 1000px;
  margin: 12px auto 16px;
  width: 140px;
  height: 200px;
}
.hl-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 1.3s cubic-bezier(0.4, 1.5, 0.5, 1);
  transform-style: preserve-3d;
}
.hl-card-inner.flipped {
  transform: rotateY(180deg);
}
.hl-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 92px;
  font-weight: 900;
  font-family: 'Georgia', serif;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  user-select: none;
}
.hl-card-front {
  background: linear-gradient(160deg, #fff, #f0f0f0);
  color: #1B5E20;
  border: 4px solid #FFE082;
}
.hl-card-back {
  background: linear-gradient(160deg, #FFE082, #FFB300);
  color: #BF360C;
  transform: rotateY(180deg);
  border: 4px solid #fff;
}

.hl-btn {
  flex: 1;
  padding: 18px 10px;
  border: none;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  text-align: center;
  line-height: 1.3;
  box-shadow: 0 4px 0 rgba(0,0,0,0.18);
  transition: transform 0.1s;
}
.hl-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.hl-btn-up { background: linear-gradient(135deg, #43A047, #1B5E20); }
.hl-btn-down { background: linear-gradient(135deg, #FB8C00, #BF360C); }
.hl-btn-cash { background: linear-gradient(135deg, #00ACC1, #006064); }
.hl-btn-continue {
  background: linear-gradient(135deg, #E53935, #B71C1C);
  animation: hlPulse 1.6s ease-in-out infinite;
}
@keyframes hlPulse {
  0%, 100% { box-shadow: 0 4px 0 rgba(0,0,0,0.18), 0 0 0 0 rgba(255,82,82,0.6); }
  50% { box-shadow: 0 4px 0 rgba(0,0,0,0.18), 0 0 0 12px rgba(255,82,82,0); }
}

/* 報表期間 preset 按鈕 */
.report-range-btn {
  flex: 1;
  min-width: 64px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #FAFAFA;
  color: var(--text-sub);
  border-radius: 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.report-range-btn.active {
  background: var(--green-main);
  color: #fff;
  border-color: var(--green-deep);
}
.report-range-btn:not(.active):hover { background: #F0F0F0; }

/* 待辦提醒：未核銷券 > 0 時用橘色（讓店員一眼看到要處理）*/
.staff-stat-num.stat-alert {
  color: #E65100;
  animation: statPulse 1.6s ease-in-out infinite;
}
@keyframes statPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.staff-stat-label {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

.staff-input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.staff-input-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
}
.staff-input-group input {
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 17px;
  width: 100%;
  background: #FAFAFA;
}
.staff-input-group input:focus {
  outline: none;
  border-color: #1A237E;
  background: white;
}

.staff-quick-points {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.staff-quick-points button {
  padding: 14px 4px;
  background: #E8EAF6;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  color: #1A237E;
}
.staff-quick-points button.active {
  background: #1A237E;
  color: white;
}

.staff-coupon-item {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.staff-coupon-icon { font-size: 38px; }
.staff-coupon-body { flex: 1; }
.staff-coupon-name { font-weight: 700; }
.staff-coupon-meta { font-size: 12px; color: var(--text-sub); margin-top: 2px; font-family: monospace; }
.staff-coupon-action {
  background: var(--green-main);
  color: white;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.staff-log-item {
  background: white;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}
.staff-log-item.log-undone {
  opacity: 0.55;
  background: #FAFAFA;
}
.staff-log-time { font-size: 11px; color: var(--text-muted); }
.staff-log-icon { font-size: 22px; margin-right: 8px; }

.member-row {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.member-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.member-row-name { font-weight: 900; font-size: 16px; }
.member-row-phone { font-size: 12px; color: var(--text-sub); font-family: monospace; }
.member-row-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  font-size: 11px;
  color: var(--text-sub);
  margin-bottom: 8px;
}
.member-row-meta strong {
  display: block;
  font-size: 14px;
  color: var(--text);
  font-weight: 900;
}
.member-row-actions {
  display: flex;
  gap: 6px;
}
.member-row-action {
  flex: 1;
  padding: 8px;
  background: #E8EAF6;
  color: #1A237E;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.member-row-action.green { background: var(--green-bg); color: var(--green-deep); }
.member-row-action.amber { background: #FFF3E0; color: #E65100; }
.member-row-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #FFF8E1;
  color: #E65100;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
}

.report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.report-row:last-child { border-bottom: none; }
.report-row-rank {
  width: 28px;
  height: 28px;
  background: var(--green-bg);
  color: var(--green-deep);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
  margin-right: 10px;
}
.report-row-rank.gold { background: #FFD54F; color: #5D4037; }
.report-row-rank.silver { background: #CFD8DC; color: #455A64; }
.report-row-rank.bronze { background: #FFAB91; color: #5D4037; }
.report-row-name { flex: 1; }
.report-row-value { font-weight: 900; color: var(--green-deep); }

#qr-scanner-container {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 16px;
}
#qr-scanner-container video,
#qr-scanner-container canvas {
  width: 100% !important;
  border-radius: var(--radius-sm);
}

.staff-pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.staff-pin-key {
  padding: 18px;
  background: white;
  border-radius: var(--radius-sm);
  font-size: 22px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.staff-pin-key:active { background: #E8EAF6; }

.staff-pin-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}
.staff-pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #CFD8DC;
}
.staff-pin-dot.filled { background: #1A237E; }

/* ========== 動畫 ========== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* === Phase 3c: Analytics tab === */
.analytics-range-btn {
  padding: 6px 12px;
  background: #ECEFF1;
  color: var(--text-sub);
  border: 1px solid #CFD8DC;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.analytics-range-btn.analytics-range-active {
  background: var(--green-main);
  color: white;
  border-color: var(--green-main);
}
.analytics-event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #ECEFF1;
}
.analytics-event-row:last-child { border-bottom: none; }
.analytics-event-name {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--text-main);
}
.analytics-event-count {
  font-weight: 700;
  color: var(--green-main);
}
.analytics-funnel-step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #F1F8E9;
  border-radius: 8px;
  border-left: 4px solid var(--green-main);
}
.analytics-funnel-step.dropped {
  background: #FFEBEE;
  border-left-color: var(--danger);
}
.analytics-funnel-rate {
  font-size: 11px;
  color: var(--text-sub);
}
