/*
 * BandUp9 (IELTS Speaking) web. Light theme is default; `html[data-theme="dark"]` swaps tokens.
 * Components use semantic tokens only — never hard-code theme colors below the token blocks.
 */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-glow: rgba(79, 70, 229, 0.09);
  --side-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e6e9f2;
  --card-bg: #ffffff;
  --card-border: #e4e7ef;
  --card-hover-border: #c7d2fe;
  --border: #d8dde8;
  --text: #111827;
  --text-muted: #566072;
  --text-faint: #5c6575; /* U1: ≥4.5:1 on --bg (was #98a1b3, 2.43:1) */
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-bright: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.09);
  --accent-glow: rgba(79, 70, 229, 0.28);
  /* Filled CTA fill / label: keep `--on-primary` on `--primary-bg*` at >= 4.5:1 (WCAG AA) in every state */
  --primary-bg: #4338ca;
  --primary-bg-hover: #3730a3;
  --primary-bg-2: #6d28d9;
  --on-primary: #ffffff;
  --success: #15803d;
  --warn: #b45309;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --warn-fill: #f59e0b;
  --error: #dc2626;
  --recording: #dc2626;
  --flame: #ea580c;
  --flame-soft: rgba(249, 115, 22, 0.12);
  --sky: #0369a1;
  --sky-soft: rgba(14, 165, 233, 0.12);
  --green-soft: rgba(22, 163, 74, 0.12);
  --topbar-bg: linear-gradient(180deg, rgba(246, 247, 251, 0.98), rgba(246, 247, 251, 0.98) 80%, rgba(246, 247, 251, 0));
  --glass: rgba(255, 255, 255, 0.94);
  --chip-track: #eceff6;
  --seg-active-bg: #ffffff;
  --seg-active-text: var(--text);
  --hero-bg:
    radial-gradient(120% 140% at 100% 0%, rgba(16, 185, 129, 0.10), transparent 55%),
    linear-gradient(135deg, #eef0ff 0%, #f5f3ff 55%, #f7f8ff 100%);
  --hero-border: #dde1fb;
  --hm-0: #eceff5;
  --hm-1: #c7d2fe;
  --hm-2: #a5b4fc;
  --hm-3: #6366f1;
  --hm-4: #4338ca;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px rgba(16, 24, 40, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121c2a;
  --bg-glow: rgba(99, 102, 241, 0.2);
  --side-bg: rgba(10, 16, 24, 0.55);
  --surface: #1a2738;
  --surface-2: #213146;
  --surface-3: #2b3d55;
  --card-bg: rgba(26, 39, 56, 0.78);
  --card-border: rgba(46, 74, 110, 0.6);
  --card-hover-border: rgba(129, 140, 248, 0.6);
  --border: #2e4a6e;
  --text: #f7f8fa;
  --text-muted: #b8c0cc;
  --text-faint: #6b7f99;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-bright: #a5b4fc;
  --accent-soft: rgba(99, 102, 241, 0.2);
  --accent-glow: rgba(99, 102, 241, 0.32);
  --primary-bg: #4f46e5;
  --primary-bg-hover: #4338ca;
  --primary-bg-2: #7c3aed;
  --on-primary: #ffffff;
  --success: #66bb6a;
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.16);
  --warn-fill: #f59e0b;
  --error: #ef5350;
  --recording: #f87171; /* U1: ≥4.5:1 on dark --bg (was #e53935, 4.05:1) */
  --flame: #fb923c;
  --flame-soft: rgba(251, 146, 60, 0.16);
  --sky: #7dd3fc;
  --sky-soft: rgba(56, 189, 248, 0.16);
  --green-soft: rgba(102, 187, 106, 0.16);
  --topbar-bg: linear-gradient(180deg, rgba(18, 28, 42, 0.98), rgba(18, 28, 42, 0.98) 80%, rgba(18, 28, 42, 0));
  --glass: rgba(26, 39, 56, 0.92);
  --chip-track: rgba(10, 16, 24, 0.55);
  --seg-active-bg: var(--accent);
  --seg-active-text: #ffffff;
  --hero-bg:
    radial-gradient(120% 140% at 100% 0%, rgba(16, 185, 129, 0.16), transparent 55%),
    linear-gradient(135deg, rgba(79, 70, 229, 0.34) 0%, rgba(26, 39, 56, 0.92) 60%);
  --hero-border: rgba(129, 140, 248, 0.32);
  --hm-0: rgba(255, 255, 255, 0.06);
  --hm-1: rgba(99, 102, 241, 0.35);
  --hm-2: rgba(99, 102, 241, 0.6);
  --hm-3: #6366f1;
  --hm-4: #a5b4fc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

:root {
  --radius: 16px;
  --page-max: 720px;
  --home-max: 1120px;
  --side-w: 256px;
  --tab-h: 72px;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --touch-min: 44px;
  --motion: 200ms ease;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

*, *::before, *::after { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.speaking-app.page {
  max-width: var(--page-max);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
}
.speaking-app.page.is-shell { max-width: none; }

:where(.speaking-app) :where(button, textarea) {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

/* ---------- Shell: sidebar (desktop) + main + bottom tabs (mobile) ---------- */

.speaking-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.side-nav { display: none; }

.speaking-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom, 0px));
}

.main-inner {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.main-inner.is-home { max-width: var(--home-max); }

.speaking-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.85rem 1rem 0.65rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--topbar-bg);
}

.speaking-topbar-leading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.speaking-topbar h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  min-height: var(--touch-min);
  border: 0;
  background: transparent;
  color: var(--accent-bright);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.25rem 0.15rem;
  cursor: pointer;
}
.topbar-back-icon { font-size: 1.05rem; line-height: 1; }
.topbar-back:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 8px; }

.speaking-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quota-chip {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-bright);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
}

.icon-btn {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border: 1px solid var(--card-border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--motion);
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.speaking-content {
  flex: 1;
  padding: 0 1rem 1.25rem;
}
.speaking-content.is-home { container-type: inline-size; }

/* Sidebar */
.side-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem 1.5rem;
}
.side-brand img { border-radius: 12px; flex-shrink: 0; }
.side-brand strong { display: block; font-size: 1.08rem; font-weight: 750; letter-spacing: -0.02em; }
.side-brand span { display: block; font-size: 0.75rem; color: var(--text-muted); }

.side-links { display: flex; flex-direction: column; gap: 0.25rem; }
.side-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--touch-min);
  padding: 0.6rem 0.75rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.is-active { background: var(--accent-soft); color: var(--accent-bright); }
.side-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}
.tab-pill { position: relative; }
.nav-badge-tab {
  position: absolute;
  top: -0.2rem;
  right: -0.15rem;
  margin: 0;
  min-width: 0.9rem;
  padding: 0 0.28rem;
  font-size: 0.62rem;
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.75rem; }
.side-quota {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--card-border);
  font-size: 0.78rem;
}
.side-quota strong { font-size: 0.92rem; }
.side-quota span { color: var(--text-muted); }
.side-quota-row { display: flex; flex-direction: column; }
.side-quota-track {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.side-quota-track > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.side-quota-cta {
  display: block;
  text-align: center;
  padding: 0.55rem;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--on-primary) !important;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
}
.side-quota-cta:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.side-actions { display: flex; gap: 0.5rem; }

.theme-toggle {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--touch-min);
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--motion);
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Bottom tabs (mobile / tablet) */
.bottom-tabs {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--page-max);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--glass);
  border-top: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
  z-index: 10;
}
.tab-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  min-height: var(--tab-h);
  padding: 0.35rem 0.25rem;
}
.tab-pill {
  width: 3rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: background var(--motion);
}
.tab-label {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab-slot:hover { color: var(--text); }
.tab-slot.is-active { color: var(--accent-bright); }
.tab-slot.is-active .tab-pill {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.tab-slot:focus-visible { outline: none; }
.tab-slot:focus-visible .tab-pill { box-shadow: var(--focus-ring); }

@media (min-width: 760px) {
  .bottom-tabs {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: min(460px, calc(100% - 2rem));
    height: var(--tab-h);
    padding-bottom: 0;
    border: 1px solid var(--card-border);
    border-radius: 22px;
    box-shadow: var(--shadow);
  }
  .speaking-main {
    padding-bottom: calc(var(--tab-h) + 40px + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 960px) {
  .side-nav {
    display: flex;
    flex-direction: column;
    width: var(--side-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding: 1.25rem 0.875rem;
    background: var(--side-bg);
    border-right: 1px solid var(--card-border);
  }
  .bottom-tabs,
  .topbar-only,
  .quota-chip { display: none; }
  .speaking-main { padding-bottom: 2rem; }
  .speaking-topbar { padding: 1.25rem 2rem 0.875rem; }
  .speaking-content { padding: 0 2rem 2rem; }
}

/* ---------- Home dashboard ---------- */

.home { display: flex; flex-direction: column; gap: 1rem; }

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.375rem;
  border-radius: 24px;
  background: var(--hero-bg);
  border: 1px solid var(--hero-border);
  animation: speak-rise 320ms ease both;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 0.78rem;
  font-weight: 700;
}
.home-hero h2 {
  margin: 0.8rem 0 0.5rem;
  font-size: clamp(1.45rem, 4.2cqi, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 750;
  text-wrap: balance;
}
.hero-body {
  margin: 0 0 1.25rem;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.hero-cta {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: 100%;
  max-width: 26rem;
  padding: 0.8rem 1rem 0.8rem 0.8rem;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary-bg), var(--primary-bg-2));
  color: var(--on-primary) !important;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 24px var(--accent-glow);
  transition: box-shadow var(--motion), filter var(--motion);
}
.hero-cta:hover { filter: brightness(1.06); box-shadow: 0 14px 30px var(--accent-glow); }
.hero-cta:active { filter: brightness(0.96); }
.hero-cta:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.hero-cta-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}
.hero-cta-copy { display: flex; flex-direction: column; min-width: 0; }
.hero-cta-copy strong { font-size: 1rem; font-weight: 700; }
.hero-cta-copy span { font-size: 0.8rem; opacity: 0.88; }
.hero-cta-arrow { margin-left: auto; display: inline-flex; transition: transform var(--motion); }
.hero-cta:hover .hero-cta-arrow { transform: translateX(3px); }

.hero-full { margin-top: 1rem; }
.hero-alt { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }
.pill-btn {
  min-height: var(--touch-min);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--hero-border);
  background: var(--surface);
  color: var(--accent-bright);
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color var(--motion), background var(--motion);
}
.pill-btn:hover { border-color: var(--accent); }
.pill-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.hero-snapshot {
  padding: 1.125rem 1.125rem 1rem;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}
.snap-title { margin: 0 0 0.5rem; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }
.snap-ring { position: relative; width: 132px; height: 132px; margin: 0 auto 0.875rem; }
.band-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.band-ring-track { fill: none; stroke: var(--surface-3); stroke-width: 10; }
.band-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  animation: ring-in 900ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.snap-ring-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.snap-ring-value strong { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.snap-ring-value span { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }
.snap-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.snap-bars li {
  display: grid;
  grid-template-columns: 6.75rem 1fr 2rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.snap-label { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snap-track,
.focus-track {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.snap-fill,
.focus-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left;
  animation: bar-grow 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.snap-bars li .snap-fill { animation-delay: calc(var(--i, 0) * 70ms + 150ms); }
.snap-value { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
.snap-empty { margin: 0; text-align: center; font-size: 0.85rem; color: var(--text-muted); line-height: 1.45; }
.snap-foot { margin: 0.65rem 0 0; text-align: center; font-size: 0.72rem; color: var(--text-muted); }

.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.stat-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  animation: speak-rise 320ms ease both;
}
.stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-flame .stat-icon { background: var(--flame-soft); color: var(--flame); }
.stat-blue .stat-icon { background: var(--sky-soft); color: var(--sky); }
.stat-green .stat-icon { background: var(--green-soft); color: var(--success); }
.stat-violet .stat-icon { background: var(--accent-soft); color: var(--accent-bright); }
.stat-copy { min-width: 0; }
.stat-copy strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.stat-sub { display: block; font-size: 0.72rem; color: var(--text-muted); opacity: 0.85; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }

.home-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.25rem;
  border-radius: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  animation: speak-rise 340ms ease both;
}
.home-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.home-card-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.015em; }
.home-card-head p { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--text-muted); }
.link-btn {
  min-height: var(--touch-min);
  margin: -0.65rem -0.5rem 0 0;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--accent-bright);
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
}
.link-btn:hover { background: var(--accent-soft); }
.link-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.part-cards { display: flex; flex-direction: column; gap: 0.6rem; }
.part-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: 100%;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--motion), background var(--motion), box-shadow var(--motion);
}
.part-card:hover { border-color: var(--card-hover-border); background: var(--surface); box-shadow: var(--shadow-sm); }
.part-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.part-badge {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
}
.part-card-1 .part-badge { background: linear-gradient(135deg, #6366f1, #4338ca); }
.part-card-2 .part-badge { background: linear-gradient(135deg, #0284c7, #075985); }
.part-card-3 .part-badge { background: linear-gradient(135deg, #059669, #065f46); }
.part-card-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1; }
.part-card-title { font-weight: 700; font-size: 0.95rem; }
.part-card-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; }
.part-card-meta { font-size: 0.75rem; font-weight: 650; color: var(--accent-bright); margin-top: 0.15rem; }
.part-card-arrow { color: var(--text-faint); display: inline-flex; transition: transform var(--motion), color var(--motion); }
.part-card:hover .part-card-arrow { color: var(--accent-bright); transform: translateX(2px); }

.heatmap { display: flex; gap: 0.5rem; max-width: 620px; }
.hm-days {
  display: grid;
  grid-template-rows: 1rem repeat(7, 1fr);
  row-gap: 3px;
  font-size: 0.66rem;
  color: var(--text-muted);
}
.hm-days span { display: flex; align-items: center; line-height: 1; }
.hm-main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-rows: 1rem auto;
  row-gap: 3px;
}
.hm-months {
  display: grid;
  grid-template-columns: repeat(var(--weeks), 1fr);
  column-gap: 3px;
  font-size: 0.66rem;
  color: var(--text-muted);
}
.hm-months span { white-space: nowrap; overflow: visible; line-height: 1rem; }
.hm-grid {
  display: grid;
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
}
.hm-cell { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--hm-0); }
.hm-l1 { background: var(--hm-1); }
.hm-l2 { background: var(--hm-2); }
.hm-l3 { background: var(--hm-3); }
.hm-l4 { background: var(--hm-4); }
.hm-future { background: transparent; }
.hm-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 0.875rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.hm-legend .hm-cell { width: 11px; height: 11px; aspect-ratio: auto; }
.hm-legend span:first-child { margin-right: 2px; }
.hm-legend span:last-child { margin-left: 2px; }

.focus-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.focus-list li {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9.5rem) 1fr 2.25rem;
  align-items: center;
  gap: 0.75rem;
}
.focus-name { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; font-size: 0.88rem; font-weight: 600; }
.focus-badge {
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.65rem;
  font-weight: 750;
}
.focus-track { height: 8px; }
.focus-list li.is-weakest .focus-fill { background: var(--warn-fill); }
.focus-value { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
.focus-tip {
  display: flex;
  gap: 0.6rem;
  margin: 1.1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 0.86rem;
  line-height: 1.5;
}
.focus-tip svg { color: var(--accent-bright); flex-shrink: 0; margin-top: 2px; }

.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.recent-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--card-border);
}
.recent-list li:first-child { border-top: 0; padding-top: 0; }
.recent-band {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, currentColor 12%, transparent);
}
.recent-body { display: flex; flex-direction: column; min-width: 0; }
.recent-q { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.home-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.home-empty svg { color: var(--accent-bright); opacity: 0.7; }
.home-empty p { margin: 0; max-width: 22rem; }

@container (min-width: 640px) {
  .home-hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(250px, 1fr);
    align-items: center;
    padding: 2rem;
  }
  .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (min-width: 820px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Practice / mock / history ---------- */

.part-row {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 1rem;
  background: var(--chip-track);
  border: 1px solid var(--card-border);
  border-radius: 999px;
}
.part-chip {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.45rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-min); /* U1: 44px touch target (was 40px) */
  transition: background var(--motion), color var(--motion);
}
.part-chip:hover { color: var(--text); }
.part-chip.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.part-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.card-list { display: flex; flex-direction: column; gap: 0.5rem; }

.surface-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion);
  animation: speak-rise 280ms ease both;
}
.surface-card:hover { background: var(--surface-2); border-color: var(--card-hover-border); }
.surface-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.surface-card.static { cursor: default; }
.surface-card.static:hover { background: var(--card-bg); border-color: var(--card-border); }

.topic-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.875rem;
}
.topic-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.card-chevron {
  flex-shrink: 0;
  color: var(--text-faint);
  transition: transform var(--motion), color var(--motion);
}
.topic-card:hover .card-chevron { color: var(--accent-bright); transform: translateX(2px); }

.topic-row { display: flex; align-items: center; gap: 0.75rem; }
.topic-index {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.q-index {
  flex-shrink: 0;
  min-width: 2.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}
.q-line { line-height: 1.45; }
.topic-meta { display: block; color: var(--text-muted); font-size: 0.85rem; margin: 0.15rem 0 0; }
.topic-title { display: block; margin: 0; font-weight: 600; color: var(--text); }
.section-title { margin: 0.25rem 0 0.875rem; font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.page-hint { margin: 0 0 0.875rem; line-height: 1.45; }

.step-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0.5rem 0 1rem; }
.step-item { text-align: center; }
.step-track { height: 4px; border-radius: 2px; background: var(--surface-3); margin-bottom: 0.4rem; }
.step-item.is-active .step-track,
.step-item.is-done .step-track { background: var(--accent); }
.step-label { font-size: 0.7rem; color: var(--text-muted); }
.step-item.is-active .step-label { color: var(--accent-bright); font-weight: 650; }

.q-text { margin: 0; font-size: 1.05rem; font-weight: 650; line-height: 1.4; }
.cue-list { margin: 0.65rem 0 0; padding-left: 1.1rem; color: var(--text-muted); font-size: 0.9rem; }

.action-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.85rem 0; }
.action-row .btn { flex: 1 1 9.5rem; justify-content: center; min-height: var(--touch-min); }
.action-row .btn-primary { width: auto; }

.btn {
  min-height: var(--touch-min);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: border-color var(--motion), background var(--motion);
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--on-primary);
  width: 100%;
  justify-content: center;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-bg-hover); border-color: var(--primary-bg-hover); }
.btn-danger { background: var(--recording); border-color: var(--recording); color: #fff; }

.btn-record {
  width: 100%;
  justify-content: flex-start;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  background: linear-gradient(135deg, var(--primary-bg), var(--primary-bg-2));
  border-color: transparent;
  color: var(--on-primary);
  min-height: 3.25rem;
  padding: 0.7rem 1rem;
}
.btn-record.is-recording {
  background: var(--recording);
  animation: speaking-pulse 1.1s ease-in-out infinite;
}
.btn-record-icon {
  display: inline-flex;
  width: 1.5rem;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-record-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; text-align: left; }
.btn-record-copy .mic-hint { margin: 0; font-weight: 500; color: rgba(255, 255, 255, 0.88); }
.mic-hint { color: var(--text-muted); font-size: 0.85rem; margin: 0.15rem 0 0; }
.mic-hint.is-live { color: var(--recording); font-weight: 600; }

/* ---------- Practice question: card → "what next" stage → sticky dock ---------- */

.practice-q { padding: 0.9rem 1rem; }
.practice-q-head { display: flex; align-items: flex-start; gap: 0.75rem; }
.practice-q-meta { flex: 1; min-width: 0; }
.practice-q-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--accent-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.practice-q-title { margin: 0; font-weight: 700; font-size: 0.95rem; }
.practice-q-count { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--text-muted); }
.practice-q-band {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, currentColor 14%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
}
.cue-card { margin-top: 0.85rem; padding-top: 0.15rem; border-top: 1px solid var(--card-border); }
.practice-q-text { margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--card-border); animation: speak-rise 200ms ease both; }

.practice-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 15rem;
  padding: 1.5rem 1rem;
  text-align: center;
  animation: speak-rise 240ms ease both;
}
.stage-title { margin: 0.5rem 0 0; font-size: 1.15rem; font-weight: 650; color: var(--text); line-height: 1.4; }
.stage-sub { margin: 0; max-width: 26rem; font-size: 0.88rem; color: var(--text-muted); line-height: 1.45; }
.stage-em { color: var(--accent-bright); font-weight: 750; }
.practice-stage.is-live .stage-title { color: var(--recording); }
.stage-actions { display: flex; gap: 0.5rem; margin-top: 0.85rem; }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-bright); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); }

.stage-ring { position: relative; width: 4.5rem; height: 4.5rem; display: grid; place-items: center; }
.stage-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.stage-ring circle { fill: none; stroke-width: 5; }
.stage-ring-track { stroke: var(--surface-3); }
.stage-ring-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 100;
  animation: cue-drain 2s linear both;
}
.stage-ring b { font-size: 1.6rem; font-weight: 750; color: var(--accent-bright); font-variant-numeric: tabular-nums; }

.stage-wave { display: inline-flex; align-items: center; gap: 4px; height: 2.75rem; }
.stage-wave i {
  display: block;
  width: 5px;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transform-origin: center;
  animation: wave-bar 900ms ease-in-out infinite;
}
.stage-wave.is-rec i { background: var(--recording); }
.stage-wave i:nth-child(2) { animation-delay: -700ms; }
.stage-wave i:nth-child(3) { animation-delay: -400ms; }
.stage-wave i:nth-child(4) { animation-delay: -200ms; }
.stage-wave i:nth-child(5) { animation-delay: -550ms; }

.practice-dock {
  position: sticky;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1rem -1rem 0;
  padding: 0.75rem 1rem;
  background: var(--glass);
  border-top: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
}
.practice-tools { display: flex; gap: 0.5rem; }
.tool-btn {
  position: relative;
  width: var(--touch-min);
  height: var(--touch-min);
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-bright);
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}
.tool-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.tool-btn.is-on { background: var(--accent); color: #fff; }
.tool-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.tool-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tool-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.record-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 1.4rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--accent-glow);
  transition: filter var(--motion), box-shadow var(--motion);
}
.record-pill:hover { filter: brightness(1.06); }
.record-pill:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.record-pill:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; filter: none; }
.record-pill.is-ready { animation: record-invite 1.8s ease-in-out infinite; }

.stage-spinner {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 4px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: stage-spin 800ms linear infinite;
}
.record-pill.is-recording { background: var(--recording); box-shadow: 0 6px 18px color-mix(in srgb, var(--recording) 35%, transparent); animation: speaking-pulse 1.1s ease-in-out infinite; }

@media (min-width: 760px) {
  .practice-dock { bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom, 0px)); margin: 1rem 0 0; border: 1px solid var(--card-border); border-radius: 18px; box-shadow: var(--shadow); }
}
@media (min-width: 960px) {
  .practice-dock { bottom: 1rem; }
}

.field-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.transcript-input {
  width: 100%;
  min-height: 7rem;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem;
  font: inherit;
  margin-bottom: 0.85rem;
}
.transcript-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }

.error-text { color: var(--error); font-size: 0.9rem; margin: 0.5rem 0; }
.ideas-card ul { margin: 0; padding-left: 1.1rem; color: var(--text-muted); }

.score-card {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: speak-rise 320ms ease both;
}
/* X5: collapsed below the score. <details>/<summary> so the band leads and the transcript is opt-in. */
.score-transcript {
  margin: 1rem 0 0;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
}
.score-transcript summary {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-bright);
  list-style-position: inside;
}
.score-transcript[open] summary { margin-bottom: 0.45rem; }
.ans-diff { line-height: 1.65; font-size: 0.98rem; }
.ans-mark--removed {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.14);
  text-decoration: line-through;
  border-radius: 4px;
  padding: 0.05em 0.18em;
}
.ans-mark--added {
  color: #15803d;
  background: rgba(21, 128, 61, 0.14);
  font-weight: 600;
  border-radius: 4px;
  padding: 0.05em 0.18em;
}
.score-improve {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--card-border, rgba(0,0,0,0.08));
}
.score-improve-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.score-improve-head h3 { margin: 0; font-size: 1rem; }
.score-improve-head strong { font-size: 1.15rem; }
.improve-criteria { margin: 0; }
.score-corrections,
.score-mistakes,
.score-advice,
.score-strengths,
.score-improved-card {
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: var(--surface, #fff);
  border: 1px solid var(--card-border, rgba(0,0,0,0.08));
}
.score-corrections h4,
.score-mistakes h4,
.score-advice h4,
.score-strengths h4,
.score-improved-card h4 {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.score-suggested-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.score-suggested-head h4 {
  margin: 0;
  color: var(--accent-bright);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.score-hear-icon {
  appearance: none;
  border: 0;
  background: color-mix(in srgb, var(--accent, #4f46e5) 16%, transparent);
  color: var(--accent, #4f46e5);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex: none;
}
.score-hear-icon:hover { background: color-mix(in srgb, var(--accent, #4f46e5) 24%, transparent); }
.score-mistakes ul,
.score-advice ul,
.score-strengths ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}
.score-mistakes li,
.score-advice li,
.score-strengths li {
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}
.score-advice,
.score-strengths {
  font-family: inherit;
  font-size: 0.92rem;
}
.score-mistakes .said { color: #dc2626; text-decoration: line-through; }
.score-mistakes .better { color: #15803d; font-weight: 600; }
.score-mistakes small { display: block; color: var(--text-muted); margin-top: 0.15rem; }
.score-advice {
  background: rgba(21, 128, 61, 0.08);
  border-color: rgba(21, 128, 61, 0.22);
}
.score-strengths {
  background: rgba(79, 70, 229, 0.06);
  border-color: rgba(79, 70, 229, 0.18);
}
.score-improved-card {
  border-color: var(--card-border, rgba(0,0,0,0.08));
  border-left: 3px solid var(--accent, #4f46e5);
}
.score-improved-body { margin: 0; }
.score-transcript blockquote {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 14rem;
  overflow-y: auto;
}
/* PowerAI members only (ui/costView.js): matches the shared staff error log look. */
.staff-cost {
  margin: 1rem 0 0;
  padding: 0.55rem 0.7rem;
  border: 1px dashed rgba(245, 158, 11, 0.7);
  border-radius: 0.6rem;
  background: rgba(245, 158, 11, 0.08);
}
.staff-cost-note {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #b45309;
}
.staff-cost-body {
  font: 0.78rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
  word-break: break-word;
  user-select: text;
}
.band-cell .band-max { font-size: 0.7em; font-weight: 600; color: var(--text-faint); margin-left: 1px; }
.score-overall { text-align: center; margin-bottom: 1rem; }
.score-overall .label { color: var(--text-muted); font-size: 0.8rem; }
.score-overall .value {
  font-size: 2.5rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
  animation: score-pop 420ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.band-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; margin-bottom: 0.9rem; }
.band-cell {
  background: var(--surface-2);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.55rem 0.25rem;
  text-align: center;
  animation: speak-rise 280ms ease both;
}
.band-cell .v { font-weight: 700; font-size: 1.05rem; }
.band-cell .l { font-size: 0.65rem; color: var(--text-muted); }
.band-good { color: var(--success); }
.band-ok { color: var(--accent-bright); }
.band-warn { color: var(--warn); }
.band-low { color: var(--error); }

.score-section { margin-top: 0.75rem; }
.score-section h3 { margin: 0 0 0.3rem; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.score-section p, .score-section li { margin: 0; font-size: 0.92rem; }
.score-section ul { margin: 0; padding-left: 1.1rem; }
.tip-text { color: var(--success); }

.empty-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 1.5rem 1.5rem 3rem;
  color: var(--text-muted);
  line-height: 1.45;
  min-height: 40vh;
}
.empty-history .btn { min-width: 12rem; justify-content: center; }

.history-band {
  flex-shrink: 0;
  border-radius: 12px;
  padding: 0.45rem 0.7rem;
  text-align: center;
  border: 1px solid transparent;
}
.history-band .v { font-weight: 750; font-size: 1.1rem; display: block; }
.history-band .l { font-size: 0.65rem; color: var(--text-muted); }

.paywall-card {
  margin: 0.75rem 0;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: linear-gradient(160deg, var(--accent-soft), var(--surface));
}
.paywall-card-title { margin: 0 0 0.35rem; font-size: 1rem; font-weight: 700; color: var(--text); }
.paywall-card-body { margin: 0 0 0.85rem; font-size: 0.9rem; line-height: 1.4; color: var(--text-muted); }
.paywall-card .btn { width: 100%; justify-content: center; text-decoration: none; }

/* ---------- Settings popup (popup-design.mdc: 80% black scrim, × only) ---------- */

.settings-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.settings-panel {
  width: min(28rem, 100%);
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--card-border);
  padding: 0 1rem 1rem;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
  animation: speak-rise 200ms ease both;
}
.popup-header { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.settings-panel h2 { margin: 0; font-size: 17px; font-weight: 600; color: var(--text-muted); }
.popup-close {
  width: var(--touch-min);
  height: var(--touch-min);
  margin-right: -0.5rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.popup-close:hover { color: var(--text); background: var(--surface-2); }
.popup-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-block { width: 100%; justify-content: center; }
.settings-panel .btn { border-color: var(--border); color: var(--text); background: var(--surface); }
.settings-panel .btn:hover { border-color: var(--accent); }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0 1rem;
  font-weight: 600;
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--chip-track);
  border: 1px solid var(--card-border);
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.35rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn.is-active { background: var(--seg-active-bg); color: var(--seg-active-text); box-shadow: var(--shadow-sm); }
.seg-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---------- Motion ---------- */

/* Same-view repaints (render.js `is-repaint`) must not replay entrances; new blocks carry `is-enter`. */
.is-repaint :is(
  .home-hero, .stat-tile, .home-card, .band-ring-fill, .snap-fill, .focus-fill,
  .surface-card, .practice-q-text, .practice-stage, .score-card, .score-overall .value, .band-cell
):not(.is-enter, .is-enter *) {
  animation: none;
}

@keyframes speak-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes score-pop {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes bar-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes ring-in {
  from { stroke-dashoffset: 326.7; }
}
@keyframes stage-spin {
  to { transform: rotate(360deg); }
}
@keyframes cue-drain {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 100; }
}
@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}
@keyframes record-invite {
  0%, 100% { box-shadow: 0 6px 18px var(--accent-glow), 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 6px 18px var(--accent-glow), 0 0 0 8px transparent; }
}
@keyframes speaking-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@media (max-width: 420px) {
  .band-grid { grid-template-columns: repeat(2, 1fr); }
  .snap-bars li { grid-template-columns: 5.75rem 1fr 1.75rem; }
}

/* ---------- Site footer (compact: brand + links, legal line) ---------- */

.bandup-footer {
  margin: var(--space-4) 1rem 0;
  padding: 0.75rem 0 0.5rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.bandup-footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}
.bandup-footer-brand { display: inline-flex; align-items: center; gap: 0.4rem; }
.bandup-footer-brand img { border-radius: 5px; }
.bandup-footer-brand strong { color: var(--text); font-weight: 600; }
.bandup-footer-links { display: flex; flex-wrap: wrap; column-gap: 1rem; }
.bandup-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* UI: WCAG 2.5.5 / 44px minimum tap target (was 32px) */
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: color var(--motion);
}
.bandup-footer-links a:hover { color: var(--accent); }
.bandup-footer-links a:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bandup-footer-legal { margin: 0.15rem 0 0; font-size: 0.75rem; color: var(--text-faint); }

@media (min-width: 960px) {
  .bandup-footer { margin: var(--space-4) 2rem 0; }
}

/* Login screen: footer sits below the centered sign-in card. */
.speaking-app:not(.is-shell) > .bandup-footer {
  width: min(100% - 2rem, var(--home-max));
  margin: 2rem auto 0;
}

/* ---------- Account (sidebar card, top-bar avatar, settings row, account sheet) ---------- */

.account-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
}
.account-avatar--initials.is-guest { background: var(--chip-track); color: var(--text-muted); }

.side-account,
.settings-account {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--motion), background-color var(--motion);
}
.side-account:hover,
.settings-account:hover { border-color: var(--accent); }
.side-account:focus-visible,
.settings-account:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.side-account-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-account-text strong,
.side-account-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account-text strong { font-size: 0.9rem; }
.side-account-text span { font-size: 0.78rem; color: var(--text-muted); }

.plan-chip {
  flex-shrink: 0;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--chip-track);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.plan-chip.is-pro { background: var(--accent-soft); color: var(--accent); }

.topbar-account { padding: 0; overflow: hidden; }

.settings-account { margin-bottom: 0.75rem; }
.settings-account-chevron { font-size: 1.4rem; color: var(--text-faint); line-height: 1; }

.account-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.25rem 0 1rem;
}
.account-hero-text { display: flex; flex-direction: column; min-width: 0; }
.account-hero-text strong { font-size: 1.1rem; color: var(--text); overflow-wrap: anywhere; }
.account-hero-text span { color: var(--text-muted); font-size: 0.9rem; overflow-wrap: anywhere; }

.account-details {
  margin: 0 0 1rem;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
}
.account-details > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--touch-min);
  padding: 0.55rem 0.85rem;
}
.account-details > div + div { border-top: 1px solid var(--card-border); }
.account-details dt { color: var(--text-muted); font-size: 0.88rem; }
.account-details dd { margin: 0; display: flex; align-items: center; gap: 0.5rem; color: var(--text); font-weight: 600; text-align: right; }
.account-row-note { font-weight: 500; font-size: 0.82rem; color: var(--text-muted); }

.account-panel .guest-signin-prompt { margin-bottom: 0.75rem; }
.account-panel .guest-signin-copy { margin: 0 0 0.75rem; color: var(--text-muted); font-size: 0.9rem; }
.account-panel .login-actions--inline { display: flex; flex-direction: column; gap: 0.5rem; }
.account-status { margin: 0 0 0.75rem; color: var(--text-muted); font-size: 0.88rem; }
.account-error { margin: 0 0 0.75rem; color: var(--error); font-size: 0.88rem; }

/* ---------- Loading: shimmer placeholders + static boot skeleton (index.html) ---------- */

.sk {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.3s ease-in-out infinite;
}
@keyframes sk-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}

.topic-card.is-skeleton { pointer-events: none; }
.topic-card.is-skeleton .topic-body { display: flex; flex-direction: column; gap: 0.4rem; }

.app-skeleton { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-skeleton .sk { display: block; }
.sk-side { display: none; }
.sk-main {
  flex: 1;
  min-width: 0;
  max-width: var(--home-max);
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sk-title { width: 55%; max-width: 280px; height: 1.6rem; margin: 0.4rem 0 0.25rem; }
.sk-hero { height: 260px; border-radius: 24px; }
.sk-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.sk-tile { height: 76px; border-radius: var(--radius); }
.sk-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.sk-card { height: 220px; border-radius: 20px; }
@media (min-width: 760px) {
  .sk-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .sk-side {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: var(--side-w);
    flex-shrink: 0;
    padding: 1.25rem 0.875rem;
    background: var(--side-bg);
    border-right: 1px solid var(--card-border);
  }
  .sk-brand { height: 40px; margin-bottom: 1rem; }
  .sk-link { height: 40px; border-radius: 12px; }
  .sk-main { padding: 1.25rem 2rem 2rem; }
}

/* PRD-07: mic check, live level bar, noise note, examiner voice */
.mic-panel { max-width: 28rem; animation: none; } /* no pop-in: the sheet is re-rendered on every step */
.mic-panel .action-row { flex-direction: column; }
.mic-panel .action-row .btn { flex: none; width: 100%; white-space: nowrap; }
.mic-intro, .mic-status { margin: 0.5rem 0 1rem; color: var(--text-muted); }
.mic-status.is-prompt { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.mic-meter { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 0.75rem 0; }
.mic-meter-fill { --level: 0; height: 100%; width: calc(var(--level) * 100%); background: var(--success); border-radius: inherit; transition: width 60ms linear; }
@media (prefers-reduced-motion: reduce) { .mic-meter-fill { transition: none; } }
.mic-verdict { font-weight: 600; margin: 0.5rem 0 1rem; }
.mic-verdict.is-good { color: var(--success); }
.mic-verdict.is-too_quiet, .mic-verdict.is-too_noisy { color: var(--warn); }
.mic-verdict.is-no_sound { color: var(--error); }
.mic-audio { width: 100%; margin-bottom: 0.75rem; }
.mic-select {
  width: 100%;
  min-height: var(--touch-min);
  margin-bottom: 0.75rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.mic-help-title { font-size: 1.05rem; margin: 0.25rem 0 0.5rem; }
.mic-slow-hint { margin-top: 0.75rem; padding: 0.75rem; border-radius: 10px; background: var(--surface-2); line-height: 1.5; }
.mic-slow-hint p { margin: 0 0 0.5rem; }
.mic-steps { padding-left: 1.25rem; margin: 0.5rem 0 1rem; line-height: 1.6; }
.note-noise { margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 0.9rem; }
.voice-settings { padding-bottom: 1rem; }
.voice-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.voice-label { font-weight: 500; color: var(--text-muted); }
.mic-step { margin: 0.25rem 0 0; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; color: var(--accent-bright); }
.mic-progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 0.75rem 0; }
.mic-progress-fill { height: 100%; background: var(--accent); transform-origin: left; animation: mic-progress var(--dur, 2000ms) linear forwards; }
@keyframes mic-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .mic-progress-fill { animation: none; } }
.mic-countdown { font-size: 3.5rem; font-weight: 700; line-height: 1; text-align: center; margin: 1rem 0 0.5rem; color: var(--accent-bright); min-height: 3.5rem; }
.mic-rec { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; margin-top: 0.75rem; }
.mic-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--recording); animation: mic-blink 1s ease-in-out infinite; }
@keyframes mic-blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .mic-rec-dot { animation: none; } }
.ready-cta { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.ready-cta .btn { justify-content: center; min-height: var(--touch-min); }

/* X6: what a mock costs, above the Start button (low-quota warning, or Pro). */
.mock-cost-note { margin: 0; font-size: 0.85rem; color: var(--text-muted); text-align: center; }
.mock-cost-note.is-warn { color: var(--warn); font-weight: 600; }

/* X3: focused test screen. Large tabular-nums countdown, recording badge, full-width finish. */
.mock-progress { text-align: center; }
.mock-question { text-align: center; }
.mock-rec-badge { justify-content: center; color: var(--recording); margin-top: 1rem; }
.mock-timer {
  font-variant-numeric: tabular-nums;
  font-size: 2.6rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0.6rem 0 1rem;
  color: var(--text);
}
.mock-timer.is-urgent { color: var(--recording); }
.mock-finish-btn { width: 100%; justify-content: center; min-height: 48px; }

/* X3 focus mode: hide the footer and tab bar during a running mock so the question + timer lead. */
.is-mock-live .bottom-tabs,
.is-mock-live .site-footer,
.is-mock-live .bandup-footer { display: none; }

/* X1: "End this mock?" confirm. */
.confirm-panel { max-width: 22rem; }
.confirm-body { margin: 0.25rem 0 0; color: var(--text-muted); line-height: 1.5; }

.mic-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.mic-row-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-bright); }
.mic-row-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; gap: 0.1rem; }
.mic-row-text strong { font-size: 0.95rem; }
.mic-row-status { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text-muted); }
.mic-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mic-row-status.is-good .mic-dot { color: var(--success); }
.mic-row-status.is-warn .mic-dot { color: var(--warn); }
.mic-row-status.is-bad .mic-dot { color: var(--error); }
.btn-quiet {
  flex: none;
  min-height: var(--touch-min);
  padding: 0 0.75rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--accent-bright);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-quiet:hover { background: var(--accent-soft); }
.btn-quiet:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* `.speaking-app button { color: inherit }` outranks single-class button colours: restore them */
.speaking-app .btn-primary { color: var(--on-primary); }
.speaking-app .btn-quiet { color: var(--accent-bright); }
/* `.settings-panel .btn` gives every popup button a white background: primary buttons keep the accent */
.settings-panel .btn-primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--on-primary); }
.settings-panel .btn-primary:hover:not(:disabled) { background: var(--primary-bg-hover); border-color: var(--primary-bg-hover); }
.mic-row--card { margin: 0 0 0.75rem; padding: 0.6rem 0.75rem; border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card-bg); }

/* PRD-11 — Pronunciation issues panel (web, P0). */
/* Hallmark · component: pronunciation-panel · matched to .score-card system
 * states: default · hover · focus · active · disabled · playing
 */
.pron-panel {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: speak-rise 320ms ease both;
}
.pron-head { margin: 0 0 0.75rem; }
.pron-eyebrow {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent-bright);
}

/* idle entry button */
.pron-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.1rem; font: inherit; font-weight: 650;
  color: #fff; background: var(--accent); border: 0; border-radius: 999px;
  cursor: pointer; transition: background 140ms ease, transform 120ms ease;
}
.pron-btn:hover { background: var(--accent-bright); }
.pron-btn:active { transform: translateY(1px); }
.pron-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pron-btn[disabled] { opacity: 0.6; cursor: default; }
.pron-hint { margin: 0.5rem 0 0; color: var(--text-muted); font-size: 0.9rem; }
.pron-left { display: inline-block; margin-top: 0.4rem; color: var(--text-faint); font-size: 0.8rem; }

/* counts + colour key */
.pron-counts { margin: 0 0 0.5rem; font-weight: 700; font-size: 0.95rem; }
.pron-key { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.9rem; font-size: 0.72rem; }
.pron-key .pron-word { padding: 0.1rem 0.4rem; border-radius: 6px; }

/* marked transcript — surface-2 block, like the answer transcript */
.pron-transcript {
  margin: 0; padding: 0.85rem 1rem; line-height: 2;
  border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--accent);
}
.pron-word { padding: 0 1px; border-radius: 4px; }
.pron-word[data-action] { cursor: pointer; }
.pron-word[data-action]:hover { background: var(--accent-soft); }
.pron-serious { color: var(--error); font-weight: 700; text-decoration: underline; }
.pron-minor { color: var(--flame); }
.pron-minor .pron-bad { text-decoration: underline; font-weight: 700; }
.pron-small { color: var(--text-muted); border-bottom: 1px dotted currentColor; }
.pron-word.pron-playing { background: var(--accent-soft); }

/* green "right way" box */
.pron-right {
  display: inline-block; margin: 0 0.25rem; padding: 0.05rem 0.5rem;
  border-radius: 6px; background: var(--green-soft); color: var(--success); font-weight: 600;
}
.pron-right b { font-weight: 800; }

/* recording player */
.pron-player { display: flex; align-items: center; gap: 0.6rem; margin: 0.9rem 0; }
.pron-play {
  flex: none; width: 2.5rem; height: 2.5rem; border-radius: 999px; border: 0;
  background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer;
  transition: background 140ms ease;
}
.pron-play:hover { background: var(--accent-bright); }
.pron-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pron-prog { flex: 1; height: 6px; border-radius: 999px; background: var(--chip-track); overflow: hidden; }
.pron-prog-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
.pron-clock { flex: none; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 0.85rem; }

/* sounds to work on */
.pron-sounds { margin-top: 1rem; }
.pron-sounds h4 { margin: 0 0 0.4rem; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.pron-sound {
  display: inline-block; margin: 0 0.4rem 0.4rem 0; padding: 0.15rem 0.6rem;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--card-border); font-weight: 600;
}

/* messages (clean / empty / error) */
.pron-msg { margin: 0; color: var(--text-muted); }
.pron-msg.pron-ok { color: var(--success); font-weight: 650; }

/* word card — nested surface-2 block */
.pron-card {
  position: relative; margin-top: 0.9rem; padding: 0.9rem 1rem;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--card-border);
  animation: speak-rise 240ms ease both;
}
.pron-card-close {
  position: absolute; top: 0.4rem; right: 0.6rem; border: 0; background: none;
  font-size: 1.3rem; line-height: 1; color: var(--text-muted); cursor: pointer;
}
.pron-card-close:hover { color: var(--text); }
.pron-card-word { margin: 0 0 0.3rem; font-size: 1.05rem; font-weight: 700; }
.pron-card-explain { margin: 0 0 0.75rem; color: var(--text-muted); font-size: 0.92rem; }
.pron-card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pron-card-btn {
  padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer;
  transition: background 140ms ease;
}
.pron-card-btn:hover { background: var(--accent-soft); }
.pron-card-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* W-PI-01 / W-PI-04 — two columns on desktop, stacked on phone */
.score-layout { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1rem; }

/* Pronunciation now lives INSIDE the score card, below the band grid: it spreads downward
   in the same card when opened, instead of a separate side column. */
.score-pron { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--card-border); }
.score-card .pron-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  animation: none;
}

/* Narrative (strengths / improvements / improved answer / tip) as balanced cards below,
   so the long text uses the full width instead of being squeezed into the summary column. */
.score-detail { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) {
  .score-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-detail .score-section--wide { grid-column: 1 / -1; }
}
.score-detail .score-section {
  margin: 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.score-detail .score-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.score-detail .score-section p,
.score-detail .score-section li { line-height: 1.55; }
.score-detail .score-section--tip {
  background: color-mix(in srgb, var(--success) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

/* F1: question-bank load failure — recoverable error card instead of an endless skeleton. */
.bank-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  margin: 1.5rem auto;
  max-width: 28rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.bank-error-title { font-weight: 600; color: var(--text); margin: 0; }
.bank-error-body { color: var(--text-muted); margin: 0; }
.bank-error .btn { margin-top: 0.5rem; }

.ft-run {
  width: 100%;
  max-width: 40rem;
  display: grid;
  gap: 1rem;
}
.ft-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.ft-head .ft-topic { margin: 0.2rem 0 0; }
.ft-question .q-text { font-size: 1.35rem; line-height: 1.45; }
.ft-live { display: grid; gap: 0.45rem; }
.ft-badge {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.ft-flash {
  margin: 0 0 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
}
.ft-leave-btn {
  justify-self: center;
  min-height: var(--touch-min);
  padding: 0 1rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ft-leave-btn:hover { color: var(--text); background: var(--surface-2); }
.ft-leave-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.speaking-app .ft-run [data-full-next]:disabled {
  opacity: 1;
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text-muted);
  filter: none;
  cursor: not-allowed;
}
/* W-FT-06: on wide screens, question on the left, recorder + timer on the right. */
@media (min-width: 960px) {
  .ft-run {
    max-width: 60rem;
    grid-template-columns: 1fr 22rem;
    align-items: start;
    column-gap: 1.5rem;
  }
  .ft-run > .ft-head { grid-column: 1 / -1; }
  .ft-run > .ft-question,
  .ft-run > label[for="full-notes"],
  .ft-run > .full-notes { grid-column: 1; }
  .ft-run > .ft-live,
  .ft-run > [data-full-next],
  .ft-run > .ft-leave-btn { grid-column: 2; align-self: start; }
}
/* FT-01: Full test entry card in the Mock tab. */
.ft-mock-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.ft-mock-card strong { color: var(--accent-bright); }
.full-notes {
  width: 100%;
  min-height: 7rem;
  margin-top: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.ft-papers { display: grid; gap: 0.6rem; margin: 0 0 1rem; }
.ft-paper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.85rem 1rem;
  text-align: left;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.ft-paper span { color: var(--text-muted); font-size: 0.82rem; }
.ft-paper.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ft-paper:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ft-brief .section-title { margin-top: 0; }
.ft-duration { margin: 0.35rem 0; font-weight: 700; }
.ft-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.ft-topic { margin: 0.2rem 0 0.75rem; color: var(--text-muted); }
.ft-say { margin: 0.85rem 0 0.25rem; font-size: 0.82rem; font-weight: 700; color: var(--text-muted); }
.ft-card-note { margin: 0.75rem 0 0; color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }
.ft-leave { padding: 1.25rem 1.25rem 1.15rem; }
.ft-leave h2 { margin: 0 0 0.65rem; font-size: 1.25rem; font-weight: 750; color: var(--text); letter-spacing: -0.02em; }
.ft-leave-body { margin: 0 0 1.25rem; color: var(--text); font-size: 1rem; line-height: 1.5; }
.ft-leave-actions { display: flex; flex-direction: column; gap: 0.75rem; }
.ft-leave-actions .btn { width: 100%; min-height: var(--touch-min); justify-content: center; }
.ft-clock {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.ft-heard { margin: 0 0 0.4rem; text-align: center; font-weight: 650; }
.ft-heard-on { display: none; color: var(--success, #1b8a4a); }
.ft-heard-wait { color: var(--text-muted); }
.ft-heard.is-hot .ft-heard-wait { display: none; }
.ft-heard.is-hot .ft-heard-on { display: inline; }
.ft-overall { display: flex; gap: 1rem; align-items: flex-start; }
.ft-overall-band { margin: 0; font-size: 2.6rem; font-weight: 750; line-height: 1; }
.ft-criteria { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.25rem; }
.ft-criteria li { display: flex; justify-content: space-between; gap: 1rem; }
.ft-parts { display: grid; gap: 0.7rem; margin: 1rem 0; }
.ft-part { border: 1px solid var(--card-border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.ft-part-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.9rem 1rem;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.ft-part-toggle strong { font-size: 1.35rem; }
.ft-part-tip { color: var(--text-muted); font-size: 0.88rem; line-height: 1.4; }
.ft-part-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ft-part-body { padding: 0 1rem 1rem; }
.ft-tip { margin: 0.6rem 0; line-height: 1.5; }
.ft-points { margin: 0.4rem 0; padding-left: 1.1rem; line-height: 1.45; }
.ft-answers { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.ft-answer { padding-top: 0.75rem; border-top: 1px solid var(--card-border); }
.ft-answer-q { margin: 0.2rem 0; font-weight: 650; line-height: 1.4; }
.ft-answer-said, .ft-model { margin: 0.35rem 0; line-height: 1.5; }
.ft-answer-said span, .ft-model span { display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); }
@media (min-width: 960px) {
  .ft-papers { grid-template-columns: 1fr 1fr; }
}
.review-page { display: grid; gap: 1rem; max-width: 40rem; padding-bottom: 0.5rem; }
.review-page textarea {
  width: 100%;
  min-height: 5.5rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}
.review-page textarea:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.review-subnav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--chip-track);
}
.review-subnav-btn {
  flex: 1;
  min-height: var(--touch-min);
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.5rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}
.review-subnav-btn.is-active {
  color: var(--accent-bright);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}
.review-subnav-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.review-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.review-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 4.5rem;
  padding: 0.75rem 0.65rem;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}
.review-stat-n { font-size: 1.45rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; }
.review-stat-l { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.review-stat.is-due { border-color: color-mix(in srgb, var(--accent) 35%, var(--card-border)); background: var(--accent-soft); }
.review-stat.is-due .review-stat-n { color: var(--accent-bright); }
.review-stat.is-learned .review-stat-n { color: var(--success); }
.review-top {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: var(--surface-2);
  font-weight: 650;
}
.review-empty {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px dashed var(--card-border);
  background: var(--surface);
  color: var(--text-muted);
  line-height: 1.5;
}
.review-empty p { margin: 0; }
.review-hub-cta { display: grid; gap: 0.4rem; }
.review-start { width: 100%; justify-content: center; min-height: 3rem; }
.review-start-sub { margin: 0; text-align: center; font-size: 0.82rem; color: var(--text-muted); }
.review-home-title { margin: 0; font-weight: 700; }
.review-session-head { display: grid; gap: 0.45rem; }
.review-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.review-progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 180ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .review-progress > span { transition: none; }
}
.review-card {
  display: grid;
  gap: 0.55rem;
  padding: 1.15rem 1.2rem;
  border-radius: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}
.review-card .label { margin: 0.35rem 0 0; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.02em; text-transform: uppercase; }
.review-card .label:first-child { margin-top: 0; }
.review-card .field-label { margin-top: 0.5rem; }
.review-dock {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.review-dock .record-pill { min-height: 3rem; }
.review-check { flex: 1 1 8rem; justify-content: center; min-height: 3rem; }
.review-grades {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.review-grade { justify-content: center; min-height: 3rem; }
.review-tts { justify-content: center; width: fit-content; }
.review-done { gap: 0.75rem; }
.review-done h2 { margin: 0.35rem 0 0; font-size: 1.55rem; letter-spacing: -0.03em; }
.review-done-sub { margin: 0 0 0.5rem; color: var(--text-muted); line-height: 1.5; }
.review-notice-pro { color: inherit; font-weight: 700; text-decoration: underline; }
.review-banner {
  margin: 0;
  padding: 0.15rem 0.25rem 0.15rem 0.85rem;
  border-radius: 14px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
}
.review-banner .link-btn { font: inherit; color: inherit; margin: 0; }
.review-chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 0.75rem;
  font-weight: 700;
}
.review-home-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; }
.review-said { margin: 0; font-size: 1.2rem; font-weight: 650; line-height: 1.4; letter-spacing: -0.02em; }
.review-better { margin: 0; font-size: 1.15rem; font-weight: 650; line-height: 1.4; }
.review-why, .review-meaning { margin: 0; line-height: 1.5; }
.review-phrase { margin: 0; font-size: 1.45rem; letter-spacing: -0.03em; }
.review-example { margin: 0; }
@media (max-width: 959px) {
  .review-page.is-session { padding-bottom: 0.25rem; }
}

/* ===== PRD-12 Study Groups UI ===== */
.groups-view { max-width: 680px; margin: 0 auto; padding: 4px 0 40px; touch-action: manipulation; }
.groups-view .groups-sub { color: var(--text-muted); margin: 4px 0; font-size: 14px; }
.groups-view h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 0 0 10px; }

/* Onboarding / create */
.groups-onboard { text-align: center; padding: 20px 16px 8px; }
.groups-onboard-icon { font-size: 40px; line-height: 1; }
.groups-onboard h2 { font-size: 24px; margin: 10px 0 4px; }
.groups-beta { display: inline-block; background: var(--accent-soft); color: var(--accent-bright); border-radius: 999px; padding: 5px 14px; font-weight: 700; font-size: 13px; margin-top: 8px; }
.groups-create { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); margin: 14px 0; }
.groups-create label, .groups-form label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 0; }
.groups-create input, .groups-create select, .groups-form input, .groups-form select, .groups-confirm select, .groups-code-form input { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px; font: inherit; background: var(--surface); color: var(--text); }
.groups-emoji-picker { border: 0; padding: 0; margin: 12px 0 0; }
.groups-emoji-picker legend { font-weight: 600; font-size: 14px; padding: 0; }
.groups-emoji-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.groups-emoji-opt { min-height: var(--touch-min); min-width: var(--touch-min); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 22px; cursor: pointer; }
.groups-emoji-opt.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.groups-emoji-opt:focus-visible, .groups-tab:focus-visible, .groups-pill:focus-visible, .groups-face:focus-visible, .groups-react:focus-visible, .groups-tutor-row:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.groups-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.groups-confirm > p, .groups-confirm > label { flex-basis: 100%; margin: 0; }
.groups-confirm .groups-leave { margin-top: 0; }
.groups-share-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.groups-goals { margin: 4px 0 0; font-size: 12.5px; color: rgba(255,255,255,.92); }
.groups-create input:focus, .groups-form input:focus, .groups-create select:focus, .groups-form select:focus, .groups-confirm select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.groups-study-days { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; border: 0; padding: 0; }
.groups-study-days legend { font-weight: 600; font-size: 14px; margin: 0 0 4px; }
.groups-study-days label { display: flex; align-items: center; gap: 6px; margin: 0; min-height: var(--touch-min); font-weight: 500; }
.groups-study-days input { width: auto; margin: 0; padding: 0; }
.groups-price-note { font-size: 12px; color: var(--text-faint); margin: 8px 0 0; }
.groups-consent { display: flex !important; align-items: flex-start; gap: 9px; font-weight: 500 !important; font-size: 13px; margin: 14px 0 !important; color: var(--text-muted); }
.groups-consent input { width: auto !important; margin: 2px 0 0 !important; accent-color: var(--accent); }
.groups-cta { width: 100%; margin-top: 4px; }
.groups-err { color: var(--error); font-size: 13px; margin: 8px 0; }
.groups-disclose { border: 1px solid var(--card-border); border-radius: 12px; margin: 10px 0; background: var(--card-bg); overflow: hidden; }
.groups-notif-body { padding: 0 16px 14px; }
.groups-notif-body .groups-list { margin: 8px 0 0; }
.groups-disclose > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; list-style: none; color: var(--text); }
.groups-disclose > summary::-webkit-details-marker { display: none; }
.groups-disclose > summary::after { content: "▸"; float: right; color: var(--text-faint); transition: transform .2s; }
.groups-disclose[open] > summary::after { transform: rotate(90deg); }
.groups-disclose[open] > summary { border-bottom: 1px solid var(--card-border); }
.groups-join, .groups-disclose .groups-form { padding: 14px 16px; }
.groups-preview-card { margin-top: 12px; background: var(--surface-2); border-radius: 16px; padding: 16px; text-align: center; }
.groups-preview-emoji { margin: 0; font-size: 36px; line-height: 1; }
.groups-preview-faces { display: flex; justify-content: center; gap: 8px; margin: 12px 0; }
.groups-preview-face { min-width: var(--touch-min); min-height: var(--touch-min); border-radius: 50%; background: var(--accent-soft); color: var(--accent-bright); display: inline-grid; place-items: center; font-weight: 700; }

/* Hero */
.groups-hero { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2, #7c3aed) 100%); color: #fff; border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.groups-hero-top { display: flex; align-items: center; gap: 14px; }
.groups-emoji { width: 52px; height: 52px; border-radius: 15px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 28px; flex: none; }
.groups-hero-id h2 { margin: 0; font-size: 22px; color: #fff; }
.groups-beta-chip { margin: 3px 0 0; font-size: 12.5px; color: rgba(255,255,255,.85); font-weight: 600; }
.groups-note { margin: 14px 0 0; background: rgba(255,255,255,.16); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: 14px; display: flex; gap: 8px; }
.groups-faces { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.groups-face-count { margin-left: 2px; font-weight: 700; font-size: 14px; color: var(--text-muted); }
.groups-face { min-width: var(--touch-min); min-height: var(--touch-min); border-radius: 50%; background: var(--accent-soft); color: var(--accent-bright); display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
button.groups-face { border: 2px solid transparent; padding: 0; cursor: pointer; font: inherit; }
button.groups-face:hover { border-color: var(--accent); }
.groups-hero .groups-face { background: rgba(255,255,255,.18); color: #fff; }
.groups-hero .groups-face-count { color: rgba(255,255,255,.9); }
.groups-streak-days { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 12px 0 0; padding: 0; }
.groups-streak-day { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; background: rgba(255,255,255,.16); }
.groups-streak-day.is-shield { background: rgba(255,255,255,.28); }
.groups-share-result { margin-top: 12px; display: grid; gap: 8px; }
.groups-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-top: 18px; }
.groups-stat { background: var(--surface-2); color: var(--text); border-radius: 14px; padding: 12px; text-align: center; }
.groups-stat-num { display: block; font-size: 22px; font-weight: 800; }
.groups-stat-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.groups-hero .groups-stat { background: rgba(255,255,255,.14); color: #fff; }
.groups-hero .groups-stat-label { color: rgba(255,255,255,.92); }
.groups-stat-action { display: grid; place-items: center; }
.groups-shield { background: rgba(255,255,255,.9) !important; color: var(--accent) !important; border: none !important; }

/* Tabs */
.groups-tabs { display: flex; gap: 6px; margin: 16px 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.groups-tabs::-webkit-scrollbar { display: none; }
.groups-tab { flex: none; border: none; background: transparent; color: var(--text-muted); font: inherit; font-weight: 600; font-size: 14px; min-height: var(--touch-min); padding: 10px 16px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.groups-tab:hover { background: var(--surface-2); }
.groups-tab.is-active { background: var(--primary-bg, var(--accent)); color: #fff; }
.groups-panel { display: none; }
.groups-panel.is-active { display: block; animation: groups-fade .22s ease; }
@keyframes groups-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Sections / cards */
.groups-section { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.groups-list, .groups-activity, .groups-feed, .groups-members, .groups-rank, .groups-comments { list-style: none; margin: 0; padding: 0; }
.groups-empty-row { color: var(--text-faint); font-size: 14px; padding: 6px 0; }

/* Challenge */
.groups-challenge-active { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.groups-chip { background: var(--accent-soft); color: var(--accent-bright); border-radius: 999px; padding: 4px 11px; font-weight: 700; font-size: 12.5px; white-space: nowrap; }

/* Progress / leaderboard */
.groups-viewtoggle { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 12px; }
.groups-pill { border: none; background: transparent; color: var(--text-muted); font: inherit; font-weight: 600; font-size: 13px; min-height: var(--touch-min); padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.groups-pill.is-active { background: var(--card-bg); color: var(--text); box-shadow: var(--shadow-sm); }
.groups-rank li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--card-border); }
.groups-rank li:last-child { border-bottom: none; }
.groups-rank-n { width: 20px; text-align: center; font-weight: 700; color: var(--text-faint); }
.groups-rank-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.groups-activity li { display: flex; align-items: center; gap: 9px; padding: 6px 0; color: var(--text-muted); font-size: 14px; }
.groups-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--flame, #ea580c); flex: none; }

/* Members */
.groups-member { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--card-border); }
.groups-member:last-child { border-bottom: none; }
.groups-member-id { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.groups-member-id strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.groups-member-id small { color: var(--text-faint); font-size: 12px; }
.groups-member-actions { display: flex; gap: 6px; flex: none; }
.groups-leave { margin-top: 16px; }
.btn-danger { background: var(--error); color: #fff; border: none; }

/* Invite */
.groups-invite { text-align: center; }
.groups-code { font-size: 30px; font-weight: 800; letter-spacing: .12em; background: var(--surface-2); border-radius: 14px; padding: 16px; margin: 8px 0; color: var(--accent); }
.groups-link { display: block; word-break: break-all; color: var(--accent); font-weight: 600; margin: 8px 0 14px; text-decoration: none; }
.groups-link:hover { text-decoration: underline; }
.groups-share-hint { font-size: 12px; color: var(--text-faint); margin: 8px 0; }
.groups-ok { color: var(--success); font-weight: 600; font-size: 14px; }
.groups-qr { margin: 16px auto 0; max-width: 168px; }
.groups-qr figcaption { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.groups-qr svg { width: 168px; height: 168px; display: block; margin: 0 auto; background: #fff; border-radius: 12px; padding: 8px; box-sizing: border-box; }

/* Feed */
.groups-post { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.groups-post-text { margin: 0 0 8px; font-size: 14.5px; }
.groups-scores { font-size: 13px; color: var(--text-muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.groups-reacts { display: flex; gap: 8px; margin: 10px 0; }
.groups-react { border: 1px solid var(--card-border); background: var(--surface); border-radius: 999px; min-height: var(--touch-min); padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.groups-react:hover { border-color: var(--accent); }
.groups-post-author { color: var(--text-faint); font-size: 12px; }
.groups-comments li { font-size: 13.5px; color: var(--text-muted); padding: 4px 0 4px 12px; border-left: 2px solid var(--card-border); margin: 4px 0; }
.groups-comment-form { display: flex; gap: 8px; margin-top: 10px; }
.groups-comment-form input { flex: 1; width: auto; min-width: 0; margin: 0; min-height: var(--touch-min); padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.groups-notif { width: 100%; text-align: left; min-height: var(--touch-min); border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 8px 0; }

.groups-skeleton { height: 120px; border-radius: 20px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: groups-shimmer 1.3s infinite; }
@keyframes groups-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .groups-panel.is-active, .groups-skeleton { animation: none; } }

/* Challenge progress (SG-13), recap (SG-14), desktop two-column (W-SG-01) */
.groups-progbar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.groups-progbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2, #7c3aed)); border-radius: 999px; transition: width .3s ease; }
.groups-recap { border-color: var(--accent); }
.groups-recap-total { font-size: 15px; margin: 2px 0 8px; }
.groups-recap p { margin: 4px 0; }
@media (min-width: 900px) {
  .groups-view.groups-app { max-width: 860px; }
}

.groups-badges{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}
.groups-badge{font-size:12px;font-weight:600;padding:3px 8px;border-radius:999px;background:rgba(255,120,40,.14);color:#c2410c}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .groups-badge{background:rgba(255,120,40,.22);color:#fdba74}}

.groups-tutor-list{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.groups-tutor-row{display:flex;align-items:center;gap:10px;width:100%;padding:10px;border:1px solid var(--card-border);border-radius:12px;cursor:pointer;min-height:var(--touch-min);background:var(--surface);color:inherit;font:inherit;text-align:left}
.groups-tutor-row.is-selected{outline:2px solid var(--accent);outline-offset:0;border-color:var(--accent)}
.groups-tutor-row .groups-member-id{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
.groups-trend{display:inline-flex;align-items:flex-end;gap:2px;height:24px;width:56px}
.groups-trend i{flex:1;min-height:2px;background:currentColor;opacity:.55;border-radius:1px}

.groups-faces .groups-face:not(.is-done){opacity:.45}
.groups-toggles{display:grid;gap:6px;margin:10px 0}
.groups-toggle{display:flex;align-items:center;gap:8px;min-height:32px;font-size:14px}
.groups-qotd-text{font-weight:600;margin:6px 0 10px}
.groups-qotd-answer{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.groups-qotd-answer .groups-member-id{flex:1 1 100%;min-width:0}
.groups-tutor-band{min-width:44px;text-align:right;font-variant-numeric:tabular-nums}
.groups-tutor-pts{min-width:36px;text-align:right}
@media (min-width: 900px) {
  .groups-panels.is-home{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:16px;align-items:start}
  .groups-panels.is-home [data-tab-panel="feed"]{display:block;grid-column:1;grid-row:1}
  .groups-panels.is-home [data-tab-panel="home"]{grid-column:2;grid-row:1;column-count:1}
}
.groups-home-rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.groups-home-rail .groups-faces,
.groups-home-rail .groups-stats { margin: 0; }
.groups-home-rail .groups-streak-day { background: var(--surface-2); }
.groups-demo-pay { margin: 0 0 12px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 12px; }
.groups-cta { cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .groups-tab, .groups-pill, .groups-react, .groups-emoji-opt { transition: none; }
}

/* Groups dark-theme contrast (UI review): faint/error text and accent chips stay >= 4.5:1, and the badge also
   works when the app theme is dark but the OS is light (the media query above only covers an OS dark mode). */
:root[data-theme="dark"] .groups-view { --text-faint: #93a5be; }
:root[data-theme="dark"] .groups-err { color: #f87171; }
:root[data-theme="dark"] .groups-badge { background: rgba(255,120,40,.22); color: #fdba74; }
.groups-nudged { opacity: .75; cursor: default; }
