:root {
  --bg: #f4f5fb;
  --panel: rgba(255, 255, 255, 0.88);
  --ink: #1b1e33;
  --muted: #6b7188;
  --line: #e6e8f3;
  --accent: #6d5efc;
  --accent-2: #9a7bff;
  --accent-soft: #efedff;
  --danger: #e0454b;
  --danger-soft: #fdeeee;
  --ok: #0e9f6e;
  --radius: 20px;
  --shadow: 0 24px 60px -34px rgba(48, 40, 130, 0.4);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  padding: 40px 24px 56px;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  width: 420px;
  height: 420px;
  top: -160px;
  left: -80px;
  background: radial-gradient(circle at 30% 30%, #cbc2ff, #eae6ff 70%);
}

.orb-b {
  width: 480px;
  height: 480px;
  right: -180px;
  top: 220px;
  background: radial-gradient(circle at 60% 40%, #d8ecff, #eef6ff 70%);
}

.site-header,
.layout,
.site-footer {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 30px -14px rgba(109, 94, 252, 0.85);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  box-shadow: 0 8px 20px -16px rgba(40, 40, 90, 0.5);
  max-width: 100%;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c3c7d8;
  flex: none;
}

.status-pill.is-ok .dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(14, 159, 110, 0.14);
}

.status-pill.is-error .dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(224, 69, 75, 0.14);
}

.status-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layout {
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.panel:nth-child(2) {
  animation-delay: 0.06s;
}

.panel:nth-child(3) {
  animation-delay: 0.12s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.step {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-soft);
}

.panel-title {
  flex: 1;
  min-width: 0;
}

.panel-title h2 {
  margin: 0;
  font-size: 16.5px;
  letter-spacing: 0.2px;
}

.panel-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.counter {
  flex: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 12px;
  align-self: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field.span-2 {
  grid-column: span 2;
}

.field > span {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.field em {
  color: var(--danger);
  font-style: normal;
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fbfbff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7188' stroke-width='1.6' stroke-linecap='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

.field input:focus,
.field select:focus {
  border-color: rgba(109, 94, 252, 0.6);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(109, 94, 252, 0.12);
}

.samples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.sample {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfbff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.sample.filled {
  border-color: rgba(109, 94, 252, 0.34);
  background: #fdfcff;
}

.sample.recording {
  border-color: rgba(224, 69, 75, 0.5);
  box-shadow: 0 0 0 4px rgba(224, 69, 75, 0.08);
}

.sample.disabled {
  opacity: 0.55;
}

.sample-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sample-no {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 3px 8px;
  letter-spacing: 0.5px;
}

.sample-state {
  flex: 1;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sample.recording .sample-state {
  color: var(--danger);
  font-weight: 600;
}

.icon-btn {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #a2a7bb;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.18s ease, color 0.18s ease;
}

.icon-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sample-visual {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 30px;
}

.level {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #eef0f8;
  overflow: hidden;
}

.level span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.08s linear;
}

.sample.recording .level span {
  background: linear-gradient(90deg, #ff7a7e, var(--danger));
}

.sample-time {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
}

.sample-audio {
  width: 100%;
  height: 32px;
}

.rec-btn {
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(109, 94, 252, 0.28);
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
}

.rec-btn:hover:not(:disabled) {
  background: var(--accent-soft);
}

.rec-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.rec-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sample.recording .rec-btn {
  border-color: var(--danger);
  color: #fff;
  background: var(--danger);
}

.primary-btn {
  position: relative;
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 18px 34px -16px rgba(109, 94, 252, 0.85);
  transition: opacity 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
}

.primary-btn:hover:not(:disabled) {
  box-shadow: 0 20px 38px -14px rgba(109, 94, 252, 0.95);
}

.primary-btn:active:not(:disabled) {
  transform: scale(0.995);
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hint {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

.hint code {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
}

.alert {
  margin-top: 16px;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.alert.error {
  background: var(--danger-soft);
  border: 1px solid rgba(224, 69, 75, 0.22);
  color: #b0333a;
}

.result {
  margin-top: 18px;
}

.file-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-radius: 14px;
  border: 1px solid rgba(109, 94, 252, 0.3);
  background: linear-gradient(135deg, #faf9ff, #f3f0ff);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.file-link:hover {
  border-color: rgba(109, 94, 252, 0.65);
  box-shadow: 0 16px 30px -22px rgba(109, 94, 252, 0.9);
  transform: translateY(-1px);
}

.file-badge {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.file-badge svg {
  width: 22px;
  height: 22px;
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-info strong {
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-info small {
  color: var(--muted);
  font-size: 12px;
}

.download-arrow {
  flex: none;
  color: var(--accent);
}

.download-arrow svg {
  width: 20px;
  height: 20px;
}

.site-footer {
  margin-top: 30px;
  text-align: center;
  color: #9aa0b5;
  font-size: 12px;
}

.site-footer code {
  color: #8b90a8;
}

@media (max-width: 820px) {
  body {
    padding: 26px 16px 40px;
  }

  .panel {
    padding: 22px 18px;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field.span-2 {
    grid-column: span 2;
  }

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

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

  .field.span-2 {
    grid-column: span 1;
  }

  .site-header {
    align-items: flex-start;
  }
}
