:root {
  --bg: #f4efe7;
  --paper: rgba(255, 252, 246, 0.92);
  --ink: #2a221c;
  --muted: #6b6258;
  --line: rgba(110, 90, 70, 0.16);
  --accent: #9e3d22;
  --accent-soft: #f5d8c8;
  --accent-deep: #6e2413;
  --olive: #5f6b31;
  --warn: #a93f2c;
  --shadow: 0 20px 50px rgba(79, 53, 34, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 223, 193, 0.8), transparent 32%),
    radial-gradient(circle at bottom right, rgba(184, 200, 162, 0.55), transparent 28%),
    linear-gradient(180deg, #f7f0e6 0%, #efe4d5 100%);
}

.page-shell {
  width: min(1200px, calc(100% - 28px));
  margin: 20px auto 32px;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.hero-card,
.panel,
.reference-dialog {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero-copy {
  padding: 28px;
}

.eyebrow {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f8e4d7;
  color: var(--accent-deep);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.hero-copy h1 {
  margin: 18px 0 12px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.05;
}

.hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.hero-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.metric-list {
  margin: 14px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 12px;
  line-height: 1.7;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h2,
.detail-block h3,
.dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.status-chip,
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f0eadf;
  color: var(--muted);
  font-size: 13px;
}

.score-badge.active {
  background: #f7dbc5;
  color: var(--accent-deep);
}

.score-badge.speaking {
  background: #f1d5c7;
  color: var(--accent-deep);
}

.state-text {
  color: var(--muted);
  font-size: 14px;
}

.template-text,
.detail-text,
.dialog-content {
  color: #43382f;
  line-height: 1.95;
  white-space: pre-wrap;
}

.record-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

button {
  border: none;
  cursor: pointer;
  font: inherit;
  border-radius: 16px;
  padding: 13px 16px;
  transition: transform 0.18s ease, opacity 0.18s ease, background-color 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-button {
  background: linear-gradient(135deg, #b1492d, #8c2e1a);
  color: #fffaf4;
}

.ghost-button {
  background: #efe7db;
  color: var(--ink);
}

.warn-button {
  background: linear-gradient(135deg, #ca6c48, #9d341f);
  color: #fff8f5;
}

.meter-card,
.audio-card,
.detail-block {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: #fcf7f0;
  border: 1px solid var(--line);
}

.meter-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
}

.meter-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e7dccf;
}

.meter-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #809f3f 0%, #d8a337 52%, #c04d28 100%);
  transition: width 0.1s linear;
}

.helper-text,
.audio-label {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.audio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audio-head .audio-label {
  margin: 0;
}

.audio-action-button {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.status-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #f4ede4;
  color: var(--muted);
  line-height: 1.7;
}

.result-summary {
  display: flex;
  align-items: center;
  gap: 18px;
}

.voice-summary {
  display: flex;
  align-items: center;
  gap: 18px;
}

.voice-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 30%, #f6dbc6 0%, #edc1a8 35%, #b14b2d 100%);
  color: #fff8f2;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.voice-avatar.speaking {
  animation: pulseVoice 1.1s ease-in-out infinite;
}

@keyframes pulseVoice {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(177, 75, 45, 0.28);
  }
  70% {
    transform: scale(1.04);
    box-shadow: 0 0 0 18px rgba(177, 75, 45, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(177, 75, 45, 0);
  }
}

.score-ring {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff7ed 0 55%, transparent 56%),
    conic-gradient(from 210deg, #f6dbc6, #bb5a35, #8f2b17, #f6dbc6);
  display: grid;
  place-items: center;
  color: var(--accent-deep);
  flex-shrink: 0;
}

.score-value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.score-unit {
  font-size: 13px;
  color: var(--muted);
}

.star-level {
  font-size: 24px;
  color: #b04a2b;
}

.result-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.subscore-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.voice-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.subscore-item {
  padding: 14px;
  border-radius: 18px;
  background: #faf3ea;
  border: 1px solid var(--line);
}

.subscore-item .label {
  color: var(--muted);
  font-size: 14px;
}

.subscore-item .value {
  margin-top: 6px;
  font-size: 28px;
  color: var(--accent-deep);
}

.detail-list {
  margin: 10px 0 0;
  padding-left: 18px;
  line-height: 1.8;
}

.reference-dialog {
  width: min(720px, calc(100% - 24px));
  padding: 0;
}

.reference-dialog::backdrop {
  background: rgba(58, 38, 25, 0.3);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 22px 0;
}

.dialog-content {
  padding: 0 22px 22px;
}

audio {
  width: 100%;
  margin-top: 10px;
}

.hidden-audio {
  display: none;
}

@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 1200px);
    margin-top: 10px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 22px;
  }

  .hero-copy {
    padding: 22px;
  }

  .record-toolbar,
  .subscore-grid {
    grid-template-columns: 1fr;
  }

  .result-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .voice-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .voice-toolbar {
    grid-template-columns: 1fr;
  }
}
