:root {
  --bg: #0f1115;
  --surface: #191c23;
  --surface-2: #21252e;
  --line: #2b303b;
  --text: #eef0f4;
  --sub: #939aa8;
  --brand: #ff5f7e;
  --ok: #3ddc97;
  --warn: #ffb454;
  --danger: #ff5a5a;
  --radius: 14px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 72px; }

.app-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.app-bar .title { font-weight: 600; }
.badge {
  font-size: 11px; color: var(--sub);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
}

.page { padding: 16px; }
.hidden { display: none !important; }

h2 { font-size: 19px; margin: 4px 0 8px; }
h3 { font-size: 15px; margin: 22px 0 8px; color: var(--sub); font-weight: 500; }
.hint { color: var(--sub); font-size: 13px; margin: 0 0 16px; }
.sub { color: var(--sub); font-size: 12px; font-weight: 400; }
.row-between { display: flex; align-items: center; justify-content: space-between; }

.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: 999px; padding: 7px 14px;
  font-size: 13px; cursor: pointer;
}
.chip.active { border-color: var(--brand); background: rgba(255, 95, 126, 0.14); color: var(--brand); }

input {
  width: 100%; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font-size: 15px; outline: none;
}
input:focus { border-color: var(--brand); }

button { font-family: inherit; cursor: pointer; }
.primary {
  width: 100%; padding: 13px; border: none; border-radius: 12px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 600;
}
.primary:disabled { opacity: 0.5; }
.primary.small { width: auto; padding: 11px 18px; font-size: 14px; border-radius: 10px; white-space: nowrap; flex: 0 0 auto; }
.primary.tiny { width: auto; padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.link { background: none; border: none; color: var(--sub); font-size: 13px; padding: 6px; }
.link.strong { color: var(--brand); }

.tabs { display: flex; gap: 6px; margin: 14px 0; overflow-x: auto; }
.tab {
  border: 1px solid var(--line); background: transparent; color: var(--sub);
  border-radius: 999px; padding: 6px 13px; font-size: 13px; white-space: nowrap;
}
.tab.active { color: var(--text); border-color: var(--text); }

.list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-title { font-weight: 600; }
.card-goal { color: var(--sub); font-size: 13px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }

.tag { font-size: 11px; border-radius: 6px; padding: 2px 7px; border: 1px solid var(--line); color: var(--sub); }
.tier-free { color: var(--brand); border-color: rgba(255, 95, 126, 0.4); }
.tier-basic { color: var(--ok); border-color: rgba(61, 220, 151, 0.4); }
.tier-intermediate { color: var(--warn); border-color: rgba(255, 180, 84, 0.4); }
.tier-advanced { color: var(--danger); border-color: rgba(255, 90, 90, 0.4); }
.effect-positive { color: var(--ok); border-color: rgba(61, 220, 151, 0.4); }
.effect-negative { color: var(--warn); border-color: rgba(255, 180, 84, 0.4); }
.effect-risk { color: var(--danger); border-color: rgba(255, 90, 90, 0.4); }

.recommend {
  background: rgba(255, 95, 126, 0.07); border: 1px solid rgba(255, 95, 126, 0.25);
  border-radius: var(--radius); padding: 12px; margin-bottom: 8px;
}
.recommend-title { font-size: 13px; color: var(--brand); margin-bottom: 10px; }
.recommend .card { background: var(--surface-2); }
.recommend #recommendList { display: flex; flex-direction: column; gap: 10px; }

/* 对话 */
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.chat-title { text-align: center; font-size: 14px; font-weight: 600; }
.meters { display: flex; gap: 10px; padding: 12px 16px 4px; }
.meter { flex: 1; font-size: 11px; color: var(--sub); }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--ok); transition: width 0.35s ease; }
.bar.danger > i { background: var(--danger); }
.goal { margin: 10px 16px; padding: 10px 12px; background: var(--surface); border-radius: 10px; font-size: 12px; color: var(--sub); }

.messages { padding: 8px 16px 12px; min-height: 40vh; }
.bubble-row { display: flex; margin-bottom: 12px; }
.bubble-row.user { justify-content: flex-end; }
.bubble {
  max-width: 78%; padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  white-space: pre-wrap; word-break: break-word;
}
.bubble-row.user .bubble { background: var(--brand); border-color: var(--brand); color: #fff; }
.bubble-row.typing .bubble { color: var(--sub); font-style: italic; }

.composer {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: flex; gap: 8px; padding: 10px 16px 14px;
  background: rgba(15, 17, 21, 0.96); border-top: 1px solid var(--line);
}
.composer input { min-width: 0; }
.composer.inline { position: static; padding: 0; background: none; border-top: none; }

/* 语音输入。composer 已是 fixed，作为绝对定位的包含块，提示条浮在它上面不占行内空间 */
.mic {
  flex: 0 0 auto; padding: 11px 14px; font-size: 14px; white-space: nowrap;
  border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--text);
}
.mic.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.mic:disabled { opacity: 0.45; }
.voice-hint {
  position: absolute; left: 16px; right: 16px; bottom: 100%; margin-bottom: 6px;
  padding: 7px 11px; border-radius: 9px; font-size: 12px; color: var(--sub);
  background: var(--surface); border: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.link.block { display: block; width: 100%; margin-top: 14px; text-align: center; padding: 10px; }

.account-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}

/* 复盘 */
.score-card { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.score { font-size: 44px; font-weight: 700; line-height: 1; }
.score-meta { font-size: 15px; font-weight: 600; }
.notice { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 12px; background: rgba(255, 180, 84, 0.12); color: var(--warn); }
.notice.danger { background: rgba(255, 90, 90, 0.12); color: var(--danger); margin-top: 10px; }
.dim { margin-top: 14px; }
.dim-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 4px; }
.next-practice { margin-top: 16px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.np-title { font-size: 12px; color: var(--brand); margin-bottom: 6px; }
.quote { font-size: 14px; margin: 6px 0; }
.comment { font-size: 13px; color: var(--sub); }
.suggestion { font-size: 13px; color: var(--ok); margin-top: 6px; }
.empty { color: var(--sub); font-size: 13px; text-align: center; padding: 24px 0; }

/* 统计 */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--sub); }
.trend-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }

/* 效果度量 */
.delta { font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--sub); }

.weekly { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.weekly-row { display: flex; justify-content: space-between; text-align: center; }
.weekly-row b { display: block; font-size: 22px; }
.weekly-row span { font-size: 12px; color: var(--sub); }
.weekly-delta { display: flex; gap: 12px; justify-content: center; margin: 10px 0 6px; font-size: 12px; }

.compare-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.compare-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.compare-head b { font-size: 20px; }
.compare-dims { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.compare-dim {
  display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--sub);
  background: var(--surface-2); border-radius: 8px; padding: 4px 8px;
}

/* 底部导航 */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: flex; background: rgba(15, 17, 21, 0.96);
  border-top: 1px solid var(--line);
}
.bottom-nav .nav { flex: 1; background: none; border: none; color: var(--sub); padding: 14px 0; font-size: 13px; }
.bottom-nav .nav.active { color: var(--brand); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  max-width: 88%; padding: 10px 16px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.86); color: #fff; font-size: 13px; z-index: 99;
}
