:root {
  --bg: #0f0d16;
  --cream: #f2efe6;
  --cream-dim: rgba(242, 239, 230, 0.62);
  --cream-faint: rgba(242, 239, 230, 0.4);
  --gold: #c4a568;
  --lavender: #8b81cf;
  --indigo: #3b3579;
  --green: #7fb583;
  --red: #d98181;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.14);
  --field-bg: rgba(15, 13, 22, 0.45);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
}

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

body {
  font-family: var(--sans);
  color: var(--cream);
  background: var(--bg);
  min-height: 100vh;
}

.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora span { position: absolute; width: 52vw; height: 52vw; border-radius: 50%; filter: blur(110px); opacity: 0.5; }
.aurora span:nth-child(1) { background: radial-gradient(circle, rgba(96,86,178,0.5), transparent 65%); top: -18vw; left: -12vw; }
.aurora span:nth-child(2) { background: radial-gradient(circle, rgba(196,165,104,0.18), transparent 65%); bottom: -20vw; left: 30vw; }
.aurora span:nth-child(3) { background: radial-gradient(circle, rgba(59,53,121,0.55), transparent 65%); top: -8vw; right: -16vw; }

/* ---- topbar ---- */

.topbar[hidden] { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 22px;
  padding: 14px 28px;
  background: rgba(15, 13, 22, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand { white-space: nowrap; }
.brand__est { white-space: nowrap; }
.allowance { white-space: nowrap; }
button.ghost { white-space: nowrap; }

.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--cream); }
.brand__name { font-family: var(--serif); font-weight: 500; font-size: 21px; }
.brand__est { font-size: 9px; font-weight: 600; letter-spacing: 0.22em; color: var(--gold); }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav button {
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  color: var(--cream-dim); background: none; border: none;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.nav button:hover { color: var(--cream); background: rgba(255,255,255,0.06); }
.nav button.active { color: var(--cream); background: rgba(255,255,255,0.09); }

.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.allowance { font-size: 12.5px; color: var(--cream-dim); }
.allowance b { color: var(--gold); font-weight: 600; }

button.ghost {
  font-family: var(--sans); font-size: 13px; color: var(--cream-dim);
  background: none; border: 1px solid var(--glass-border);
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
button.ghost:hover { color: var(--cream); border-color: rgba(255,255,255,0.3); }

/* ---- layout ---- */

.view { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 40px 24px 80px; }
.view--center { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100vh - 140px); text-align: center; }

.glass {
  background: linear-gradient(160deg, rgba(255,255,255,0.09), rgba(255,255,255,0.035));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 30px 70px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.12);
  padding: 34px;
}

h1, h2 { font-family: var(--serif); font-weight: 500; }
h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.15; }
h2 { font-size: 24px; }

.muted { color: var(--cream-dim); line-height: 1.6; }
.small { font-size: 13px; }
.gold { color: var(--gold); }

/* ---- forms ---- */

label { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(242,239,230,0.7); margin: 16px 0 7px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; font-family: var(--sans); font-size: 15px; color: var(--cream);
  background: var(--field-bg); border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 12px 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(196,165,104,0.75); box-shadow: 0 0 0 3px rgba(196,165,104,0.16); }
input::placeholder { color: rgba(242,239,230,0.3); }

.btn {
  font-family: var(--sans); font-size: 15.5px; font-weight: 600; color: var(--cream);
  background: linear-gradient(135deg, #4c4494, var(--indigo) 60%);
  border: 1px solid rgba(139,129,207,0.4); border-radius: 12px;
  padding: 14px 26px; cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
  box-shadow: 0 10px 26px rgba(30,26,70,0.55);
}
.btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn--big { font-size: 18px; padding: 18px 40px; border-radius: 14px; }
.btn--danger { background: linear-gradient(135deg, #8f4444, #6e3030 60%); border-color: rgba(217,129,129,0.4); box-shadow: 0 10px 26px rgba(70,26,26,0.55); }
.btn--gold { background: linear-gradient(135deg, #caa96a, #9a7b40 60%); border-color: rgba(196,165,104,0.5); color: #1c1710; }

.error { color: var(--red); font-size: 13.5px; margin-top: 12px; }

.result-note {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 0 18px; padding: 14px 16px; border-radius: 12px;
  font-size: 14px; line-height: 1.5;
  background: rgba(196, 165, 104, 0.1); border: 1px solid rgba(196, 165, 104, 0.35); color: var(--gold);
}
.result-note svg { flex-shrink: 0; margin-top: 2px; }
.result-note--offtopic { background: rgba(217, 129, 129, 0.1); border-color: rgba(217, 129, 129, 0.4); color: var(--red); }

/* ---- auth ---- */

.auth-card { width: min(430px, 100%); margin: 0 auto; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 22px; }
.auth-tabs button {
  flex: 1; font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 10px; border-radius: 10px; cursor: pointer;
  color: var(--cream-dim); background: rgba(255,255,255,0.04); border: 1px solid transparent;
}
.auth-tabs button.active { color: var(--cream); background: rgba(255,255,255,0.1); border-color: var(--glass-border); }

/* ---- home ---- */

/* Inline icons (Lucide): baseline-align with surrounding text. */
svg.ic { vertical-align: -0.18em; }
button svg.ic { vertical-align: -0.22em; margin-right: 4px; }
.hl-pause svg.ic { vertical-align: -0.12em; }

.mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 30px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  backdrop-filter: blur(10px);
}
.mode-tabs button {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  color: var(--cream-dim); background: none; border: none;
  border-radius: 999px; padding: 9px 22px; cursor: pointer;
}
.mode-tabs button.active { color: #1c1710; background: var(--gold); }
.mode-tabs button:not(.active):hover { color: var(--cream); background: rgba(255,255,255,0.06); }

.source-link {
  color: var(--gold); font-size: 14px; text-decoration: none;
  border-bottom: 1px solid rgba(196,165,104,0.4);
}
.source-link:hover { border-bottom-color: var(--gold); }

.hero-num { font-family: var(--serif); font-size: 15px; color: var(--gold); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 14px; }
.duration-row { display: flex; gap: 8px; justify-content: center; margin: 26px 0 34px; flex-wrap: wrap; }
.duration-row button {
  font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--cream-dim);
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
  border-radius: 999px; padding: 10px 20px; cursor: pointer;
}
.duration-row button.active { color: #1c1710; background: var(--gold); border-color: var(--gold); }

.limit-note { margin-top: 26px; font-size: 13px; color: var(--cream-faint); }

/* ---- reveal ---- */

.reveal-box { min-height: 130px; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: hidden; }
.reveal-title { font-family: var(--serif); font-size: clamp(26px, 3.6vw, 40px); line-height: 1.2; transition: opacity 0.08s; }
.reveal-title.rolling { animation: reveal-roll 0.12s ease-out; }
@keyframes reveal-roll {
  from { transform: translateY(0.55em); opacity: 0.15; filter: blur(3px); }
  to { transform: translateY(0); opacity: 1; filter: blur(0); }
}
.reveal-title.locked { animation: settle 0.6s ease-out; }
@keyframes settle { 0% { transform: scale(1.15); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.category-chip { display: inline-block; margin-top: 16px; font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); border: 1px solid rgba(196,165,104,0.5); border-radius: 999px; padding: 6px 14px; }

/* ---- research ---- */

.countdown { font-family: var(--serif); font-size: clamp(64px, 12vw, 110px); font-variant-numeric: tabular-nums; line-height: 1; margin: 24px 0 8px; transition: color 1s linear; }
#rec-time { transition: color 0.5s linear; }
.timer-bar { width: min(420px, 80%); height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; margin: 22px auto 0; overflow: hidden; }
.timer-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--lavender), var(--gold)); border-radius: 3px; transition: width 1s linear; }

/* ---- recorder ---- */

.rec-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--red); margin-right: 9px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.rec-time { font-family: var(--serif); font-size: 56px; font-variant-numeric: tabular-nums; margin: 18px 0; }
.level-meter { width: min(360px, 80%); height: 42px; margin: 0 auto 26px; display: flex; align-items: center; gap: 3px; justify-content: center; }
.level-meter i { width: 5px; border-radius: 3px; background: var(--gold); height: 8%; transition: height 0.08s; }
/* ---- custom audio player ---- */

.player {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.player__btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #1c1710;
  background: linear-gradient(135deg, #caa96a, #9a7b40 60%);
  box-shadow: 0 4px 14px rgba(30, 26, 70, 0.4);
}
.player__btn svg.ic { margin: 0; vertical-align: 0; }
.player.playing .player__btn { background: linear-gradient(135deg, #4c4494, var(--indigo) 60%); color: var(--cream); }

.player__time {
  flex-shrink: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--cream-dim);
  min-width: 34px;
  text-align: center;
}

.player__track {
  position: relative;
  flex: 1;
  height: 22px;
  cursor: pointer;
  touch-action: none;
}
.player__track::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 6px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.player__fill {
  position: absolute;
  left: 0; top: 50%;
  height: 6px;
  width: 0;
  transform: translateY(-50%);
  background: linear-gradient(90deg, var(--lavender), var(--gold));
  border-radius: 3px;
  pointer-events: none;
}
.player__dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  background: var(--cream);
  border-radius: 50%;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.player__track:hover .player__dot,
.player.playing .player__dot { opacity: 1; }
.player__track:focus-visible { outline: 2px solid rgba(196, 165, 104, 0.7); outline-offset: 2px; border-radius: 6px; }

.player__rate {
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--cream-dim);
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}
.player__rate:hover { color: var(--cream); border-color: rgba(255, 255, 255, 0.3); }

/* ---- floating playback dock ---- */

.abandon-link {
  margin-top: 26px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: rgba(242, 239, 230, 0.35);
  background: none;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(242, 239, 230, 0.2);
}
.abandon-link:hover { color: var(--red); text-decoration-color: rgba(217, 129, 129, 0.5); }

.btn--listen {
  width: 100%;
  font-size: 14px;
  padding: 11px 16px;
  background: rgba(196, 165, 104, 0.1);
  border: 1px solid rgba(196, 165, 104, 0.45);
  color: var(--gold);
  box-shadow: none;
}
.btn--listen:hover { filter: none; background: rgba(196, 165, 104, 0.18); }

@keyframes dockIn {
  from { transform: translate(-50%, 24px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(760px, calc(100vw - 24px));
  padding: 12px 16px;
  background: linear-gradient(160deg, rgba(34, 30, 46, 0.85), rgba(22, 19, 30, 0.85));
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: dockIn 0.3s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.dock__info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  max-width: 200px;
  color: var(--cream-dim);
  font-size: 13px;
}
.dock__info svg.ic { color: var(--gold); flex-shrink: 0; }
.dock__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dock__player { flex: 1; min-width: 0; }
.dock__player .player { background: none; border: none; padding: 0; backdrop-filter: none; }

.dock__close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--cream-faint);
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}
.dock__close:hover { color: var(--cream); border-color: var(--glass-border); }
.dock__close svg.ic { margin: 0; vertical-align: 0; }

@media (max-width: 680px) {
  .dock { bottom: 10px; width: calc(100vw - 16px); padding: 10px 12px; gap: 10px; }
  .dock__info { max-width: 90px; }
}

@media (prefers-reduced-motion: reduce) { .dock { animation: none; } }

/* ---- processing ---- */

.spinner { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.12); border-top-color: var(--gold); animation: spin 1s linear infinite; margin: 0 auto 26px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- results ---- */

.result-grid { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
@media (max-width: 720px) { .result-grid { grid-template-columns: 1fr; } }

.score-ring { position: relative; width: 190px; height: 190px; margin: 0 auto; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.score-ring .track { stroke: rgba(255,255,255,0.08); }
.score-ring .fill { stroke: url(#ringGrad); transition: stroke-dashoffset 1.2s ease-out; }
.score-ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .num b { font-family: var(--serif); font-size: 52px; font-weight: 500; }
.score-ring .num span { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--cream-dim); }

.subscores { display: flex; gap: 12px; margin: 18px 0 8px; }
.subscore { flex: 1; text-align: center; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); border-radius: 12px; padding: 12px 8px; }
.subscore b { font-family: var(--serif); font-size: 26px; display: block; }
.subscore span { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cream-dim); }

.bars { display: grid; gap: 10px; margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 26px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .track { height: 7px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.bar-row .fill { display: block; height: 100%; background: linear-gradient(90deg, var(--lavender), var(--gold)); border-radius: 4px; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip { font-size: 12.5px; color: var(--cream-dim); background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); border-radius: 999px; padding: 6px 13px; }
.chip b { color: var(--cream); }

.fb-section { margin-top: 22px; }
.fb-section h3 { font-family: var(--serif); font-size: 17px; font-weight: 500; margin-bottom: 8px; }
.fb-section ul { list-style: none; display: grid; gap: 7px; }
.fb-section li { font-size: 14px; line-height: 1.55; color: var(--cream-dim); padding-left: 20px; position: relative; }
.fb-section li::before { content: "◆"; position: absolute; left: 0; top: 1px; font-size: 9px; color: var(--gold); }
.fb-section.neg li::before { color: var(--red); }
.fb-section.pos li::before { color: var(--green); }
.fb-structure { white-space: pre-wrap; font-size: 14px; line-height: 1.65; color: var(--cream-dim); background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); border-radius: 12px; padding: 16px 18px; }

.transcript-tabs { display: flex; gap: 6px; margin: 22px 0 12px; }
.transcript-tabs button { font-size: 13px; font-weight: 600; color: var(--cream-dim); background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); border-radius: 8px; padding: 8px 16px; cursor: pointer; }
.transcript-tabs button.active { color: var(--cream); background: rgba(255,255,255,0.11); }
.transcript-body { font-size: 14.5px; line-height: 1.7; color: var(--cream-dim); background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); border-radius: 12px; padding: 18px 20px; max-height: 300px; overflow-y: auto; white-space: pre-wrap; }

.hl-filler { background: rgba(196,165,104,0.26); color: var(--cream); border-radius: 4px; padding: 0 3px; }
.hl-repeat { text-decoration: underline wavy rgba(139,129,207,0.9); text-underline-offset: 3px; }
.hl-pause {
  display: inline-block; font-size: 11px; font-weight: 600; color: var(--red);
  border: 1px dashed rgba(217,129,129,0.55); border-radius: 999px;
  padding: 1px 9px; margin: 0 2px; vertical-align: middle; white-space: nowrap;
}
.hl-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12px; color: var(--cream-faint); margin-bottom: 10px; }
.hl-legend[hidden] { display: none; }

/* ---- history ---- */

.history-list { display: grid; gap: 12px; margin-top: 22px; }
.history-item {
  display: flex; align-items: center; gap: 16px; text-align: left; width: 100%;
  background: linear-gradient(160deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  border: 1px solid var(--glass-border); border-radius: 14px; padding: 16px 20px;
  color: var(--cream); font-family: var(--sans); cursor: pointer;
}
.history-item:hover { border-color: rgba(196,165,104,0.5); }
.history-item .t { flex: 1; }
.history-item .t b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.history-item .t span { font-size: 12.5px; color: var(--cream-faint); }
.history-score { font-family: var(--serif); font-size: 26px; color: var(--gold); }
.state-tag { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; border-radius: 999px; padding: 4px 10px; }
.state-tag.completed { color: var(--green); border: 1px solid rgba(127,181,131,0.4); }
.state-tag.failed, .state-tag.abandoned { color: var(--red); border: 1px solid rgba(217,129,129,0.4); }
.state-tag.processing, .state-tag.submitted { color: var(--gold); border: 1px solid rgba(196,165,104,0.4); }
.state-tag.ready, .state-tag.researching { color: var(--lavender); border: 1px solid rgba(139,129,207,0.45); }

.back-link { background: none; border: none; color: var(--cream-dim); font-size: 13.5px; cursor: pointer; padding: 0; margin-bottom: 18px; font-family: var(--sans); }
.back-link:hover { color: var(--cream); }

/* ---- settings ---- */

/* Centered column: the blocks sit in the middle of the screen while their
   text stays left-aligned inside. */
.settings-col { max-width: 520px; margin: 0 auto; }
.settings-card { max-width: 520px; }
.radio-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.radio-grid button { font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--cream-dim); background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); border-radius: 12px; padding: 16px 8px; cursor: pointer; }
.radio-grid button.active { color: #1c1710; background: var(--gold); border-color: var(--gold); }
.saved-note { color: var(--green); font-size: 13px; margin-top: 12px; }

/* ---- motion ---- */

button {
  transition: transform 0.12s ease, background 0.18s ease, color 0.18s ease,
    border-color 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}
button:active:not(:disabled) { transform: scale(0.96); }

button:focus-visible { outline: 2px solid rgba(196, 165, 104, 0.7); outline-offset: 2px; }

/* Every screen slides up softly as it renders. */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.view-anim { animation: viewIn 0.3s cubic-bezier(0.2, 0.7, 0.3, 1); }

/* Newly selected pills/tabs pop into place. */
@keyframes pop {
  0% { transform: scale(0.9); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.duration-row button.active,
.mode-tabs button.active,
.radio-grid button.active,
.transcript-tabs button.active,
.auth-tabs button.active,
.nav button.active {
  animation: pop 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* History entries cascade in and lift on hover. */
.history-item {
  animation: viewIn 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.history-item:hover { transform: translateY(-2px); }

.hi-del {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: var(--cream-faint);
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.history-item:hover .hi-del, .hi-del:focus-visible { opacity: 1; }
.hi-del:hover { color: var(--red); border-color: rgba(217, 129, 129, 0.4); }
.hi-del svg.ic { margin: 0; vertical-align: 0; }
@media (hover: none) { .hi-del { opacity: 1; } }

.btn--sm-danger {
  font-size: 13.5px;
  padding: 10px 18px;
  background: none;
  border: 1px solid rgba(217, 129, 129, 0.4);
  color: var(--red);
  box-shadow: none;
}
.btn--sm-danger:hover { filter: none; background: rgba(217, 129, 129, 0.08); }

/* Rating bars grow from the left, one after another. */
.bar-row .fill {
  transform-origin: left;
  animation: grow 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms + 0.15s);
}
@keyframes grow { from { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  .view-anim, .history-item, .bar-row .fill,
  .duration-row button.active, .mode-tabs button.active, .radio-grid button.active,
  .transcript-tabs button.active, .auth-tabs button.active, .nav button.active {
    animation: none !important;
  }
  button { transition: none; }
}

.suggest-link {
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--cream-dim);
}
.suggest-link:hover { color: var(--cream); border-color: rgba(196, 165, 104, 0.5); }

/* ---- mobile ---- */

@media (max-width: 680px) {
  body { overflow-x: clip; }

  /* Two-row topbar: brand + account controls above, full-width nav below.
     On one row, half the controls were pushed off-screen entirely. */
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand right"
      "nav nav";
    gap: 10px 12px;
    padding: 12px 16px 10px;
  }

  .brand { grid-area: brand; }
  .brand__name { font-size: 19px; }
  .brand__est { display: none; }

  .topbar__right { grid-area: right; gap: 10px; }
  .allowance { font-size: 12px; }
  button.ghost { font-size: 12px; padding: 6px 11px; }
  /* compact text link — the bordered pill crowded the top row */
  .suggest-link { border: none; padding: 6px 2px; font-size: 12px; color: var(--gold); }

  .nav {
    grid-area: nav;
    margin-left: 0;
    gap: 6px;
  }

  .nav button {
    flex: 1;
    text-align: center;
    padding: 9px 4px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.04);
  }

  .view { padding: 26px 16px 64px; }

  .glass { padding: 24px 18px; border-radius: 16px; }

  .duration-row button { padding: 9px 16px; font-size: 13px; }

  .btn--big { font-size: 16px; padding: 16px 28px; width: 100%; }

  .subscores { gap: 8px; }
  .subscore b { font-size: 22px; }

  .bar-row { grid-template-columns: 88px 1fr 24px; font-size: 12.5px; }

  .transcript-body { font-size: 13.5px; padding: 14px 15px; }

  .history-item { padding: 14px 16px; gap: 12px; }
  .history-score { font-size: 22px; }

  .radio-grid { grid-template-columns: repeat(2, 1fr); }

  .rec-time { font-size: 44px; }
  .countdown { margin: 18px 0 6px; }
}

/* ---- google sign-in ---- */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: rgba(242, 239, 230, 0.4);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

#google-btn { display: flex; justify-content: center; min-height: 44px; }

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.btn-google:hover {
  border-color: rgba(196, 165, 104, 0.55);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

/* ---- announcements ---- */

.announce-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 8, 16, 0.45);
  backdrop-filter: blur(4px);
  animation: announce-in 0.25s ease;
}

.announce-card {
  width: min(480px, 100%);
  text-align: center;
  padding: 34px 32px 28px;
}

.announce-body { margin-top: 14px; }
.announce-body p { color: var(--cream-dim); line-height: 1.65; font-size: 14.5px; margin-top: 8px; }

@keyframes announce-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .announce-overlay { animation: none; } }

/* ---- skeleton loading ---- */

.skel {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 10px;
}

.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.06) 50%, transparent 65%);
  animation: skel-sweep 1.5s infinite;
}

.skel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  margin-top: 12px;
}

@keyframes skel-sweep { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skel::after { animation: none; } }

/* ---- skip to content (keyboard/screen-reader) ---- */

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--gold, #c4a568); color: #1c1710;
  padding: 10px 18px; border-radius: 0 0 12px 0;
  font-family: var(--sans, sans-serif); font-size: 14px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---- password visibility toggle ---- */

.pw-field { position: relative; }
.pw-field input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; background: none; border: none; padding: 8px;
  border-radius: 8px; color: var(--cream-faint); cursor: pointer;
}
.pw-eye:hover { color: var(--cream); }
