/* Shared visual layer for the redesigned school and learner cabinet. */
:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f1f6fa;
  --surface-3: #e8eef5;
  --line: #e1e7ee;
  --text: #252936;
  --text-soft: #687286;
  --primary: #873ca0;
  --primary-strong: #713187;
  --primary-soft: #f2e8f6;
  --cyan: #388caf;
  --cyan-soft: #edf7fc;
  --coral: #d05a57;
  --coral-soft: #fbedec;
  --amber: #a66b00;
  --amber-soft: #fff2d7;
  --shadow: 0 12px 30px rgba(44, 58, 84, .07);
  --shadow-soft: 0 4px 16px rgba(44, 58, 84, .05);
}

html { letter-spacing: 0; }
body { background: var(--bg); color: var(--text); }
.sidebar, .topbar { background: var(--surface); }
.sidebar { border-color: var(--line); }
.topbar { height: 72px; padding: 0 30px; border-bottom-color: var(--line); backdrop-filter: none; }
.page-content { max-width: 1480px; padding: 28px 30px 100px; }
.page-head { margin-bottom: 24px; }
.page-head h2 { font-size: 26px; font-weight: 650; }
.page-head p { line-height: 1.6; }
.page-kicker { font-size: 10px; letter-spacing: 0; }
.brand { font-size: 17px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; }
.nav-btn { border-radius: 8px; font-weight: 600; }
.nav-btn.active { background: var(--primary-soft); color: var(--primary); box-shadow: inset 3px 0 var(--primary); }
.btn { border-radius: 8px; font-weight: 600; }
.panel, .stat-card, .course-card, .studio-course { border-radius: 8px; }
.stat-card, .course-card, .studio-course { box-shadow: var(--shadow-soft); }
.course-cover { aspect-ratio: 16 / 9; }
.course-cover.empty { display: grid; place-items: center; min-height: 120px; background: var(--cyan-soft); }
.course-cover.empty svg { width: 48px; height: 48px; color: var(--cyan); }
.course-body { padding: 22px; }
.course-body h3 { line-height: 1.4; }
.course-actions { border-top: 0; padding-top: 8px; }
.courses-grid .course-card { display: flex; flex-direction: column; }
.courses-grid .course-body { display: flex; flex: 1; flex-direction: column; }
.courses-grid .course-actions { margin-top: auto; padding-top: 20px; }
.school-course-band, .course-module-panel { border-radius: 0; background: transparent; box-shadow: none; }
.school-list-row { border-radius: 8px; }
.modal { border-radius: 8px; }
.field input, .field textarea, .field select { line-height: 1.5; }
.assistant-mini { display: none; }
.support-launcher {
  right: 22px;
  bottom: 20px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
html.learning-mode .support-launcher { bottom: 88px; }
.assistant-drawer { height: 100dvh; }
.chat-composer { background: var(--surface); }

/* Student navigation follows the compact header in the design reference. */
@media (min-width: 1100px) {
  html[data-role="student"]:not(.embed-mode) .sidebar {
    width: 100%;
    height: 64px;
    position: fixed;
    inset: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 28px;
    border: 0;
    border-bottom: 1px solid var(--line);
    z-index: 30;
  }
  html[data-role="student"]:not(.embed-mode) .sidebar-head {
    height: auto;
    flex: 0 0 auto;
    padding: 0;
    margin-right: 34px;
    border: 0;
  }
  html[data-role="student"]:not(.embed-mode) .nav-list {
    display: flex;
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 0;
    overflow: visible;
  }
  html[data-role="student"]:not(.embed-mode) .nav-btn {
    min-height: 64px;
    padding: 0 12px;
    border-radius: 0;
    border-bottom: 3px solid transparent;
  }
  html[data-role="student"]:not(.embed-mode) .nav-btn.active {
    background: transparent;
    box-shadow: none;
    border-bottom-color: var(--primary);
  }
  html[data-role="student"]:not(.embed-mode) .nav-btn svg,
  html[data-role="student"]:not(.embed-mode) .nav-label { display: none; }
  html[data-role="student"]:not(.embed-mode) .sidebar-bottom {
    flex: 0 0 auto;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
  }
  html[data-role="student"]:not(.embed-mode) .profile-mini { margin: 0; }
  html[data-role="student"]:not(.embed-mode) .profile-copy { display: none; }
  html[data-role="student"]:not(.embed-mode) .main-shell {
    margin-left: 0;
    padding-top: 64px;
  }
  html[data-role="student"]:not(.embed-mode) .topbar {
    position: static;
    max-width: 1320px;
    margin: 0 auto;
    background: transparent;
    border-bottom: 0;
  }
  html[data-role="student"]:not(.embed-mode) .page-content {
    max-width: 1320px;
    padding-top: 12px;
  }
  html.learning-mode[data-role="student"]:not(.embed-mode) .topbar {
    display: none;
  }
  html.learning-mode[data-role="student"]:not(.embed-mode) .main-shell {
    padding-top: 64px;
  }
}

/* One-step lesson player. */
html.learning-mode .main-shell { background-color: var(--bg); }
html.learning-mode .page-content { max-width: 1180px; padding-top: 22px; padding-bottom: 110px; }
.learn-player {
  min-height: calc(100vh - 100px);
  display: grid;
  grid-template-rows: auto auto auto minmax(360px, 1fr) auto;
  gap: 16px;
}
.learn-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}
.learn-heading > div { min-width: 0; }
.learn-heading > div > span {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.learn-heading h1 {
  margin: 4px 0 0;
  font-size: 26px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.learn-heading > .icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}
.learn-player-score { color: var(--primary); font-size: 17px; font-weight: 800; }
.learn-progress { height: 7px; overflow: hidden; border-radius: 8px; background: var(--surface-3); }
.learn-progress span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .2s ease; }
.learn-step-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--text-soft); font-size: 12px; }
.learn-stage { width: min(900px, 100%); margin: 18px auto; align-self: center; }
.learn-stage > h2 { margin: 0 0 22px; font-size: 25px; line-height: 1.35; font-weight: 650; overflow-wrap: anywhere; }
.learn-exercise {
  display: grid;
  gap: 18px;
  min-height: 160px;
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.learn-material {
  display: grid;
  gap: 18px;
  padding: 30px 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  line-height: 1.8;
}
.learn-material > h3, .learn-context h3 { margin: 0 0 12px; font-size: 18px; }
.learn-material audio, .learn-context audio { width: 100%; }
.learn-material .studio-video, .learn-context .studio-video { width: 100%; border-radius: 8px; }
.learn-material .studio-image, .learn-context .studio-image { max-width: 100%; max-height: 420px; margin: 0 auto; }
.learn-context {
  max-height: 420px;
  overflow: auto;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}
.learn-context summary { margin-bottom: 10px; cursor: pointer; color: var(--text-soft); font-weight: 700; }
.learn-player-question { display: grid; gap: 16px; }
.lesson-player-question-number {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
}
.learn-options, .learn-pairs { display: grid; gap: 10px; padding: 0; border: 0; margin: 0; }
.learn-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.learn-option:hover, .learn-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.learn-option input { accent-color: var(--primary); }
.learn-answer { display: grid; gap: 8px; color: var(--text-soft); font-size: 13px; font-weight: 700; }
.learn-answer input, .learn-slot {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.learn-passage {
  padding: 20px;
  border-radius: 8px;
  background: var(--cyan-soft);
  font-size: 17px;
  line-height: 2.2;
  overflow-wrap: anywhere;
}
.learn-slot { display: inline-block; width: auto; min-width: 140px; min-height: 38px; padding: 5px 9px; vertical-align: middle; }
.learn-pair { display: grid; grid-template-columns: minmax(0,1fr) minmax(150px,.8fr); gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.learn-token-bank, .learn-order-answer { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; min-height: 48px; }
.learn-order-answer { padding: 13px; border: 1px dashed #b9c5d6; border-radius: 8px; background: #f8fbfd; }
.learn-token { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 0; border-radius: 20px; background: #e7dcf0; color: #4f3560; font: inherit; cursor: pointer; box-shadow: 0 3px 8px rgba(68,47,89,.12); }
.learn-token svg { width: 15px; }
.learn-feedback { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 8px; font-weight: 700; }
.learn-feedback.correct { color: #187b64; background: #e3f5ee; }
.learn-feedback.incorrect { color: var(--amber); background: var(--amber-soft); }
.learn-feedback small { display: block; margin-top: 3px; color: var(--text-soft); font-weight: 500; }
.learn-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
}
.learn-footer small { flex: 1; color: var(--text-soft); text-align: center; }
.learn-player-actions { display: flex; gap: 9px; }
.learn-footer .btn.primary { min-width: 170px; }
.learn-summary { padding: 30px 0; text-align: center; }
.learn-summary > svg { width: 48px; height: 48px; color: var(--primary); }
.learn-summary h2 { margin: 16px 0 8px; }
.learn-summary .school-list-row { width: 100%; margin-top: 8px; text-align: left; }
.learn-summary > .btn { margin-top: 18px; }
.learn-outline { display: grid; gap: 7px; max-height: 65vh; overflow: auto; }
.learn-outline .school-list-row { width: 100%; text-align: left; }
.learn-outline .school-list-row span { min-width: 0; display: grid; gap: 3px; }
.learn-outline small { color: var(--text-soft); overflow-wrap: anywhere; }

/* Exercise editor controls. */
.exercise-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; }
.exercise-type-row { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.exercise-type-row .field { flex: 1; }
.exercise-keys { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.exercise-keys label { display: flex; align-items: center; gap: 10px; }
.exercise-pair-keys { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1099px) {
  html[data-role="student"]:not(.embed-mode) .main-shell { margin-left: 0; }
  html.learning-mode .support-launcher { bottom: 94px; }
}
@media (max-width: 700px) {
  .topbar { height: 68px; padding: 0 16px; }
  .page-content { padding: 20px 16px 100px; }
  html.learning-mode .page-content { padding: 14px 12px 110px; }
  .learn-player { gap: 11px; min-height: calc(100vh - 88px); }
  .learn-heading { gap: 9px; }
  .learn-heading h1 { font-size: 19px; }
  .learn-heading > .btn { min-width: 40px; padding: 8px; font-size: 0; }
  .learn-heading > .btn svg { margin: 0; }
  .learn-stage { margin: 10px auto; }
  .learn-stage > h2 { font-size: 21px; margin-bottom: 16px; }
  .learn-exercise, .learn-material { padding: 20px 16px; border-radius: 8px; }
  .learn-pair { grid-template-columns: 1fr; }
  .learn-passage { padding: 14px; font-size: 15px; line-height: 2; }
  .learn-slot { min-width: 105px; max-width: 100%; }
  .learn-footer { align-items: stretch; flex-wrap: wrap; gap: 8px; }
  .learn-footer small { order: 3; flex-basis: 100%; }
  .learn-player-actions { margin-left: auto; }
  .learn-footer .btn.primary { min-width: 125px; }
  .exercise-pair-keys { grid-template-columns: 1fr; }
}

[data-theme="dark"] .learn-context,
[data-theme="dark"] .learn-order-answer { background: var(--surface-2); }
[data-theme="dark"] .learn-token { background: var(--primary-soft); color: var(--text); }

/* Vocabulary block */
.learn-vocab-list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.learn-vocab-row { display: grid; grid-template-columns: auto minmax(0,1fr) minmax(0,1fr); align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.learn-vocab-speak { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); color: var(--primary); cursor: pointer; }
.learn-vocab-word { font-weight: 700; overflow-wrap: anywhere; }
.learn-vocab-translation { color: var(--text-soft); overflow-wrap: anywhere; }
@media (max-width: 700px) { .learn-vocab-row { grid-template-columns: auto 1fr; grid-template-rows: auto auto; } .learn-vocab-translation { grid-column: 2; } }

/* Embed block (LearningApps / Wordwall) */
.learn-embed { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.learn-embed > header { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.learn-embed > header > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); flex: none; }
.learn-embed > header > div { flex: 1; min-width: 0; }
.learn-embed-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--surface-2); }
.learn-embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Truefalse */
.learn-truefalse { display: grid; gap: 10px; }
.learn-truefalse-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.learn-truefalse-label { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.learn-truefalse-options { display: flex; gap: 14px; }
.learn-truefalse-option { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.learn-truefalse-option input { accent-color: var(--primary); }

/* Gaps word bank blanks */
.learn-gap-blank { display: inline-flex; align-items: center; justify-content: center; min-width: 90px; min-height: 34px; margin: 0 3px; padding: 4px 10px; border: 1px dashed #b9c5d6; border-radius: 8px; background: #f8fbfd; font: inherit; cursor: pointer; }
.learn-gap-blank.filled { border-style: solid; border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }

/* Order presentations */
.learn-order-letters.learn-order-answer, .learn-token-bank.learn-order-letters { gap: 6px; }
.learn-order-letters .learn-token { min-width: 34px; padding: 8px 10px; justify-content: center; font-size: 16px; font-weight: 700; text-transform: uppercase; }
.learn-order-sentences.learn-order-answer, .learn-token-bank.learn-order-sentences { flex-direction: column; align-items: stretch; }
.learn-order-sentences .learn-token { display: block; width: 100%; text-align: left; white-space: normal; }

/* Recording countdown */
.learn-recording-timer { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; background: var(--surface-2); color: var(--text-soft); font-weight: 700; font-variant-numeric: tabular-nums; }

[data-theme="dark"] .learn-gap-blank { background: var(--surface-2); border-color: var(--line); }
