/* =============================================================
   有機生活圈 — 設計系統（長輩友善硬規格 + 質感）
   本文 ≥18pt(24px)、按鈕高 ≥48px（主按鈕 64px）、對比 ≥4.5:1
   ============================================================= */
:root {
  /* 色彩 — 有機森林綠 × 暖米白 × 柿橘 */
  --green-900: #1c3a28;
  --green-800: #24503a;
  --green-700: #2d6a4a;
  --green-600: #37845b;
  --green-100: #e3efe5;
  --green-50:  #f0f6f0;
  --cream:     #faf6ee;
  --card:      #ffffff;
  --ink:       #26301f;
  --ink-soft:  #55604a;
  --accent:    #d96f32;   /* 柿橘 */
  --accent-dark: #b4551d;
  --gold:      #e8a33d;
  --danger:    #c0392b;
  --danger-bg: #fdecea;
  --line:      #e6e0d2;

  /* 字級（長輩規格：本文 24px ≈ 18pt） */
  --fs-body: 24px;
  --fs-small: 20px;
  --fs-h2: 30px;
  --fs-h1: 34px;
  --fs-price: 40px;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 4px 18px rgba(38, 48, 31, .09);
  --shadow-lg: 0 10px 32px rgba(38, 48, 31, .14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "微軟正黑體", sans-serif;
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, #eef4e4 0%, transparent 60%),
    var(--cream);
  min-height: 100vh;
  padding-bottom: 110px; /* 底部導覽列空間 */
}

.wrap { max-width: 560px; margin: 0 auto; padding: 0 18px; }

/* ---------- 固定置頂區（開發模式列＋品牌橫幅） ---------- */
.fixed-head {
  position: sticky;
  top: 0;
  z-index: 80;
}

/* ---------- 頂部橫幅 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-700) 70%, #3d7a52 100%);
  color: #fff;
  padding: 20px 0 24px;
  border-radius: 0 0 28px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
/* 頁面滾動時（非首頁）topbar 不存在，devbar 單獨置頂時收窄陰影避免太突兀 */
.fixed-head:has(.devbar):not(:has(.topbar)) .devbar {
  box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 54px; height: 54px; border-radius: 16px;
  background: rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; backdrop-filter: blur(2px);
  border: 1px solid rgba(255,255,255,.25);
}
.brand-name { font-size: 26px; font-weight: 700; letter-spacing: 1px; }
.brand-sub  { font-size: 17px; opacity: .85; letter-spacing: 2px; }
.top-user { text-align: right; font-size: var(--fs-small); }
.top-user .hello { opacity: .9; }
.top-user .name { font-weight: 700; font-size: 23px; }

/* 頁面標題列（次頁） */
.pagehead { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; }
.btn-back {
  width: 56px; height: 56px; border-radius: 16px; border: 2px solid var(--line);
  background: var(--card); font-size: 26px; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; box-shadow: var(--shadow);
}
.pagehead h1 { font-size: var(--fs-h1); color: var(--green-900); font-weight: 800; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(230, 224, 210, .8);
  overflow: hidden;
  margin-bottom: 18px;
}
.card-pad { padding: 22px; }

/* ---------- 首頁功能大格 ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tile {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(230,224,210,.8);
  padding: 26px 18px 22px;
  text-align: center;
  text-decoration: none; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
  position: relative;
}
.tile:active { transform: scale(.97); box-shadow: var(--shadow-lg); }
.tile-icon {
  width: 76px; height: 76px; margin: 0 auto 12px;
  border-radius: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 40px;
}
.tile-icon.g1 { background: linear-gradient(145deg, #e6f2e2, #d0e8cd); }
.tile-icon.g2 { background: linear-gradient(145deg, #fdeedd, #fbdfc0); }
.tile-icon.g3 { background: linear-gradient(145deg, #e5eef8, #cfe0f2); }
.tile-icon.g4 { background: linear-gradient(145deg, #f6e9f0, #eed3e2); }
.tile-title { font-size: 26px; font-weight: 800; color: var(--green-900); }
.tile-sub { font-size: 18px; color: var(--ink-soft); margin-top: 2px; }
.tile .dot {
  position: absolute; top: 14px; right: 14px;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 商品大圖卡 ---------- */
.item-card { display: block; text-decoration: none; color: var(--ink); }
.item-hero {
  height: 128px; display: flex; align-items: center; justify-content: center;
  font-size: 68px; position: relative;
}
.hero-1 { background: linear-gradient(135deg, #e9f4e3, #cfe6c7); }
.hero-2 { background: linear-gradient(135deg, #fdeae2, #f9d2c0); }
.hero-3 { background: linear-gradient(135deg, #fdf3dc, #f7e2af); }
.hero-4 { background: linear-gradient(135deg, #fffbe0, #f5ecb8); }
.hero-5 { background: linear-gradient(135deg, #e6f2ee, #c8e4d8); }
.hero-6 { background: linear-gradient(135deg, #eaf3e0, #d4e8c4); }
.item-hero .cert {
  position: absolute; top: 12px; left: 12px;
  background: rgba(45, 106, 74, .92); color: #fff;
  font-size: 17px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
}
.item-hero.photo {
  height: 170px;
  background-size: cover;
  background-position: center;
}
.item-body { padding: 18px 20px 20px; }
.item-name { font-size: 28px; font-weight: 800; color: var(--green-900); }
.item-origin { font-size: 18px; color: var(--ink-soft); margin: 2px 0 10px; }
.item-priceline { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.item-price { font-size: var(--fs-price); font-weight: 900; color: var(--accent-dark); letter-spacing: -1px; }
.item-unit { font-size: 19px; color: var(--ink-soft); }
.item-left { font-size: 18px; color: var(--green-700); font-weight: 700; margin-left: auto; }

/* ---------- 按鈕（高 64px 主按鈕 / 56px 次按鈕） ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 64px;
  border: none; border-radius: 18px; cursor: pointer;
  font-family: inherit; font-size: 26px; font-weight: 800; letter-spacing: 1px;
  text-decoration: none; transition: transform .1s ease, filter .1s ease;
}
.btn:active { transform: scale(.98); filter: brightness(.95); }
.btn-primary { background: linear-gradient(135deg, var(--green-700), var(--green-600)); color: #fff; box-shadow: 0 6px 16px rgba(45,106,74,.32); }
.btn-accent  { background: linear-gradient(135deg, var(--accent), #e5883f); color: #fff; box-shadow: 0 6px 16px rgba(217,111,50,.32); }
.btn-outline { background: var(--card); color: var(--green-800); border: 2.5px solid var(--green-700); }
.btn-ghost   { background: var(--green-50); color: var(--green-800); min-height: 56px; font-size: 23px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center;
  font-size: 18px; font-weight: 700; padding: 6px 16px; border-radius: 999px;
}
.badge-ok     { background: #e3f2e5; color: #1e6b34; }
.badge-info   { background: #e3ecf8; color: #1f4e8c; }
.badge-warn   { background: #fdf1dc; color: #8a5a0a; }
.badge-accent { background: #fdeadd; color: #a34a12; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted  { background: #eeece6; color: #6b6a5f; }

/* ---------- 步驟指示 ---------- */
.steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 6px 0 20px; }
.step { display: flex; align-items: center; gap: 6px; font-size: 19px; color: #9aa08e; font-weight: 700; }
.step .n {
  width: 40px; height: 40px; border-radius: 50%;
  background: #e8e5da; color: #8b897c;
  display: flex; align-items: center; justify-content: center; font-size: 21px;
}
.step.on { color: var(--green-800); }
.step.on .n { background: var(--green-700); color: #fff; }
.step-bar { width: 26px; height: 3px; background: #ddd8c8; border-radius: 2px; }

/* ---------- 數量選擇 ---------- */
.qty-box { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 8px 0; }
.qty-btn {
  width: 74px; height: 74px; border-radius: 22px; border: none; cursor: pointer;
  background: var(--green-100); color: var(--green-800);
  font-size: 42px; font-weight: 800; line-height: 1;
  transition: transform .1s ease;
}
.qty-btn:active { transform: scale(.94); background: var(--green-700); color: #fff; }
.qty-num {
  min-width: 130px; text-align: center;
  font-size: 56px; font-weight: 900; color: var(--green-900);
}
.qty-unit { font-size: 22px; color: var(--ink-soft); text-align: center; }

/* ---------- 表單 ---------- */
label.field-label { display: block; font-size: 22px; font-weight: 700; color: var(--green-900); margin: 16px 0 8px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 64px; padding: 12px 18px;
  font-family: inherit; font-size: 24px; color: var(--ink);
  background: #fff; border: 2.5px solid var(--line); border-radius: 16px;
  outline: none;
}
.input:focus { border-color: var(--green-600); box-shadow: 0 0 0 4px rgba(55,132,91,.15); }
.hint { font-size: 18px; color: var(--ink-soft); margin-top: 6px; }

/* 錯誤提示（大字紅框） */
.error-box {
  border: 3px solid var(--danger); background: var(--danger-bg);
  border-radius: var(--radius-sm); padding: 16px 18px; margin: 14px 0;
  font-size: 23px; font-weight: 700; color: var(--danger);
}
.error-box .how { font-size: 20px; font-weight: 500; color: #7a2a20; margin-top: 4px; }

/* 成功框 */
.ok-box {
  border: 3px solid var(--green-600); background: var(--green-50);
  border-radius: var(--radius-sm); padding: 16px 18px; margin: 14px 0;
  font-size: 23px; font-weight: 700; color: var(--green-800);
}

/* ---------- 摘要列表 ---------- */
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 0; border-bottom: 1.5px dashed var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-soft); font-size: 21px; }
.kv .v { font-weight: 700; text-align: right; }
.kv .v.big { font-size: 34px; color: var(--accent-dark); font-weight: 900; }

/* ---------- 公告 ---------- */
.notice {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 20px; border-bottom: 1.5px solid var(--green-50);
  text-decoration: none; color: var(--ink);
}
.notice:last-child { border-bottom: none; }
.notice .ic { font-size: 30px; line-height: 1.3; }
.notice .t { font-size: 23px; font-weight: 700; color: var(--green-900); }
.notice .d { font-size: 18px; color: var(--ink-soft); margin-top: 2px; }
.notice.urgent .t { color: var(--danger); }
.pin { color: var(--accent-dark); font-size: 17px; font-weight: 800; }

/* ---------- 訂單卡 ---------- */
.order-card { display: block; text-decoration: none; color: var(--ink); }
.order-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.order-no { font-size: 18px; color: var(--ink-soft); letter-spacing: .5px; }
.order-body { padding: 10px 20px 18px; }
.order-name { font-size: 26px; font-weight: 800; color: var(--green-900); }
.order-meta { font-size: 19px; color: var(--ink-soft); margin-top: 2px; }
.order-amt { font-size: 30px; font-weight: 900; color: var(--accent-dark); margin-top: 6px; }

/* ---------- QR ---------- */
.qr-stage { text-align: center; padding: 26px 20px; }
.qr-frame {
  width: 280px; height: 280px; margin: 0 auto 14px;
  background: #fff; border: 3px solid var(--green-100); border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.qr-frame canvas, .qr-frame img, .qr-frame svg { border-radius: 12px; }
.qr-amt { font-size: 46px; font-weight: 900; color: var(--green-900); }
.qr-tip { font-size: 20px; color: var(--ink-soft); margin-top: 6px; }

/* ---------- 底部導覽 ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-top: 1.5px solid var(--line);
  box-shadow: 0 -6px 20px rgba(38,48,31,.08);
}
.bottomnav .inner { max-width: 560px; margin: 0 auto; display: flex; }
.nav-item {
  flex: 1; text-align: center; padding: 10px 4px 12px;
  text-decoration: none; color: #8b897c; font-size: 17px; font-weight: 700;
}
.nav-item .ic { display: block; font-size: 30px; line-height: 1.25; }
.nav-item.on { color: var(--green-800); }
.nav-item.on .ic { transform: scale(1.08); }

/* ---------- 區塊標題 ---------- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 12px; }
.sec-head h2 { font-size: var(--fs-h2); color: var(--green-900); font-weight: 800; }
.sec-head a { font-size: 20px; color: var(--green-700); font-weight: 700; text-decoration: none; }

/* ---------- 開發模式列 ---------- */
.devbar {
  background: #343b2e; color: #e8e5d6; font-size: 16px;
  padding: 8px 0;
}
.devbar .wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.devbar a {
  color: #fff; background: #55604a; text-decoration: none;
  padding: 4px 12px; border-radius: 999px; font-weight: 700;
}
.devbar a.on { background: var(--accent); }

/* ---------- 語音按鈕 ---------- */
.voice-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; border-radius: 16px; border: 2.5px dashed var(--green-600);
  background: var(--green-50); color: var(--green-800);
  font-family: inherit; font-size: 23px; font-weight: 800; cursor: pointer; width: 100%;
}
.voice-btn.rec { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(192,57,43,.3); } 50% { box-shadow: 0 0 0 10px rgba(192,57,43,0); } }

/* 動線輔助 */
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.center { text-align: center; }
.muted { color: var(--ink-soft); font-size: 20px; }

@media (min-width: 700px) {
  body { padding-bottom: 120px; }
}
