:root {
  --ink: #10241d;
  --muted: #66756f;
  --line: #dfe8e3;
  --surface: rgba(255, 255, 255, 0.94);
  --green: #07c160;
  --green-dark: #049e4e;
  --green-soft: #eaf9f1;
  --red: #ec5353;
  --shadow: 0 20px 60px rgba(20, 65, 46, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: #edf6f1;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 8% 4%, rgba(7, 193, 96, 0.17), transparent 30rem),
    linear-gradient(180deg, #f8fcfa 0%, #edf6f1 100%);
}

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

button {
  font: inherit;
}

.page-shell {
  width: min(100% - 28px, 720px);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 0 max(42px, env(safe-area-inset-bottom));
}

.hero {
  padding: 18px 8px 24px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 48px);
  line-height: 1.14;
  letter-spacing: -0.04em;
}

.hero p {
  max-width: 570px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.card {
  margin-bottom: 16px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid rgba(207, 222, 214, 0.9);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.section-heading,
.section-heading > div {
  display: flex;
  align-items: center;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0 0 0 10px;
  font-size: 18px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-waiting,
.badge-muted {
  color: #65716c;
  background: #edf1ef;
}

.badge-success {
  color: #08763b;
  background: #dcf7e9;
}

.badge-error {
  color: #aa3030;
  background: #fde8e8;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--line);
}

.status-item {
  min-width: 0;
  padding: 14px;
  background: #fff;
}

.status-item strong,
.status-label {
  display: block;
}

.status-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.status-item strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.button {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  font-weight: 700;
}

.button-primary {
  color: #fff;
  background: var(--green);
}

.button-secondary {
  color: var(--ink);
  background: #edf2ef;
}

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

.hint {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.recorder-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 4px;
}

.timer {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.record-button {
  position: relative;
  z-index: 1;
  display: flex;
  width: 168px;
  height: 168px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  border: 10px solid #e4f7ed;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #19d774, #04a950);
  box-shadow: 0 16px 34px rgba(7, 193, 96, 0.28), inset 0 1px rgba(255, 255, 255, 0.25);
  font-size: 16px;
  font-weight: 800;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.record-button.is-recording {
  border-color: #fde6e6;
  background: linear-gradient(145deg, #ff7373, #df3f3f);
  box-shadow: 0 18px 38px rgba(236, 83, 83, 0.28);
  transform: scale(0.97);
}

.record-icon {
  position: relative;
  width: 27px;
  height: 38px;
  border: 3px solid currentColor;
  border-radius: 16px;
}

.record-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 38px;
  height: 22px;
  border: 3px solid currentColor;
  border-top: 0;
  border-radius: 0 0 22px 22px;
  transform: translateX(-50%);
}

.record-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  transform: translateX(-50%);
}

.record-tip {
  min-height: 22px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.waveform {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.waveform.is-active {
  opacity: 1;
}

.waveform i,
.overlay-bars i {
  width: 4px;
  border-radius: 4px;
  background: var(--green);
  animation: sound-wave 850ms ease-in-out infinite alternate;
}

.waveform i:nth-child(1), .waveform i:nth-child(7) { height: 10px; animation-delay: -0.5s; }
.waveform i:nth-child(2), .waveform i:nth-child(6) { height: 18px; animation-delay: -0.25s; }
.waveform i:nth-child(3), .waveform i:nth-child(5) { height: 28px; animation-delay: -0.7s; }
.waveform i:nth-child(4) { height: 34px; }

@keyframes sound-wave {
  to { transform: scaleY(0.35); }
}

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

.action-button {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
}

.action-button span {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #eef3f0;
  font-size: 12px;
}

.action-accent {
  color: #08733a;
  border-color: #bde9d1;
  background: var(--green-soft);
}

.server-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #f1f8f4;
}

.server-result p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.download-link {
  flex: 0 0 auto;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

#server-audio {
  width: 100%;
  margin-top: 12px;
}

.text-button {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.log-list {
  max-height: 220px;
  margin: 0;
  padding: 4px 0 0;
  overflow-y: auto;
  list-style: none;
}

.log-list li {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  color: #42524c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.log-list time {
  color: #91a099;
}

.record-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 22, 16, 0.36);
  backdrop-filter: blur(5px);
  pointer-events: none;
}

.record-overlay[hidden] {
  display: none;
}

.overlay-panel {
  display: flex;
  width: 220px;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: 28px;
  color: #fff;
  background: rgba(17, 38, 30, 0.93);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.overlay-panel.is-cancel {
  background: rgba(133, 40, 40, 0.94);
}

.overlay-mic {
  position: relative;
  width: 39px;
  height: 55px;
  margin-bottom: 22px;
  border: 4px solid currentColor;
  border-radius: 22px;
}

.overlay-mic::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 56px;
  height: 31px;
  border: 4px solid currentColor;
  border-top: 0;
  border-radius: 0 0 30px 30px;
  transform: translateX(-50%);
}

.overlay-bars {
  display: flex;
  height: 24px;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
}

.overlay-bars i {
  background: #fff;
}

.overlay-bars i:nth-child(1) { height: 8px; }
.overlay-bars i:nth-child(2) { height: 16px; animation-delay: -0.2s; }
.overlay-bars i:nth-child(3) { height: 24px; animation-delay: -0.45s; }
.overlay-bars i:nth-child(4) { height: 13px; animation-delay: -0.65s; }

.overlay-panel strong {
  font-size: 16px;
}

.overlay-panel > span {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 20px, 720px);
  }

  .card {
    padding: 18px;
    border-radius: 19px;
  }

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

  .record-button {
    width: 150px;
    height: 150px;
  }
}
