/* ============ 内容实验室 H5 样式 ============ */

:root {
  --primary: #007aff;
  --primary-light: #e8f4ff;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #e94560;
  --gold: #FFD700;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #8e8e93;
  --text-light: #b0b0b0;
  --border: #e5e5ea;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ============ 页面容器 ============ */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; background: var(--bg); }

.page { display: none; padding: 16px 16px 80px; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ============ 顶部导航 ============ */
.nav-header {
  background: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}

.nav-title { font-size: 18px; font-weight: 700; }

.nav-back { color: var(--primary); font-size: 15px; cursor: pointer; padding: 4px 8px; border: none; background: none; }
.nav-back::before { content: '← '; }

/* ============ 底部 TabBar ============ */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px;
  background: #fff; display: flex; border-top: 1px solid var(--border); z-index: 200;
  padding-bottom: var(--safe-bottom);
}

.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6px 0 4px; cursor: pointer; color: var(--text-secondary); font-size: 10px;
  transition: color 0.2s; border: none; background: none; -webkit-tap-highlight-color: transparent;
}

.tab-item.active { color: var(--primary); }
.tab-icon { font-size: 22px; margin-bottom: 2px; line-height: 1; }

/* ============ 场景切换 ============ */
.scene-tabs {
  display: flex; background: #fff; border-radius: var(--radius); padding: 4px; margin-bottom: 16px; box-shadow: var(--shadow);
}

.scene-tab {
  flex: 1; padding: 10px; text-align: center; border-radius: var(--radius-sm); font-size: 14px;
  cursor: pointer; color: var(--text-secondary); border: none; background: none;
  transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}

.scene-tab.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ============ 输入框 ============ */
.input-card {
  background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px;
}

.input-mode-tabs { display: flex; gap: 8px; margin-bottom: 12px; }

.input-mode-tab {
  flex: 1; padding: 8px; text-align: center; border-radius: 20px; font-size: 13px;
  cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text-secondary);
}
.input-mode-tab.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); font-weight: 600; }

.textarea-input {
  width: 100%; min-height: 100px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; line-height: 1.6; resize: vertical; font-family: inherit; transition: border-color 0.2s;
}

.textarea-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,122,255,0.1); }

.link-input {
  width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; transition: border-color 0.2s;
}
.link-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,122,255,0.1); }

.char-count { text-align: right; font-size: 12px; color: var(--text-light); margin-top: 6px; }
.paste-btn { color: var(--primary); font-size: 13px; cursor: pointer; margin-top: 8px; display: inline-block; background: none; border: none; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 12px 24px;
  border-radius: 24px; font-size: 15px; font-weight: 600; cursor: pointer; border: none;
  transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0066d6; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }

.btn-block { width: 100%; }

.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }

.btn-gold { background: linear-gradient(135deg, #FFD700, #FFA500); color: #fff; }

.btn-loading { position: relative; pointer-events: none; }
.btn-loading::after {
  content: ''; width: 18px; height: 18px; border: 2px solid #fff; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.6s linear infinite; margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

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

.card-title { font-size: 16px; font-weight: 600; }

/* ============ 配额条 ============ */
.quota-bar {
  background: #fff; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between;
}

.quota-text { font-size: 13px; color: var(--text-secondary); }
.quota-text span { color: var(--primary); font-weight: 600; }

.quota-upgrade {
  background: linear-gradient(135deg, #FFD700, #FFA500); color: #fff; padding: 5px 12px;
  border-radius: 14px; font-size: 12px; cursor: pointer; border: none; font-weight: 600;
}

/* ============ 评分圆环 ============ */
.score-ring-container { display: flex; justify-content: center; margin: 16px 0; }

.score-ring {
  width: 120px; height: 120px; position: relative; display: flex; align-items: center; justify-content: center;
}

.score-ring svg { transform: rotate(-90deg); }
.score-ring-value {
  position: absolute; font-size: 36px; font-weight: 700;
}

.score-ring-label { position: absolute; bottom: 20px; font-size: 12px; color: var(--text-secondary); }

/* ============ 维度列表 ============ */
.dimension-list { margin: 12px 0; }

.dimension-item {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dimension-item:last-child { border-bottom: none; }

.dimension-name { font-size: 14px; font-weight: 500; }

.dimension-bar-bg {
  flex: 1; height: 6px; background: #eee; border-radius: 3px; margin: 0 12px; overflow: hidden;
}

.dimension-bar-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }

.dimension-score { font-size: 14px; font-weight: 600; min-width: 32px; text-align: right; }

/* ============ 报告页 ============ */
.report-header { text-align: center; padding: 8px 0; }

.report-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }

.report-platform { font-size: 13px; color: var(--text-secondary); }

.report-prediction {
  background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
  border-radius: var(--radius); padding: 20px; margin: 16px 0;
}

.prediction-level { font-size: 20px; font-weight: 700; margin-bottom: 8px; }

.prediction-detail { font-size: 14px; opacity: 0.9; line-height: 1.8; }

.report-suggestions { margin: 16px 0; }

.suggestion-item {
  padding: 10px 12px; background: var(--primary-light); border-radius: var(--radius-sm);
  margin-bottom: 8px; display: flex; align-items: flex-start; gap: 8px; font-size: 14px;
}

.suggestion-num {
  width: 22px; height: 22px; background: var(--primary); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0;
}

.report-actions { display: flex; gap: 12px; margin-top: 16px; }

.report-actions .btn { flex: 1; }

/* ============ 内容银行 ============ */
.bank-search { margin-bottom: 12px; }

.bank-search-input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 14px; background: #fff;
}

.bank-filter { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.filter-tag {
  padding: 6px 14px; border-radius: 16px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text-secondary);
}
.filter-tag.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.bank-item {
  background: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.15s;
}
.bank-item:active { transform: scale(0.98); }

.bank-item-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }

.bank-item-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; }

.bank-item-actions { display: flex; gap: 8px; margin-top: 8px; }
.bank-item-actions button { font-size: 12px; padding: 4px 10px; border-radius: 12px; cursor: pointer; border: 1px solid var(--border); background: #fff; }

.bank-empty { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.bank-empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ============ 趋势雷达 ============ */
.trend-card {
  background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow); cursor: pointer;
}

.trend-rank { font-size: 24px; font-weight: 800; color: var(--primary); }

.trend-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }

.trend-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; }

.trend-heat { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }

.trend-heat-high { background: #fff0f0; color: var(--danger); }
.trend-heat-mid { background: #fff8e1; color: var(--warning); }
.trend-heat-low { background: #e8f5e9; color: var(--success); }

/* ============ 个人中心 ============ */
.profile-header {
  text-align: center; padding: 24px 0 16px;
}

.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #5856d6);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; color: #fff; font-size: 32px;
}

.profile-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }

.profile-stats {
  display: flex; justify-content: space-around; background: #fff; border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px;
}

.stat-item { text-align: center; }

.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.profile-menu { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }

.menu-item {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #f5f5f5; }

.menu-item-left { display: flex; align-items: center; gap: 12px; }
.menu-item-icon { font-size: 20px; }
.menu-item-label { font-size: 15px; }
.menu-item-arrow { color: var(--text-light); font-size: 14px; }

/* 校准曲线 */
.calibration-section { margin: 16px 0; }

.calibration-chart {
  background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}

.calibration-bar {
  display: flex; height: 48px; border-radius: 8px; overflow: hidden; margin: 12px 0;
}

.calibration-over { background: rgba(233,69,96,0.2); }
.calibration-accurate { background: rgba(76,175,80,0.2); }
.calibration-under { background: rgba(0,122,255,0.2); }

.calibration-legend { display: flex; justify-content: center; gap: 16px; font-size: 12px; margin-top: 8px; }
.calibration-legend span { display: flex; align-items: center; gap: 4px; }
.calibration-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ============ VIP 页 ============ */
.vip-hero {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460); color: #fff;
  border-radius: var(--radius); padding: 32px 24px; text-align: center; margin-bottom: 16px;
}

.vip-hero-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.vip-hero-subtitle { font-size: 14px; opacity: 0.8; }

.vip-plan {
  background: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 12px;
  box-shadow: var(--shadow); border: 2px solid transparent; cursor: pointer; transition: all 0.2s;
}
.vip-plan.active { border-color: var(--primary); }
.vip-plan.recommended { border-color: #FFD700; position: relative; }

.vip-plan-badge {
  position: absolute; top: -10px; right: 16px; background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #fff; padding: 3px 12px; border-radius: 10px; font-size: 11px; font-weight: 600;
}

.vip-plan-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.vip-plan-price { font-size: 32px; font-weight: 800; color: var(--primary); }
.vip-plan-price-unit { font-size: 14px; color: var(--text-secondary); }
.vip-plan-features { margin: 12px 0; }
.vip-plan-feature { padding: 4px 0; font-size: 13px; color: var(--text-secondary); }
.vip-plan-feature::before { content: '✓ '; color: var(--success); font-weight: bold; }

.vip-faq { margin-top: 20px; }

.faq-item { background: #fff; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); }

.faq-q { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.faq-a { font-size: 13px; color: var(--text-secondary); }

/* ============ 隐私协议 ============ */
.privacy-content {
  background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  font-size: 14px; line-height: 1.8;
}

.privacy-content h2 { font-size: 18px; margin: 16px 0 8px; }
.privacy-content h2:first-child { margin-top: 0; }
.privacy-content h3 { font-size: 15px; margin: 12px 0 6px; }
.privacy-content p { margin-bottom: 8px; }

/* ============ 弹出层 ============ */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 300;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: #fff; border-radius: var(--radius); padding: 24px; width: 85%; max-width: 360px;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; text-align: center; }
.modal-content { font-size: 14px; line-height: 1.8; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn { flex: 1; }

/* Toast 提示 */
.toast {
  position: fixed; top: 20%; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8);
  color: #fff; padding: 10px 20px; border-radius: 20px; font-size: 14px; z-index: 400;
  animation: fadeIn 0.2s ease; pointer-events: none;
}

/* ============ 响应式 ============ */
@media (min-width: 481px) {
  #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* 隐藏滚动条但可滚动 */
::-webkit-scrollbar { width: 0; }

/* ============ 图表容器 ============ */
.chart-container {
  width: 100%;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 350px;
}

/* 图表切换标签 */
.chart-tabs {
  display: flex;
  gap: 4px;
}

.chart-tab {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.chart-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 分数圆环动画 */
.score-ring-animate {
  transition: stroke-dashoffset 1.2s ease-out;
}

/* 维度详情折叠 */
.dimension-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

#dim-detail-list .dimension-item {
  padding: 12px 0;
}

#dim-detail-list .dimension-item:last-child {
  border-bottom: none;
}