/* Glass belongs to navigation; reading surfaces stay calm and legible. */
:root {
  --bg: #f1f3f8;
  --bg-strong: #e7edf5;
  --surface: rgba(255,255,255,.82);
  --surface-muted: rgba(243,246,252,.8);
  --ink: #202633;
  --ink-soft: #535f72;
  --ink-faint: #647187;
  --accent: #286be8;
  --accent-strong: #1756c6;
  --accent-soft: rgba(45,111,235,.1);
  --line: rgba(64,87,122,.13);
  --glass-chrome: rgba(247,250,255,.64);
  --glass-edge: rgba(255,255,255,.88);
  --shadow-soft: 0 4px 16px rgba(27,48,88,.045), inset 0 1px 0 var(--glass-edge);
  --shadow: 0 18px 50px rgba(30,49,81,.12);
  --radius: 24px;
  --spring: cubic-bezier(.2,.8,.2,1);
}
:root[data-theme="dark"] {
  --bg: #141823;
  --bg-strong: #1c2333;
  --surface: rgba(33,40,56,.9);
  --surface-muted: rgba(43,51,68,.85);
  --surface-solid: #252d3e;
  --ink: #f1f5ff;
  --ink-soft: #bfcbdf;
  --ink-faint: #a1aec4;
  --accent: #82b1ff;
  --accent-strong: #adcaff;
  --accent-soft: rgba(127,173,255,.15);
  --line: rgba(209,225,255,.13);
  --glass-chrome: rgba(30,38,55,.72);
  --glass-edge: rgba(233,243,255,.17);
  --shadow-soft: 0 5px 18px rgba(0,0,0,.12), inset 0 1px 0 var(--glass-edge);
  --shadow: 0 20px 55px rgba(0,0,0,.25);
}
body {
  background: radial-gradient(ellipse at 10% 5%, rgba(150,182,235,.22), transparent 48%),
    radial-gradient(ellipse at 95% 80%, rgba(161,180,226,.18), transparent 48%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
.ambient { display: none; }
.glass { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
.topbar, .sidebar, .toast {
  background: var(--glass-chrome);
  border-color: var(--glass-edge);
  backdrop-filter: blur(30px) saturate(155%);
  -webkit-backdrop-filter: blur(30px) saturate(155%);
  box-shadow: var(--shadow-soft);
}
.topbar { top: 18px; left: 18px; right: 18px; min-height: 64px; border-radius: 23px; padding-inline: 19px; }
.brand-mark { border-radius: 12px; background: linear-gradient(150deg,#65b5fa,#3471e9 65%,#797df4); box-shadow: inset 0 1px 1px #ffffff9c, 0 4px 10px #2569d32b; }
.brand-mark svg { width: 23px; height: 23px; }
.brand small { font-size: .68rem; }
.app-shell { max-width: 1600px; gap: 24px; padding: 108px 30px 40px 18px; }
.sidebar { top: 100px; bottom: 18px; width: 208px; padding: 18px 10px 12px; border-radius: 25px; }
.sidebar-label { margin: 3px 13px 12px; font-size: 11px; font-weight: 650; color: var(--ink-faint); letter-spacing: .07em; }
.nav-list { gap: 6px; }
.nav-item { min-height: 45px; border-radius: 13px; padding: 10px 13px; font-weight: 560; transition: background .22s, box-shadow .22s, transform .22s var(--spring); }
.nav-item span { color: var(--accent); }
.nav-item svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active { color: var(--ink); background: var(--surface); box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 10px rgba(20,42,80,.08); border-color: var(--glass-edge); }
main { width: calc(100% - 232px); margin-left: 232px; }
.page { animation: crystal-page-in .38s var(--spring) both; }
.page-heading { margin: 18px 0 26px; }
h1 { font-size: clamp(1.8rem,3vw,2.65rem); font-weight: 720; line-height: 1.2; letter-spacing: -.035em; }
.eyebrow { font-size: .65rem; letter-spacing: .12em; }
.hero-heading {
  position: relative; isolation: isolate; overflow: hidden; min-height: 265px;
  padding: 34px 36px; margin-top: 0; border-radius: 30px;
  align-items: flex-start; flex-direction: column; justify-content: center; gap: 22px;
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow-soft);
  background: linear-gradient(115deg,rgba(250,253,255,.95) 5%,rgba(236,244,255,.87) 55%,rgba(213,226,255,.72));
}
.hero-heading::before {
  content: ""; position: absolute; z-index: -1; width: 390px; height: 390px; right: -170px; top: -150px;
  border-radius: 42%; transform: rotate(-32deg);
  background: linear-gradient(145deg,rgba(95,149,236,.1),rgba(134,188,242,.6),rgba(197,175,244,.28));
  box-shadow: -35px 45px 0 12px rgba(148,187,236,.14), -75px 90px 0 22px rgba(171,162,230,.08), inset 3px 3px 2px rgba(255,255,255,.7);
}
:root[data-theme="dark"] .hero-heading { background: linear-gradient(115deg,#222c42 5%,#273956 65%,#3a4870); }
.hero-heading h1 { max-width: 660px; margin-bottom: 13px; }
.hero-heading .lede { max-width: 520px; font-size: .9rem; }
.hero-heading .eyebrow { color: var(--accent-strong); margin-bottom: 17px; }
.hero-heading .primary-button { min-height: 42px; padding-inline: 21px; }
.primary-button { border-radius: 99px; background: linear-gradient(180deg,#3885f8,#2367df); color: #fff; box-shadow: inset 0 1px 0 #ffffff4d,0 4px 10px #2469dd26; }
.primary-button:hover { background: linear-gradient(180deg,#4990ff,#3276ed); box-shadow: inset 0 1px 0 #ffffff4d,0 7px 18px #2469dd36; }
.secondary-button, .icon-button, .event-button { border-radius: 99px; background: var(--surface-muted); box-shadow: inset 0 1px 0 var(--glass-edge); }
.icon-button { width: 37px; height: 37px; }
button, .episode-card, .expression-card { transition: transform .22s var(--spring), box-shadow .22s, background-color .22s, border-color .22s; }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.error-class-grid input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 3px; }
.file-button:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.metric-grid { gap: 13px; margin: 20px 0; }
.metric-card { min-height: 130px; padding: 20px 22px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 30px; height: 4px; border-radius: 8px; top: 0; left: 23px; background: var(--metric-tint, #478bf4); }
.metric-card:nth-child(2) { --metric-tint: #8e83dc; }
.metric-card:nth-child(3) { --metric-tint: #e7a153; }
.metric-card:nth-child(4) { --metric-tint: #3ca99a; }
.metric-card strong { font-size: 2.1rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric-card small { font-size: .72rem; }
.panel { padding: 23px; }
.panel-heading { margin-bottom: 19px; }
.empty-card { border-style: solid; border-color: var(--line); background: var(--surface-muted); color: var(--ink-soft); }
.continue-item { padding: 19px; background: var(--surface-muted); border-radius: 17px; }
.continue-item strong { font-size: 1.07rem; line-height: 1.4; }
.coach-banner { margin-top: 20px; box-shadow: none; background: transparent; border-color: var(--line); }
.coach-banner h2 { font-size: 1rem; }
.coach-banner .eyebrow { display: none; }
.feed-tabs, .segmented { width: fit-content; max-width: 100%; padding: 5px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-muted); gap: 3px; }
.feed-tabs .chip { border: 1px solid transparent; }
.chip.active, .segmented button.active { background: var(--surface-solid); color: var(--accent-strong); border-color: var(--line); box-shadow: 0 2px 7px rgba(15,37,76,.07); }
.episode-card { padding: 22px; min-height: 252px; }
.episode-card h2 { font-size: 1.12rem; line-height: 1.35; }
.episode-card p { -webkit-line-clamp: 3; }
.episode-card:hover { transform: translateY(-3px); }
.episode-bottom { flex-wrap: wrap; }
.text-input, .select-control { border-radius: 12px; }
.learning-layout { grid-template-columns: minmax(0,1.12fr) minmax(300px,.88fr); }
.player-controls { gap: 8px; }
.subtitle-item { border-radius: 12px; padding-block: 11px; }
.subtitle-item.current { box-shadow: inset 3px 0 var(--accent); }
.modal { border-radius: 27px; padding: 27px; }
.modal[open] { animation: crystal-dialog-in .28s var(--spring) both; }
.modal::backdrop { background: rgba(13,22,39,.28); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.toast { border-radius: 20px; padding: 15px 20px; transition: opacity .25s,transform .35s var(--spring); }
.setting-row input[type="checkbox"] { appearance: none; -webkit-appearance: none; position: relative; width: 40px; height: 24px; border-radius: 99px; background: var(--ink-faint); cursor: pointer; flex-shrink: 0; transition: background .2s; }
.setting-row input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0003; transition: transform .23s var(--spring); }
.setting-row input:checked { background: #27824d; }
.setting-row input:checked::after { transform: translateX(16px); }
@keyframes crystal-page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes crystal-dialog-in { from { opacity: 0; transform: translateY(9px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (min-width: 821px) and (max-width: 1150px) {
  .learning-layout { grid-template-columns: 1fr; }
  .player-panel { grid-row: auto; }
  .recording-box { flex-wrap: wrap; }
  .metric-card { padding: 17px; }
}
@media (max-width: 820px) {
  .topbar { top: 10px; left: 12px; right: 12px; }
  .app-shell { padding: 88px 14px 30px; }
  .sidebar { position: static; width: 100%; padding: 7px; border-radius: 20px; margin-bottom: 18px; }
  .sidebar-label { display: none; }
  .nav-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; gap: 3px; }
  .nav-item { min-height: 38px; padding: 8px 13px; white-space: nowrap; flex-shrink: 0; }
  .sidebar-bottom { justify-content: flex-end; }
  .sidebar-bottom .nav-item { min-height: 32px; padding-block: 4px; }
  main { width: 100%; margin: 0; }
  .hero-heading { min-height: 255px; padding: 28px; }
  .learning-layout { grid-template-columns: 1fr; }
  .metric-card { min-height: 125px; }
  .compact-heading .select-control { max-width: 100%; }
}
@media (max-width: 550px) {
  .topbar { padding-inline: 13px; }
  .hero-heading { padding: 26px 23px; border-radius: 25px; }
  .hero-heading h1 { font-size: 1.9rem; }
  .hero-heading .lede { font-size: .85rem; }
  .metric-card { padding: 17px; }
  .metric-card strong { font-size: 1.8rem; }
  .panel { padding: 19px; }
  .player-header, .subtitles-panel .panel-heading { flex-wrap: wrap; }
  .coach-banner { padding: 17px 5px; }
  .coach-banner .coach-icon { display: none; }
  .coach-banner .secondary-button { margin-left: 0; }
  .setting-row { gap: 10px; flex-wrap: wrap; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .sidebar, .toast, .glass { background: var(--surface-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .sidebar, .toast { background: var(--surface-solid); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button:active:not(:disabled), .episode-card:hover, .primary-button:hover { transform: none; }
}
:root[data-reduce-motion="true"] *, :root[data-reduce-motion="true"] *::before, :root[data-reduce-motion="true"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
:root[data-reduce-motion="true"] button:active, :root[data-reduce-motion="true"] .episode-card:hover, :root[data-reduce-motion="true"] .primary-button:hover { transform: none; }
@media (forced-colors: active) { .nav-item.active, .chip.active { outline: 2px solid Highlight; } .setting-row input[type="checkbox"] { appearance: auto; } .setting-row input::after { display: none; } }
