:root {
  --cream: #FAF7F2;
  --warm-white: #FFFCF8;
  --paper: #FFFFFF;
  --ink: #2B2620;
  --ink-soft: #574E45;
  --ink-muted: #6E655C;
  --hairline: #ECE4D9;
  --coral: #E0603F;
  --coral-deep: #B8492A;
  --lavender: #E4D7F2;
  --sage: #D9E8D4;
  --sand: #F6DDA8;
  --peach: #F8E0CC;
  --on-sage: #4A7843;
  --on-lav: #6E5491;
  --on-peach: #B8492A;
  --success: #5C9152;
  --error: #D1583E;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 22px;
  --s6: 30px;
  --gutter: 24px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 28px;
  --shadow-sm: 0 2px 8px rgba(46, 42, 38, .08);
  --shadow-md: 0 6px 20px rgba(46, 42, 38, .06);
  --shadow-lg: 0 14px 36px rgba(46, 42, 38, .10);
  --shadow-accent: 0 12px 28px rgba(224, 96, 63, .28);
  --font-display: 'Lora', Georgia, serif;
  --font-ui: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: #ECE6DD;
  background-image: radial-gradient(120% 80% at 50% -10%, var(--warm-white) 0%, #ECE6DD 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 80px;
}

.app {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}
.app.wide { max-width: 1080px; }

.head { text-align: center; }
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--coral-deep);
}
h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.14;
  margin-top: 8px;
}
h1 em { font-style: italic; color: var(--coral); }
.lead {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-muted);
  margin-top: 10px;
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

.card {
  background: var(--warm-white);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: var(--s5);
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
}

.orb {
  width: 132px;
  height: 132px;
  border: none;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: radial-gradient(circle at 42% 38%, #FBE3A6 0%, #E8674A 45%, #C9A6E8 100%);
  box-shadow: inset 12px 12px 30px rgba(255, 255, 255, .22), 0 18px 40px rgba(232, 103, 74, .34);
  animation: pbreathe 5s ease-in-out infinite;
  position: relative;
}
.orb svg { width: 40px; height: 40px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; position: relative; z-index: 2; }
.orb::before, .orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--coral);
  opacity: 0;
  z-index: 0;
  animation: orbPulse 3.6s cubic-bezier(.4, 0, .2, 1) infinite;
}
.orb::after { animation-delay: 1.8s; }
.stage.rec .orb { box-shadow: 0 0 0 8px rgba(224, 96, 63, .12), 0 18px 40px rgba(224, 96, 63, .45); }

@keyframes pbreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes orbPulse { 0% { transform: scale(1); opacity: .35; } 100% { transform: scale(1.55); opacity: 0; } }

.wave { display: flex; gap: 4px; align-items: center; height: 30px; }
.wave i { width: 3px; height: 8px; border-radius: 2px; background: var(--coral); opacity: .4; display: block; }
.stage.rec .wave i { opacity: .85; animation: wv 1s ease-in-out infinite; }
.stage.rec .wave i:nth-child(2n) { animation-delay: .2s; }
.stage.rec .wave i:nth-child(3n) { animation-delay: .4s; }
@keyframes wv { 0%, 100% { height: 8px; } 50% { height: 26px; } }

.timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--ink-muted); text-align: center; max-width: 300px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }

.upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  border: 1.5px dashed var(--hairline);
  border-radius: var(--r-md);
  background: var(--cream);
  color: var(--coral-deep);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.upload svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.upload.has { border-style: solid; border-color: var(--coral); color: var(--ink); }
audio { width: 100%; margin-top: var(--s3); }

.section-lbl { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 22px;
  background: var(--warm-white);
  border: 1.5px solid var(--hairline);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.chip.sel { border-color: var(--coral); color: var(--coral-deep); background: rgba(224, 96, 63, .06); }
.chip .tick { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline); }
.chip.sel .tick { background: var(--coral); }

.seg { display: flex; background: var(--hairline); border-radius: var(--r-md); padding: 4px; gap: 4px; }
.seg button {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  padding: 10px 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}
.seg button.active { background: var(--warm-white); color: var(--ink); box-shadow: 0 2px 10px rgba(46, 42, 38, .08); }

.cta {
  width: 100%;
  min-height: 54px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--coral);
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  cursor: pointer;
  box-shadow: var(--shadow-accent);
  transition: transform .12s ease, background .12s ease;
}
.cta:active { transform: scale(.985); background: var(--coral-deep); }
.cta:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.cta svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.results { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
@media (min-width: 720px) { .results { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }

.res {
  background: var(--warm-white);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  animation: up .5s ease forwards;
}
.res.err { border-color: rgba(209, 88, 62, .4); }
.res-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.res-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.res-lang { font-size: 11px; font-weight: 600; color: var(--on-lav); background: var(--lavender); padding: 3px 8px; border-radius: 12px; }
.res-text { font-family: var(--font-display); font-size: 15px; line-height: 1.65; color: var(--ink); white-space: pre-wrap; }
.res-text.placeholder { color: var(--ink-muted); font-style: italic; }
.res-err { font-size: 13px; line-height: 1.5; color: var(--error); }
.res-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--ink-muted); border-top: 1px solid var(--hairline); padding-top: 10px; }
.res-meta b { color: var(--ink); font-weight: 600; }
.copy { margin-left: auto; border: none; background: none; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--coral-deep); cursor: pointer; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--hairline); border-top-color: var(--coral); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.foot { text-align: center; font-size: 12px; color: var(--ink-muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .res { opacity: 1 !important; }
}
