:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-muted: #eef2f7;
  --ink: #101828;
  --ink-soft: #344054;
  --muted: #667085;
  --border: #d9e1ec;
  --border-strong: #b8c5d6;
  --primary: #0b6bcb;
  --primary-hover: #0859ad;
  --primary-soft: #e8f2ff;
  --success: #15803d;
  --success-soft: #e9f8ef;
  --warning: #b45309;
  --warning-soft: #fff4df;
  --danger: #b4233a;
  --danger-soft: #fff0f3;
  --focus: rgba(11, 107, 203, 0.24);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 22px 60px rgba(16, 24, 40, 0.12);
  --radius: 10px;
  --radius-lg: 16px;
  --header-h: 76px;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #0b1018;
  --surface: #111827;
  --surface-subtle: #0f1724;
  --surface-muted: #1e293b;
  --ink: #f8fafc;
  --ink-soft: #d8e0ea;
  --muted: #98a2b3;
  --border: #263244;
  --border-strong: #3c4a60;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-soft: rgba(96, 165, 250, 0.16);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --focus: rgba(96, 165, 250, 0.28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.42);
}

body.theme-soft-light {
  color-scheme: light;
  --bg: #fff7ed;
  --surface: #fffaf3;
  --surface-subtle: #fff3e4;
  --surface-muted: #ffe8cc;
  --ink: #24140a;
  --ink-soft: #5b3820;
  --muted: #8a6042;
  --border: #f0cfa8;
  --border-strong: #dda76e;
  --primary: #c75b12;
  --primary-hover: #9a430c;
  --primary-soft: #ffe1bf;
  --success: #227a3b;
  --success-soft: #eaf8e7;
  --warning: #a34800;
  --warning-soft: #ffe6c7;
  --danger: #b4233a;
  --danger-soft: #fff0f3;
  --focus: rgba(199, 91, 18, 0.24);
  --shadow-sm: 0 1px 2px rgba(120, 63, 20, 0.08);
  --shadow-md: 0 10px 30px rgba(120, 63, 20, 0.1);
  --shadow-lg: 0 22px 60px rgba(120, 63, 20, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(11, 107, 203, 0.06), transparent 320px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.theme-dark {
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.08), transparent 320px),
    var(--bg);
}

body.theme-soft-light {
  background:
    linear-gradient(180deg, rgba(249, 115, 22, 0.12), transparent 340px),
    var(--bg);
}

.welcome-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 54%, var(--bg)), var(--bg));
}

.welcome-gate[hidden] {
  display: none;
}

.lux-welcome {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--primary-soft) 72%, transparent), transparent 45%),
    radial-gradient(circle at 82% 18%, color-mix(in srgb, var(--surface-muted) 55%, transparent), transparent 42%),
    linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 42%, var(--bg)), var(--bg));
}

.lux-welcome[hidden] {
  display: none;
}

.lux-welcome.is-exit {
  animation: lux-fade-out 460ms ease forwards;
}

.lux-welcome-card {
  width: min(560px, 100%);
  min-height: 320px;
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--border-strong) 55%, transparent);
  background:
    linear-gradient(130deg, color-mix(in srgb, var(--surface) 97%, transparent), color-mix(in srgb, var(--surface-subtle) 88%, transparent));
  box-shadow: 0 26px 84px rgba(10, 20, 35, 0.18);
  padding: 36px 34px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
  animation: lux-card-in 820ms cubic-bezier(0.22, 0.7, 0.2, 1) both;
}

.lux-orbit {
  width: 98px;
  height: 98px;
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  position: relative;
  animation: lux-spin 6.8s linear infinite;
}

.lux-orbit::before,
.lux-orbit::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.lux-orbit::before {
  inset: 11px;
  border: 2px solid color-mix(in srgb, var(--primary) 48%, transparent);
}

.lux-orbit::after {
  inset: -4px;
  border: 1px dashed color-mix(in srgb, var(--primary) 24%, transparent);
  animation: lux-spin 10s linear infinite reverse;
}

.lux-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.lux-welcome-card h1 {
  font-size: clamp(30px, 4.2vw, 44px);
  letter-spacing: -0.02em;
}

.lux-welcome-card p {
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 16px;
}

#lux-welcome-enter {
  margin-top: 10px;
  min-width: 190px;
}

.welcome-stage {
  position: relative;
  width: min(1040px, 100%);
  min-height: 600px;
  display: grid;
  place-items: center;
}

.welcome-panel {
  width: min(520px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.welcome-intro {
  display: grid;
  gap: 18px;
}

.welcome-signup {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.98);
}

.welcome-gate.is-signup .welcome-intro {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-18px) scale(0.98);
}

.welcome-gate.is-signup .welcome-signup {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.welcome-gate.is-complete {
  opacity: 0;
  transition: opacity 240ms ease;
}

.welcome-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 900;
}

.welcome-mark {
  width: 44px;
  height: 44px;
}

.welcome-copy {
  color: var(--ink-soft);
  font-size: 17px;
}

.welcome-animation {
  position: relative;
  min-height: 220px;
  margin: 6px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, var(--surface-subtle), var(--surface));
}

.lesson-card {
  position: absolute;
  display: grid;
  gap: 8px;
  width: 180px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: welcome-card-float 2400ms ease-in-out infinite;
}

.lesson-card strong {
  color: var(--ink);
  font-size: 14px;
}

.lesson-card span {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
}

.lesson-card span:last-child {
  width: 62%;
  background: var(--primary-soft);
}

.card-one {
  top: 28px;
  left: 28px;
}

.card-two {
  top: 80px;
  right: 42px;
  animation-delay: 240ms;
}

.card-three {
  bottom: 26px;
  left: 122px;
  animation-delay: 480ms;
}

.welcome-path {
  position: absolute;
  inset: 44px 54px;
  border: 2px solid color-mix(in srgb, var(--primary) 34%, transparent);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 28px;
  animation: welcome-path-pulse 1800ms ease-in-out infinite;
}

.welcome-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.1;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

button:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
  transform: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(0, 1.8fr) minmax(130px, 0.5fr);
  align-items: center;
  gap: 20px;
  max-width: 1280px;
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 12px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  align-content: center;
  gap: 4px;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 11px;
  background: var(--ink);
  box-shadow: var(--shadow-sm);
}

.brand-mark span {
  display: block;
  height: 3px;
  border-radius: 999px;
  background: var(--surface);
}

.brand-mark span:nth-child(2) {
  width: 72%;
  background: var(--primary);
}

.brand-mark span:nth-child(3) {
  width: 46%;
  background: var(--warning);
}

.brand-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}

.tab {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
}

.tab:hover {
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

.tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 34px 28px 72px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 22px;
  animation: panel-in 220ms ease both;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  padding: 8px 0 12px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hero-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 750;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: start;
}

.side-column {
  display: grid;
  gap: 20px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.panel-main,
.panel-small,
.results-panel,
#ai-teach-panel,
.dashboard-layout>.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.panel-header .eyebrow {
  margin-bottom: 5px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.compact-field {
  margin-top: 12px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 13px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  min-height: 44px;
}

select {
  min-height: 44px;
  appearance: none;
}

textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.55;
}

input[type="file"] {
  min-height: 44px;
  padding: 8px;
  color: var(--muted);
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-subtle);
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="file"]:hover,
textarea:hover,
select:hover {
  border-color: var(--border-strong);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus);
  outline: 0;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.inline-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
}

.inline-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.inline-section-header .eyebrow {
  margin-bottom: 5px;
}

.record-controls,
.button-row,
.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#record-preview {
  width: 100%;
  min-height: 38px;
  margin-top: 12px;
}

#record-preview:not([src]) {
  display: none;
}

.action-bar {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.action-bar .btn-primary {
  justify-self: start;
}

.lesson-source-panel {
  display: grid;
  gap: 22px;
}

.embedded-source-form {
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.embedded-source-header {
  margin-bottom: 18px;
}

.embedded-source-header .eyebrow {
  margin-bottom: 5px;
}

.btn-primary {
  background: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink-soft);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
  color: var(--ink);
}

.btn-warning,
#fortnightly-test {
  background: var(--warning);
}

.btn-warning:hover,
#fortnightly-test:hover {
  background: color-mix(in srgb, var(--warning) 86%, black);
}

.btn-danger,
#monthly-test,
#record-stop {
  background: var(--danger);
}

.btn-danger:hover,
#monthly-test:hover,
#record-stop:hover {
  background: color-mix(in srgb, var(--danger) 86%, black);
}

.upload-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.upload-progress progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-muted);
}

.upload-progress progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--surface-muted);
}

.upload-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--primary);
}

.upload-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--primary);
}

.upload-progress.progress-working progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--primary), #7c3aed);
}

.upload-progress.progress-working progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--primary), #7c3aed);
}

.upload-progress.progress-error progress::-webkit-progress-value {
  background: var(--danger);
}

.upload-progress.progress-error progress::-moz-progress-bar {
  background: var(--danger);
}

.upload-progress.progress-done progress::-webkit-progress-value {
  background: var(--success);
}

.upload-progress.progress-done progress::-moz-progress-bar {
  background: var(--success);
}

.status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status:not(:empty) {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  line-height: 1.25;
}

.status.status-working {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
  background: var(--primary-soft);
  color: var(--primary);
}

.status.status-success {
  border-color: color-mix(in srgb, var(--success) 34%, var(--border));
  background: var(--success-soft);
  color: var(--success);
}

.status.status-error {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
}

.step-list li::marker {
  color: var(--primary);
  font-weight: 900;
}

.results-panel:has(.output:empty) {
  display: none;
}

.output {
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

.summary-grid>*:last-child {
  grid-column: 1 / -1;
}

.section,
.card,
.output .card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 16px;
}

.card,
.output .card {
  display: grid;
  gap: 12px;
}

.section h3 {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 16px;
}

.section h4 {
  margin: 14px 0 7px;
  color: var(--ink-soft);
  font-size: 14px;
}

.section p {
  color: var(--ink-soft);
}

.section ul,
.section ol {
  margin: 0;
  padding-left: 21px;
  color: var(--ink-soft);
}

.section li+li {
  margin-top: 7px;
}

.section li::marker {
  color: var(--primary);
}

.sources {
  margin-top: 9px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: 8px;
  background: color-mix(in srgb, var(--warning) 8%, var(--surface));
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.quiz-question {
  display: grid;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.quiz-question+.quiz-question {
  margin-top: 4px;
}

.quiz-question>div:first-child {
  color: var(--ink);
  line-height: 1.45;
}

.quiz-question label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 650;
}

.quiz-question label:hover {
  border-color: var(--border-strong);
}

.quiz-question label:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--ink);
}

.quiz-question input[type="radio"] {
  accent-color: var(--primary);
}

.study-session-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.study-coach-shell {
  display: grid;
  gap: 14px;
}

.study-session-intro {
  display: grid;
  gap: 10px;
}

.study-coach-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.study-coach-card.complete {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.study-coach-card h3 {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.25;
}

.study-coach-topline,
.study-actions,
.study-summary-stats,
.study-plan-list article {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.study-coach-topline {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.study-actions button {
  min-height: 40px;
}

.study-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.study-feedback {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--ink-soft);
}

.study-feedback.is-correct {
  border-left: 4px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.study-feedback.needs-review {
  border-left: 4px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}

.study-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.study-summary-stats.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.study-summary-stats div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.study-summary-stats strong {
  display: block;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.study-summary-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.study-plan-list {
  display: grid;
  gap: 12px;
}

.study-plan-list article {
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.study-plan-list article:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.study-plan-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.study-summary-section ul {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.study-summary-section li {
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.study-summary-section li strong {
  color: var(--ink);
}

.study-summary-section li span {
  color: var(--ink-soft);
  line-height: 1.45;
}

.needs-review li {
  border-left: 4px solid var(--danger);
}

.mastered-review li {
  border-left: 4px solid var(--primary);
}

.lesson-list-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.lesson-list-item+.lesson-list-item {
  margin-top: 10px;
}

.lesson-item-main {
  display: grid;
  gap: 3px;
}

.lesson-item-main strong,
.lesson-list-item strong {
  color: var(--ink);
  font-size: 15px;
}

.lesson-item-main span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: capitalize;
}

.lesson-action-btn {
  min-height: 34px;
  padding: 7px 10px;
  border-color: var(--border);
  background: var(--surface-subtle);
  color: var(--ink-soft);
  box-shadow: none;
  font-size: 12px;
}

.lesson-action-btn:hover {
  border-color: var(--border-strong);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: none;
}

.lesson-action-btn.action-delete {
  border-color: color-mix(in srgb, var(--danger) 36%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.lesson-action-btn.action-delete:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

#ai-teach-panel {
  display: grid;
  gap: 14px;
}

#ai-teach-panel .panel-header {
  margin-bottom: 0;
}

#teach-output {
  display: none;
}

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

.teach-history-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.teach-history-list {
  display: grid;
  gap: 10px;
}

.history-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.teach-history-item {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.teach-history-item:hover,
.teach-history-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.teach-history-item strong {
  font-size: 13px;
}

.teach-history-item span,
.teach-history-item small {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
}

.teach-history-item em {
  color: var(--primary);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.teach-lesson-picker {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 14px;
}

.teach-lesson-picker[hidden] {
  display: none;
}

.teach-picker-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.teach-lessons-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.teach-lesson-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.teach-lesson-item:hover,
.teach-lesson-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.teach-lesson-item strong {
  font-size: 14px;
}

.teach-lesson-item span {
  color: var(--ink-soft);
  font-size: 12px;
}

.teach-room {
  min-height: 620px;
}

.teach-toolbar,
.teach-composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.teach-toolbar {
  align-items: center;
  flex-wrap: wrap;
}

.teach-toolbar .active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.voice-disclosure {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.teach-chat {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 360px;
  max-height: 58vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, transparent), transparent 34%),
    var(--surface-subtle);
  padding: 18px;
}

.teach-message {
  display: flex;
}

.teach-message.student {
  justify-content: flex-end;
}

.teach-bubble {
  width: min(880px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.teach-message.student .teach-bubble {
  max-width: 720px;
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: var(--primary-soft);
}

.teach-bubble>strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  text-transform: uppercase;
}

.immersive-teach {
  display: grid;
  gap: 14px;
}

.teach-blocks {
  display: grid;
  gap: 12px;
}

.teach-block-heading {
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.18;
}

h2.teach-block-heading {
  font-size: 24px;
}

h3.teach-block-heading,
h4.teach-block-heading {
  font-size: 17px;
}

.teach-list-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
  color: var(--ink-soft);
  line-height: 1.55;
}

.teach-list-index,
.teach-list-dot {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.teach-list-dot::before {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.teach-quote {
  margin: 0;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 13px 14px;
}

.teach-quote p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.teach-quote cite {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.teach-source-toggle {
  justify-self: start;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
}

.teach-source-toggle:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.teach-source-panel {
  display: grid;
  gap: 10px;
}

.teach-source-panel[hidden] {
  display: none;
}

.teach-image-block {
  display: grid;
  gap: 8px;
  margin: 0;
}

.teach-image-block img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.teach-image-block figcaption {
  color: var(--ink-soft);
  font-size: 13px;
}

.teach-thinking-bubble {
  max-width: 460px;
}

.thinking-row {
  display: flex;
  gap: 7px;
  align-items: center;
}

.thinking-row span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  animation: teachTyping 1s infinite ease-in-out;
}

.thinking-row span:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-row span:nth-child(3) {
  animation-delay: 0.3s;
}

.thinking-row p {
  margin: 0 0 0 6px;
  color: var(--ink-soft);
  font-size: 14px;
}

@keyframes teachTyping {

  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.teach-explanation {
  display: grid;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.65;
}

.teach-emphasis {
  margin: 4px 0;
  color: var(--ink);
  font-size: 26px;
  font-weight: 900;
  line-height: 1.2;
}

.teach-bubble strong,
.teach-bubble b {
  color: var(--ink);
  font-weight: 900;
}

.teach-bubble mark {
  border-radius: 6px;
  background: color-mix(in srgb, var(--warning) 32%, transparent);
  color: var(--ink);
  padding: 1px 5px;
}

.teach-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.teach-grid section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 13px;
}

.teach-grid h4 {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 13px;
  text-transform: uppercase;
}

.teach-grid ul,
.teach-grid ol {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

.teach-grid li+li {
  margin-top: 7px;
}

.teach-composer .field {
  flex: 1;
}

.teach-composer .btn-primary {
  min-width: 128px;
  min-height: 54px;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.settings-panel {
  padding: 22px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.setting-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink-soft);
  font-weight: 800;
}

.setting-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.settings-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.settings-choice-row .active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.settings-warning {
  margin-bottom: 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border));
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: var(--ink-soft);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

#adhd-stars {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

body.adhd-mode #adhd-stars {
  opacity: 0.72;
}

.star {
  position: absolute;
  border-radius: 999px;
  animation: drift linear infinite;
}

body.adhd-mode {
  --primary: #7dd3fc;
  --primary-hover: #bae6fd;
  --primary-soft: rgba(125, 211, 252, 0.16);
}

body.adhd-mode .brand-mark {
  background: linear-gradient(135deg, #2563eb, #16a34a 52%, #f59e0b);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  from {
    transform: translate(0, 0);
  }

  to {
    transform: translate(20px, -120vh);
  }
}

@keyframes welcome-card-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes welcome-path-pulse {

  0%,
  100% {
    opacity: 0.32;
  }

  50% {
    opacity: 0.9;
  }
}

@keyframes lux-card-in {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    filter: blur(6px);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes lux-spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes lux-fade-out {
  to {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 1080px) {
  .header-inner {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .tabs {
    order: 3;
  }

  .workspace-layout,
  .dashboard-layout,
  .study-session-layout,
  .teach-layout,
  .settings-layout,
  .teach-grid {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .header-inner {
    min-height: auto;
    padding: 12px 16px;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  .app-main {
    padding: 24px 16px 56px;
  }

  .hero-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .hero-stats {
    justify-content: flex-start;
  }

  .field-grid,
  .settings-grid,
  .side-column,
  .summary-grid,
  .study-summary-stats,
  .study-summary-stats.compact {
    grid-template-columns: 1fr;
  }

  .summary-grid>*:last-child {
    grid-column: auto;
  }

  .inline-section-header {
    flex-direction: column;
  }

  .record-controls,
  .button-row,
  .lesson-actions,
  .study-actions,
  .teach-composer {
    flex-direction: column;
    align-items: stretch;
  }

  .record-controls>button,
  .button-row>button,
  .lesson-actions>button,
  .study-actions>button,
  .teach-composer>button,
  .action-bar .btn-primary,
  .panel-small>button,
  #teach-ask-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 30px;
  }

  .panel-main,
  .panel-small,
  .results-panel,
  #ai-teach-panel,
  .dashboard-layout>.panel {
    padding: 18px;
  }

  .brand-subtitle {
    display: none;
  }
}

/* Email verification page */
.verify-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--primary-soft) 80%, transparent), transparent 42%),
    radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--surface-muted) 70%, transparent), transparent 38%),
    linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 42%, var(--bg)), var(--bg));
}

.verify-card {
  width: min(520px, 100%);
  border: 1px solid color-mix(in srgb, var(--border-strong) 58%, transparent);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-lg);
  padding: 34px;
  text-align: center;
  display: grid;
  gap: 16px;
  animation: verify-card-in 420ms ease both;
}

.verify-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--success-soft);
  color: var(--success);
  font-size: 34px;
  font-weight: 900;
}

.verify-icon.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.verify-card h1 {
  max-width: none;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.035em;
}

.verify-card p {
  color: var(--ink-soft);
  font-size: 16px;
}

.verify-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.verify-actions a {
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 800;
}

.verify-primary {
  background: var(--primary);
  color: #fff;
}

.verify-primary:hover {
  background: var(--primary-hover);
}

.verify-secondary {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink-soft);
}

.verify-secondary:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

@keyframes verify-card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}