:root {
  --bg: #14110f;
  --card: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f5ede7;
  --muted: #a4968d;
  --accent: #ef7d63;
  --accent-2: #f3b98c;
  --danger: #ff6b6b;
  --radius: 18px;
}

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

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

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(239, 125, 99, 0.16), transparent 62%),
    radial-gradient(900px 560px at 92% 4%, rgba(243, 185, 140, 0.10), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 18px 16px 48px; }

/* 视图切换 */
.view { display: none; }
body[data-view="login"] #view-login,
body[data-view="who"] #view-who,
body[data-view="main"] #view-main { display: block; }

body[data-view="login"] .wrap,
body[data-view="who"] .wrap { display: flex; align-items: center; min-height: 100vh; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.card.center { text-align: center; width: 100%; }

.logo { font-size: 40px; line-height: 1; margin-bottom: 6px; }

h1 { font-size: 22px; margin: 6px 0 4px; font-weight: 600; letter-spacing: 0.02em; }
h2 { font-size: 19px; margin: 4px 0 4px; font-weight: 600; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.tiny { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* 表单与按钮 */
input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 0.18em;
}
input[type="password"]:focus { border-color: var(--accent); }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 13px 22px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.2s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #241512; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }

.row { display: flex; gap: 10px; margin-top: 12px; }
.row .btn { flex: 1; }

.chip {
  appearance: none;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.chip.ghost { color: var(--muted); }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0 2px; }

.who-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; }
.who-list button {
  appearance: none;
  width: 100%;
  padding: 15px;
  font-size: 17px;
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.who-list button:active { background: rgba(239, 125, 99, 0.18); }

.error { color: var(--danger); font-size: 13px; margin: 12px 0 0; }

/* 顶栏 */
.topbar { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 14px; }
.brand { font-size: 17px; font-weight: 600; letter-spacing: 0.03em; }
.top-actions { display: flex; gap: 8px; }

/* 录音区 */
.recorder { text-align: center; }

.meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-bottom: 14px;
}
#meter-bar {
  height: 100%;
  width: 3%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.06s linear;
}

.timer { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--text); letter-spacing: 0.06em; }
.timer-limit { color: var(--muted); font-size: 13px; margin-left: 4px; }

.rec-btn {
  position: relative;
  appearance: none;
  width: 132px;
  height: 132px;
  margin: 16px auto 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03));
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.rec-btn:active { transform: scale(0.97); }
.rec-icon { font-size: 26px; color: var(--accent); line-height: 1; }
.rec-label { font-weight: 600; }

.rec-btn.recording {
  background: radial-gradient(circle at 32% 28%, rgba(255, 107, 107, 0.30), rgba(255, 107, 107, 0.10));
  box-shadow: 0 0 0 10px rgba(255, 107, 107, 0.09);
}
.rec-btn.recording .rec-icon { color: var(--danger); animation: pulse 1.15s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.88); }
}

.hint { color: var(--muted); font-size: 13px; min-height: 20px; margin: 8px 0 0; }
.hint.bad { color: var(--danger); }

.take { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.take audio { width: 100%; height: 40px; }

/* 时间线 */
.timeline { margin-top: 20px; }
.timeline-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
.count { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 26px 0; }

.voices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.voice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
.voice.unread { border-color: rgba(239, 125, 99, 0.55); background: rgba(239, 125, 99, 0.09); }
.voice.playing { border-color: var(--accent); }

.voice .play {
  appearance: none;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
}
.voice-main { flex: 1 1 auto; min-width: 0; }
.voice-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.voice-top .who { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-top .when { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.voice-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 2px; }
.voice-meta .dot {
  color: var(--accent);
  border: 1px solid rgba(239, 125, 99, 0.5);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
}

.rule { color: var(--muted); font-size: 12px; text-align: center; margin-top: 18px; }
.tip {
  margin-top: 18px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 11px 18px;
  background: rgba(28, 22, 20, 0.96);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  z-index: 50;
}

audio { filter: invert(0.92) hue-rotate(180deg); border-radius: 10px; }

@media (min-width: 620px) {
  .wrap { padding-top: 40px; }
  .rec-btn { width: 148px; height: 148px; }
}
