:root {
  --bg: #F7F2FA;
  --ink: #2A1638;
  --muted: #5E4A6E;
  --terracotta: #5B2A86;
  --terracotta-dark: #3F1A63;
  --warm: #E8B84A;
  --card: #FFFDF7;
  --line: #E2D6EC;
  --ok: #3F6B3A;
  font-size: 21px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen { max-width: 640px; margin: 0 auto; padding: 1.2rem 1.1rem 3rem; }
h1 {
  font-family: "Times New Roman", Times, Georgia, serif;
  font-weight: 700; font-size: 2rem; line-height: 1.15;
  color: var(--terracotta-dark); margin: 0.6rem 0 0.6rem;
  outline: none;
}
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.2rem; }
.small, .note { font-size: 0.85rem; color: var(--muted); }
.center { text-align: center; }
.error { background: #FBE3DC; color: #7A1F0A; padding: 0.7rem 0.9rem; border-radius: 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem; color: #8A6516; font-weight: 700; margin: 0.4rem 0; }

.stack { display: flex; flex-direction: column; gap: 0.8rem; margin: 1rem 0; }
.row { display: flex; gap: 0.8rem; }
.row > * { flex: 1; }

button { font: inherit; cursor: pointer; }
.big {
  display: block; width: 100%; min-height: 64px;
  padding: 0.9rem 1.1rem; border-radius: 18px;
  border: 2px solid var(--terracotta); background: var(--card); color: var(--terracotta-dark);
  font-size: 1.1rem; font-weight: 650; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.big:active { transform: scale(0.985); }
.big.primary { background: var(--terracotta); color: #fff; border-color: var(--terracotta); box-shadow: inset 0 -3px 0 var(--warm); }
.big.warm { background: var(--warm); border-color: #C99A2E; color: var(--terracotta-dark); }
.big.quiet { border-color: var(--line); color: var(--ink); }
.big.left { text-align: left; }
.big .sub { display: block; font-weight: 400; font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }
.big:disabled { opacity: 0.6; }
.back { background: none; border: 0; color: var(--terracotta); font-size: 1rem; padding: 0.4rem 0; font-weight: 600; }
.link { background: none; border: 0; color: var(--terracotta); text-decoration: underline; font-size: 1rem; padding: 0.6rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.7rem 0 0.2rem; }
.chip { border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 0.55rem 0.9rem; font-size: 0.95rem; color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--warm); border-radius: 22px; padding: 1.2rem; margin: 0.6rem 0 1rem; box-shadow: 0 2px 10px rgba(60, 20, 90, 0.07); }
.card .question { font-family: "Times New Roman", Times, Georgia, serif; font-size: 1.55rem; line-height: 1.3; margin: 0; }
.small-card .question { font-size: 1.2rem; }
.from { color: var(--terracotta); font-weight: 700; margin: 0 0 0.6rem; font-size: 0.95rem; }
.media img, .media video { width: 100%; border-radius: 14px; margin: 0 0 0.8rem; display: block; background: #eee; }
.small-card .media img, .small-card .media video { max-height: 30vh; object-fit: contain; }

input, textarea {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 0.8rem 0.9rem;
  border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); margin: 0.3rem 0 0.6rem;
}
label { display: block; font-weight: 600; }

.recorder { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin: 1.2rem 0; }
.mic {
  width: 200px; height: 200px; border-radius: 50%;
  border: 0; background: var(--terracotta); color: #fff;
  font-size: 1.3rem; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  box-shadow: 0 8px 24px rgba(91, 42, 134, 0.35);
}
.mic { border: 5px solid var(--warm) !important; }
.mic .dot { width: 34px; height: 34px; border-radius: 50%; background: var(--warm); }
.mic.on { background: var(--terracotta-dark); animation: breathe 2.4s ease-in-out infinite; }
.mic.on .bars { width: 30px; height: 30px; border-left: 9px solid var(--warm); border-right: 9px solid var(--warm); }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(91, 42, 134, 0.45); } 50% { box-shadow: 0 0 0 22px rgba(91, 42, 134, 0); } }
.timer { font-size: 2.2rem; font-variant-numeric: tabular-nums; margin: 0.4rem 0 0; font-weight: 700; }
.meter { width: 70%; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--warm); transition: width 0.15s; }
.hint { text-align: center; color: var(--muted); margin: 0.3rem 0 0; }

.spinner { width: 56px; height: 56px; border-radius: 50%; border: 6px solid var(--line); border-top-color: var(--warm); animation: spin 1s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin: 1rem 0; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.thumbs figure { margin: 0; }
.thumbs figcaption { font-size: 0.8rem; color: var(--muted); }
.player audio { width: 100%; margin: 0.6rem 0; }
.summary { font-size: 1.05rem; background: var(--card); border-left: 5px solid var(--warm); padding: 0.8rem 1rem; border-radius: 0 12px 12px 0; }
.transcript { margin: 1.2rem 0; }
.transcript summary { font-weight: 700; color: var(--terracotta); padding: 0.6rem 0; font-size: 1.05rem; }
.transcript p { font-family: "Times New Roman", Times, Georgia, serif; font-size: 1.1rem; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 0.8rem 1.2rem; border-radius: 14px; font-size: 0.95rem; max-width: 90vw; z-index: 10; }

@media (prefers-reduced-motion: reduce) { .mic.on, .spinner { animation: none; } }

/* Her badge, with twinkling gold stars */
.badge-wrap { position: relative; width: 190px; height: 190px; margin: 0.6rem auto 0.2rem; }
.badge-wrap.small { width: 130px; height: 130px; }
.badge-wrap img { width: 100%; height: 100%; border-radius: 50%; display: block; box-shadow: 0 6px 22px rgba(74, 32, 110, 0.35); }
.star { position: absolute; width: 22px; height: 22px; background: #E8B84A;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 4px rgba(255, 214, 110, 0.9));
  animation: twinkle 2.6s ease-in-out infinite; opacity: 0; }
.s0 { top: -6px; left: 12px; animation-delay: 0s; }
.s1 { top: 4px; right: -4px; width: 16px; height: 16px; animation-delay: 0.7s; }
.s2 { top: 42%; right: -22px; width: 26px; height: 26px; animation-delay: 1.4s; }
.s3 { bottom: 6px; right: 6px; width: 14px; height: 14px; animation-delay: 0.3s; }
.s4 { bottom: -12px; left: 40%; width: 18px; height: 18px; animation-delay: 1.9s; }
.s5 { bottom: 14px; left: -14px; width: 24px; height: 24px; animation-delay: 1.1s; }
.s6 { top: 38%; left: -26px; width: 14px; height: 14px; animation-delay: 2.2s; }
.s7 { top: -18px; left: 55%; width: 12px; height: 12px; animation-delay: 1.6s; }
.s8 { top: 70%; right: -8px; width: 10px; height: 10px; animation-delay: 0.5s; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(45deg); }
}
@media (prefers-reduced-motion: reduce) { .star { animation: none; opacity: 0.9; } }
