/* ═══════════════════════════════════════════════
   攒聪 H5（W4）—— 移动端优先 · Bitcoin 橙暖色主题
   ═══════════════════════════════════════════════ */
:root {
  --bg:        #fff6ec;
  --card:      #ffffff;
  --orange:    #f7931a;
  --orange-d:  #e07c00;
  --ink:       #3a2e22;
  --muted:     #a89580;
  --green:     #2bb673;
  --track:     #f1e4d2;
  --danger:    #e2574c;
  --shadow:    0 6px 24px rgba(247,147,26,0.13);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, monospace; }
.muted { color: var(--muted); font-size: 14px; }

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ── 视图切换 ── */
.view { display: none; flex: 1; flex-direction: column; padding: 0 22px; }
.view.active { display: flex; }

/* ── 加载中 ── */
.loading-wrap, .onboard-loading {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
.coin-spin { font-size: 48px; animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 登录 ── */
.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.brand-logo {
  display: block; width: 84px; height: 84px; margin: 0 auto 14px;
  filter: drop-shadow(0 8px 22px rgba(58,46,34,.22));
}
.brand-big { font-size: 34px; font-weight: 800; text-align: center; }
.brand-hook {
  text-align: center; color: var(--orange-d); font-weight: 700;
  margin-top: 8px; font-size: 15px;
}
.login-desc {
  text-align: center; color: var(--muted); font-size: 14px;
  line-height: 1.7; margin: 22px 0 26px;
}
.field { margin-bottom: 8px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .amount-input {
  width: 100%; padding: 14px 16px; font-size: 16px;
  border: 1.5px solid var(--track); border-radius: 14px;
  background: var(--card); color: var(--ink); outline: none;
}
.field input:focus, .amount-input:focus { border-color: var(--orange); }
.fineprint { text-align: center; color: var(--muted); font-size: 11px; margin-top: 16px; }

/* ── 按钮 ── */
.btn-primary {
  width: 100%; padding: 16px; font-size: 17px; font-weight: 700;
  color: #fff; background: var(--orange); border: none; border-radius: 16px;
  cursor: pointer; box-shadow: var(--shadow); margin-top: 14px;
  transition: transform .08s, background .15s;
}
.btn-primary:active { transform: scale(.98); background: var(--orange-d); }
.btn-primary:disabled { opacity: .55; box-shadow: none; }
.btn-ghost {
  flex: 1; padding: 13px; font-size: 15px; font-weight: 600;
  color: var(--orange-d); background: var(--card);
  border: 1.5px solid var(--track); border-radius: 14px; cursor: pointer;
}
.btn-ghost:active { background: #fff0dd; }
.icon-btn {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--muted); padding: 4px;
}
.form-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; text-align: center; }

/* ── 开户 ── */
.onboard-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.onboard-emoji { font-size: 64px; }
.onboard-title { font-size: 22px; font-weight: 800; margin-top: 14px; }
.onboard-desc {
  text-align: center; color: var(--muted); font-size: 14px;
  line-height: 1.8; margin: 14px 0 8px;
}

/* ── 主页 topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 4px;
}
.topbar-brand { font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.topbar-logo { width: 26px; height: 26px; display: block; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.acct { font-size: 12px; color: var(--muted); }

/* ── 主页 hero（百万聪进度环）── */
.hero {
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  padding: 20px 18px 22px; margin-top: 12px;
  display: flex; flex-direction: column; align-items: center;
}
.hero-tag {
  font-size: 12px; font-weight: 700; color: var(--orange-d);
  background: #fff0dd; padding: 4px 12px; border-radius: 999px;
}
.ring-wrap { position: relative; width: 220px; height: 220px; margin: 8px 0 4px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--track); stroke-width: 16; }
.ring-fill {
  fill: none; stroke: var(--orange); stroke-width: 16; stroke-linecap: round;
  stroke-dasharray: 540.35; stroke-dashoffset: 540.35;
  transition: stroke-dashoffset .9s ease;
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-label { font-size: 13px; color: var(--muted); }
.ring-value { font-size: 38px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ring-unit { font-size: 13px; color: var(--muted); }
.hero-goal { margin-top: 6px; font-size: 14px; font-weight: 600; }
.hero-btc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── 统计行 ── */
.stat-row { display: flex; gap: 12px; margin-top: 14px; }
.stat {
  flex: 1; background: var(--card); border-radius: 18px;
  padding: 14px; text-align: center; box-shadow: var(--shadow);
}
.stat-num { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; }

.wallet-line {
  text-align: center; font-size: 13px; color: var(--muted); margin-top: 12px;
}

/* ── 操作区 ── */
.actions { margin-top: 14px; padding-bottom: 24px; }
.btn-save { font-size: 19px; letter-spacing: 2px; padding: 18px; margin-top: 0; }
.actions-sub { display: flex; gap: 12px; margin-top: 12px; }
.checkin-hint { text-align: center; font-size: 13px; color: var(--green); padding-bottom: 16px; }

/* ── 底部弹层 sheet ── */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 50;
}
.sheet-mask.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 460px;
  transform: translate(-50%, 100%);
  background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 10px 22px calc(26px + env(safe-area-inset-bottom));
  transition: transform .3s cubic-bezier(.2,.8,.2,1); z-index: 51;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-handle {
  width: 40px; height: 4px; background: var(--track);
  border-radius: 999px; margin: 0 auto 14px;
}
.sheet-title { font-size: 20px; font-weight: 800; text-align: center; }
.sheet-hint { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 16px; }
.presets { display: flex; gap: 10px; margin-bottom: 12px; }
.preset {
  flex: 1; padding: 12px 4px; text-align: center; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--track);
  border-radius: 14px; font-size: 14px; font-weight: 600;
}
.preset.active { border-color: var(--orange); background: #fff0dd; color: var(--orange-d); }

/* ── toast ── */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -160%);
  background: var(--ink); color: #fff; padding: 12px 20px;
  border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: transform .3s, opacity .3s; z-index: 60; max-width: 90%;
  opacity: 0; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.ok    { background: var(--green); }
.toast.err   { background: var(--danger); }

/* ── 教练卡片（主页）── */
.coach-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; margin-top: 12px; padding: 13px 16px;
  background: var(--card); border: none; border-radius: 18px;
  box-shadow: var(--shadow); cursor: pointer; text-align: left;
}
.coach-card:active { transform: scale(.99); }
.coach-ava {
  width: 42px; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: #fff0dd; border-radius: 50%;
}
.coach-body { flex: 1; min-width: 0; }
.coach-name { font-size: 12px; color: var(--orange-d); font-weight: 700; }
.coach-msg {
  font-size: 14px; color: var(--ink); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.coach-arrow { font-size: 22px; color: var(--muted); flex-shrink: 0; }

/* ── 教练对话视图 ── */
.back-btn { font-size: 15px; color: var(--orange-d); font-weight: 600; }
.topbar-spacer { width: 52px; }
.chat-list {
  flex: 1; overflow-y: auto; padding: 14px 0 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-msg {
  max-width: 82%; padding: 11px 14px; border-radius: 16px;
  font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.chat-msg.coach {
  align-self: flex-start; background: var(--card);
  border-bottom-left-radius: 5px; box-shadow: var(--shadow);
}
.chat-msg.user {
  align-self: flex-end; background: var(--orange); color: #fff;
  border-bottom-right-radius: 5px;
}
.chat-msg.typing { color: var(--muted); }
.chat-input-bar {
  display: flex; gap: 10px;
  padding: 12px 0 calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
}
.chat-input-bar input {
  flex: 1; min-width: 0; padding: 12px 16px; font-size: 15px;
  border: 1.5px solid var(--track); border-radius: 999px;
  background: var(--card); color: var(--ink); outline: none;
}
.chat-input-bar input:focus { border-color: var(--orange); }
.chat-input-bar button {
  padding: 0 20px; font-size: 15px; font-weight: 700; color: #fff;
  background: var(--orange); border: none; border-radius: 999px; cursor: pointer;
}
.chat-input-bar button:disabled { opacity: .5; }
