/**
 * [INPUT]: 依赖 index.html 的语义结构与 app.js 写入的 data-state/data-check 状态
 * [OUTPUT]: 对外提供桌面与移动端录音界面、波形、按钮、诊断卡片的完整视觉样式
 * [POS]: assets 模块的视觉层，不承载业务状态与录音逻辑
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */

:root {
  color-scheme: light;
  --paper: #f3f0e9;
  --paper-deep: #e9e4da;
  --ink: #171719;
  --muted: #6f6b67;
  --line: rgba(23, 23, 25, 0.14);
  --panel: #1d1e21;
  --panel-soft: #292a2f;
  --white: #fffdf8;
  --pink: #fb7299;
  --pink-dark: #e85c88;
  --mint: #56d8be;
  --yellow: #f0c95a;
  --danger: #ff6b6b;
  --radius-large: 28px;
  --radius-medium: 18px;
  --shadow: 0 24px 70px rgba(42, 35, 26, 0.12);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 11%, rgba(251, 114, 153, 0.18), transparent 25rem),
    radial-gradient(circle at 91% 28%, rgba(86, 216, 190, 0.18), transparent 24rem), var(--paper);
}

button,
audio {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
audio:focus-visible {
  outline: 3px solid rgba(251, 114, 153, 0.45);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(100%, 1080px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px clamp(20px, 5vw, 56px) 28px;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.13em;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 23px;
  height: 23px;
  padding: 5px;
  border-radius: 7px;
  background: var(--ink);
}

.brand-mark span {
  width: 3px;
  border-radius: 3px;
  background: var(--paper);
}

.brand-mark span:nth-child(1) {
  height: 7px;
}

.brand-mark span:nth-child(2) {
  height: 13px;
}

.brand-mark span:nth-child(3) {
  height: 10px;
}

.version-chip {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

main {
  width: min(100%, 820px);
  margin: 0 auto;
}

.hero {
  padding: clamp(72px, 10vw, 120px) 0 clamp(36px, 6vw, 64px);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 14px;
  color: var(--pink-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hero h1 {
  max-width: 740px;
  margin: 0;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: clamp(58px, 12vw, 112px);
  font-weight: 500;
  letter-spacing: -0.075em;
  line-height: 0.9;
}

.hero-copy {
  margin: 28px 0 0;
  color: #4f4c49;
  font-size: clamp(17px, 2.6vw, 22px);
  line-height: 1.75;
}

.recorder-card {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 38px);
  border-radius: var(--radius-large);
  color: var(--white);
  background:
    radial-gradient(circle at 50% 31%, rgba(251, 114, 153, 0.13), transparent 35%),
    linear-gradient(145deg, #232428 0%, #17181b 72%);
  box-shadow: var(--shadow);
}

.recorder-card::before {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: inherit;
  pointer-events: none;
  content: "";
}

.recorder-head,
.playback-heading,
.timer-row,
.action-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.recorder-head h2,
.playback-heading h3,
.section-heading h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: -0.04em;
}

.recorder-head .panel-kicker,
.playback-heading .panel-kicker {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.48);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 5px rgba(240, 201, 90, 0.1);
}

.visualizer {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: clamp(250px, 43vw, 340px);
  place-items: center;
}

#waveCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.72;
}

.mic-orb {
  position: relative;
  display: grid;
  width: 128px;
  height: 128px;
  place-items: center;
}

.mic-core,
.mic-ring {
  position: absolute;
  border-radius: 50%;
}

.mic-core {
  z-index: 2;
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  color: var(--ink);
  background: var(--pink);
  box-shadow: 0 18px 45px rgba(251, 114, 153, 0.28);
  transition:
    transform 220ms ease,
    background 220ms ease;
}

.mic-core svg {
  width: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mic-ring {
  inset: 0;
  border: 1px solid rgba(251, 114, 153, 0.42);
  opacity: 0;
  transform: scale(0.74);
}

.mic-ring-two {
  inset: -18px;
}

.recorder-card[data-state="recording"] .mic-ring {
  animation: pulse-ring 1.8s ease-out infinite;
}

.recorder-card[data-state="recording"] .mic-ring-two {
  animation-delay: 0.45s;
}

.recorder-card[data-state="recording"] .mic-core {
  background: #ff4f7f;
  transform: scale(1.05);
}

@keyframes pulse-ring {
  0% {
    opacity: 0.74;
    transform: scale(0.72);
  }
  100% {
    opacity: 0;
    transform: scale(1.3);
  }
}

.timer-row {
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: clamp(38px, 7vw, 58px);
  font-weight: 520;
  letter-spacing: -0.055em;
}

.limit-label {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

.action-row {
  align-items: stretch;
  margin-top: 24px;
}

.primary-action,
.secondary-action,
.download-action {
  border: 0;
  cursor: pointer;
  font-weight: 760;
  transition:
    transform 160ms ease,
    background 160ms ease,
    opacity 160ms ease;
}

.primary-action:active,
.secondary-action:active,
.download-action:active {
  transform: translateY(1px) scale(0.99);
}

.primary-action {
  display: inline-flex;
  min-height: 58px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border-radius: 17px;
  color: var(--ink);
  background: var(--pink);
  font-size: 17px;
}

.primary-action:hover:not(:disabled) {
  background: #ff84a7;
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-icon {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: currentColor;
}

.recorder-card[data-state="recording"] .button-icon {
  border-radius: 2px;
}

.secondary-action {
  min-height: 58px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 17px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.07);
}

.inline-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 13px;
  line-height: 1.7;
}

.recorder-card[data-state="error"] .inline-message {
  color: #ff9b9b;
}

.recorder-card[data-state="ready"] .status-dot,
.recorder-card[data-state="complete"] .status-dot {
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(86, 216, 190, 0.11);
}

.recorder-card[data-state="recording"] .status-dot {
  background: var(--pink);
  box-shadow: 0 0 0 5px rgba(251, 114, 153, 0.11);
  animation: blink-dot 1.2s ease-in-out infinite;
}

.recorder-card[data-state="error"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(255, 107, 107, 0.11);
}

@keyframes blink-dot {
  50% {
    opacity: 0.35;
  }
}

.playback-panel {
  position: relative;
  z-index: 2;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.playback-heading h3 {
  font-size: 21px;
}

.download-action {
  padding: 10px 13px;
  border-radius: 11px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.09);
  font-size: 13px;
}

#audioPlayer {
  width: 100%;
  margin-top: 20px;
  accent-color: var(--pink);
}

.recording-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 0;
}

.recording-meta div {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
}

.recording-meta dt {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
}

.recording-meta dd {
  margin: 5px 0 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagnostics {
  padding: clamp(70px, 10vw, 110px) 0 28px;
}

.section-heading {
  display: grid;
  grid-template-columns: 0.62fr 1fr;
  align-items: end;
  gap: 24px;
  margin-bottom: 26px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
}

.check-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
}

.check-index {
  color: #96918a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.check-copy {
  display: grid;
  gap: 5px;
}

.check-copy strong {
  font-size: 16px;
}

.check-copy small {
  color: var(--muted);
  font-size: 13px;
}

.check-badge {
  min-width: 56px;
  padding: 7px 9px;
  border-radius: 999px;
  color: #77716a;
  background: rgba(23, 23, 25, 0.06);
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

.check-list li[data-check="pass"] .check-badge {
  color: #126b59;
  background: rgba(86, 216, 190, 0.2);
}

.check-list li[data-check="fail"] .check-badge {
  color: #a32e43;
  background: rgba(251, 114, 153, 0.18);
}

.privacy-note {
  display: flex;
  gap: 14px;
  margin: 22px 0 clamp(70px, 10vw, 112px);
  padding: 20px;
  border: 1px solid rgba(23, 23, 25, 0.08);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.43);
}

.privacy-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--mint);
  background: var(--ink);
  font-size: 9px;
}

.privacy-note strong {
  font-size: 14px;
}

.privacy-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.site-footer {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

noscript {
  position: fixed;
  inset: auto 16px 16px;
  padding: 14px;
  border-radius: 12px;
  color: #fff;
  background: #171719;
  text-align: center;
}

@media (max-width: 620px) {
  .page-shell {
    padding: 18px 16px 24px;
  }

  .hero {
    padding-top: 72px;
  }

  .hero h1 {
    font-size: clamp(54px, 20vw, 76px);
  }

  .hero-copy br {
    display: none;
  }

  .recorder-card {
    border-radius: 24px;
  }

  .recorder-head {
    align-items: flex-start;
  }

  .status-pill {
    max-width: 132px;
    justify-content: center;
    text-align: center;
  }

  .visualizer {
    min-height: 250px;
  }

  .action-row {
    flex-direction: column;
  }

  .secondary-action {
    width: 100%;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .recording-meta {
    grid-template-columns: 1fr 1fr;
  }

  .recording-meta div:last-child {
    grid-column: 1 / -1;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    line-height: 1.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
