/* Speakzy — practice app. Extends styles.css tokens. */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 420px at 88% -12%, rgba(210, 232, 91, 0.16), transparent 60%),
    radial-gradient(900px 420px at -8% 6%, rgba(139, 133, 245, 0.10), transparent 55%),
    var(--bg);
}

.header__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.header__clock {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--fill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.app__main {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  align-items: stretch;
}

.stage {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 26px;
  padding: clamp(24px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-height: 468px;
  position: relative;
  overflow: hidden;
}

/* ---------- Deck chips ---------- */

.decks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.chip {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--fill);
  border: none;
  border-radius: var(--r-pill);
  padding: 10px 18px;
  min-height: 42px;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.chip:hover { background: var(--fill-hover); transform: translateY(-1px); }
.chip[aria-pressed="true"] {
  background: var(--lime);
  color: var(--on-lime);
  font-weight: 700;
  box-shadow: 0 8px 18px -9px rgba(210, 232, 91, 0.9);
}
.chip[aria-pressed="true"]:hover { background: var(--lime-hover); transform: translateY(-1px); }

/* ---------- Phase panels ---------- */

.phase {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.phase[hidden] { display: none; }

.phase--idle {
  gap: 28px;
  align-items: flex-start;
  padding: 20px 0;
}
.phase--prepare {
  gap: 24px;
  align-items: flex-start;
  padding: 12px 0;
}
.phase--live { gap: 26px; padding: 12px 0; }
.live__eyebrow { text-align: center; width: 100%; }
.phase--live .countdown__topic { margin-bottom: 28px; }
.phase--done { gap: 22px; padding: 12px 0; }

/* Idle */

.idle-mark {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: idlePulse 2.6s ease-out infinite;
}
@keyframes idlePulse {
  0% { box-shadow: 0 0 0 0 rgba(210, 232, 91, 0.45); }
  70% { box-shadow: 0 0 0 22px rgba(210, 232, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(210, 232, 91, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .idle-mark { animation: none; }
}
.idle-mark__inner {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.idle-mark__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-solid);
}

.idle__copy { display: flex; flex-direction: column; gap: 12px; }
.idle__title {
  margin: 0;
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: pretty;
}
.idle__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 42ch;
}

/* Prepare */

.prepare__time {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.select-wrapper {
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.select-wrapper::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: none;
  opacity: 0.55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111113' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 3'/%3E%3C/svg%3E") no-repeat center / contain;
}
.select-wrapper:hover {
  background: var(--fill-hover);
}
.select-wrapper:focus-within {
  border-color: var(--periwinkle);
  box-shadow: 0 0 0 4px rgba(139, 133, 245, 0.15);
}
.select-time {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  appearance: none;
  padding-right: 20px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23111113' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
}

.prepare__footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 16px;
}
.prepare__hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-muted);
}
.prepare__hint svg { color: var(--periwinkle); flex: none; }
.prepare__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons — lift + glow (scoped to the practice screen) */
.stage .btn,
.rail .btn,
.btn--link {
  transition: background var(--ease), color var(--ease), border-color var(--ease),
    transform var(--ease), box-shadow var(--ease);
}
.stage .btn:hover,
.rail .btn:hover {
  transform: translateY(-1px);
}
.stage .btn--primary:hover {
  box-shadow: 0 12px 26px -12px rgba(210, 232, 91, 0.85);
}
.stage .btn--outline:hover,
.stage .btn--neutral:hover {
  box-shadow: 0 8px 18px -12px rgba(17, 17, 19, 0.3);
}
.btn--link:hover { transform: translateX(2px); }

/* Countdown */
.is-countdown .header__meta { display: none !important; }
.is-countdown .stage {
  border: none !important;
  background: transparent !important;
  padding-top: 10vh !important;
  align-items: center !important;
}
.is-countdown .decks, .is-countdown .notice { display: none !important; }

.is-done .decks { display: none !important; }

.phase--countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}
.countdown__topic {
  font-size: clamp(32px, 4.5vw, 48px);
  line-height: 1.15;
  margin-bottom: 16px;
  text-align: center;
}
.countdown__hint {
  font-size: 17px;
  color: var(--ink-muted);
  margin-bottom: 48px;
  text-align: center;
}
.countdown__dial {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--lime) 0deg 0deg, var(--track) 0deg 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  flex: none;
  box-shadow: 0 24px 60px -28px rgba(139, 133, 245, 0.4);
}
.countdown__face {
  width: 216px;
  height: 216px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.countdown__time {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
}
.countdown__label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--periwinkle);
  text-transform: uppercase;
}
.btn--countdown {
  font-size: 17px;
  padding: 18px 40px;
  border-radius: var(--r-pill);
  font-weight: 700;
}

/* Processing */

.phase--processing .countdown__topic { margin-bottom: 12px; }
.phase--processing .countdown__hint { margin-bottom: 0; max-width: 46ch; }
.progress-track {
  width: 100%;
  max-width: 320px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--track);
  overflow: hidden;
  margin-bottom: 32px;
  position: relative;
}
.progress-track[hidden] { display: none; }
.progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--lime);
  transition: width 0.2s ease;
  position: relative;
  overflow: hidden;
}
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent);
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-track.is-indeterminate .progress-fill {
  width: 35%;
  animation: indeterminate 1.1s ease-in-out infinite;
}
.progress-track.is-indeterminate .progress-fill::after {
  animation: none;
  opacity: 0;
}
@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(385%); }
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill::after { animation: none; }
  .progress-track.is-indeterminate .progress-fill { animation: none; width: 100%; opacity: 0.6; }
}

/* Live */

.live__labels { display: flex; align-items: center; gap: 14px; }
.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--periwinkle);
}
.label--neutral { color: var(--ink-muted); }

.topic {
  margin: 0;
  font-size: clamp(26px, 3.8vw, 36px);
  font-weight: 700;
  letter-spacing: -0.032em;
  line-height: 1.15;
  text-wrap: pretty;
}

.live__row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.dial {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--lime) 0deg 0deg, var(--track) 0deg 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.dial__face {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.controls { display: flex; flex-direction: column; gap: 10px; }
.controls__row { display: flex; gap: 10px; flex-wrap: wrap; }
.controls__hint { font-size: 13px; color: var(--ink-muted); }

.btn--sm {
  font-size: 15px;
  padding: 13px 22px;
  min-height: 46px;
  border-radius: var(--r-pill);
  gap: 0;
}
.btn--neutral { background: var(--fill); color: var(--ink); }
.btn--neutral:hover { background: var(--fill-hover); }

/* Done */

.topic--done {
  font-size: clamp(24px, 3.4vw, 32px);
  letter-spacing: -0.03em;
  line-height: 1.18;
}

.player {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-panel);
  padding: 16px 18px;
}
.player__button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--player-btn-bg);
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  cursor: pointer;
  transition: transform var(--ease);
}
.player__button:hover { transform: scale(1.06); }
.player__button::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 12px solid var(--player-btn-fg);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  margin-left: 4px;
}
.player__track {
  flex: 1;
  height: 6px;
  background: var(--track-strong);
  border-radius: var(--r-pill);
}
.player__time { font-size: 14px; color: var(--ink-muted); }

/* Inline analysis (embedded in the done phase) */

.done__analysis { display: contents; }
.done__analysis[hidden] { display: none; }

/* Done screen mirrors analysis.html: the stage card gives way to a stack of cards.
   Order: score, recording, everything else, actions. */
.is-done .stage {
  background: transparent;
  border: none;
  padding: 0;
  min-height: 0;
  overflow: visible;
  gap: 16px;
}
.phase--done { gap: 16px; padding: 0; }
.phase--done > .acard { order: 1; }
.done__analysis > * { order: 2; }
.done__analysis > .score { order: 0; }
.phase--done > .done__actions { order: 3; }

.done__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn--sm.btn--outline { font-weight: 600; padding: 13px 24px; }

/* ---------- Rail ---------- */

.rail {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.rail__card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.rail__card--takes { gap: 6px; }
.rail__card--takes .label { margin-bottom: 8px; }

.week__count {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.week__number {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.week__unit { font-size: 15px; color: var(--ink-muted); }

.week__bars { display: flex; gap: 6px; }
.week__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.week__bar {
  width: 100%;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--track-soft);
}
.week__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-subtle);
}
.week__col--today .week__label {
  color: var(--ink);
  font-weight: 700;
}
.week__bar--done { background: linear-gradient(180deg, var(--lime-hover), var(--lime)); }

.week__note {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.take {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 14px;
  margin: 0 -14px;
  border-top: 1px solid var(--track);
  border-radius: var(--r-panel);
  transition: background var(--ease);
}
a.take:hover {
  background: var(--surface-muted);
  border-top-color: transparent;
}
a.take:hover + a.take { border-top-color: transparent; }
.take__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.take__title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.take__deck { font-size: 12px; color: var(--ink-subtle); }
.take__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}
.take__score {
  font-size: 13px;
  font-weight: 700;
  background: var(--lime-soft);
  color: var(--ink);
  border-radius: var(--r-pill);
  padding: 4px 10px;
}
.take__duration {
  font-size: 13px;
  color: var(--ink-muted);
  flex: none;
}
.take__chevron {
  font-size: 18px;
  line-height: 1;
  color: var(--ink-subtle);
  transition: transform var(--ease), color var(--ease);
}
a.take:hover .take__chevron {
  color: var(--ink);
  transform: translateX(3px);
}

/* ---------- Notice (mic / browser support) ---------- */

.notice {
  margin: 0;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-panel);
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-muted);
}
.notice[hidden] { display: none; }

.player__fill {
  height: 100%;
  width: 0;
  background: var(--lime);
  border-radius: var(--r-pill);
}
.player__button.is-playing::after {
  border: none;
  width: 12px;
  height: 14px;
  margin-left: 0;
  border-left: 4px solid var(--player-btn-fg);
  border-right: 4px solid var(--player-btn-fg);
}
.player__button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--link {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--periwinkle-ink);
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 8px;
  white-space: nowrap;
}
.btn--link:hover { color: var(--ink); }
.btn--link[hidden] { display: none; }

.rail__empty {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-muted);
}
a.take:hover { color: var(--ink); }
a.take:hover .take__title { color: var(--periwinkle-ink); }
