/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Page ───────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
}

body {
  background: #ffffff;
  font-family: system-ui, -apple-system, sans-serif;
  color: #111111;
}

/* ─── App Shell ──────────────────────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-shell__noise {
  display: none;
}

/* ─── Hero Panel ─────────────────────────────────────────────────────────── */
.hero-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  padding: 2rem 1.5rem;
  text-align: center;
  width: 100%;
  max-width: 640px;
}

.hero-copy__eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.45;
  margin-bottom: 0.5rem;
}

.hero-copy h1 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* ─── Record Stage ───────────────────────────────────────────────────────── */
.record-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.record-stage__callout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  opacity: 0.4;
  white-space: nowrap;
}

.record-stage__line {
  display: block;
  width: 36px;
  height: 1px;
  background: currentColor;
  transform-origin: right center;
}

/* ─── Avatar Circle ──────────────────────────────────────────────────────── */
#avatarCircle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-circle__button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 270px;
  height: 270px;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  outline-offset: 4px;
}

/* ─── Rings ──────────────────────────────────────────────────────────────── */
.avatar-circle__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  transform: scale(1);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.avatar-circle__button.is-recording .avatar-circle__ring {
  border-color: rgba(210, 30, 30, 0.35);
}

/* ─── Sticker Group ──────────────────────────────────────────────────────── */
/*
 * Three images are displayed simultaneously as a fanned sticker stack:
 *   left  = img 0  — tilted left,  peeking behind
 *   center = img 1 — straight,     on top (the "default" face)
 *   right  = img 2 — tilted right, peeking behind
 *
 * CSS custom properties (--r, --tx, --ty) let every state rule
 * compose with the base position without repeating values.
 */
.avatar-sticker-group {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.avatar-sticker {
  --r:  0deg;
  --tx: 0px;
  --ty: 0px;

  position: absolute;
  width: 200px;
  height: 200px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  /* Default: each sticker waits at its fan position, barely visible */
  opacity: 0;
  /* transform: rotate(var(--r)) translate(var(--tx), var(--ty)); */
  transition:
    opacity 0.1s ease;
  will-change: transform, opacity;
  z-index: 1;
}

/* Left sticker fan position */
.avatar-sticker--left  { --r: -13deg; --tx: -32px; --ty: 8px; }

/* Right sticker fan position */
.avatar-sticker--right { --r:  13deg; --tx:  32px; --ty: 8px; }

/* Active sticker — snaps to center regardless of its fan position */
.avatar-sticker.is-active {
  --r:  0deg;
  --tx: 0px;
  --ty: 0px;
  opacity: 1;
  z-index: 10;
}

/* Listening overlay — hidden by default, full z-index */
.avatar-sticker--listening {
  opacity: 0;
  z-index: 20;
  pointer-events: none;
}

/* ── Press: hide all rotation stickers, show listening image */
.avatar-circle__button.is-pressed .avatar-sticker {
  opacity: 0 !important;
}
.avatar-circle__button.is-pressed .avatar-sticker--listening {
  opacity: 1 !important;
}

/* ── Primed (first tap, before mic permission) and Recording: keep listening visible */
.avatar-circle__button.is-primed .avatar-sticker,
.avatar-circle__button.is-recording .avatar-sticker {
  opacity: 0 !important;
}
.avatar-circle__button.is-primed .avatar-sticker--listening,
.avatar-circle__button.is-recording .avatar-sticker--listening {
  opacity: 1 !important;
}

/* ── Set-cycle fade: briefly applied via JS, then removed */
.avatar-sticker.is-fading {
  opacity: 0 !important;
  transform: rotate(var(--r)) translate(var(--tx), var(--ty)) scale(0.8) !important;
  transition:
    transform 0.14s ease,
    opacity   0.14s ease;
}

/* ─── Hero Message ───────────────────────────────────────────────────────── */
.hero-message p {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ─── Success Burst ──────────────────────────────────────────────────────── */
@keyframes burst-in {
  0%   { opacity: 0; transform: scale(0.55) rotate(-4deg); }
  55%  { opacity: 1; transform: scale(1.08) rotate(2deg); }
  72%  { transform: scale(0.96) rotate(-1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes burst-out {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.85); }
}

.success-burst {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  pointer-events: none;
  z-index: 999;
}

.success-burst[hidden] {
  display: none;
}

.success-burst.is-entering {
  animation: burst-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.success-burst.is-leaving {
  animation: burst-out 0.35s ease-in forwards;
}

.success-burst__yeah {
  font-size: clamp(3.5rem, 15vw, 7rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #d21e1e;
  line-height: 1;
  text-shadow: 0 4px 24px rgba(210, 30, 30, 0.35);
}

.success-burst__sub {
  font-size: clamp(1.2rem, 5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #111;
  text-transform: uppercase;
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  .success-burst.is-entering,
  .success-burst.is-leaving {
    animation: none;
    opacity: 1;
  }
}

/* ─── Tap hint ──────────────────────────────────────────────────────────── */
@keyframes hint-breathe {
  0%   { opacity: 0.55; letter-spacing: 0.18em; transform: translateY(0); }
  45%  { opacity: 1;    letter-spacing: 0.28em; transform: translateY(-3px); }
  100% { opacity: 0.55; letter-spacing: 0.18em; transform: translateY(0); }
}

@keyframes hint-underline-sweep {
  0%   { background-size: 0% 2px; }
  50%  { background-size: 100% 2px; }
  100% { background-size: 0% 2px; }
}

.tap-hint {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d21e1e;
  text-align: center;
  margin-top: 0.9rem;
  pointer-events: none;
  user-select: none;
  /* underline sweep */
  background-image: linear-gradient(#d21e1e, #d21e1e);
  background-repeat: no-repeat;
  background-position: center bottom 1px;
  background-size: 0% 2px;
  /* animation:
    hint-breathe      2.6s ease-in-out infinite,
    hint-underline-sweep 2.6s ease-in-out infinite; */
}

/* @media (prefers-reduced-motion: reduce) {
  .tap-hint {
    animation: none;
    opacity: 0.7;
    letter-spacing: 0.18em;
  }
}

/* Hide hint once the user has interacted */
#avatarCircle:has(.avatar-circle__button.is-primed)    ~ .tap-hint,
#avatarCircle:has(.avatar-circle__button.is-recording) ~ .tap-hint {
  opacity: 0;
  transition: opacity 0.2s ease;
} */

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.hero-footer {
  font-size: 0.78rem;
  opacity: 0.35;
}

.hero-footer a {
  color: inherit;
  text-decoration: none;
}

.hero-footer a:hover {
  text-decoration: underline;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

/* Small phones (≤ 390px) */
@media (max-width: 390px) {
  .hero-panel {
    gap: 1.6rem;
    padding: 1.25rem 1rem;
  }

  .hero-copy h1 {
    font-size: 1.45rem;
  }

  .avatar-circle__button {
    width: 220px;
    height: 220px;
  }

  .avatar-sticker-group {
    width: 180px;
    height: 180px;
  }

  .avatar-sticker {
    width: 160px;
    height: 160px;
  }

  .hero-message p {
    font-size: 1rem;
  }
}

/* Mid-size phones (391px – 480px) */
@media (min-width: 391px) and (max-width: 480px) {
  .hero-panel {
    gap: 2rem;
    padding: 1.5rem 1.25rem;
  }

  .avatar-circle__button {
    width: 240px;
    height: 240px;
  }

  .avatar-sticker-group {
    width: 200px;
    height: 200px;
  }

  .avatar-sticker {
    width: 180px;
    height: 180px;
  }
}

/* Landscape phones — shrink vertically so nothing clips */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-panel {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem 2.5rem;
    padding: 0.75rem 1.5rem;
    max-width: 100%;
  }

  .hero-copy {
    text-align: left;
    flex: 1 1 200px;
  }

  .avatar-circle__button {
    width: 180px;
    height: 180px;
  }

  .avatar-sticker-group {
    width: 155px;
    height: 155px;
  }

  .avatar-sticker {
    width: 140px;
    height: 140px;
  }

  .hero-message,
  .hero-footer {
    flex-basis: 100%;
  }
}

/* Tablets (481px – 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .hero-panel {
    gap: 2.2rem;
  }

  .avatar-circle__button {
    width: 260px;
    height: 260px;
  }
}

/* Touch devices: larger tap area, no hover artifacts */
@media (hover: none) and (pointer: coarse) {
  .avatar-circle__button {
    outline: none;
  }

  .hero-footer a:hover {
    text-decoration: none;
  }
}

