/* ───────────────────────── Base ───────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --purple: #625df5;
  --purple-dark: #4f4ae0;
  --ink: #1c1633;
  --ink-soft: #6f6a8a;
  --card: #ffffff;
  --red: #f0384e;
}

html, body { height: 100%; }

/* `display:flex` on screens would otherwise defeat the hidden attribute */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 600px at 85% -10%, #efe7ff 0%, transparent 60%),
    radial-gradient(900px 600px at -10% 100%, #e3f2ff 0%, transparent 55%),
    linear-gradient(180deg, #faf9ff 0%, #f4f2ff 100%);
  -webkit-font-smoothing: antialiased;
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin-bottom: 44px;
}

/* ───────────────────────── Brand ───────────────────────── */
.brand {
  position: fixed;
  top: 26px;
  left: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}
.brand-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--purple);
  box-shadow: inset 0 0 0 4px #fff, 0 0 0 2px var(--purple);
}

/* ───────────────────────── Mode cards ───────────────────────── */
.mode-cards {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 940px;
}

.mode-card {
  position: relative;
  width: 260px;
  padding: 34px 24px 28px;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 24px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  box-shadow: 0 8px 30px rgba(60, 40, 140, 0.10);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.mode-card:hover, .mode-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--purple);
  box-shadow: 0 16px 44px rgba(80, 60, 200, 0.18);
  outline: none;
}
.mode-card:active { transform: translateY(-1px); }

.mode-card.recommended { border-color: #d9d6ff; }

.badge {
  position: absolute;
  top: -13px;
  background: var(--purple);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  letter-spacing: .02em;
}

.mode-emoji { position: relative; font-size: 3.2rem; line-height: 1; }
.mode-emoji-bubble {
  position: absolute;
  right: -14px; bottom: -8px;
  font-size: 1.6rem;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.mode-title { font-size: 1.25rem; font-weight: 800; }
.mode-desc { font-size: .95rem; color: var(--ink-soft); line-height: 1.4; }

.mic-note {
  margin-top: 40px;
  color: var(--ink-soft);
  font-size: 1rem;
}

/* ───────────────────────── Countdown ───────────────────────── */
.countdown {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 14, 45, .92);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.countdown-number {
  font-size: 11rem;
  font-weight: 800;
  animation: pop .95s ease infinite;
}
.countdown-hint { font-size: 1.3rem; opacity: .8; }
@keyframes pop {
  0% { transform: scale(.6); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.05); opacity: 1; }
}

/* ───────────────────────── Recording ───────────────────────── */
.rec-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 700;
}
.rec-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red);
  animation: pulse 1.4s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 56, 78, .45); }
  50% { box-shadow: 0 0 0 14px rgba(240, 56, 78, 0); }
}
.paused .rec-dot { background: #f5a623; animation: none; }

.rec-timer {
  font-size: clamp(4rem, 10vw, 6.5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
}

.rec-hint { color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 44px; }

.rec-controls {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 96px;
  padding: 16px 10px;
  background: var(--card);
  border: none;
  border-radius: 20px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(60, 40, 140, .12);
  transition: transform .12s ease;
}
.control-btn span:first-child { font-size: 1.7rem; line-height: 1; }
.control-btn:hover { transform: translateY(-2px); }
.control-btn.active { background: #ffe9ec; color: var(--red); }

.stop-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 44px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(240, 56, 78, .40);
  transition: transform .12s ease, box-shadow .12s ease;
}
.stop-btn:hover { transform: scale(1.04); box-shadow: 0 16px 44px rgba(240, 56, 78, .5); }
.stop-square { width: 20px; height: 20px; background: #fff; border-radius: 5px; }

.self-view {
  position: fixed;
  left: 28px;
  bottom: 28px;
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid #fff;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .28);
  transform: scaleX(-1);
}

/* ───────────────────────── Done ───────────────────────── */
.preview {
  width: min(760px, 92vw);
  border-radius: 20px;
  box-shadow: 0 18px 60px rgba(40, 25, 100, .22);
  background: #000;
  margin-bottom: 36px;
}

.done-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.big-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 18px 30px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 6px 20px rgba(60, 40, 140, .12);
  transition: transform .12s ease;
}
.big-btn:hover { transform: translateY(-2px); }
.big-btn.primary {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 12px 32px rgba(98, 93, 245, .38);
}
.big-btn.primary:hover { background: var(--purple-dark); }
.big-btn.ghost { background: transparent; box-shadow: none; color: var(--ink-soft); }
.big-btn[disabled] { opacity: .6; cursor: wait; transform: none; }

.share-result {
  margin-top: 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: min(640px, 92vw);
}
.share-url {
  flex: 1;
  min-width: 260px;
  padding: 16px 20px;
  border-radius: 999px;
  border: 2px solid #ddd9ff;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: #fff;
}

.error {
  margin-top: 26px;
  color: var(--red);
  font-size: 1.05rem;
  font-weight: 600;
  max-width: 560px;
}

@media (max-width: 640px) {
  .self-view { width: 110px; height: 110px; left: 16px; bottom: 16px; }
  .brand { position: static; justify-content: center; margin-bottom: 28px; }
}
