:root {
  --bg: #f7f8ff; --card: rgba(255, 255, 255, 0.92);
  --ink: #151936; --muted: #858ba5; --line: #e8eaf4;
  --accent: #6736d8; --danger: #c92f61;
  --shadow: 0 16px 45px rgba(76, 64, 145, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; min-height: 100%;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 4%, rgba(126, 82, 235, 0.08), transparent 24%),
    linear-gradient(180deg, #fafbff 0%, var(--bg) 100%);
}

body {
  padding: calc(22px + env(safe-area-inset-top)) 20px
    calc(28px + env(safe-area-inset-bottom));
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page {
  width: min(100%, 430px); margin: 0 auto;
}

.hero {
  margin-bottom: 28px; text-align: center;
}

.hero-icon {
  width: 62px; height: 62px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #5e32d6;
  background: linear-gradient(145deg, #f0ebff, #e8e0ff);
}

.hero-icon svg { width: 34px; height: 34px; }

h1 {
  margin: 0; font-size: clamp(28px, 8vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.hint {
  margin: 12px 0 0; color: #7d8298;
  font-size: 16px;
  line-height: 1.45;
}

.card {
  width: 100%; border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px; background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.name-card {
  margin-bottom: 20px; padding: 22px 20px 20px;
}

.field {
  display: flex; flex-direction: column;
  gap: 14px;
  font-size: 17px;
  font-weight: 800;
}

.input-wrap {
  height: 58px; padding: 0 16px;
  display: flex; align-items: center;
  gap: 13px;
  border: 1.8px solid #7742e5;
  border-radius: 16px;
  background: #fff;
}

.input-wrap svg {
  width: 24px; flex: 0 0 auto;
  color: #626984;
}

.field input {
  width: 100%; min-width: 0;
  border: 0; outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 17px;
  font-weight: 400;
}

.field input::placeholder { color: #a7adc2; }
.record-card { overflow: hidden; }

.record-zone {
  min-height: 310px; padding: 34px 22px 30px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}

.mic {
  width: 112px; height: 112px;
  border: 0; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg, #7547e4, #5f32d4);
  box-shadow:
    0 0 0 18px rgba(109, 66, 221, 0.075),
    0 0 0 34px rgba(109, 66, 221, 0.045),
    0 18px 32px rgba(96, 48, 212, 0.3);
  cursor: pointer;
}

.mic:active { transform: scale(0.97); }
.mic svg { width: 56px; height: 56px; }

.mic.recording {
  animation: pulse 1.25s infinite;
  background: linear-gradient(145deg, #ec4d76, var(--danger));
}

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

.status {
  min-height: 1.4em; margin: 34px 0 0;
  color: #4e546f;
  font-size: 18px;
  font-weight: 800;
}

.record-subtitle {
  margin: 8px 0 0; color: #8d93ab;
  font-size: 15px;
}

.recordings {
  padding: 20px; border-top: 1px solid var(--line);
}

.recordings-header {
  margin-bottom: 14px; display: flex;
  align-items: center; justify-content: space-between;
  gap: 12px;
}

.recordings-header h2 {
  margin: 0; font-size: 18px;
  letter-spacing: -0.02em;
}

.count-badge {
  padding: 7px 10px; border-radius: 10px;
  color: #7040db; background: #f3efff;
  font-size: 13px;
  font-weight: 700;
}

.clips {
  width: 100%; margin: 0; padding: 0;
  overflow: hidden; list-style: none;
  border: 1px solid #e6e8f1; border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
}

.clips:empty::before {
  content: "Chưa có bản ghi. Chạm microphone để bắt đầu.";
  display: block; padding: 24px 16px;
  color: #9aa0b5; text-align: center;
  font-size: 14px;
}

.clips li {
  min-height: 72px; padding: 10px 12px;
  display: flex; align-items: center;
  gap: 9px;
}

.clips li + li { border-top: 1px solid #e9eaf2; }
.clips li > span { color: #7040db; font-weight: 800; }

.clips audio {
  height: 40px; min-width: 0;
  flex: 1;
}

.clips button {
  padding: 8px 5px; border: 0;
  color: var(--danger); background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.submit {
  width: 100%; height: 64px;
  margin-top: 18px;
  border: 0; border-radius: 18px;
  display: flex; align-items: center;
  justify-content: center; gap: 12px;
  color: #fff;
  background: linear-gradient(90deg, #5c2fd2, #7942e5);
  box-shadow: 0 14px 28px rgba(98, 50, 210, 0.28);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.submit svg { width: 24px; height: 24px; }
.submit:disabled { opacity: 0.5; box-shadow: none; cursor: not-allowed; }

.result {
  width: 100%; margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--accent);
  background: #eee8ff;
}

.result.error { color: var(--danger); background: #fce8ee; }

.privacy {
  margin: 18px 8px 0; display: flex;
  align-items: center; justify-content: center;
  gap: 8px;
  color: #969cb1;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}

.privacy svg { width: 16px; height: 16px; flex: 0 0 auto; }

@media (max-width: 380px) {
  body { padding-inline: 14px; }
  h1 { font-size: 30px; }
  .record-zone { min-height: 286px; }
  .clips audio { width: 200px; }
}
