:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bv-color: #f59e0b;
  --ibv-color: #10b981;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --nav-h: 64px;
  --top-h: 52px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'Noto Sans TC', sans-serif; background: var(--bg); color: var(--text); }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }

/* TOP BAR */
.top-bar { background: var(--primary); color: #fff; height: var(--top-h); position: sticky; top: 0; z-index: 100; }
.top-bar-inner { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; height: 100%; }
.logo { font-size: 18px; font-weight: 700; }
.team-name { font-size: 13px; opacity: 0.8; }

/* MAIN */
#main-content { padding: 12px 12px calc(var(--nav-h) + 12px); min-height: calc(100vh - var(--top-h)); }

/* BOTTOM NAV */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: var(--nav-h); background: #fff; border-top: 1px solid var(--border); display: flex; z-index: 100; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; color: var(--text-muted); text-decoration: none; gap: 2px; transition: color .2s; }
.nav-item span { font-size: 11px; }
.nav-item .icon { font-size: 22px; }
.nav-item.active { color: var(--primary); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-line { background: #00b900; color: #fff; }
.btn-full { width: 100%; }
.btn-large { padding: 14px; font-size: 16px; border-radius: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* HOME */
.hero-banner { background: linear-gradient(135deg, var(--primary), #818cf8); border-radius: 16px; padding: 24px; color: #fff; margin-bottom: 16px; }
.hero-banner h1 { font-size: 22px; margin-bottom: 6px; }
.quick-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-card { background: var(--card); border-radius: 14px; padding: 16px; text-decoration: none; color: var(--text); border: 1px solid var(--border); transition: transform .15s, box-shadow .15s; }
.menu-card:active { transform: scale(0.97); }
.menu-icon { font-size: 28px; margin-bottom: 8px; }
.menu-label { font-size: 15px; font-weight: 700; }
.menu-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.bv-card { border-top: 3px solid var(--bv-color); }
.ibv-card { border-top: 3px solid var(--ibv-color); }
.post-card { border-top: 3px solid var(--primary); }
.checkin-card { border-top: 3px solid #f97316; }
.event-card { border-top: 3px solid #3b82f6; }
.know-card { border-top: 3px solid #8b5cf6; }

/* PRODUCTS */
.filter-bar { position: sticky; top: var(--top-h); background: var(--bg); z-index: 50; padding: 8px 0; }
.type-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tab-btn { padding: 6px 16px; border-radius: 20px; border: 2px solid var(--border); background: var(--card); font-size: 13px; cursor: pointer; font-weight: 600; }
.tab-btn.active { border-color: var(--primary); color: var(--primary); background: #eef2ff; }
.search-bar input { width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 14px; outline: none; }
.search-bar input:focus { border-color: var(--primary); }
.category-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin-top: 6px; }
.category-chips::-webkit-scrollbar { display: none; }
.chip { padding: 4px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--card); font-size: 12px; cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.product-card { background: var(--card); border-radius: 12px; border: 1px solid var(--border); padding: 12px; cursor: pointer; transition: box-shadow .15s; }
.product-card:active { box-shadow: 0 4px 12px rgba(99,102,241,.2); }
.product-card .ptype-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-bottom: 6px; }
.ptype-badge.BV { background: #fef3c7; color: #92400e; }
.ptype-badge.IBV { background: #d1fae5; color: #065f46; }
.ptype-badge.BOTH { background: #ede9fe; color: #5b21b6; }
.product-card .pname { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .pcat { font-size: 11px; color: var(--text-muted); }
.product-card .pprice { font-size: 12px; color: var(--ibv-color); font-weight: 600; margin-top: 4px; }

/* POST PAGE */
.page-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.post-steps { display: flex; flex-direction: column; gap: 14px; }
.step { background: var(--card); border-radius: 14px; padding: 14px; border: 1px solid var(--border); }
.step-header { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 10px; }
.step-num { width: 24px; height: 24px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.tone-options, .length-options { display: flex; gap: 8px; flex-wrap: wrap; }
.tone-btn, .length-btn { padding: 8px 14px; border-radius: 10px; border: 2px solid var(--border); background: var(--card); font-size: 13px; cursor: pointer; }
.tone-btn.active, .length-btn.active { border-color: var(--primary); background: #eef2ff; color: var(--primary); }
.post-result { margin-top: 16px; background: var(--card); border-radius: 14px; padding: 16px; border: 1px solid var(--border); }
.result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; }
.post-textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 14px; line-height: 1.6; resize: vertical; }
.result-actions { display: flex; gap: 8px; margin-top: 10px; }
.result-actions .btn { flex: 1; }
.copy-feedback { display: none; text-align: center; color: var(--ibv-color); font-size: 13px; margin-top: 8px; }

/* CHECKIN */
.checkin-hero { background: linear-gradient(135deg, #f97316, #fb923c); border-radius: 16px; padding: 24px; color: #fff; text-align: center; margin-bottom: 16px; }
.streak-number { font-size: 64px; font-weight: 900; line-height: 1; }
.streak-label { font-size: 14px; opacity: 0.9; margin-top: 4px; }
.checkin-subtitle { font-size: 13px; opacity: 0.9; margin-top: 10px; }
.btn-checkin { width: 100%; padding: 20px; border-radius: 16px; background: linear-gradient(135deg, #f97316, #fb923c); border: none; color: #fff; font-size: 20px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 20px rgba(249,115,22,.4); margin-bottom: 16px; }
.checkin-history h3, .team-ranking h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; background: var(--border); }
.cal-day.checked { background: #f97316; color: #fff; }
.cal-day.today { border: 2px solid var(--primary); }
.team-ranking { margin-top: 16px; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--card); border-radius: 10px; margin-bottom: 6px; border: 1px solid var(--border); }
.rank-num { font-size: 16px; font-weight: 900; width: 28px; }
.rank-name { flex: 1; font-size: 14px; }
.rank-streak { font-size: 13px; color: #f97316; font-weight: 700; }

/* MODAL */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: flex-end; }
.modal-box { background: #fff; width: 100%; max-height: 80vh; border-radius: 20px 20px 0 0; padding: 20px; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 16px; right: 16px; background: var(--border); border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-size: 14px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 100px; }

/* LOADING & EMPTY */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.empty-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* KNOWLEDGE */
.know-item { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); }
.know-icon { font-size: 24px; flex-shrink: 0; }
.know-body h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.know-body p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* EVENTS */
.events-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.events-filter::-webkit-scrollbar { display: none; }
.event-card-item { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 10px; border: 1px solid var(--border); border-left: 4px solid var(--primary); }

/* 商品卡片圖片 */
.pimg { width:100%; aspect-ratio:1; border-radius:8px 8px 0 0; background-size:cover; background-position:center; background-color:#f1f5f9; overflow:hidden; }
.pimg-placeholder { display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:900; color:#94a3b8; }
.product-card { padding: 0; overflow:hidden; }
.pcard-body { padding: 10px; }

/* 模式選擇 */
.mode-options { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.mode-btn { background:var(--card); border:2px solid var(--border); border-radius:12px; padding:14px 10px; cursor:pointer; text-align:center; transition:all .2s; }
.mode-btn.active { border-color:var(--primary); background:#eef2ff; }
.mode-icon { font-size:24px; margin-bottom:6px; }
.mode-label { font-size:14px; font-weight:700; }
.mode-sub { font-size:11px; color:var(--text-muted); margin-top:3px; }

/* 複製成功綠色按鈕 */
.btn-success { background:#10b981; color:#fff; }
.btn-success:hover { background:#059669; }

/* 商品詳情複製回饋 */
.copy-feedback { text-align:center; color:#10b981; font-weight:600; padding:8px; font-size:13px; }
