:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1b1f24;
  --ink2: #4b5563;
  --ink3: #8b93a1;
  --line: #e6e8ec;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eef2ff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.35; }

.wrap { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.wrap.wide { max-width: 1100px; }

/* ---------- 顶部 ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px;
}
.brand b { font-size: 15.5px; letter-spacing: .2px; }
.brand span { font-size: 11.5px; color: var(--ink3); display: block; margin-top: -2px; }
.top .link { font-size: 13px; color: var(--ink3); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-top: 14px; box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }
.card h3 { font-size: 15px; margin-bottom: 10px; }
.card .sub { font-size: 12.5px; color: var(--ink3); }
.card.tight { padding: 14px; }

.hero { margin-top: 16px; }
.hero h1 { font-size: 23px; letter-spacing: -.2px; }
.hero p { margin: 8px 0 0; color: var(--ink2); font-size: 14px; }

.steps { display: grid; gap: 8px; margin-top: 14px; }
.step { display: flex; gap: 11px; align-items: flex-start; font-size: 13.5px; color: var(--ink2); }
.step i {
  flex: none; width: 21px; height: 21px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-dark); font-style: normal; font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}

/* ---------- 表单 ---------- */
label.f { display: block; font-size: 12.5px; color: var(--ink3); margin: 14px 0 6px; }
label.f.first { margin-top: 0; }
input[type=text], input[type=password], select {
  width: 100%; border: 1px solid #d5d9e0; border-radius: 10px; padding: 12px 13px;
  font-size: 16px; font-family: inherit; color: var(--ink); background: #fff; outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid #d5d9e0; background: #fff; color: var(--ink2);
  border-radius: 11px; padding: 12px 18px; font-size: 15px; font-family: inherit;
  cursor: pointer; transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:active { background: var(--brand-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.btn.ghost { border-color: transparent; background: #f1f3f6; }

.hintline { font-size: 12px; color: var(--ink3); margin-top: 10px; line-height: 1.6; }
.err { color: var(--bad); font-size: 13px; margin-top: 10px; display: none; }
.warnbox {
  background: #fff8eb; border: 1px solid #fde3b8; color: #8a5a00; border-radius: 11px;
  padding: 11px 13px; font-size: 13px; line-height: 1.6; margin-top: 12px;
}
.warnbox.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.okbox {
  background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 11px;
  padding: 11px 13px; font-size: 13px; line-height: 1.6; margin-top: 12px;
}

/* ---------- 进度 ---------- */
.stat-row { display: flex; gap: 10px; margin-top: 12px; }
.stat { flex: 1; background: #fafbfc; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.stat b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.stat span { font-size: 11.5px; color: var(--ink3); }

.bar { height: 6px; background: #e9ebef; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 4px; transition: width .3s ease; }

/* ---------- 录制页 ---------- */
.rhead { position: sticky; top: 0; z-index: 9; background: var(--bg); padding: 12px 0 10px; }
.rhead .line { display: flex; align-items: center; justify-content: space-between; }
.rhead .n { font-size: 13px; color: var(--ink3); font-variant-numeric: tabular-nums; }
.sent-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px; margin-top: 12px; box-shadow: var(--shadow); }
.tagline { font-size: 11.5px; color: var(--brand-dark); background: var(--brand-soft); display: inline-block; padding: 3px 9px; border-radius: 6px; letter-spacing: .3px; }
.sent { font-size: 25px; line-height: 1.5; font-weight: 650; margin: 12px 0 6px; letter-spacing: .3px; word-break: break-word; }
.plain { font-size: 13px; color: var(--ink3); line-height: 1.55; }
.plain b { color: var(--ink2); font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 14px 0 12px; }
.tip { font-size: 12px; color: var(--ink3); line-height: 1.6; }

.miczone { text-align: center; margin-top: 20px; }
.mic {
  width: 118px; height: 118px; border-radius: 50%; border: none; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; font-family: inherit;
  box-shadow: 0 10px 26px rgba(37, 99, 235, .3); cursor: pointer;
  transition: transform .12s, background .18s; touch-action: none; user-select: none;
}
.mic svg { width: 26px; height: 26px; }
.mic:active { transform: scale(.96); }
.mic.rec { background: var(--bad); box-shadow: 0 10px 26px rgba(220, 38, 38, .34); animation: pulse 1.4s infinite; }
.mic[disabled] { background: #c3c8d0; box-shadow: none; animation: none; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

#wave { display: block; width: 100%; height: 54px; margin-top: 16px; }
.meter { width: 82%; height: 7px; background: #e9ebef; border-radius: 4px; margin: 10px auto 0; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 4px; transition: width .08s linear; }
.meter.warn i { background: var(--warn); }
.meter.bad i { background: var(--bad); }
.mtxt { font-size: 12px; color: var(--ink3); height: 18px; margin-top: 8px; font-variant-numeric: tabular-nums; }

.footer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; justify-content: center; z-index: 20;
}
.footer-bar .btn { flex: 1; max-width: 170px; }

.echo { margin-top: 14px; background: #fafbfc; border: 1px dashed #d7dbe2; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--ink2); display: none; }
.echo b { color: var(--ink); }
.echo .score { color: var(--brand-dark); font-weight: 600; }
.echo .low { color: var(--bad); font-weight: 600; }

.done-wrap { text-align: center; padding: 34px 10px; }
.done-wrap .big { font-size: 44px; line-height: 1; }
.done-wrap h2 { font-size: 20px; margin-top: 14px; }

/* ---------- 管理台 ---------- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.grid3 .stat b { font-size: 21px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11.5px; color: var(--ink3); font-weight: 600; letter-spacing: .3px; background: #fafbfc; position: sticky; top: 0; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-dark); }
.pill.g { background: #f0fdf4; color: #15803d; }
.pill.y { background: #fff8eb; color: #a16207; }
.pill.r { background: #fef2f2; color: #b91c1c; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.scroll { overflow: auto; max-height: 62vh; }
audio { height: 32px; max-width: 210px; }
.detail { margin-top: 12px; }
.kv { font-size: 12.5px; color: var(--ink3); }
.kv b { color: var(--ink2); font-weight: 600; }

@media (max-width: 520px) {
  .sent { font-size: 22px; }
  .mic { width: 104px; height: 104px; font-size: 13px; }
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .grid3 .stat b { font-size: 17px; }
}

/* ---------- 引导流程（v2） ---------- */
.pane { display: none; }
.pane.on { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.stepsbar { display: flex; align-items: center; gap: 6px; margin: 18px 0 2px; }
.stepsbar .s { flex: 1; height: 4px; border-radius: 3px; background: #e3e6ec; }
.stepsbar .s.on { background: var(--brand); }
.stepsbar .s.done { background: #93b4f7; }

.lead { font-size: 15px; color: var(--ink2); line-height: 1.75; }
.lead b { color: var(--ink); }
.bullets { margin: 12px 0 0; padding-left: 0; list-style: none; }
.bullets li { position: relative; padding-left: 22px; font-size: 14px; color: var(--ink2); line-height: 1.7; margin-bottom: 8px; }
.bullets li::before {
  content: ""; position: absolute; left: 6px; top: 10px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--brand); opacity: .55;
}
.bullets li b { color: var(--ink); }

.bigstep { display: flex; gap: 13px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.bigstep:last-child { border-bottom: 0; }
.bigstep .no {
  flex: none; width: 30px; height: 30px; border-radius: 10px; background: var(--brand-soft);
  color: var(--brand-dark); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.bigstep .t { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.bigstep .d { font-size: 13px; color: var(--ink3); line-height: 1.65; margin-top: 3px; }
.bigstep .d code { background: #f1f3f6; border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }

.footnav { display: flex; gap: 10px; margin-top: 20px; }
.footnav .btn { flex: 1; }

.privacy { background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.privacy h4 { margin: 0 0 6px; font-size: 13px; color: var(--ink2); }
.privacy p { margin: 0; font-size: 12.5px; color: var(--ink3); line-height: 1.7; }

/* ---------- 录制页 v2 ---------- */
.listenbar {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px;
}
.listenbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink3); flex: none; }
.listenbar.playing .dot { background: var(--brand); animation: pulse2 1s infinite; }
.listenbar .txt { font-size: 13px; color: var(--ink2); flex: 1; }
@keyframes pulse2 { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.refbtn { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--brand-dark); background: var(--brand-soft); border: 0; border-radius: 9px; padding: 8px 12px; font-family: inherit; cursor: pointer; }
.refbtn:disabled { opacity: .45; }

.bigstate {
  position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: 60;
  display: none; align-items: center; justify-content: center; flex-direction: column;
  background: rgba(12, 18, 28, .55); backdrop-filter: blur(3px); color: #fff; text-align: center; padding: 24px;
}
.bigstate.on { display: flex; animation: fade .16s ease; }
.bigstate .ico { font-size: 62px; line-height: 1; }
.bigstate .tt { font-size: 22px; font-weight: 700; margin-top: 12px; letter-spacing: .5px; }
.bigstate .dd { font-size: 14px; opacity: .92; margin-top: 6px; line-height: 1.6; max-width: 320px; }

.overlay {
  position: fixed; inset: 0; z-index: 70; background: #f5f6f8;
  display: flex; flex-direction: column; justify-content: center; padding: 28px 22px;
  text-align: center;
}
.overlay.off { display: none; }
.overlay h2 { font-size: 20px; }
.overlay p { color: var(--ink2); font-size: 14px; line-height: 1.75; }
.overlay .btn { margin-top: 26px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink2); margin-top: 14px; }
.switch input { width: 44px; height: 26px; appearance: none; -webkit-appearance: none; background: #d6dae1; border-radius: 14px; position: relative; transition: background .18s; outline: none; flex: none; }
.switch input:checked { background: var(--brand); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch input:checked::after { transform: translateX(18px); }

/* ---------- 管理台 v2 ---------- */
.tabs { display: flex; gap: 6px; margin-top: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  border: 0; background: none; font-family: inherit; font-size: 13.5px; color: var(--ink3);
  padding: 9px 12px; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent;
}
.tabs button.on { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tabpane { display: none; }
.tabpane.on { display: block; }

.reflist { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 12px; }
.refrow { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 13px; background: #fff; }
.refrow.has { border-color: #bbf7d0; background: #f7fef9; }
.refrow .sid { font-size: 11px; color: var(--ink3); }
.refrow .tx { margin: 3px 0 6px; color: var(--ink); line-height: 1.5; }
.refrow .ac { display: flex; gap: 6px; }

.recbox { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 14px; }
.recbox .stx { font-size: 18px; font-weight: 600; line-height: 1.5; margin: 8px 0 4px; }

.loginwrap { max-width: 360px; margin: 0 auto; padding: 56px 18px 40px; }

.tablewrap { overflow: auto; max-height: 60vh; }

/* 判定反馈：白卡片 + 彩色图标，比整屏红底好读 */
.bigstate { background: rgba(15, 23, 42, .38); }
.bigstate .bs-card {
  background: #fff; border-radius: 20px; padding: 26px 22px 24px; width: 100%; max-width: 310px;
  box-shadow: 0 18px 50px rgba(10, 20, 40, .28); color: var(--ink);
}
.bigstate .ico { font-size: 50px; line-height: 1; }
.bigstate.ok .ico { color: var(--ok); }
.bigstate.bad .ico { color: var(--bad); }
.bigstate .tt { color: var(--ink); font-size: 21px; margin-top: 10px; }
.bigstate .dd { color: var(--ink2); font-size: 13.5px; margin-top: 7px; max-width: none; }
