/**
 * R108 简易报价计算器 — 样式表
 */
:root, [data-theme="blue-gold"] {
  --primary: #2563EB;
  --primary-light: #DBEAFE;
  --cta: #F59E0B;
  --cta-hover: #D97706;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --border: #E2E8F0;
  --success: #10B981;
  --danger: #EF4444;
  --grade-selected: #EFF6FF;
  --grade-border: #93C5FD;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

[data-theme="nature-green"] {
  --primary: #059669; --primary-light: #ECFDF5; --cta: #D97706; --cta-hover: #B45309;
  --grade-selected: #ECFDF5; --grade-border: #6EE7B7;
}
[data-theme="creative-purple"] {
  --primary: #7C3AED; --primary-light: #F5F3FF; --cta: #EC4899; --cta-hover: #DB2777;
  --bg: #FAFAFE; --grade-selected: #F5F3FF; --grade-border: #C4B5FD;
}
[data-theme="festive-red"] {
  --primary: #DC2626; --primary-light: #FEF2F2; --cta: #FBBF24; --cta-hover: #F59E0B;
  --bg: #FFFBEB; --border: #FECACA; --danger: #DC2626;
  --grade-selected: #FEF2F2; --grade-border: #FCA5A5;
}
[data-theme="minimal-dark"] {
  --primary: #3B82F6; --primary-light: #1E3A5F; --cta: #60A5FA; --cta-hover: #3B82F6;
  --bg: #0F172A; --card-bg: #1E293B; --text-primary: #F1F5F9; --text-secondary: #94A3B8;
  --border: #334155; --success: #34D399; --danger: #F87171;
  --grade-selected: #1E3A5F; --grade-border: #2563EB;
}
[data-theme="warm-orange"] {
  --primary: #EA580C; --primary-light: #FFF7ED; --cta: #F97316; --cta-hover: #EA580C;
  --bg: #FFFBEB; --border: #FED7AA;
  --grade-selected: #FFF7ED; --grade-border: #FDBA74;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

#page-container { position: relative; min-height: 100dvh; }

.page {
  min-height: 100dvh;
  padding-bottom: 120px;
  animation: fadeIn 0.35s ease;
}

.page.slide-left-exit { animation: slideLeftExit 0.3s ease forwards; }
.page.slide-right-exit { animation: slideRightExit 0.3s ease forwards; }

.app-header { text-align: center; padding: 28px 20px 12px; }
.app-header .logo { font-size: 20px; font-weight: 700; color: var(--primary); }
.slogan { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.hero-banner { text-align: center; padding: 0 20px 20px; }
.hero-banner h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.hero-sub { font-size: 13px; color: var(--text-secondary); }

.social-proof {
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
  color: var(--text-secondary); font-size: 12px; margin-top: 12px;
}

.resume-banner {
  display: block; margin: 0 16px 12px; padding: 12px;
  background: var(--primary-light); border: 1px solid var(--grade-border);
  border-radius: var(--radius-md); font-size: 14px; color: var(--primary);
  cursor: pointer; text-align: center; animation: slideUp 0.4s ease;
}

.category-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 0 16px 20px;
}

.category-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px 12px; text-align: center;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  animation: cardEnter 0.4s ease backwards;
}
.category-card:nth-child(n) { animation-delay: calc(0.05s * var(--i, 1)); }
.category-card:active { transform: scale(0.97); }
.category-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.cat-icon { font-size: 32px; margin-bottom: 6px; }
.cat-name { font-size: 14px; font-weight: 600; }

.trust-bar {
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
  padding: 0 16px 16px; font-size: 12px; color: var(--text-secondary);
}

.how-it-works {
  display: flex; justify-content: space-around; padding: 16px;
  margin: 0 16px 24px; background: var(--card-bg);
  border-radius: var(--radius-md); border: 1px solid var(--border);
}
.step { font-size: 13px; font-weight: 500; }

.theme-picker { margin-left: auto; }
.theme-btn {
  background: var(--primary-light); border: none; color: var(--primary);
  padding: 8px 12px; border-radius: 20px; font-size: 12px; cursor: pointer;
  min-height: 44px;
}

.quote-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: var(--card-bg); position: sticky; top: 0; z-index: 10;
}
.back-btn {
  background: none; border: none; font-size: 24px; padding: 8px;
  cursor: pointer; color: var(--text-primary); min-width: 44px; min-height: 44px;
}
.topbar-title { font-weight: 600; flex: 1; font-size: 15px; }

.section-block { padding: 12px 16px; }
.section-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text-secondary); }

.grade-selector {
  display: flex; gap: 10px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px;
}
.grade-selector::-webkit-scrollbar { display: none; }

.grade-card {
  flex: 0 0 auto; min-width: 110px; background: var(--card-bg);
  border: 2px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 12px; text-align: center; cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.grade-card.selected {
  border-color: var(--primary); background: var(--grade-selected);
  transform: scale(1.05); box-shadow: var(--shadow-md);
}
.grade-name { font-size: 14px; font-weight: 700; }
.grade-price { font-size: 12px; color: var(--primary); margin: 4px 0; }
.grade-desc { font-size: 10px; color: var(--text-secondary); }
.recommended-badge {
  display: inline-block; background: var(--cta); color: #fff;
  font-size: 10px; padding: 2px 8px; border-radius: 10px; margin-bottom: 4px;
}

.range-slider-group { margin-bottom: 18px; }
.range-slider-group label {
  display: flex; justify-content: space-between; font-size: 14px; font-weight: 500; margin-bottom: 8px;
}
.range-value { color: var(--primary); font-weight: 700; }
.range-slider-group input[type="range"] {
  width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
  background: var(--border); border-radius: 3px; outline: none;
}
.range-slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); border: 3px solid #fff; box-shadow: var(--shadow-md); cursor: pointer;
}

.select-group { margin-bottom: 16px; }
.select-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.qc-select {
  width: 100%; padding: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card-bg);
  font-size: 15px; min-height: 48px;
}

.addon-checklist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.addon-item {
  background: var(--card-bg); border: 2px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 10px; cursor: pointer;
  transition: all 0.2s; display: flex; flex-direction: column; align-items: center;
  min-height: 44px;
}
.addon-item.checked {
  border-color: var(--success); background: color-mix(in srgb, var(--success) 8%, var(--card-bg));
  transform: scale(1.02);
}
.addon-icon { font-size: 22px; }
.addon-name { font-size: 12px; font-weight: 600; margin: 4px 0; text-align: center; }
.addon-price { font-size: 11px; color: var(--primary); }
.check-mark { color: var(--success); font-size: 16px; opacity: 0; transition: opacity 0.2s; animation: none; }
.addon-item.checked .check-mark { opacity: 1; animation: checkPop 0.3s ease; }

.sticky-bottom-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06); z-index: 100;
  animation: slideUp 0.3s ease;
}
.total-label { font-size: 11px; color: var(--text-secondary); }
.total-amount { font-size: 22px; font-weight: 800; color: var(--primary); }
.total-amount.pulse { animation: pricePulse 0.5s ease; }
.sticky-actions { display: flex; gap: 8px; align-items: center; }
.detail-link {
  background: none; border: none; color: var(--text-secondary);
  font-size: 13px; cursor: pointer; min-height: 44px; padding: 0 8px;
}
.detail-btn {
  background: var(--primary); color: #fff; border: none;
  padding: 10px 18px; border-radius: 24px; font-size: 14px; font-weight: 600;
  cursor: pointer; min-height: 44px;
}

.breakdown-collapsible {
  margin: 0 16px 8px; overflow: hidden; max-height: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease; opacity: 0;
}
.breakdown-collapsible.expanded { max-height: 400px; opacity: 1; }
.breakdown-inner {
  background: var(--card-bg); border-radius: var(--radius-md);
  padding: 12px; border: 1px solid var(--border);
}
.breakdown-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.breakdown-row:last-child { border-bottom: none; }
.total-row { font-weight: 700; color: var(--primary); }

.result-page { padding: 0 0 24px; }
.summary-card {
  background: linear-gradient(135deg, var(--primary), var(--cta));
  color: #fff; border-radius: var(--radius-lg); padding: 24px;
  text-align: center; margin: 16px; animation: cardEnter 0.5s ease;
}
.summary-label { font-size: 14px; opacity: 0.9; }
.summary-total { font-size: 34px; font-weight: 800; margin: 8px 0; }
.summary-grade { font-size: 13px; opacity: 0.85; }

.pie-chart-container { display: flex; justify-content: center; margin: 8px 0; }

.breakdown-section {
  background: var(--card-bg); border-radius: var(--radius-md);
  padding: 16px; margin: 0 16px 12px; box-shadow: var(--shadow-sm);
}

.result-proof { text-align: center; font-size: 13px; color: var(--text-secondary); margin: 8px 16px; }
.tip-line { font-size: 12px; color: var(--text-secondary); margin: 4px 16px; }

.action-bar { display: flex; gap: 8px; padding: 16px; flex-wrap: wrap; }
.action-bar .btn {
  flex: 1; min-width: 90px; padding: 12px; border-radius: 24px;
  font-size: 14px; font-weight: 600; text-align: center; cursor: pointer;
  border: none; min-height: 48px; transition: transform 0.15s;
}
.action-bar .btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--card-bg); color: var(--primary); border: 1px solid var(--primary); }

.qc-toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(30,41,59,0.92); color: #fff; padding: 10px 20px;
  border-radius: 24px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; z-index: 200;
}
.qc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.contact-footer {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--card-bg); border-top: 1px solid var(--border); z-index: 50;
}
.has-contact-footer .page { padding-bottom: 160px; }
.has-contact-footer .sticky-bottom-bar { bottom: 56px; }
.contact-footer__btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.contact-footer__cta, .contact-footer__btn {
  padding: 8px 14px; border-radius: 20px; font-size: 12px; text-decoration: none;
  min-height: 36px; display: inline-flex; align-items: center;
}
.contact-footer__cta { background: var(--primary); color: #fff; }
.contact-footer__btn { border: 1px solid var(--border); background: var(--card-bg); color: var(--text-primary); cursor: pointer; }
.contact-footer__brand { text-align: center; font-size: 0.65rem; color: var(--text-secondary); margin-top: 4px; }

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100%); }
  to { transform: translateX(-50%) translateY(0); }
}
@keyframes slideLeftExit {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-30%); }
}
@keyframes slideRightExit {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30%); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pricePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); color: var(--cta); }
  100% { transform: scale(1); }
}
@keyframes checkPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes bounceIn {
  0% { transform: scale(0.9); opacity: 0; }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 40%, transparent); }
  50% { box-shadow: 0 0 12px 4px color-mix(in srgb, var(--primary) 25%, transparent); }
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes countTick {
  0% { opacity: 0.5; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
  #app { max-width: 900px; }
  .category-grid { grid-template-columns: repeat(4, 1fr); }
  .quote-page .section-block { max-width: 600px; margin: 0 auto; }
}

/* ━━━ P2 — AI 市场参考 ━━━ */
.ai-pricing-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  animation: cardEnter 0.4s ease;
}
.ai-pricing-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.ai-pricing-head h4 { font-size: 14px; font-weight: 600; }
.ai-score {
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 12px;
  background: var(--primary-light); color: var(--primary);
}
.ai-score--warn { background: #FEF3C7; color: #D97706; }
.ai-score--info { background: #E0E7FF; color: #4338CA; }
.ai-verdict { font-size: 13px; margin-bottom: 10px; color: var(--text-primary); }
.ai-range-bar {
  display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-secondary);
}
.ai-range-track {
  flex: 1; height: 8px; background: var(--border); border-radius: 4px; position: relative;
}
.ai-range-fill {
  position: absolute; left: 10%; right: 10%; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 4px; opacity: 0.5;
}
.ai-range-dot {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  background: var(--primary); border-radius: 50%; border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}
.ai-range-label { font-size: 12px; color: var(--text-secondary); margin: 8px 0; }
.ai-tips { font-size: 12px; color: var(--text-secondary); padding-left: 18px; }
.ai-tips li { margin: 4px 0; }

/* P2 — 档次对比 */
.compare-table { animation: cardEnter 0.35s ease; }
.compare-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.compare-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
  padding: 12px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px; cursor: pointer; transition: all 0.2s;
}
.compare-row.active { border-color: var(--primary); background: var(--grade-selected); }
.compare-row.best .compare-total { color: var(--success); }
.compare-badge {
  display: inline-block; font-size: 10px; background: var(--cta); color: #fff;
  padding: 1px 6px; border-radius: 8px; margin-right: 4px;
}
.compare-total { font-weight: 700; font-size: 15px; color: var(--primary); }
.compare-diff { font-size: 11px; color: var(--text-secondary); min-width: 52px; text-align: right; }
.compare-hint { font-size: 11px; color: var(--text-secondary); text-align: center; }

/* P2 — 报价历史 */
.history-entry-btn {
  display: block; margin: 0 16px 16px; padding: 12px;
  background: var(--card-bg); border: 1px dashed var(--border);
  border-radius: var(--radius-md); font-size: 14px; cursor: pointer; color: var(--primary);
  min-height: 44px;
}
.history-page { padding: 0 16px; }
.history-list { padding-bottom: 24px; }
.history-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 10px; overflow: hidden;
}
.history-item-main {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 12px; cursor: pointer; min-height: 44px;
}
.history-icon { font-size: 24px; }
.history-total { font-weight: 700; color: var(--primary); font-size: 14px; margin-left: auto; }
.history-item small { display: block; color: var(--text-secondary); font-size: 11px; }
.history-del {
  border: none; background: none; font-size: 22px; color: var(--text-secondary);
  padding: 0 14px; cursor: pointer; min-height: 44px;
}
.history-empty { text-align: center; padding: 40px 16px; color: var(--text-secondary); }
.history-empty .hint { font-size: 13px; margin-top: 8px; }

/* P2 — 分享落地页 */
.share-landing { background: var(--bg); }
.share-main { max-width: 480px; margin: 0 auto; padding: 16px 16px 100px; min-height: 100dvh; }
.share-hero {
  text-align: center; padding: 24px 16px;
  background: linear-gradient(135deg, var(--primary), var(--cta));
  color: #fff; border-radius: var(--radius-lg); margin-bottom: 16px;
}
.share-badge { font-size: 14px; opacity: 0.9; }
.share-hero h1 { font-size: 36px; font-weight: 800; margin: 8px 0; }
.share-sub { font-size: 13px; opacity: 0.85; }
.share-breakdown { margin-bottom: 16px; }
.share-qr-block {
  text-align: center; background: var(--card-bg); border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 16px; border: 1px solid var(--border);
}
.share-qr-block p { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.share-actions { display: flex; flex-direction: column; gap: 10px; }
.share-actions .btn-block { width: 100%; text-decoration: none; display: block; text-align: center; }
.share-empty { text-align: center; padding: 48px 16px; }
.share-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.share-empty .btn { margin-top: 16px; display: inline-block; padding: 12px 24px;
  background: var(--primary); color: #fff; border-radius: 24px; text-decoration: none; }
