/* Wake word console — page-specific styles on top of styles.css + components.css. */

:root {
  --series-1: #2563eb;
  --series-2: #db2777;
  --series-3: #059669;
  --series-4: #d97706;
  --series-5: #7c3aed;
  --series-6: #0891b2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --series-1: #60a5fa;
    --series-2: #f472b6;
    --series-3: #34d399;
    --series-4: #fbbf24;
    --series-5: #a78bfa;
    --series-6: #22d3ee;
  }
}

:root[data-theme="dark"] {
  --series-1: #60a5fa;
  --series-2: #f472b6;
  --series-3: #34d399;
  --series-4: #fbbf24;
  --series-5: #a78bfa;
  --series-6: #22d3ee;
}

/* ---------- Layout ---------- */

.test-layout {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.test-layout .span-full {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .test-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Model picker ---------- */

.model-pick {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.model-pick__group {
  padding: 6px 8px 2px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.model-pick .check {
  justify-content: space-between;
}

.model-pick .check > span:first-of-type {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-pick .check > span:last-child {
  flex: none;
  white-space: nowrap;
}

.swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--border-strong);
}

.swatch.series-1 { background: var(--series-1); }
.swatch.series-2 { background: var(--series-2); }
.swatch.series-3 { background: var(--series-3); }
.swatch.series-4 { background: var(--series-4); }
.swatch.series-5 { background: var(--series-5); }
.swatch.series-6 { background: var(--series-6); }

/* ---------- Threshold slider ---------- */

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.range-row output {
  min-width: 42px;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Live status ---------- */

.wake {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.wake__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
}

.wake__title {
  font-size: 20px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.wake__sub {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13px;
}

.wake.is-listening .wake__icon {
  background: var(--accent-soft);
  color: var(--accent-strong);
  animation: wake-pulse 1.8s ease-in-out infinite;
}

.wake.is-detected {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.wake.is-detected .wake__icon {
  background: var(--ok);
  color: var(--surface);
  animation: none;
}

.wake.is-error {
  border-color: var(--err);
  background: var(--err-soft);
}

@keyframes wake-pulse {
  50% { box-shadow: 0 0 0 10px transparent; transform: scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .wake.is-listening .wake__icon { animation: none; }
}

.level {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 4px;
}

/* ---------- Charts ---------- */

.chart {
  display: block;
  width: 100%;
  height: 260px;
}

.chart--sm {
  height: 180px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  color: var(--text-2);
  font-size: 12px;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Detection log ---------- */

.hits {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}

.hit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
}

.hit__time {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 12px;
}

.hit__score {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Clip upload ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-within,
.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dropzone__title {
  color: var(--text);
  font-weight: 600;
}

.clip-player {
  width: 100%;
  margin-top: 10px;
}

.table tr.is-selected td {
  background: var(--accent-soft);
}

.table tr[data-clip] {
  cursor: pointer;
}

.th-model {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-score {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-score.is-hit {
  color: var(--ok);
  font-weight: 650;
}

.table tfoot td {
  border-top: 1px solid var(--border-strong);
  font-weight: 650;
}

/* ---------- Shared bits: nav count, kbd, switch, tags ---------- */

.nav__count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--warn);
  color: var(--surface);
  font: 700 10.5px/18px var(--font-sans);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-2);
  font: 600 11px/1 var(--font-mono);
}

.kbd + .kbd {
  margin-left: 3px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 550;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch__track {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.switch input:checked + .switch__track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch__track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.switch input:disabled ~ * {
  opacity: 0.6;
  cursor: default;
}

.tag--guest {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tag--warn {
  margin-left: 6px;
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  background: var(--warn-soft);
  color: var(--warn);
}

.icon--flip {
  transform: rotate(180deg);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.94em;
}

.card-head__actions {
  display: flex;
  gap: 6px;
}

/* ---------- Live page: save for review ---------- */

.save-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.save-box .field-hint {
  margin: 0;
}

.hit {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.hit__saved {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 11.5px;
}

.hit__saved.is-saved {
  color: var(--ok);
  font-weight: 600;
}

/* ---------- Review page ---------- */

.kpis--tight {
  margin-bottom: 18px;
}

.share-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: var(--radius-lg);
  background:
    linear-gradient(120deg, var(--accent-soft), transparent 70%),
    var(--surface);
}

.share-bar__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
}

.share-bar__text {
  min-width: 0;
  color: var(--text-2);
  font-size: 13px;
}

.share-bar__title {
  color: var(--text);
  font-weight: 650;
}

.share-bar__link {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
}

.share-bar__actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 860px) {
  .share-bar {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .share-bar__link,
  .share-bar__actions {
    grid-column: 1 / -1;
    max-width: none;
  }
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.review-player {
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

@media (max-width: 1020px) {
  .review-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .review-player {
    position: static;
  }
}

.wavebox {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.wavebox__main {
  min-width: 0;
}

.wavebox__time {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--text-3);
  font: 11.5px var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.waveform {
  display: block;
  width: 100%;
  height: 64px;
  cursor: pointer;
  border-radius: 4px;
}

.play-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.play-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.play-btn .icon svg {
  margin-left: 2px; /* optical centre of the triangle */
}

.play-btn.is-playing .icon svg {
  margin-left: 0;
}

.p-headline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
}

.p-score {
  font-size: 30px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--tone, var(--text));
}

.p-headline__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 12.5px;
}

.p-model {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 600;
}

.p-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 7px 14px;
  margin: 0 0 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.p-facts dt {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}

.p-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.p-other {
  display: inline-block;
  margin-right: 8px;
}

.p-reset {
  margin-left: 8px;
}

.verdict {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.verdict-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 12px;
  border: 1.5px solid color-mix(in srgb, var(--tone) 40%, var(--border));
  border-radius: var(--radius);
  background: var(--tone-soft);
  color: var(--tone);
  font: 650 13.5px var(--font-sans);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, transform 0.08s ease;
}

.verdict-btn__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--tone);
  color: var(--surface);
}

.verdict-btn:hover:not(:disabled),
.verdict-btn[aria-pressed="true"] {
  background: var(--tone);
  color: var(--surface);
}

.verdict-btn:hover:not(:disabled) .verdict-btn__icon,
.verdict-btn[aria-pressed="true"] .verdict-btn__icon {
  background: var(--surface);
  color: var(--tone);
}

.verdict-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.verdict-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.verdict-btn .kbd {
  background: transparent;
  border-color: currentColor;
  color: inherit;
  opacity: 0.75;
}

.p-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
}

.btn--danger-text {
  color: var(--err);
}

.p-foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.p-foot__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.p-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 0;
}

.p-name__label {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.input--sm {
  height: 32px;
  font-size: 13px;
}

.shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--text-3);
  font-size: 12px;
}

.queue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.queue-meta {
  font-size: 12.5px;
}

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.seg__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: 550 13px var(--font-sans);
  cursor: pointer;
}

.seg__btn:hover {
  color: var(--text);
}

.seg__btn[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.seg__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone);
  font: 700 11px var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.chip--new {
  height: 26px;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.q-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.q-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.q-item.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.q-play {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}

.q-play:hover,
.q-play.is-playing {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.q-main {
  min-width: 0;
}

.q-line1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.q-who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 620;
}

.q-line2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
}

.q-review {
  color: var(--tone);
}

.q-note {
  font-style: italic;
}

.q-side {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone);
  font: 650 11.5px var(--font-mono);
}

.score-pill__bar {
  width: 32px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: color-mix(in srgb, var(--tone) 22%, transparent);
}

.score-pill__bar > span {
  display: block;
  height: 100%;
  background: var(--tone);
}

.guests {
  margin-top: 30px;
}

.guests__sub {
  margin: -6px 0 12px;
  font-size: 13px;
}

.usage-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.usage-cell__sub {
  font-size: 11.5px;
}

.usage {
  width: 60px;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-3);
}

.usage__fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.usage.is-full .usage__fill {
  background: var(--warn);
}

.review-mini {
  display: inline-flex;
  gap: 4px;
}

.review-mini > span {
  min-width: 24px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--tone-soft);
  color: var(--tone);
  font: 650 11.5px var(--font-mono);
  text-align: center;
}

/* ---------- Guest recording page ---------- */

.record-page {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -8%, var(--accent-soft), transparent 70%),
    var(--bg);
}

.record-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 16px;
}

.record-top__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
}

.record-top__brand .brand__mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.record-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
  padding: 4px 16px 40px;
}

.prompt-card {
  padding: 26px 20px 22px;
  border-radius: var(--radius-lg);
  /* fixed brand colours: the dark theme's lighter accent would wash out the white text */
  background: linear-gradient(140deg, #5b3fd6, #33208f);
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.prompt-card__eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}

.prompt-card__text {
  margin: 6px 0 8px;
  font-size: clamp(36px, 9vw, 56px);
  font-weight: 760;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.prompt-card__hint {
  font-size: 14px;
  opacity: 0.9;
}

.recorder {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 18px;
}

.recorder.is-sent {
  animation: sent-pop 0.5s ease;
}

@keyframes sent-pop {
  30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 45%, transparent); }
}

.rec-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.rec-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.rec-btn:hover:not(:disabled) {
  transform: scale(1.04);
}

.rec-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.rec-btn__icon {
  position: relative;
  display: grid;
  place-items: center;
}

.rec-btn__ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--err) 45%, transparent);
  opacity: 0;
  transition: transform 0.08s linear, opacity 0.2s ease;
}

.rec-btn.is-recording .rec-btn__ring {
  opacity: 1;
}

.rec-btn.is-recording::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--err);
  animation: rec-pulse 1.4s ease-out infinite;
}

@keyframes rec-pulse {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(1.35); opacity: 0; }
}

.rec-status {
  font-size: 17px;
  font-weight: 650;
}

.rec-sub {
  min-height: 1.4em;
  color: var(--text-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.waveform--rec {
  height: 56px;
  margin-top: 8px;
}

.rec-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 8px;
}

.rec-actions .btn {
  height: 42px;
  justify-content: center;
}

@media (max-width: 420px) {
  .rec-actions {
    grid-template-columns: 1fr 1fr;
  }
  .rec-actions .btn--primary {
    grid-column: 1 / -1;
    order: -1;
  }
}

.rec-error {
  margin: 0;
  text-align: center;
}

.rec-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  text-align: center;
}

.rec-done__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
}

.rec-done.is-off .rec-done__icon {
  background: var(--muted-soft);
  color: var(--muted);
}

.rec-done__title {
  font-size: 20px;
  font-weight: 700;
}

.rec-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.rec-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.rec-dot.is-done {
  border-color: var(--ok);
  background: var(--ok);
}

.rec-count {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 550;
}

.tips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 10px;
}

.tip {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
}

.tip__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tip__title {
  margin-bottom: 2px;
  color: var(--text);
  font-weight: 650;
}

.consent {
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .rec-btn.is-recording::after,
  .recorder.is-sent {
    animation: none;
  }
}

/* ---------- Review: filter bar ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.filter-bar .chip {
  height: 28px;
}

.filter-bar__search {
  flex: 1 1 200px;
}

.select--sm {
  width: auto;
  height: 32px;
  font-size: 13px;
}

/* ---------- Guest page: thank-you note ---------- */

.rec-thanks {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  border-radius: var(--radius);
  background: var(--ok-soft);
}

.rec-thanks.is-in {
  animation: thanks-in 0.35s ease;
}

@keyframes thanks-in {
  from { opacity: 0; transform: translateY(-6px); }
}

.rec-thanks__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ok);
  color: var(--surface);
}

.rec-thanks__title {
  color: var(--ok);
  font-weight: 700;
}

.rec-thanks__text {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .rec-thanks.is-in { animation: none; }
}

/* ---------- Dataset page ---------- */

.tag--real {
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  background: var(--ok-soft);
  color: var(--ok);
}

.btn--ok {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  background: var(--ok-soft);
  color: var(--ok);
}

.btn--ok:hover:not(:disabled) {
  background: var(--ok);
  color: var(--surface);
}

.icon-btn.tone-ok,
.icon-btn.tone-err {
  color: var(--tone);
}

.icon-btn.tone-ok:hover:not(:disabled),
.icon-btn.tone-err:hover:not(:disabled) {
  background: var(--tone-soft);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.play-btn--sm {
  width: 38px;
  height: 38px;
  flex: none;
  box-shadow: var(--shadow-sm);
}

.dataset-main {
  padding-bottom: 24px;
}

body.has-playerbar .dataset-main {
  padding-bottom: 120px;
}

.dataset-name {
  flex: 0 1 260px;
}

.import-card {
  margin-bottom: 18px;
}

.import-card__head {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.import-card__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--ok-soft);
  color: var(--ok);
}

.import-card__sub {
  margin-top: 2px;
  font-size: 13px;
  max-width: 90ch;
}

.snap-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.snap-row + .snap-row {
  margin-top: 8px;
}

.snap-row__main {
  display: flex;
  flex-direction: column;
  flex: 1 1 240px;
  min-width: 0;
  font-size: 13px;
}

.groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.group-card:hover,
.group-card.is-open {
  border-color: var(--border-strong);
}

.group-card.is-open {
  box-shadow: var(--shadow);
}

.group-card__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.group-card__main {
  min-width: 0;
}

.group-card__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.group-card__name {
  font-size: 15.5px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.group-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12.5px;
}

.group-card__counts {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.status-bar {
  display: flex;
  flex: 0 1 260px;
  gap: 2px;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-3);
}

.status-bar__seg {
  display: block;
  min-width: 3px;
  background: var(--tone);
}

.group-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

@media (max-width: 760px) {
  .group-card__head {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .group-card__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.group-card__body {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}

.sel-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 10px 0;
  background: var(--surface);
}

.sel-bar__all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sel-bar.is-active .sel-bar__all {
  color: var(--accent-strong);
}

.sel-bar__count {
  margin-left: auto;
  font-size: 12px;
}

.sel-bar input,
.clip-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
}

.clip-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.clip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.clip-row:hover {
  background: var(--surface-2);
}

.clip-row.is-playing {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.clip-row.is-playing .q-play {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.clip-row .q-play {
  flex: none;
  width: 28px;
  height: 28px;
}

.clip-row > input,
.clip-row > .score-pill,
.clip-row > .badge,
.clip-row > .tag,
.clip-row__actions {
  flex: none;
}

.clip-row__n {
  width: 34px;
  color: var(--text-3);
  font-size: 11.5px;
}

.clip-row__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

.clip-row__len {
  font-size: 11.5px;
}

.clip-row__actions {
  display: inline-flex;
  gap: 2px;
}

@media (max-width: 560px) {
  .clip-row__n,
  .clip-row__len {
    display: none;
  }
}

.clip-more {
  margin-top: 8px;
}

/* sticky playlist player */

.playerbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  box-shadow: 0 -8px 24px rgba(16, 24, 40, 0.08);
}

.playerbar__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  max-width: var(--container);
  margin: 0 auto;
}

.playerbar__controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.playerbar__info {
  min-width: 0;
}

.playerbar__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.playerbar__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 3px;
  font-size: 12px;
}

.playerbar__progress {
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-3);
}

.playerbar__progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.1s linear;
}

.playerbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pb-verdict {
  border-color: color-mix(in srgb, var(--tone) 40%, var(--border));
  color: var(--tone);
}

.pb-verdict[aria-pressed="true"],
.pb-verdict:hover:not(:disabled) {
  background: var(--tone);
  color: var(--surface);
}

.pb-verdict .kbd {
  border-color: currentColor;
  background: transparent;
  color: inherit;
  opacity: 0.7;
}

@media (max-width: 760px) {
  .playerbar__inner {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 12px;
  }
  .playerbar__actions {
    grid-column: 1 / -1;
  }
  .pb-verdict .kbd {
    display: none;
  }
}

/* status switch: never wider than the screen (scrolls inside itself on phones) */
.seg {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.seg::-webkit-scrollbar {
  display: none;
}

.seg__btn {
  flex: none;
}

@media (max-width: 480px) {
  .seg__btn {
    padding: 0 9px;
    gap: 5px;
  }
}
