:root {
  --on-accent: #ffffff;
  --on-strong: #ffffff;
  --canvas: #ffffff;
  --ink: #1a2030;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #edf1f8;
  --border: #d6dbe8;
  --text: #151a25;
  --muted: #5a6376;
  --accent: #3360d4;
  --accent-soft: rgba(51, 96, 212, 0.10);
  --green: #1d8a55;
  --amber: #9a6b12;
  --red: #c3362f;
  --radius: 12px;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
    --on-accent: #1b1206;
    --on-strong: #1b1206;
    --canvas: #16191c;
    --ink: #e9ebee;
    --bg: #121416;
    --surface: #1a1d21;
    --surface-2: #22262b;
    --border: #30353c;
    --text: #e9ebee;
    --muted: #a0a6af;
    --accent: #f2a65a;
    --accent-soft: rgba(242, 166, 90, 0.14);
    --green: #5cc98f;
    --amber: #e8b965;
    --red: #f07b72;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
      --on-accent: #1b1206;
      --on-strong: #1b1206;
      --canvas: #16191c;
      --ink: #e9ebee;
      --bg: #121416;
      --surface: #1a1d21;
      --surface-2: #22262b;
      --border: #30353c;
      --text: #e9ebee;
      --muted: #a0a6af;
      --accent: #f2a65a;
      --accent-soft: rgba(242, 166, 90, 0.14);
      --green: #5cc98f;
      --amber: #e8b965;
      --red: #f07b72;
  }
}

:root, :root[data-bs-theme] {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-body-font-family: "Teachers", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-font-size: 15px;
  --bs-body-line-height: 1.6;
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-color: var(--muted);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-heading-color: inherit;
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: var(--border);
  --bs-border-radius: 10px;
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: var(--radius);
  --bs-border-radius-xl: 16px;
  --bs-border-radius-pill: 999px;
  --bs-primary: var(--accent);
  --bs-success: var(--green);
  --bs-warning: var(--amber);
  --bs-danger: var(--red);
  --bs-code-color: inherit;
  --bs-highlight-bg: var(--accent-soft);
  --bs-highlight-color: inherit;
  --bs-focus-ring-color: var(--accent-soft);
  --bs-form-valid-color: var(--green);
  --bs-form-valid-border-color: var(--green);
  --bs-form-invalid-color: var(--red);
  --bs-form-invalid-border-color: var(--red);
  scroll-behavior: auto;
}

a { color: var(--accent); }
a:hover { color: var(--accent); }
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: inherit; }
h4 { font-size: 1em; }
h5 { font-size: 0.9em; }
h6 { font-size: 0.8em; }
legend { float: none; font-size: inherit; line-height: inherit; margin-bottom: 0; }
dt { font-weight: inherit; }
dd { margin-bottom: 0; }
textarea { resize: both; }

.btn { --bs-btn-font-family: inherit; --bs-btn-font-weight: 600; --bs-btn-font-size: 14px; --bs-btn-border-radius: 10px; --bs-btn-padding-y: 8px; --bs-btn-padding-x: 16px; }
.btn-sm { --bs-btn-font-size: 13px; --bs-btn-padding-y: 5px; --bs-btn-padding-x: 10px; --bs-btn-border-radius: 8px; }
.btn-primary {
  --bs-btn-color: var(--on-accent);
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--on-accent);
  --bs-btn-hover-bg: color-mix(in srgb, var(--accent) 88%, #000);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--accent) 88%, #000);
  --bs-btn-active-color: var(--on-accent);
  --bs-btn-active-bg: color-mix(in srgb, var(--accent) 80%, #000);
  --bs-btn-active-border-color: color-mix(in srgb, var(--accent) 80%, #000);
  --bs-btn-disabled-color: var(--on-accent);
  --bs-btn-disabled-bg: var(--accent);
  --bs-btn-disabled-border-color: var(--accent);
}
.btn-outline-primary, .btn-check + .btn-outline-primary {
  --bs-btn-color: var(--accent);
  --bs-btn-border-color: var(--border);
  --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-soft);
  --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-color: var(--accent);
  --bs-btn-active-bg: var(--accent-soft);
  --bs-btn-active-border-color: var(--accent);
  --bs-btn-disabled-color: var(--muted);
  --bs-btn-disabled-border-color: var(--border);
}
.btn-outline-secondary {
  --bs-btn-color: var(--text);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-color: var(--text);
  --bs-btn-hover-bg: var(--surface-2);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-active-color: var(--text);
  --bs-btn-active-bg: var(--surface-2);
  --bs-btn-active-border-color: var(--border);
}
.btn:focus-visible, .btn-check:focus-visible + .btn { box-shadow: 0 0 0 3px var(--accent-soft); }

.form-control, .form-select { background-color: var(--surface); color: var(--text); border-color: var(--border); border-radius: 10px; }
.form-control::placeholder { color: var(--muted); }
.form-control:focus, .form-select:focus { background-color: var(--surface); color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.form-check-input { background-color: var(--surface); border-color: var(--border); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-range::-webkit-slider-thumb { background-color: var(--accent); }
.form-range::-moz-range-thumb { background-color: var(--accent); }
.form-range::-webkit-slider-runnable-track { background-color: var(--surface-2); }
.form-range::-moz-range-track { background-color: var(--surface-2); }

.progress, .progress-stacked { --bs-progress-bg: var(--surface-2); --bs-progress-bar-bg: var(--accent); --bs-progress-border-radius: 999px; --bs-progress-height: 8px; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--accent-soft); --bs-nav-pills-link-active-color: var(--accent); --bs-nav-pills-border-radius: 8px; }
.nav-link { --bs-nav-link-color: var(--muted); --bs-nav-link-hover-color: var(--text); --bs-nav-link-font-size: 14px; }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-color: var(--text); --bs-dropdown-border-color: var(--border); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-2); --bs-dropdown-link-active-color: var(--accent); --bs-dropdown-link-active-bg: var(--accent-soft); }
.list-group { --bs-list-group-bg: var(--surface); --bs-list-group-color: var(--text); --bs-list-group-border-color: var(--border); --bs-list-group-action-color: var(--text); --bs-list-group-action-hover-color: var(--text); --bs-list-group-action-hover-bg: var(--surface-2); --bs-list-group-active-color: var(--accent); --bs-list-group-active-bg: var(--accent-soft); --bs-list-group-active-border-color: var(--border); }
.text-bg-primary { color: var(--on-accent) !important; background-color: var(--accent) !important; }
.text-primary { color: var(--accent) !important; }
.text-success { color: var(--green) !important; }
.text-warning { color: var(--amber) !important; }
.text-danger { color: var(--red) !important; }
.text-body-secondary { color: var(--muted) !important; }
.bg-body-tertiary { background-color: var(--surface-2) !important; }
.border { border-color: var(--border) !important; }
.bi { line-height: 1; vertical-align: -0.125em; }

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* Waiting on the server: the pressed button spins, and a thin bar runs along the top of the page. */
.is-busy { cursor: progress !important; }
.is-busy:disabled { opacity: 0.85; }
.is-busy::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.45em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spin 0.7s linear infinite;
}
.icon-button.is-busy::before, .plan-refresh.is-busy::before { margin-right: 0; }
.icon-button.is-busy, .plan-refresh.is-busy { font-size: 0; }
.icon-button.is-busy::before, .plan-refresh.is-busy::before { width: 14px; height: 14px; }
body.loading::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 40%, var(--accent) 60%, transparent 100%);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  animation: busy-bar 1.1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@keyframes busy-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) {
  .is-busy::before { animation-duration: 2s; }
  body.loading::after { animation: none; background: var(--accent); opacity: 0.6; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Teachers", system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 34px; }
h2 { font-size: 21px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }

button { font: inherit; cursor: pointer; }
code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

input, select, textarea {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type="range"] { padding: 0; }
input[type="radio"] { width: auto; }
input[type="color"] { width: 44px; padding: 2px; }
textarea { resize: vertical; }

.primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
}
.primary:disabled { opacity: 0.55; cursor: progress; }

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
}
.ghost:hover { background: var(--surface-2); }
.ghost.small { padding: 5px 10px; font-size: 13px; }
.ghost.recording { border-color: var(--red); color: var(--red); }

.card {
  display: block;
  position: static;
  flex-direction: row;
  min-width: auto;
  background: var(--surface);
  color: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ------------------------------------------------------------------ chrome */

.chrome {
  --bs-navbar-padding-x: 0;
  --bs-navbar-padding-y: 12px;
  --bs-navbar-color: var(--muted);
  --bs-navbar-hover-color: var(--text);
  --bs-navbar-active-color: var(--accent);
  --bs-navbar-brand-color: var(--text);
  --bs-navbar-brand-hover-color: var(--text);
  --bs-navbar-brand-padding-y: 0;
  --bs-navbar-brand-margin-end: 22px;
  --bs-navbar-toggler-padding-x: 8px;
  --bs-navbar-toggler-padding-y: 2px;
  --bs-navbar-toggler-border-color: var(--border);
  --bs-navbar-toggler-border-radius: 8px;
  --bs-navbar-toggler-focus-width: 3px;
  --bs-navbar-nav-link-padding-x: 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.chrome-bar { --bs-gutter-x: 48px; flex-wrap: nowrap; }
.chrome-nav { --bs-nav-link-padding-x: 14px; --bs-nav-link-padding-y: 8px; gap: 4px; }
.chrome-nav .nav-link:hover:not(.active) { background: var(--surface-2); }
.chrome-toggler { color: var(--text); font-size: 20px; line-height: 1; box-shadow: none; }
.chrome-toggler:focus { box-shadow: 0 0 0 3px var(--accent-soft); }

.brand { display: flex; align-items: center; gap: 10px; }
.navbar-brand.brand { font-size: inherit; white-space: normal; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand-words { display: grid; line-height: 1.1; }
.brand strong.brand-name { display: block; font-size: 19px; font-weight: 800; letter-spacing: 0.14em; }
.brand-line { color: var(--muted); font-size: 10.5px; letter-spacing: 0.02em; white-space: nowrap; }
.tag { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }

.who { display: flex; align-items: center; gap: 10px; flex: none; }
.who-name { font-size: 13px; color: var(--muted); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-menu { position: relative; }
.user-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
  color: var(--text);
}
.user-menu-button:hover,
.user-menu-button[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
.user-menu-button .caret { font-size: 10px; color: var(--muted); }
.who-initial {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.user-menu-panel {
  --bs-dropdown-min-width: 260px;
  --bs-dropdown-padding-x: 6px;
  --bs-dropdown-padding-y: 6px;
  --bs-dropdown-border-radius: var(--radius);
  --bs-dropdown-box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  --bs-dropdown-item-border-radius: 8px;
  --bs-dropdown-item-padding-x: 10px;
  --bs-dropdown-item-padding-y: 8px;
  --bs-dropdown-font-size: 14px;
  --bs-dropdown-zindex: 20;
  width: 260px;
  box-shadow: var(--bs-dropdown-box-shadow);
}
.user-menu-panel.show { display: grid; gap: 2px; }
.user-menu-panel[data-bs-popper] { margin-top: 6px; }
.user-menu-head { display: grid; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-menu-head strong, .user-menu-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { display: flex; align-items: center; gap: 8px; }
.menu-item .bi { color: var(--muted); }
.menu-section { display: grid; gap: 6px; justify-items: start; padding: 8px 10px 10px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 4px 0; }
/* With Profile hidden (before onboarding) the head's own border already divides them. */
.user-menu-head + .menu-item[hidden] + .menu-section { border-top: none; margin-top: 0; }
.tutor-chip {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 11px;
}

.stage { max-width: 1120px; margin: 0 auto; padding: 26px 24px 64px; }

/* -------------------------------------------------------------------- gate */

.gate {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  min-height: 82vh;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
}
.gate-art h1 { margin-bottom: 16px; }
.gate-art > p { color: var(--muted); font-size: 16px; max-width: 46ch; }
.gate-points { color: var(--muted); padding-left: 18px; margin: 18px 0 0; }
.gate-points li { margin-bottom: 7px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 9px 13px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; }
.form label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.form label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }

/* ------------------------------------------------------------------ wizard */

.wizard { max-width: 720px; margin: 0 auto; }

.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 22px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.step + .step::before { content: ""; width: 18px; height: 1px; background: var(--border); }
.step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 11px;
}
.step.current { color: var(--text); }
.step.current .step-dot { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.step.done .step-dot { background: var(--green); border-color: var(--green); color: var(--on-accent); }

.knowledge-row {
  display: grid;
  grid-template-columns: 1fr 160px 56px auto;
  gap: 12px;
  align-items: center;
}
.knowledge-name { font-weight: 500; }
.knowledge-readout { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.notice { border-radius: 8px; padding: 11px 14px; margin-bottom: 14px; font-size: 14px; }
.notice.warn { background: rgba(229, 181, 103, 0.12); color: var(--amber); }

.rec {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
  background: var(--surface-2);
}
.rec p { margin: 3px 0 0; }
.rec button { margin-top: 8px; }

.stack { display: grid; gap: 10px; }

/* ------------------------------------------------------------------- match */

.match { display: grid; gap: 22px; max-width: 980px; margin: 0 auto; }
.sliders { display: grid; gap: 18px; margin: 18px 0; }
.slider { display: grid; gap: 6px; }
.slider-label { font-size: 14px; }
.slider-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.persona { text-align: center; position: relative; }
.persona.best { border-color: var(--accent); }
.persona-art {
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.persona-art img { width: 100%; height: 100%; object-fit: cover; }
.persona-initial { font-size: 30px; color: var(--accent); }
.badge {
  display: inline-block;
  font-weight: 400;
  line-height: inherit;
  white-space: normal;
  text-align: inherit;
  vertical-align: baseline;
  font-size: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 6px;
}
.badge.good { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.trait-bars { display: grid; gap: 4px; margin: 12px 0 14px; }
.trait-bar { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.trait-fill { height: 100%; background: var(--accent); }

/* -------------------------------------------------------------------- home */

.home { display: grid; gap: 18px; max-width: 1180px; margin: 0 auto; width: 100%; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; align-items: start; }

/* ----------------------------------------------------------------- library */

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.row-gap { display: flex; gap: 8px; margin-top: 12px; }
.search { max-width: 260px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.course h3 { margin-top: 8px; }
.pill {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 10px;
}
.pill.small { font-size: 10px; }
.empty { color: var(--muted); text-align: center; padding: 40px; }

.library-head { flex-wrap: wrap; }
.library-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.library-tools .search { width: 220px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 16px; }
.library-domains { margin-bottom: 18px; min-width: 0; }
.library-domains[hidden] { display: none; }
.library-rows { display: grid; gap: 40px; min-width: 0; }
.library-row { display: grid; gap: 14px; min-width: 0; }
.library-row-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.library-row-title { display: inline-flex; align-items: center; gap: 9px; min-width: 0; margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.library-row-title::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--banner, var(--accent)); }
.library-featured .library-row-title { font-size: 26px; }
.library-featured .library-row-title::before { display: none; }
.library-row-count { color: var(--muted); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.library-row-all { flex: none; margin-left: auto; color: var(--accent); font-weight: 600; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.library-row-all:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.library-tabs { display: flex; gap: 24px; min-width: 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); margin-top: -4px; }
.library-tabs::-webkit-scrollbar { display: none; }
.library-tab { flex: none; position: relative; padding: 6px 2px 12px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.library-tab:hover { color: var(--text); background: none; }
.library-tab.active { color: var(--text); }
.library-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); }
.library-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.library-shelf { min-width: 0; padding-top: 4px; }

.library-rail { position: relative; min-width: 0; container-type: inline-size; }
.library-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 3 * 16px) / 4);
  gap: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 6px 2px 12px;
  margin: -6px -2px -12px;
}
.library-track::-webkit-scrollbar { display: none; }
.library-track > .library-card { scroll-snap-align: start; }
@container (min-width: 1160px) { .library-track { grid-auto-columns: calc((100% - 4 * 16px) / 5); } }
@container (max-width: 880px) { .library-track { grid-auto-columns: calc((100% - 2 * 16px) / 3); } }
@container (max-width: 640px) { .library-track { grid-auto-columns: calc((100% - 16px) / 2); } }
@container (max-width: 440px) { .library-track { grid-auto-columns: 80%; } }
.library-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transform: translateY(-50%);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.library-arrow.prev { left: -12px; }
.library-arrow.next { right: -12px; }
.library-arrow:hover { background: var(--surface-2); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24); }
.library-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.library-arrow[hidden] { display: none; }
@media (hover: none) and (pointer: coarse) { .library-arrow { display: none; } }

.domain-filter { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; min-width: 0; }
.domain-filter::-webkit-scrollbar { display: none; }
.domain-chip { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.875rem; font-weight: 600; white-space: nowrap; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease; }
.domain-chip:hover, .domain-chip:focus-visible { border-color: var(--banner, var(--accent)); }
.domain-chip-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--banner, var(--accent)); }
.domain-chip-count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.domain-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.domain-chip.active .domain-chip-count { color: inherit; }

.library-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.library-card:hover { border-color: color-mix(in srgb, var(--banner, var(--accent)) 50%, var(--border)); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09); transform: translateY(-2px); }
.library-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.library-thumb { position: relative; flex: none; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: color-mix(in srgb, var(--banner, var(--accent)) 24%, var(--surface-2)); }
.library-thumb > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.library-badge { position: absolute; z-index: 2; top: 8px; left: 8px; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; color: #0e3b35; background: #c7f0e8; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.library-badge.updated { color: #3d2a00; background: #ffe08a; }
.library-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 16% 24%, rgba(255, 255, 255, 0.2) 0 13%, transparent 13.5%),
    radial-gradient(circle at 88% 86%, rgba(255, 255, 255, 0.14) 0 24%, transparent 24.5%),
    linear-gradient(135deg, color-mix(in srgb, var(--banner, var(--accent)) 88%, #fff) 0%, color-mix(in srgb, var(--banner, var(--accent)) 72%, #000) 100%);
}
.library-art[data-pattern="1"] {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0 10px, transparent 10px 26px),
    linear-gradient(160deg, color-mix(in srgb, var(--banner, var(--accent)) 90%, #fff) 0%, color-mix(in srgb, var(--banner, var(--accent)) 70%, #000) 100%);
}
.library-art[data-pattern="2"] {
  background:
    radial-gradient(rgba(255, 255, 255, 0.22) 1.5px, transparent 2px) 0 0 / 16px 16px,
    linear-gradient(120deg, color-mix(in srgb, var(--banner, var(--accent)) 76%, #000) 0%, color-mix(in srgb, var(--banner, var(--accent)) 94%, #fff) 100%);
}
.library-art[data-pattern="3"] {
  background:
    conic-gradient(from 210deg at 78% 30%, rgba(255, 255, 255, 0.18) 0 60deg, transparent 60deg),
    radial-gradient(circle at 22% 90%, rgba(255, 255, 255, 0.16) 0 30%, transparent 30.5%),
    linear-gradient(145deg, color-mix(in srgb, var(--banner, var(--accent)) 84%, #fff) 0%, color-mix(in srgb, var(--banner, var(--accent)) 66%, #000) 100%);
}
.library-art-icon { display: grid; place-items: center; width: 34%; aspect-ratio: 1; border-radius: 22%; font-size: 40px; background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 8px 22px rgba(0, 0, 0, 0.16); }
.library-body { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.library-title { margin: 0; font-size: 16.5px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.library-byline { margin: 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.library-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; white-space: nowrap; }
.library-chip.hot { border-color: transparent; color: #0e3b35; background: #c7f0e8; font-weight: 700; }
.library-stars { color: var(--text); font-weight: 600; }
.library-stars .bi { color: var(--amber); font-size: 11px; }
.library-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 10px; }
.library-length { min-width: 0; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-action { flex: none; padding: 6px 14px; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); font-size: 14px; font-weight: 700; transition: background 0.15s ease; }
.library-card:hover .library-action { background: var(--accent-soft); }

.course-hero {
  display: grid;
  gap: 6px;
  padding: 16px 18px 14px;
  background: color-mix(in srgb, var(--banner, var(--accent)) 13%, var(--surface));
  border-top: 5px solid var(--banner, var(--accent));
}
.course-hero-banner { display: block; width: 100%; max-width: 520px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 8px; background: var(--surface-2); }
.library-banner-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.library-domain { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; letter-spacing: 0.02em; color: var(--text); }
.library-domain::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--banner, var(--accent)); }
.library-date { color: var(--muted); white-space: nowrap; }
.library-facts { margin: 0; color: var(--muted); font-size: 13px; }
.library-progress { display: flex; align-items: center; gap: 10px; }
.library-progress-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.library-progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.library-progress-label { color: var(--muted); font-size: 12px; white-space: nowrap; }

.course-page { display: grid; gap: 16px; }
.course-back { justify-self: start; }
.course-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.course-unenrol { color: var(--muted); }
.course-unenrol:hover, .course-unenrol:focus-visible { color: var(--red); border-color: var(--red); }
.course-hero { border-radius: var(--radius); border: 1px solid var(--border); border-top: 6px solid var(--banner, var(--accent)); padding: 20px 22px; gap: 8px; }
.course-title { margin: 0; font-size: 26px; line-height: 1.25; }
.course-description { margin: 0; color: var(--muted); max-width: 70ch; line-height: 1.5; }
.course-progress { max-width: 420px; }
.course-resume { justify-self: start; margin-top: 6px; }
.course-modules { display: grid; gap: 14px; }
.course-module { padding: 14px 16px; }
.course-module-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.course-module-head h3 { margin: 0; font-size: 16px; }
.course-lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.course-lesson {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.course-lesson:hover { border-color: var(--accent); background: var(--accent-soft); }
.course-lesson-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
}
.course-lesson.started .course-lesson-mark { color: var(--on-accent); background: var(--accent); }
.course-lesson.done .course-lesson-mark { color: var(--on-accent); background: var(--green); }
.course-lesson-words { display: grid; gap: 2px; min-width: 0; }
.course-lesson-words strong { font-weight: 600; }
.course-lesson-topics { color: var(--muted); overflow-wrap: anywhere; }
.course-lesson-side { white-space: nowrap; }
.course-opening { text-align: center; padding: 40px; }
.course-branches { list-style: none; margin: 4px 0 2px 52px; padding: 0; display: grid; gap: 2px; }
.course-branches li { display: flex; align-items: baseline; gap: 8px; }
.course-branch, .plan-branch {
  padding: 2px 4px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}
.course-branch:hover, .plan-branch:hover { background: var(--accent-soft); }
.plan-branches { list-style: none; margin: 2px 0 4px 26px; padding: 0; display: grid; gap: 1px; }
.plan-branch { font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 620px) {
  .library-tools { width: 100%; }
  .library-tools .search { flex: 1; width: auto; max-width: none; }
  .course-title { font-size: 21px; }
  .course-lesson { grid-template-columns: auto minmax(0, 1fr); }
  .course-lesson-side { grid-column: 2; }
}

/* ----------------------------------------------------------------- session */

.transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px 4px;
}
.bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}
.bubble p { margin: 0; }
.bubble.learner { justify-self: end; background: var(--accent-soft); color: var(--text); border-bottom-right-radius: 4px; }
.bubble.tutor { justify-self: start; border-bottom-left-radius: 4px; }
.bubble-image { max-width: 100%; border-radius: 8px; margin-bottom: 6px; display: block; }
.bubble-reading { margin: 0 0 6px; }
.bubble-reading summary { font-size: 12px; color: var(--muted); cursor: pointer; }
.bubble-reading p { font-size: 13px; margin-top: 4px; white-space: pre-wrap; }
.bubble-flag {
  display: inline-block;
  font-size: 11px;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 6px;
}

.attachment {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  margin-bottom: 10px;
}
.attachment img { max-height: 90px; border-radius: 6px; }

.composer { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.composer textarea { resize: none; min-height: 58px; max-height: 30vh; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }


.subtopics { padding-left: 20px; margin: 0; color: var(--muted); font-size: 14px; }
.subtopics li { margin-bottom: 6px; }

/* ------------------------------------------------------------------- modal */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 14, 0.76);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 24px;
}
.dialog { width: min(780px, 100%); display: grid; gap: 14px; }
.camera-view { display: block; width: 100%; max-height: min(65vh, 540px); border-radius: 9px; background: #000; object-fit: contain; }
.camera-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#draw-canvas {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--canvas);
  touch-action: none;
  cursor: crosshair;
}

/* -------------------------------------------------------------- assessment */

.assessment { display: grid; gap: 18px; }
.check-row { display: grid; gap: 8px; font-size: 13px; color: var(--muted); margin: 14px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.question { border: 1px solid var(--border); border-radius: 10px; padding: 15px; background: var(--surface-2); }
.q-index { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.q-prompt { margin: 6px 0 10px; }
.question.unanswered { border-color: var(--amber); box-shadow: inset 3px 0 0 var(--amber); }
.choices { display: grid; gap: 7px; margin-top: 10px; }
.choice { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.question .choice {
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.question .choice:hover { border-color: var(--accent); }
.question .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.question .choice input { flex: none; margin: 0; }
.answer-preview img { max-height: 160px; border-radius: 8px; margin-top: 10px; display: block; }
.score { font-size: 44px; font-weight: 600; margin: 4px 0 8px; }
.quiz-points { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.quiz-points > span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-weight: 600; font-variant-numeric: tabular-nums; }
.quiz-points-earned { color: var(--accent); background: var(--accent-soft); }
.quiz-points-earned.down { color: var(--muted); background: var(--surface-2); }
.quiz-points-bonus { color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.question, .flashcard { position: relative; }
.time-up { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 10px; border-radius: inherit; color: var(--red); background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(3px); animation: time-up-in 0.28s ease-out; }
.time-up.final { position: fixed; z-index: 2000; border-radius: 0; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.time-up-icon { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; font-size: 44px; color: var(--red); background: color-mix(in srgb, var(--red) 14%, var(--surface)); box-shadow: 0 0 0 10px color-mix(in srgb, var(--red) 8%, transparent); animation: time-up-shake 0.5s ease-in-out 0.1s; }
.time-up-text { font-size: clamp(26px, 4vw, 40px); letter-spacing: 0.01em; }
.time-up.final .time-up-icon { width: 128px; height: 128px; font-size: 60px; }
.timed-out .flashcard-option, .timed-out .choice, .timed-out textarea, .timed-out input { pointer-events: none; }
@keyframes time-up-in { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: scale(1); } }
@keyframes time-up-shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .time-up, .time-up-icon { animation: none; } }

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}
.history-row:hover { border-color: var(--accent); }
.history-about { display: grid; gap: 2px; min-width: 0; }
.history-about strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-score { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.history-score.passed { color: var(--green); }
.history-score.passed::after { content: "\F633"; font-family: "bootstrap-icons"; margin-left: 4px; vertical-align: -0.125em; }
.history-score.not-yet { color: var(--red); }
.history-score.waiting { color: var(--muted); font-weight: 500; font-size: 13px; }

/* ----------------------------------------------------------------- profile */

.profile { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; max-width: 1080px; margin: 0 auto; width: 100%; }
.profile > *, .profile-panels, .profile-panel { min-width: 0; }
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-avatar { display: grid; place-items: center; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; background: var(--accent-soft); color: var(--accent); font-size: 26px; font-weight: 700; flex: none; cursor: pointer; }
.profile-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.profile-avatar img, .who-initial img { width: 100%; height: 100%; object-fit: cover; display: block; }
.who-initial.has-photo { overflow: hidden; background: var(--surface-2); }
.profile-photo { position: relative; flex: none; }
.profile-avatar-badge { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; border: 2px solid var(--surface); pointer-events: none; }
.profile-avatar-remove { position: absolute; top: -4px; right: -6px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 10px; }
.profile-avatar-remove[hidden] { display: none; }
.profile-avatar-remove:hover, .profile-avatar-remove:focus-visible { color: var(--red); border-color: var(--red); }
.profile-avatar.is-busy { opacity: 0.6; }
.profile-id { display: grid; gap: 2px; min-width: 0; flex: 1 1 200px; }
.profile-id h2 { margin: 0; font-size: 22px; }
.profile-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.profile-name[hidden] { display: none; }
.profile-name h2 { min-width: 0; overflow-wrap: anywhere; }
.profile-name-edit { flex: none; }
.profile-name-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-name-form[hidden] { display: none; }
.profile-name-form input { flex: 1 1 200px; min-width: 0; max-width: 320px; padding: 4px 10px; font-size: 18px; font-weight: 600; }
.profile-name-form button { min-height: 36px; }
.profile-id .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.profile-nav { display: grid; gap: 4px; position: sticky; top: 88px; }
.profile-nav button { text-align: left; padding: 10px 14px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 15px; cursor: pointer; }
.profile-nav button:hover { background: var(--surface-2); color: var(--text); }
.profile-nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.profile-panel[hidden] { display: none; }
.profile-panel > h3, .profile-account .card > h3 { margin: 0 0 6px; }
.profile-account { display: grid; gap: 18px; }
.settings { display: grid; margin: 0; }
.settings-row { display: grid; grid-template-columns: minmax(150px, 240px) minmax(0, 1fr); align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); margin: 0; }
.settings-row:last-of-type { border-bottom: 0; }
.settings-label { color: var(--text); font-size: 14px; font-weight: 500; margin: 0; }
.settings-value { margin: 0; font-size: 14px; color: var(--muted); }
.settings-control { width: 100%; max-width: 360px; min-width: 0; box-sizing: border-box; }
.settings-number { max-width: 140px; }
.settings-row input[type="checkbox"] { justify-self: start; }
.settings-actions { display: flex; justify-content: flex-end; padding-top: 14px; }
@media (max-width: 760px) {
  .profile-body { grid-template-columns: minmax(0, 1fr); }
  .profile-nav { position: static; display: flex; gap: 4px; overflow-x: auto; }
  .profile-nav button { flex: none; }
  .settings-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .settings-control { max-width: none; }
}
.facts { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.curriculum { display: grid; gap: 18px; }

/* ------------------------------------------------------------------ toasts */

.toasts { position: fixed; top: 16px; right: 16px; display: grid; gap: 8px; z-index: 100; }
.notice {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 11px 15px;
  font-size: 14px;
  max-width: 340px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.36);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.notice.good { border-left-color: var(--green); }
.notice.bad { border-left-color: var(--red); }
.notice.info { border-left-color: var(--accent); }
.notice.out { opacity: 0; transform: translateX(14px); }

@media (max-width: 767.98px) {
  .chrome-bar { flex-wrap: wrap; }
  .chrome .navbar-brand { margin-right: auto; }
  .chrome .brand-line { display: none; }
  .chrome-nav { padding: 10px 0 2px; }
  .who-name { display: none; }
}

@media (max-width: 900px) {
  .gate { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; }
  .form-grid { grid-template-columns: 1fr; }
  .knowledge-row { grid-template-columns: 1fr; gap: 6px; }
  .chrome-bar { --bs-gutter-x: 32px; }
  .stage { padding: 18px 16px 48px; }
}

.start-panel { max-width: 560px; margin: 8vh auto 0; }

.mastery-row { display: grid; grid-template-columns: 1fr 120px 46px; gap: 12px; align-items: center; font-size: 13px; }
.mastery-name { color: var(--muted); }
.mastery-value { font-family: var(--mono); font-size: 12px; text-align: right; }


/* ------------------------------------------------------- tutor setup routes */

.match-head { max-width: 62ch; }
.route-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.route-tab {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
}
.route-tab span { font-size: 12px; color: var(--muted); }
.route-tab:hover { border-color: var(--accent); }
.route-tab.active { border-color: var(--accent); background: var(--accent-soft); }
.route-tab.active span { color: var(--text); }

.builder { display: grid; grid-template-columns: minmax(280px, 1fr) 1.2fr; gap: 16px; align-items: start; }
.builder-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.trait-groups { display: grid; gap: 20px; }
.trait-group { display: grid; gap: 10px; }
.trait-group h4 { margin: 0; font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.trait-group > p { margin: -6px 0 2px; }
.trait { display: grid; gap: 4px; }
.trait-head, .dial-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.trait-label { font-size: 14px; }
.trait-level, .dial-level { font-size: 12px; font-weight: 600; color: var(--accent); text-align: right; white-space: nowrap; }
.trait-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-bottom: 10px; }
.chip {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 9px;
}
.row-gap.center { justify-content: center; }

/* ------------------------------------------------------------ delivery mode */

.delivery-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 10px 0 18px; }
.delivery {
  display: grid;
  gap: 4px;
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text);
}
.delivery:hover { border-color: var(--accent); }
.delivery.chosen { border-color: var(--accent); background: var(--accent-soft); }
.delivery-icon { font-size: 20px; }
.delivery-title { font-size: 15px; }
.delivery-blurb { font-size: 12px; color: var(--muted); }

.delivery-switch { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.mode-chip {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
}
.mode-chip:hover { color: var(--text); border-color: var(--accent); }
.mode-chip.chosen { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.primary.wide { width: 100%; }

@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------- route icons */

.route-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--accent);
}
.route-tab.active .route-icon { background: var(--surface); }
.route-tab .route-icon svg { display: block; }

/* ------------------------------------------------------ based on my topic */

.topic-designer { max-width: 720px; }
.topic-form { display: flex; gap: 10px; margin: 14px 0 18px; }
.topic-form input { flex: 1; }
.card.persona.draft { max-width: 420px; margin: 0 auto; }
.draft-why { font-size: 14px; line-height: 1.45; margin: 8px 0; }

/* --------------------------------------------------------- session start */

.session-start { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.session-start .start-panel { max-width: none; margin: 0; }
.resume-panel h2 { margin-top: 0; }
.session-list { display: grid; gap: 8px; margin-top: 12px; }
.session-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.session-item:hover { border-color: var(--accent); }
.session-item.ended, .session-item.archived { opacity: 0.85; }
.session-open {
  display: grid;
  gap: 4px;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  min-width: 0;
}
.session-item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.session-actions { display: grid; gap: 6px; justify-items: stretch; }
.session-confirm { display: grid; gap: 2px; min-width: 0; }
.session-item.confirming { border-color: var(--red); opacity: 1; }
.ghost.danger { color: var(--red); }
.ghost.danger:hover { border-color: var(--red); }
.primary.danger { background: var(--red); border-color: var(--red); color: var(--on-strong); }
.session-item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.session-item-top .badge { margin: 0; }
.session-item-action { font-size: 12px; color: var(--accent); }
.badge.quiet { background: var(--surface-2); color: var(--muted); }

/* a broad topic: why, then narrower ones as a list to start from */
.topic-help { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.topic-help-reason { margin: 0; font-size: 14px; }
.suggestion-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.suggestion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.suggestion-row:hover, .suggestion-row:focus-visible { border-color: var(--accent); }
.suggestion-row:hover .suggestion-go { color: var(--accent); }
.suggestion-words { display: grid; gap: 2px; min-width: 0; }
.suggestion-words .badge { margin-left: 4px; vertical-align: 1px; }
.suggestion-go { flex: none; font-size: 13px; color: var(--muted); }

/* the start button turned Continue: a short pulse so the change is seen */
.start-button.attention { animation: start-attention 1.2s ease-in-out 2; }
@keyframes start-attention {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); transform: none; }
  45% { box-shadow: 0 0 0 7px var(--accent-soft); transform: scale(1.015); }
}
@media (prefers-reduced-motion: reduce) { .start-button.attention { animation: none; outline: 2px solid var(--accent); outline-offset: 2px; } }

/* the Tutoring page: what to learn, and the last three sessions */
.tutoring-home { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.tutoring-home .start-panel { max-width: none; margin: 0; }
.recent-panel h2 { margin: 0; }
.recent-list { display: grid; gap: 10px; margin-top: 12px; }
.recent-card {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}
.recent-card:hover, .recent-card:focus-visible { border-color: var(--accent); }
.recent-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.recent-badges .badge { margin: 0; }
.all-sessions { max-width: 760px; margin: 0 auto; }
.all-sessions-title { display: flex; align-items: center; gap: 10px; }
.all-sessions-title h2 { margin: 0; }

/* three equal ways to give the topic; the one used last time is ready */
.input-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.input-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}
.input-mode:hover { border-color: var(--accent); }
.input-mode.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.input-mode-icon { font-size: 20px; line-height: 1; }
.topic-capture { display: grid; }
.capture-photo { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.capture-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 96px;
  padding: 14px;
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
}
.capture-button:hover, .capture-button.dropping { border-color: var(--accent); color: var(--accent); }
.capture-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); font-size: 26px; }
.capture-voice.recording { border-style: solid; border-color: var(--red); color: var(--red); }
.capture-voice.recording .capture-icon { border-color: var(--red); animation: recording-pulse 1.2s ease-in-out infinite; }
@keyframes recording-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--red) 18%, transparent); } }
@media (prefers-reduced-motion: reduce) { .capture-voice.recording .capture-icon { animation: none; } }
.link { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ---------------------------------------------------------- guided lesson */

.lesson-summary { margin: 0; padding-left: 18px; font-size: 13px; }

.checkpoint { display: grid; gap: 10px; }
.checkpoint fieldset { margin: 0; min-width: 0; display: grid; gap: 6px; }
fieldset.question > legend { float: left; width: 100%; margin: 0 0 4px; padding: 0; }
.checkpoint .q-prompt { padding: 0 4px; line-height: 1.5; }

/* Each option is a whole card to pick; the radio never shrinks, however long the option. */
.checkpoint .choice {
  align-items: center;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.checkpoint .choice:hover { border-color: var(--accent); }
.checkpoint .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.checkpoint .choice input { flex: none; margin: 0; }
.choice-text { min-width: 0; overflow-x: auto; line-height: 1.5; }
.choice-text .katex { font-size: 1.2em; }
.q-prompt .katex { font-size: 1.1em; }
.checkpoint-result { display: grid; gap: 6px; }
.mark { display: grid; gap: 2px; padding: 6px 8px; border-radius: 8px; background: transparent; color: inherit; }
.mark.right { background: color-mix(in srgb, var(--green) 10%, transparent); }
.mark.wrong { background: color-mix(in srgb, var(--red) 10%, transparent); }

/* ----------------------------------------------------------- explain back */

.explain-panel { margin-bottom: 10px; }
.explain-card { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.explain-card h4 { margin: 0; }
.explain-card p { margin: 0; }
.explain-card .row-gap { margin-top: 0; align-items: center; }

.diagnosis {
  justify-self: center;
  width: min(100%, 520px);
  display: grid;
  gap: 4px;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.diagnosis.understood { border-color: var(--green); }
.diagnosis.partly { border-color: var(--amber); }
.diagnosis.notYet { border-color: var(--red); }
.diagnosis ul { margin: 0; padding-left: 18px; font-size: 13px; }
.diagnosis p { margin: 0; }
.diagnosis-heading { color: var(--muted); }

/* ---------------------------------------------------- notes in the transcript */

.transcript-note { justify-self: center; font-size: 12px; color: var(--muted); text-align: center; max-width: 80%; font-style: italic; }
.bubble-label { display: block; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }

.tuning-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.tuning-list li { display: grid; gap: 1px; }

@media (max-width: 900px) {
  .session-start, .tutoring-home { grid-template-columns: minmax(0, 1fr); }
  .input-mode { flex-direction: column; gap: 2px; font-size: 13px; min-height: 60px; }
  .capture-photo .capture-button { flex-direction: column; gap: 8px; font-size: 15px; text-align: center; }
  .topic-form { flex-direction: column; }
}

/* ---------------------------------------------------------------- batch 4 */

#s-topic {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* the tutor at work */
.bubble.thinking { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dots { display: inline-block; flex: none; }
.bubble.thinking .dots {
  width: 26px;
  height: 6px;
  background:
    radial-gradient(circle closest-side, var(--muted) 90%, transparent) 0 50% / 6px 6px no-repeat,
    radial-gradient(circle closest-side, var(--muted) 90%, transparent) 50% 50% / 6px 6px no-repeat,
    radial-gradient(circle closest-side, var(--muted) 90%, transparent) 100% 50% / 6px 6px no-repeat;
  animation: thinking 1.1s infinite ease-in-out;
}
@keyframes thinking {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .bubble.thinking .dots { animation: none; } }
.board { position: relative; }
.board.busy::before { content: ""; position: absolute; z-index: 4; top: 0; left: 0; width: 35%; height: 3px; background: var(--accent); animation: board-busy-run 1.2s ease-in-out infinite; }
@keyframes board-busy-run { from { left: -35%; } to { left: 100%; } }
.board-busy { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 16px 0; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); font-weight: 600; font-size: 14px; }
.board-busy-spin { flex: none; width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: busy-spin 0.8s linear infinite; }
.board-busy-text { min-width: 0; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .board.busy::before { animation: none; left: 0; width: 100%; } .board-busy-spin { animation-duration: 2s; } }
button:disabled { cursor: not-allowed; }

/* listening */
.bubble.tutor { position: relative; }
.player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
}
.player[hidden] { display: none; }
.player-label { flex: 1; min-width: 0; }
.player-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.player-dot.live { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }

/* voices */
.voice-switch { display: flex; align-items: center; gap: 6px; }
.voice-picker { display: flex; align-items: center; gap: 4px; min-width: 0; }
.voice-picker select {
  max-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--text);
  font-size: 13px;
}
.home-voice { display: grid; gap: 4px; margin-top: 12px; }
.voice-row { display: grid; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); }
.voice-row .voice-picker select { max-width: none; flex: 1; padding: 8px 10px; font-size: 14px; }

/* topic */
.topic-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.topic-count.over { color: var(--red); }

/* the lesson plan */
.plan-tree { display: grid; gap: 6px; margin-top: 8px; }
.plan-concept { display: block; font-size: 14px; margin-bottom: 4px; }
.plan-sections, .plan-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.plan-sections { border-left: 2px solid var(--border); padding-left: 10px; gap: 6px; }
.plan-section summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 0;
}
.plan-section.done summary .plan-section-title::after { content: " \2713"; color: var(--green); }
.plan-section .plan-steps { margin: 2px 0 4px 4px; }
.plan-step button {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 6px;
  color: var(--text);
  font-size: 13px;
}
.plan-step button:hover:not(:disabled) { border-color: var(--border); }
.plan-step button:disabled { color: var(--muted); cursor: default; }
.plan-step.viewing button { background: var(--accent-soft); border-color: var(--accent); }
.plan-mark { color: var(--muted); font-size: 11px; text-align: center; }
.plan-step.done .plan-mark { color: var(--green); }
.plan-step.current .plan-mark { color: var(--accent); }
.plan-step-text { line-height: 1.3; }
.plan-kind { font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }

/* comparing tutors */
.compare-picker { display: grid; gap: 6px; }
.compare-picker .check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.comparisons { display: grid; gap: 6px; justify-self: stretch; }
.comparisons-label { font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.comparison {
  display: grid;
  gap: 4px;
  align-content: start;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  font-size: 13px;
}
.comparison p { margin: 0; white-space: pre-wrap; }
.comparison.failed { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }

/* ------------------------------------------------------- chart colour tokens */

/*
 * Categorical series in a fixed order, validated for colour-blind separation against these surfaces in
 * each theme; three light hues sit under 3:1, so every chart also carries a legend with values and a table.
 */
:root {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --chart-grid: #e7eaf1;
  --chart-axis: #c3c8d4;
}

:root[data-theme="dark"] {
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --chart-grid: #262b31;
  --chart-axis: #3d444d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --chart-grid: #262b31;
    --chart-axis: #3d444d;
  }
}

/* ------------------------------------------------- session: three columns */

/* A session uses the whole screen; the side columns grow a little with it, the middle takes the rest. */
.stage.wide { max-width: none; padding: 18px 20px 16px; }

.session {
  display: grid;
  grid-template-columns: clamp(250px, 18vw, 340px) minmax(0, 1fr) clamp(300px, 24vw, 420px);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "plan centre chat";
  gap: 14px 16px;
  height: calc(100dvh - 112px);
  min-height: 560px;
}

.session-chat { grid-area: chat; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.session-chat .chat { flex: 1 1 auto; min-height: 0; }

.session-bar { grid-area: bar; display: flex; align-items: center; gap: 14px; }
.session-title { flex: 1; min-width: 0; }
.session-title h2 { margin: 0; font-size: 19px; }
.session-title p { margin: 2px 0 0; }

.session-plan { grid-area: plan; }
.session-tools { grid-area: tools; }
.session-plan, .session-tools { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.session-plan .card, .session-tools .card { padding: 14px 16px; flex: none; }
/* The plan takes the room it needs and scrolls on its own; the tutor card stays at the column's foot. */
.session-plan .plan-card { flex: 0 1 auto; min-height: 180px; overflow-y: auto; }
.session-chat { gap: 12px; }
.session-chat .tutor-card { flex: none; max-height: 55%; overflow-y: auto; padding: 12px 14px; }
.session-tools h3, .session-plan h3 { margin-bottom: 6px; }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.side-head h3 { margin: 0; }
.side-title { display: grid; gap: 1px; min-width: 0; }
.side-title #s-plan-note:empty { display: none; }
.plan-refresh { flex: none; width: 28px; height: 28px; font-size: 15px; }
.plan-confirm {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
}
.plan-confirm-actions { display: flex; gap: 6px; }

.session-centre { grid-area: centre; display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; }

/* the board: what the tutor is teaching */
.board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-top: 3px solid var(--accent);
}
.board.collapsed { max-height: none; }
.board.collapsed .board-body, .board.collapsed .board-controls { display: none; }
.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 16px 10px; border-bottom: 1px solid var(--border); }
.board.collapsed .board-head { border-bottom: none; }
.board-title { min-width: 0; display: grid; gap: 2px; }
.board-title h3 { margin: 0; font-size: 16px; }
.board-kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.board-progress { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.board-progress-bar { width: 120px; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.board-progress-fill { height: 100%; background: var(--green); transition: width 0.3s ease; }
.board-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.board-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.board-controls[hidden] { display: none; }
.board-controls .board-next, .board-controls .board-return, .board-controls .board-waiting { margin-left: auto; }
.board-controls .board-return + .board-next { margin-left: 0; }
.board-lead { margin: 0; font-size: 15px; }
.guided-body { display: grid; gap: 12px; }
.step-head { display: grid; gap: 2px; }
.step-head h4 { margin: 0; font-size: 15px; }
.step-goal { margin: -6px 0 0; }
.step-listen { justify-self: start; }
.step-outline { margin: 0; padding-left: 22px; display: grid; gap: 5px; }
.primary.small { padding: 6px 14px; font-size: 13px; }
.video-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.video-list li { display: grid; gap: 1px; }

/* the chat: the conversation */
.chat { flex: 1 1 300px; min-height: 260px; display: flex; flex-direction: column; padding: 12px 16px 14px; }

.guided-body > .rich { max-width: 88ch; }

.step-thread { display: grid; gap: 10px; }
.step-thread:not(:empty) { padding-top: 12px; border-top: 1px dashed var(--border); }
.step-thread .bubble { max-width: 88%; }
.step-thread .bubble.tutor { justify-self: start; }
.step-thread .bubble.learner { justify-self: end; }
.step-thread .inline-board { display: grid; gap: 10px; max-width: 88%; }


.skip-confirm { display: grid; gap: 8px; }
.skip-confirm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-card[hidden], #s-explain-open[hidden] { display: none; }
.scene-after .coach-note, .stage-after .coach-note { max-width: 640px; margin: 8px auto 0; }
.coach-note { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border)); display: grid; gap: 4px; }
.coach-line { margin: 0; font-size: 13px; line-height: 1.45; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px; }
.coach-line:not(:has(.coach-label)) { grid-template-columns: minmax(0, 1fr); }
.coach-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); padding-top: 2px; }
.coach-say .coach-text { font-weight: 600; }
.chat-empty { justify-self: center; align-self: center; text-align: center; margin: 24px 0; max-width: 42ch; }
.chat-marker {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 92%;
  border: 1px dashed var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text);
}
.chat-marker:hover { border-color: var(--accent); color: var(--accent); }
.chat-marker.earlier { opacity: 0.7; }
.chat-marker.earlier:hover { border-color: var(--border); color: inherit; }
.chat-marker-where { color: var(--muted); }
.bubble-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bubble-chip { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.bubble-chip:hover, .bubble-chip.active { color: var(--accent); border-color: var(--accent); }

/* the tools: who, how, and how it is going */
.tutor-card { display: grid; gap: 10px; }
.tutor-head { display: flex; align-items: center; gap: 12px; }
.tutor-voice-line { display: flex; align-items: baseline; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.tutor-voice-line .link { font-size: 12px; }
.tutor-voice[hidden] { display: none; }
.tutor-card .persona-art { width: 46px; height: 46px; margin: 0; flex: none; }
.tutor-card .persona-initial { font-size: 20px; }
.tutor-who { display: grid; gap: 1px; min-width: 0; }
.tutor-who .small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.session-tools .delivery-switch { margin: 6px 0 12px; }
.tutor-part { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.tutor-part-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tutor-card .delivery-switch { margin: 0; }
.tutor-dials { display: grid; gap: 8px; }
.dials { display: grid; gap: 8px; }
.dials-group { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.dial { display: grid; gap: 2px; padding: 4px 6px; border-radius: 8px; }
.dial.chosen { background: var(--accent-soft); }
.dial-name { font-size: 13px; }
.dial input[type="range"] { width: 100%; margin: 0; accent-color: var(--accent); }
.dial-scale { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.dials-status { margin: 2px 0 0; }
.dials-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.field { display: grid; gap: 6px; }
.voice-switch .voice-picker { width: 100%; }
.voice-switch .voice-picker select { max-width: none; flex: 1; padding: 6px 8px; }
.tool-buttons { display: grid; gap: 8px; margin-top: 4px; }
.tool-buttons .ghost { text-align: left; }

/* the plan: the guided lesson's steps, or the topic's syllabus */
.plan-empty { display: grid; gap: 8px; justify-items: start; margin-top: 6px; }
.plan-empty p { margin: 0; }
.syllabus-units { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.syllabus-unit summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; padding: 4px 0; }
.unit-title.done::after { content: " \2713"; color: var(--green); }
.unit-topics { list-style: none; margin: 2px 0 6px; padding: 0 0 0 4px; display: grid; gap: 2px; }
.unit-topic {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 6px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 13px;
  color: var(--text);
}
.unit-topic:hover { border-color: var(--accent); color: var(--accent); }
.unit-topic.asked .plan-mark { color: var(--green); }
.unit-topic.current { border-color: var(--accent); background: var(--accent-soft); }

/* While the tutor is working, the plan cannot start anything else. */
.session.working .unit-topic,
.session.working .plan-refresh { pointer-events: none; opacity: 0.55; }

/* a whole subject: parts, then units, then sub-topics, with the running lesson nested in its place */
.plan-filter { width: 100%; margin: 8px 0 2px; padding: 6px 10px; font-size: 13px; }
.syllabus-parts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.syllabus-part > details > summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.syllabus-part > details > summary:hover { color: var(--text); }
.part-title.done::after { content: " \2713"; color: var(--green); }
.syllabus-part .syllabus-units { margin: 4px 0 6px; padding-left: 6px; }
.plan-nested { margin: 2px 0 8px 22px; padding-left: 8px; border-left: 2px solid var(--accent); }
.plan-lesson-note { display: block; margin: 2px 0 2px; }
.plan-now { display: grid; gap: 4px; margin: 8px 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.plan-heading { display: block; margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.unit-topics .plan-confirm { margin: 4px 0 6px; }

/* --------------------------------------------------- tutor text and maths */

.rich { display: grid; gap: 8px; }
.rich > * { margin: 0; }
.rich p { line-height: 1.55; }
.rich ul, .rich ol { padding-left: 20px; display: grid; gap: 3px; }
.rich h4 { font-size: 14px; }
.rich .code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 13px; }
.rich .code code { background: none; padding: 0; }

/*
 * Source code: a labelled block with numbered lines and a Copy button. Its colours are the theme's own
 * text tokens, which meet contrast on every theme's surfaces, so code reads the same in all of them.
 */
.code-block { margin: 0; min-width: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px 5px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.code-lang { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.code-copy { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 12px; color: var(--muted); }
.code-copy:hover { color: var(--accent); border-color: var(--accent); }
.code-block pre.code, .rich .code-block pre.code { margin: 0; border: none; border-radius: 0; background: none; padding: 10px 0; overflow-x: auto; font: 13px/1.55 var(--mono); tab-size: 4; counter-reset: code-line; }
.code-block code { display: grid; min-width: max-content; }
.code-line { display: block; padding: 0 14px 0 0; white-space: pre; color: var(--text); }
.code-line::before {
  counter-increment: code-line;
  content: counter(code-line);
  display: inline-block;
  width: 3ch;
  margin-right: 12px;
  padding-left: 8px;
  text-align: right;
  color: var(--muted);
  opacity: 0.7;
  user-select: none;
}
.tok-comment { color: var(--muted); font-style: italic; }
.tok-string { color: var(--green); }
.tok-number { color: var(--amber); }
.tok-keyword { color: var(--accent); font-weight: 600; }
.tok-function { color: var(--red); }
.tok-tag { color: var(--accent); }
.tok-attr, .tok-property { color: var(--amber); }
.tok-variable { color: var(--red); }
.bubble .rich { gap: 6px; }
.math-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.katex { font-size: 1.08em; }
.katex-display { margin: 0.35em 0; }
code.tex { white-space: pre-wrap; }

/* the board's working, one numbered step per line */
.math-board {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.math-board li { counter-increment: step; position: relative; padding-left: 32px; overflow-x: auto; line-height: 1.6; }
.math-board li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 22px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.board-label { color: var(--muted); font-size: 13px; margin-right: 8px; }

/* ----------------------------------------------------------------- figures */

.lesson-figure { margin: 0; display: grid; gap: 8px; }
.figure-title { font-size: 14px; font-weight: 600; }
.figure-caption { margin: 0; font-size: 13px; color: var(--muted); }

.lesson-figure .s1 { --series: var(--series-1); }
.lesson-figure .s2 { --series: var(--series-2); }
.lesson-figure .s3 { --series: var(--series-3); }
.lesson-figure .s4 { --series: var(--series-4); }
.lesson-figure .s5 { --series: var(--series-5); }
.lesson-figure .s6 { --series: var(--series-6); }
.lesson-figure .s7 { --series: var(--series-7); }
.lesson-figure .s8 { --series: var(--series-8); }

.chart { position: relative; display: grid; gap: 8px; }
.chart-body { min-width: 0; max-width: 640px; }
.chart-svg { display: block; width: 100%; height: auto; max-height: 300px; overflow: visible; }
.chart-svg.pie { width: 200px; max-width: 100%; flex: none; }
.pie-body { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.pie-body .chart-legend { flex: 1 1 200px; max-width: 340px; }
.chart-svg .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-svg .axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font: 11px system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
.chart-svg .mark { fill: var(--series); }
.chart-svg .mark.slice { stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; }
.chart-svg .mark.ring { fill: none; stroke: var(--series); }
.chart-svg .mark.line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .mark.dot { stroke: var(--surface); stroke-width: 2; }
.chart-svg .mark.slice.active { opacity: 0.82; }
.chart-svg .hit { fill: transparent; }
.chart-svg .hit.active { fill: var(--accent-soft); }
.chart-svg .crosshair { stroke: var(--chart-axis); stroke-width: 1; }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--series); flex: none; }
.chart-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.chart-legend.legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.chart-legend li { display: flex; align-items: center; gap: 8px; }
.legend-value { margin-left: auto; padding-left: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  display: grid;
  gap: 2px;
  padding: 6px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  font-size: 12px;
  white-space: nowrap;
}
.chart-tip[hidden] { display: none; }
.chart-tip-row { display: flex; align-items: center; gap: 6px; }
.chart-table summary { font-size: 12px; color: var(--muted); cursor: pointer; width: max-content; }
.chart-table table { border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.chart-table th, .chart-table td { padding: 3px 12px 3px 0; text-align: left; border-bottom: 1px solid var(--border); }
.chart-table td { font-variant-numeric: tabular-nums; }

.picture { max-width: 520px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.picture img { display: block; width: 100%; height: auto; }
.picture.loading { min-height: 220px; animation: picture-wait 1.4s ease-in-out infinite; }
.picture.missing { display: flex; align-items: center; gap: 10px; padding: 16px; font-size: 13px; color: var(--muted); }
@keyframes picture-wait { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .picture.loading { animation: none; } }

/* ------------------------------------------------------------ starting one */

.start-panel h2 { margin-bottom: 14px; }
.start-form { gap: 12px; }
.topic-box { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.topic-box:focus-within, .topic-box.dropping { border-color: var(--accent); }
.topic-box.dropping { box-shadow: inset 0 0 0 1px var(--accent); }
.topic-images { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 10px 0; }
.topic-images[hidden] { display: none; }
.topic-image { position: relative; flex: none; width: 64px; height: 64px; margin: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.topic-image img { display: block; width: 100%; height: 100%; border-radius: 7px; object-fit: cover; }
.topic-image.reading img { opacity: 0.45; }
.topic-image.reading::after { content: ""; position: absolute; inset: 0; width: 18px; height: 18px; margin: auto; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: busy-spin 0.8s linear infinite; }
.topic-image-remove { position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); font-size: 10px; line-height: 1; }
.topic-image-remove:hover { border-color: var(--accent); color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .topic-image.reading::after { animation: none; } }
.topic-box textarea { border: none; background: transparent; resize: vertical; min-height: 88px; }
.topic-box-bar { display: flex; align-items: center; gap: 6px; padding: 2px 8px 8px; }
.topic-box-bar:has(.topic-status:empty):has(.topic-count[hidden]) { display: none; }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
}
.icon-button:hover { border-color: var(--accent); }
.icon-button.recording { border-color: var(--red); color: var(--red); }
.start-options { border: 1px solid var(--border); border-radius: 10px; }
.start-options summary { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.start-options summary::-webkit-details-marker { display: none; }
.start-options summary::before { content: "\25B8"; font-size: 11px; color: var(--muted); }
.start-options[open] summary::before { content: "\25BE"; }
.start-options-label { flex: none; font-size: 13px; font-weight: 600; color: var(--text); }
.start-options-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.start-options[open] .start-options-summary { visibility: hidden; }
.start-options-body { display: grid; gap: 12px; padding: 0 12px 12px; }

/* ------------------------------------------------------------ narrower screens */

@media (max-width: 1100px) {
  .session {
    height: auto;
    min-height: 0;
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "plan centre"
      "plan chat";
    align-items: start;
  }
  .session-chat .chat { height: 70vh; }
  .session-plan, .session-tools { overflow: visible; }
  .session-plan .plan-card { overflow: visible; }
  .board { height: calc(100dvh - 150px); min-height: 480px; }
}

@media (max-width: 860px) {
  .session { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .session > *, .session-plan > * { grid-area: auto; }
  .session-plan { display: contents; }
  .session-plan > .topic-card { order: -3; }
  .session-centre { order: -2; }
  .session-chat { order: -1; }
  .board { height: auto; min-height: 60vh; }
  .session-chat .chat { height: 78vh; }
  .bubble { max-width: 94%; }
  .chart-svg .tick { font-size: 17px; }
}

/* ------------------------------------------------------------------ more themes */

/*
 * Paper: warm, low-glare light for long reading. Ocean: a deep blue dark. High contrast: black and
 * white with a yellow accent and outlined surfaces, for low vision. Chart series were validated
 * against each surface; the blackboard keeps its green slate except in high contrast.
 */
:root[data-theme="paper"] {
  --on-accent: #ffffff;
  --on-strong: #ffffff;
  --canvas: #fffdf8;
  --ink: #2b241a;
  --bg: #f3ecdc;
  --surface: #fbf7ee;
  --surface-2: #efe6d3;
  --border: #ddd0b6;
  --text: #2a2319;
  --muted: #6d604c;
  --accent: #9b4d1e;
  --accent-soft: rgba(155, 77, 30, 0.12);
  --green: #2e7d4f;
  --amber: #8a5d0a;
  --red: #b3372c;
  --chart-grid: #e6dcc6;
  --chart-axis: #c9b99a;
}

:root[data-theme="ocean"] {
  --on-accent: #04202a;
  --on-strong: #04202a;
  --canvas: #0f1c2e;
  --ink: #e3eefc;
  --bg: #0a1422;
  --surface: #10203a;
  --surface-2: #16294a;
  --border: #22395e;
  --text: #e6f0ff;
  --muted: #9bb0cf;
  --accent: #4fd1c5;
  --accent-soft: rgba(79, 209, 197, 0.15);
  --green: #5ad19a;
  --amber: #f0c36b;
  --red: #ff8a80;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --chart-grid: #1c3152;
  --chart-axis: #34507a;
}

:root[data-theme="highContrast"] {
  --on-accent: #000000;
  --on-strong: #000000;
  --canvas: #000000;
  --ink: #ffffff;
  --bg: #000000;
  --surface: #000000;
  --surface-2: #141414;
  --border: #ffffff;
  --text: #ffffff;
  --muted: #e6e6e6;
  --accent: #ffd400;
  --accent-soft: rgba(255, 212, 0, 0.22);
  --green: #3dff8b;
  --amber: #ffd400;
  --red: #ff6b6b;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --chart-grid: #3a3a3a;
  --chart-axis: #ffffff;
  --board-frame: #ffffff;
  --board-surface: #000000;
  --board-ink: #ffffff;
  --board-yellow: #ffd400;
}

/*
 * Mint, Rose and Lavender are light; Forest, Plum and Slate are dark. Text, muted text, the accent and
 * the status colours meet WCAG AA on every surface, and the chart series were validated against each
 * surface: the light themes take the light series, the dark themes the dark set below.
 */
:root[data-theme="mint"] {
  --on-accent: #ffffff;
  --on-strong: #ffffff;
  --canvas: #ffffff;
  --ink: #13241c;
  --bg: #eef6f2;
  --surface: #fbfefc;
  --surface-2: #e3f0e9;
  --border: #c9ddd2;
  --text: #13241c;
  --muted: #4f6b5d;
  --accent: #13795b;
  --accent-soft: rgba(19, 121, 91, 0.12);
  --green: #1d7a48;
  --amber: #8a5f0b;
  --red: #b8322a;
  --chart-grid: #dfece5;
  --chart-axis: #b9cfc3;
}

:root[data-theme="rose"] {
  --on-accent: #ffffff;
  --on-strong: #ffffff;
  --canvas: #ffffff;
  --ink: #2a151b;
  --bg: #fbf1f3;
  --surface: #fffafb;
  --surface-2: #f5e4e8;
  --border: #e7cdd4;
  --text: #2a151b;
  --muted: #74515b;
  --accent: #b0305a;
  --accent-soft: rgba(176, 48, 90, 0.11);
  --green: #2a7a4b;
  --amber: #8c5c08;
  --red: #b42318;
  --chart-grid: #f0dfe3;
  --chart-axis: #d8bcc4;
}

:root[data-theme="lavender"] {
  --on-accent: #ffffff;
  --on-strong: #ffffff;
  --canvas: #ffffff;
  --ink: #1c1830;
  --bg: #f4f2fb;
  --surface: #fdfcff;
  --surface-2: #ebe7f7;
  --border: #d7d0ec;
  --text: #1c1830;
  --muted: #5d5877;
  --accent: #6a4bc4;
  --accent-soft: rgba(106, 75, 196, 0.12);
  --green: #237a4f;
  --amber: #8a600c;
  --red: #b8332b;
  --chart-grid: #e6e1f4;
  --chart-axis: #c4bbe0;
}

:root[data-theme="forest"],
:root[data-theme="plum"] {
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
}

:root[data-theme="forest"] {
  --on-accent: #06150e;
  --on-strong: #06150e;
  --canvas: #0f1a14;
  --ink: #e4f0e9;
  --bg: #0c1511;
  --surface: #122019;
  --surface-2: #182a21;
  --border: #24392e;
  --text: #e4f0e9;
  --muted: #9bb3a6;
  --accent: #5fd49a;
  --accent-soft: rgba(95, 212, 154, 0.14);
  --green: #6bd99f;
  --amber: #e9c46a;
  --red: #ff8f85;
  --chart-grid: #1c3027;
  --chart-axis: #34503f;
}

:root[data-theme="plum"] {
  --on-accent: #1a0f2a;
  --on-strong: #1a0f2a;
  --canvas: #18121f;
  --ink: #efe8f7;
  --bg: #140f1c;
  --surface: #1c1527;
  --surface-2: #251c33;
  --border: #352a47;
  --text: #efe8f7;
  --muted: #ab9fc0;
  --accent: #c7a0ff;
  --accent-soft: rgba(199, 160, 255, 0.15);
  --green: #5fd39a;
  --amber: #f0c36b;
  --red: #ff8a8a;
  --chart-grid: #2a2038;
  --chart-axis: #463a5c;
}

:root[data-theme="highContrast"] a { text-decoration: underline; }
:root[data-theme="highContrast"] .bubble { border: 1px solid var(--border); }
:root[data-theme="highContrast"] :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* the theme picker in the user menu */
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
.theme-grid button {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 6px 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}
.theme-grid button:hover { color: var(--text); border-color: var(--accent); }
.theme-grid button.active { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-swatch { width: 28px; height: 18px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.18); }
.theme-swatch.light { background: linear-gradient(135deg, #f5f7fb 50%, #3360d4 50%); }
.theme-swatch.paper { background: linear-gradient(135deg, #f3ecdc 50%, #9b4d1e 50%); }
.theme-swatch.dark { background: linear-gradient(135deg, #1a1d21 50%, #f2a65a 50%); }
.theme-swatch.ocean { background: linear-gradient(135deg, #10203a 50%, #4fd1c5 50%); }
.theme-swatch.mint { background: linear-gradient(135deg, #eef6f2 50%, #13795b 50%); }
.theme-swatch.rose { background: linear-gradient(135deg, #fbf1f3 50%, #b0305a 50%); }
.theme-swatch.lavender { background: linear-gradient(135deg, #f4f2fb 50%, #6a4bc4 50%); }
.theme-swatch.forest { background: linear-gradient(135deg, #122019 50%, #5fd49a 50%); }
.theme-swatch.plum { background: linear-gradient(135deg, #1c1527 50%, #c7a0ff 50%); }
.theme-swatch.highContrast { background: linear-gradient(135deg, #000000 50%, #ffd400 50%); border-color: #ffffff; }
.theme-swatch.system { background: linear-gradient(135deg, #f5f7fb 50%, #1a1d21 50%); }

/* ------------------------------------------------------------------ delivery toggles */

.delivery .delivery-check {
  justify-self: end;
  width: 18px;
  height: 18px;
  margin-top: -4px;
  border: 2px solid var(--border);
  border-radius: 5px;
  grid-row: 1;
}
.delivery.chosen .delivery-check { background: var(--accent); border-color: var(--accent); }
.delivery.chosen .delivery-check::after { content: "\2713"; display: block; color: var(--on-accent); font-size: 12px; line-height: 14px; text-align: center; }
.delivery { grid-template-columns: 1fr auto; }
.delivery > :not(.delivery-check) { grid-column: 1 / -1; }
.delivery .delivery-icon { grid-column: 1; grid-row: 1; height: 26px; line-height: 26px; overflow: hidden; }

/* ------------------------------------------------------------------ the blackboard */

@font-face {
  font-family: "Chalk Hand";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/patrick-hand/patrick-hand-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Chalk Hand";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/patrick-hand/patrick-hand-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

.blackboard {
  --board-frame-color: var(--board-frame, #7a5234);
  padding: 10px 10px 0;
  border-radius: 12px;
  background: var(--board-frame-color);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.12);
}
.blackboard-surface {
  min-height: 110px;
  padding: 16px 22px 18px;
  border-radius: 6px;
  color: var(--board-ink, #f2f0e6);
  background:
    radial-gradient(ellipse at 20% 15%, rgba(255, 255, 255, 0.07), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(255, 255, 255, 0.05), transparent 50%),
    var(--board-surface, #2b3f33);
  font-family: "Chalk Hand", "Segoe Print", "Comic Sans MS", cursive;
  font-size: 22px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.45), 0 0 8px rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}
.chalk-line { position: relative; width: max-content; max-width: 100%; padding: 0.1em 0; }
.chalk-line.heading { font-size: 28px; margin-bottom: 4px; }
.chalk-line.heading .chalk-words { border-bottom: 2px solid currentColor; padding-bottom: 1px; }
.chalk-line.bullet { padding-left: 1.1em; }
.chalk-line.bullet::before { content: "\2022"; position: absolute; left: 0.15em; }
.chalk-gap { height: 0.7em; }
.chalk-yellow { color: var(--board-yellow, #f6e27a); }
.chalk-underline { position: relative; white-space: nowrap; }
.chalk-underline::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 0.02em;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
  opacity: 0.85;
  transform: rotate(-0.6deg);
  transform-origin: left center;
}
.blackboard .katex { font-size: 0.95em; color: inherit; text-shadow: none; }
.blackboard-ledge {
  position: relative;
  height: 12px;
  margin: 0 -10px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.18), transparent 60%), var(--board-frame-color);
}
.chalk-stick {
  position: absolute;
  right: 18%;
  top: 2px;
  width: 26px;
  height: 6px;
  border-radius: 3px;
  background: #f4f1e6;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* Writing: each line uncovers left to right in turn, then its underlines are drawn. */
.chalk-line.writing {
  animation: chalk-write var(--write-time) cubic-bezier(0.35, 0.1, 0.4, 1) var(--write-delay) both;
}
.chalk-line.writing .chalk-underline::after {
  animation: chalk-underline 260ms ease-out calc(var(--write-delay) + var(--write-time)) both;
}
@keyframes chalk-write {
  from { clip-path: inset(-0.3em 100% -0.3em -0.5em); }
  to { clip-path: inset(-0.3em -0.5em -0.3em -0.5em); }
}
@keyframes chalk-underline {
  from { transform: rotate(-0.6deg) scaleX(0); }
  to { transform: rotate(-0.6deg) scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .chalk-line.writing, .chalk-line.writing .chalk-underline::after { animation: none; }
}
@media (max-width: 860px) {
  .blackboard-surface { font-size: 19px; padding: 12px 16px 14px; }
  .chalk-line.heading { font-size: 23px; }
}

/* ------------------------------------------------------------------ photo credits */

.figure-credit { margin: -2px 0 0; font-size: 11px; color: var(--muted); }
.figure-credit a { color: inherit; }
.figure-credit a:hover { color: var(--accent); }

/* ------------------------------------------------------------ cards to arrange */

.arrange {
  display: grid;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.arrange.solved { border-color: var(--green); }
.arrange-prompt { margin: 0; font-weight: 600; line-height: 1.45; }
.arrange-help { margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.arrange-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 46px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.arrange-note { align-self: center; font-size: 12px; color: var(--muted); }
.arrange-lanes { display: grid; grid-template-columns: repeat(var(--lanes, 2), minmax(0, 1fr)); gap: 8px; }
.arrange-lane {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.arrange-lane-head {
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.arrange-lane-head:disabled { cursor: default; }
.arrange-drop { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; padding: 8px; }
.arrange .over { outline: 2px solid var(--accent); outline-offset: -2px; }
.arrange-card {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.arrange-card:hover { border-color: var(--accent); }
.arrange-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.arrange-card.dragging, .arrange-row.dragging { opacity: 0.35; }
.arrange-card.right, .arrange-row.right { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.arrange-card.wrong, .arrange-row.wrong { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.arrange-card:disabled { cursor: default; opacity: 1; }
.arrange-ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  transform: translate(-50%, -60%) rotate(-2deg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  opacity: 0.95;
}
.arrange-order { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: arrange; }
.arrange-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: grab;
  touch-action: none;
  user-select: none;
  counter-increment: arrange;
}
.arrange-row::before { content: counter(arrange); min-width: 1.4em; font-size: 12px; color: var(--muted); text-align: right; }
.arrange-grip { color: var(--muted); letter-spacing: -2px; }
.arrange-text { flex: 1; min-width: 0; }
.arrange-arrow {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.arrange-arrow:disabled { opacity: 0.35; cursor: default; }
.arrange-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.arrange-result { margin-right: auto; font-size: 13px; color: var(--muted); }
.arrange.solved .arrange-result { color: var(--green); font-weight: 600; }

/* ------------------------------------------------------------ flow diagrams */

.flow { display: grid; gap: 6px; width: fit-content; max-width: 100%; padding: 6px 2px; }
.flow-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; }
.flow-item { display: flex; align-items: center; }
.flow-arrow { padding: 0 8px; color: var(--accent); font-size: 18px; }
.flow-step {
  padding: 8px 14px;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
  text-align: center;
}
.flow-return {
  position: relative;
  height: 14px;
  margin: 0 18px;
  border: 1.5px solid var(--accent);
  border-top: 0;
  border-radius: 0 0 12px 12px;
}
.flow-return::before {
  content: "";
  position: absolute;
  left: -6px;
  top: -6px;
  border: 5px solid transparent;
  border-bottom: 7px solid var(--accent);
}
.flow-return-label {
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  padding: 0 6px;
  background: var(--surface);
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 620px) {
  .arrange-lanes { grid-template-columns: minmax(0, 1fr); }
  .arrange-lane { min-height: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  .arrange-ghost { transform: translate(-50%, -60%); }
}

.topic-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 10px; }
.topic-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.topic-foot { grid-column: 2; grid-row: 2; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 30px; }
.topic-foot #s-meta { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-foot #s-meta[hidden] { display: block; visibility: hidden; }
.topic-archive svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topic-asked { width: 30px; height: 30px; font-size: 16px; line-height: 1; }
.topic-asked[hidden] { display: none; }
.topic-asked[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.topic-asked-panel { grid-column: 1 / -1; display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.topic-asked-panel[hidden] { display: none; }
.topic-asked-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.topic-asked-text { margin: 0; max-height: 240px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.topic-asked-media img { display: block; max-width: 100%; max-height: 260px; border-radius: 8px; border: 1px solid var(--border); object-fit: contain; }
.topic-asked-media audio { width: 100%; }
.topic-asked-images { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-asked-images img { display: block; max-width: min(100%, 260px); max-height: 200px; border: 1px solid var(--border); border-radius: 8px; object-fit: contain; }
.topic-back { grid-column: 1; grid-row: 1; width: 30px; height: 30px; font-size: 18px; line-height: 1; }
.topic-archive { width: 30px; height: 30px; font-size: 15px; line-height: 1; }
.topic-title { grid-column: 2; grid-row: 1; min-width: 0; display: grid; gap: 2px; }
.topic-title h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.topic-title p[hidden] { display: none; }

.tutor-card .tutor-head { display: flex; align-items: center; gap: 10px; }
.tutor-card .persona-art { width: 40px; height: 40px; }
.tutor-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tutor-tools { display: flex; gap: 6px; flex: none; }
.tutor-tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tutor-tool.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tutor-panel { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tutor-panel-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tutor-panel .delivery-switch { margin: 0; }
.dials-status[hidden] { display: none; }

.board-head { flex-wrap: wrap; }
.board-head .board-title { flex: 1 1 220px; }
.board-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: none; margin-left: auto; }
.board > .explain-panel, .board > .player { margin: 10px 16px 0; }
.board.board-empty .board-body { min-height: 120px; }

.lesson-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 92%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.lesson-link:hover, .lesson-link.active { border-color: var(--accent); color: var(--accent); }
.lesson-link-icon { color: var(--accent); }

.offer-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bubble.flagged { background: color-mix(in srgb, var(--red) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); }
.bubble-flag-removed { font-size: 13px; color: var(--red); }

.composer-tools .icon-tool { min-width: 36px; padding: 5px 8px; font-size: 15px; }

.talk { display: grid; gap: 6px; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.talk-controls { display: flex; align-items: center; gap: 6px; }
.talk-button {
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.talk-button:hover:not(:disabled) { border-color: var(--accent); }
.talk-button:disabled { opacity: 0.4; cursor: default; }
.talk-play { width: 38px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.talk-count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.talk-caption { margin: 0; font-size: 14px; line-height: 1.45; min-height: 1.45em; }
.talk-caption:empty { display: none; }

.graph { width: 100%; }
.graph-svg { display: block; width: 100%; height: auto; max-height: 100%; }
.graph-grid line { stroke: color-mix(in srgb, var(--border) 70%, transparent); stroke-width: 1; }
.graph-axes line { stroke: var(--muted); stroke-width: 1.6; }
.graph-ticks text, .graph-axis-name { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.graph-axis-name { font-style: italic; font-weight: 600; }
.graph-curve { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; transition: stroke-width 0.3s ease, filter 0.3s ease; }
.graph-curve.tone-blue, .graph-point.tone-blue { --tone: #2f6fdb; }
.graph-curve.tone-green, .graph-point.tone-green { --tone: #1f9d6b; }
.graph-curve.tone-orange, .graph-point.tone-orange { --tone: #e07b1a; }
.graph-curve.tone-purple, .graph-point.tone-purple { --tone: #8a4fd6; }
.graph-curve.tone-red, .graph-point.tone-red { --tone: #d6455d; }
.graph-curve { stroke: var(--tone, var(--accent)); }
.graph-curve.lit { stroke-width: 4.5; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--tone, var(--accent)) 60%, transparent)); }
.graph-point { transition: opacity 0.3s ease; }
.graph-point.waiting { opacity: 0; }
.graph-dot { fill: var(--tone, var(--accent)); stroke: var(--surface); stroke-width: 1.5; }
.graph-ring { fill: none; stroke: var(--tone, var(--accent)); stroke-width: 2.5; opacity: 0; transition: opacity 0.3s ease; }
.graph-point.lit .graph-ring { opacity: 1; }
.graph-label { font-size: 13px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.graph-point.lit .graph-label { fill: var(--tone, var(--accent)); }
.scene-graph { display: flex; flex-direction: column; min-height: 0; }
.scene-graph .graph { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
.scene-graph .graph-svg { max-height: 70cqh; }
.flowchart-figure { display: grid; gap: 4px; }
.flowchart { overflow-x: auto; max-height: 560px; overflow-y: auto; }
.flowchart-svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.flow-shape { fill: var(--surface); stroke: var(--border); stroke-width: 1.6; transition: fill 0.25s ease, stroke 0.25s ease; }
.flow-start .flow-shape, .flow-end .flow-shape { fill: var(--surface-2); }
.flow-decision .flow-shape { fill: color-mix(in srgb, var(--amber) 10%, var(--surface)); }
.flow-label {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  overflow-wrap: anywhere;
}
.flow-line { fill: none; stroke: var(--muted); stroke-width: 1.6; transition: stroke 0.25s ease; }
.flow-arrow { fill: var(--muted); }
.flow-arrow-active { fill: var(--accent); }
.flow-edge-label { font-size: 12px; fill: var(--muted); font-weight: 600; }
.flow-node { transition: opacity 0.35s ease; transform-box: fill-box; transform-origin: center; }
.flowchart.focusing .flow-node:not(.active):not(.visited) .flow-label { color: color-mix(in srgb, var(--text) 72%, var(--surface)); }
.flowchart.focusing .flow-edge:not(.active) { opacity: 0.8; }
.flow-edge { transition: opacity 0.35s ease; }
.flow-node.visited .flow-shape { stroke: color-mix(in srgb, var(--accent) 55%, var(--border)); stroke-width: 2; }
.flow-node.active .flow-shape {
  fill: var(--accent);
  stroke: var(--accent);
  stroke-width: 3;
  filter: drop-shadow(0 0 9px color-mix(in srgb, var(--accent) 70%, transparent));
}
.flow-node.active .flow-label { color: var(--on-accent); font-weight: 700; font-size: 14px; }
.flow-node.active { animation: flow-pulse 0.7s ease; }
@keyframes flow-pulse { 0% { transform: scale(1); } 35% { transform: scale(1.09); } 100% { transform: scale(1); } }
.flow-edge.active .flow-line { stroke: var(--accent); stroke-width: 3; }
.flow-edge.active .flow-edge-label { fill: var(--accent); }
.flow-edge-label { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }

.chalk-line.waiting { visibility: hidden; }
.chalk-line.speaking { background: rgba(255, 255, 255, 0.07); border-radius: 6px; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.07); }
.blackboard-talk { display: grid; }
.blackboard-talk .talk { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }

@media (prefers-reduced-motion: reduce) {
  .flow-shape, .flow-line { transition: none; }
  .flow-node.active { animation: none; }
}

.scene { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.scene-screen { position: relative; flex: 1 1 auto; min-height: 200px; overflow: hidden; border-radius: 12px; container-type: size; }
.scene-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  transition: opacity 0.3s ease;
}
.scene.has-tool .scene-card { opacity: 0; pointer-events: none; }
.scene-card-title { margin: 0; font-size: clamp(20px, 6cqh, 34px); line-height: 1.25; }
.scene-card-note { margin: 0 auto; max-width: 60ch; color: var(--muted); font-size: clamp(14px, 3cqh, 18px); }
.scene-tool { position: absolute; inset: 0; display: flex; align-items: stretch; justify-content: center; overflow: hidden; animation: scene-in 0.35s ease; }
.scene-tool:empty { display: none; }
.scene-tool > * { flex: 1 1 auto; min-width: 0; max-height: 100%; margin: 0; }
.scene-tool[data-kind="checkpoint"], .scene-tool[data-kind="explain"], .scene-tool[data-kind="diagnosis"], .scene-tool[data-kind="summary"], .scene-tool[data-kind="arrange"] {
  overflow-y: auto;
  align-items: flex-start;
}
.scene-tool[data-kind="checkpoint"] > *, .scene-tool[data-kind="explain"] > *, .scene-tool[data-kind="diagnosis"] > *, .scene-tool[data-kind="summary"] > *, .scene-tool[data-kind="arrange"] > * { max-height: none; }
.scene-tool[data-kind="working"] { align-items: center; }
.scene-tool .math-board { font-size: clamp(16px, 5cqh, 28px); max-width: 60ch; margin: auto; }
.scene-code { display: flex; flex-direction: column; min-height: 0; }
.scene-code .code-block { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.scene-code pre { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 0; }
.scene-tool .blackboard { height: 100%; display: flex; flex-direction: column; }
.scene-tool .blackboard-surface { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.scene-tool .chalk-line { font-size: calc(clamp(16px, calc(64cqh / var(--lines, 8)), 40px) * var(--fit, 1)); }
.scene-tool .chalk-line.heading { font-size: calc(clamp(20px, calc(82cqh / var(--lines, 8)), 50px) * var(--fit, 1)); }
.scene-tool .lesson-figure { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.scene-tool .chart-svg { max-height: 72cqh; }
.scene-tool .picture img { max-height: 76cqh; width: auto; max-width: 100%; object-fit: contain; }
.scene-flow .flowchart { flex: 1 1 auto; min-height: 0; max-height: none; overflow: hidden; }
.scene-flow .flowchart-svg { width: 100%; height: 100%; max-width: none; }
.scene-flow.tall .flowchart-svg { height: auto; }
.scene-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.scene-strip[hidden] { display: none; }
.scene-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.scene-tab:hover, .scene-tab.active { border-color: var(--accent); color: var(--accent); }
.scene-tab-icon { font-size: 12px; }
.scene-after:empty { display: none; }
.scene-after { flex: none; max-height: 36vh; overflow-y: auto; }
.scene-after:has(.board-question) { max-height: 48vh; }
.scene-after .board-question { width: 100%; gap: 10px; padding: 10px 8px 4px; }
.scene-after .board-question-text { max-width: 52ch; font-size: clamp(18px, 2.6vw, 24px); }
.scene-after .board-question-options { gap: 10px; }
.scene-after .board-question-option { min-height: 48px; padding: 10px 16px; font-size: clamp(16px, 2.2vw, 20px); }
.flashcard .musical-staff { justify-self: center; max-width: 100%; margin: 0; }
.flashcard .musical-staff .ms-svg { margin: 0 auto; }
.scene-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.scene-bar[hidden] { display: none; }
.scene-button {
  flex: none;
  width: 32px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.scene-button:hover:not(:disabled) { border-color: var(--accent); }
.scene-button:disabled { opacity: 0.4; cursor: default; }
.scene-play { width: 40px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.scene-transcript-toggle.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.scene-caption { flex: 1 1 auto; min-width: 0; font-size: 16px; line-height: 1.45; }
.scene-caption p { margin: 0; }
.scene-count { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scene-transcript {
  flex: none;
  max-height: 32%;
  margin: 0;
  padding: 6px 8px 6px 30px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  display: grid;
  gap: 2px;
}
.scene-transcript[hidden] { display: none; }
.scene-transcript-line { padding: 4px 8px; border-radius: 6px; font-size: 14px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.scene-transcript-line p { margin: 0; }
.scene-transcript-line.cue { font-style: italic; }
.scene-transcript-line:hover { color: var(--text); }
.scene-transcript-line.current { color: var(--text); background: var(--accent-soft); }
.scene-outline { overflow-y: auto; display: grid; gap: 12px; align-content: start; padding: 8px; }

@keyframes scene-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-tool { animation: none; }
  .scene-card { transition: none; }
}

@media (max-width: 860px) {
  .scene-screen { min-height: 320px; }
}

@media (max-width: 620px) {
  .scene-bar { flex-wrap: wrap; }
  .scene-caption { order: -1; flex-basis: 100%; }
  .scene-count { margin-left: auto; }
}


.board-next { position: relative; overflow: hidden; }
.board-next .next-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  height: 1.6em;
  margin-left: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 22%, transparent);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}
.board-next.counting::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: currentColor;
  opacity: 0.55;
  transform-origin: left;
  animation: next-drain 5s linear forwards;
}
@keyframes next-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.board-preparing { place-items: center; align-content: center; min-height: 220px; text-align: center; }
.board-preparing p { margin: 0; }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}
.plan-preparing::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.45em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spin 0.7s linear infinite;
}

.fraction-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 18px; padding: 8px 0; }
.fraction-model { display: grid; justify-items: center; gap: 6px; transition: opacity 0.25s ease; }
.fraction-model.waiting, .fraction-sign.waiting { visibility: hidden; }
.fraction-model.speaking .fraction-svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent)); }
.fraction-svg { width: min(240px, calc(78vw / var(--models, 1) - 40px)); height: auto; overflow: visible; }
.fraction-svg.circle { width: min(120px, calc(70vw / var(--models, 1) - 40px)); }
.fraction-part { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.fraction-part.shaded { fill: var(--series-1); }
.fraction-sign { font-size: 28px; font-weight: 600; color: var(--text); }
.fraction-label { font-size: 20px; }
.scene-tool .figure-fraction { justify-content: center; }
.scene-tool .figure-fraction .figure-title { text-align: center; font-size: 18px; }
.scene-tool .fraction-row { flex: 1 1 auto; flex-wrap: nowrap; gap: 18px; }
.scene-tool .fraction-svg { width: min(340px, calc((92cqw - (var(--models, 1) - 1) * 58px) / var(--models, 1))); }
.scene-tool .fraction-svg.circle { width: min(240px, calc((88cqw - (var(--models, 1) - 1) * 58px) / var(--models, 1)), 48cqh); }
.scene-tool .fraction-sign { font-size: 36px; }
.scene-tool .fraction-label { font-size: 28px; }
@media (max-width: 620px) {
  .scene-tool .fraction-row { flex-wrap: wrap; gap: 6px 14px; }
  .scene-tool .fraction-svg { width: min(220px, 62cqw); }
  .scene-tool .fraction-svg.circle { width: min(120px, 34cqw, 30cqh); }
  .scene-tool .fraction-sign { font-size: 26px; }
  .scene-tool .fraction-label { font-size: 20px; }
}

.code-line.lit { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 3px 0 0 var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .board-next.counting::after { animation: none; opacity: 0; }
  .spinner, .plan-preparing::before { animation-duration: 2s; }
}

.chalk-strike, .chalk-circle { position: relative; display: inline-block; }
.chalk-x { position: absolute; left: -0.12em; top: 0.14em; width: calc(100% + 0.24em); height: calc(100% - 0.22em); overflow: visible; pointer-events: none; }
.chalk-x line { stroke: #ff9e8f; stroke-width: max(2.5px, 0.11em); stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chalk-x-strike line { stroke-width: max(2.5px, 0.1em); }
.blackboard .katex-sout, .blackboard .chalk-later-under.chalk-later-sout { border-bottom-color: #ff9e8f; }
.chalk-line.writing .katex-sout:not(.chalk-later-sout) { transform-origin: left center; animation: chalk-grow 420ms cubic-bezier(0.55, 0.1, 0.35, 1) calc(var(--write-delay) + var(--write-time) + 180ms) both; }
.chalk-strike:not(.chalk-later) .chalk-struck, .chalk-strike.crossed .chalk-struck { opacity: 0.55; transition: opacity 0.4s ease; }
.chalk-double { position: relative; white-space: nowrap; }
.chalk-double::before, .chalk-double::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  height: 2.5px;
  border-radius: 3px;
  background: var(--board-yellow, #f6e27a);
  transform: rotate(-0.6deg);
  transform-origin: left center;
}
.chalk-double::before { bottom: 0.04em; }
.chalk-double::after { bottom: -0.14em; }
.chalk-later:not(.crossed) > .chalk-x, .chalk-later.chalk-double:not(.crossed)::before, .chalk-later.chalk-double:not(.crossed)::after,
.chalk-later-line:not(.drawn), .chalk-later-under:not(.drawn) { visibility: hidden; }
.chalk-cue { display: none !important; }
.blackboard .chalk-later-under { border-bottom-color: var(--board-yellow, #f6e27a); }
.chalk-circle { padding: 0 0.18em; }
.chalk-circle::after {
  content: "";
  position: absolute;
  inset: -0.16em -0.12em;
  border: 0.08em solid var(--board-yellow, #f6e27a);
  border-radius: 50%;
  transform: rotate(-4deg);
}
.chalk-cancel { stroke: #ff9e8f; stroke-width: 0.07em; stroke-linecap: round; }
.chalk-line.writing .chalk-strike:not(.chalk-later) .chalk-x {
  animation: chalk-x-draw 420ms cubic-bezier(0.55, 0.1, 0.35, 1) calc(var(--write-delay) + var(--write-time) + 180ms) both;
}
.chalk-line.writing .chalk-strike:not(.chalk-later) .chalk-struck {
  animation: chalk-dim 420ms ease-out calc(var(--write-delay) + var(--write-time) + 380ms) both;
}
.chalk-line.writing .chalk-double:not(.chalk-later)::before {
  animation: chalk-underline 260ms ease-out calc(var(--write-delay) + var(--write-time)) both;
}
.chalk-line.writing .chalk-double:not(.chalk-later)::after {
  animation: chalk-underline 260ms ease-out calc(var(--write-delay) + var(--write-time) + 220ms) both;
}
.chalk-line.writing .chalk-later-line { animation: none; }
.chalk-later.crossing > .chalk-x { animation: chalk-x-draw 460ms cubic-bezier(0.55, 0.1, 0.35, 1) var(--later-delay, 0ms) both; }
.chalk-later.crossing > .chalk-struck { animation: chalk-dim 460ms ease-out calc(var(--later-delay, 0ms) + 200ms) both; }
.chalk-later-line.crossing { stroke-dasharray: 1; animation: chalk-draw 460ms ease-out var(--later-delay, 0ms) both; }
.chalk-later.crossing.chalk-double::before { animation: chalk-underline 260ms ease-out var(--later-delay, 0ms) both; }
.chalk-later.crossing.chalk-double::after { animation: chalk-underline 260ms ease-out calc(var(--later-delay, 0ms) + 220ms) both; }
.chalk-later-under.crossing { transform-origin: left center; animation: chalk-grow 300ms ease-out var(--later-delay, 0ms) both; }
.chalk-line.writing .chalk-cross-stroke {
  animation: chalk-draw 420ms ease-out calc(var(--write-delay) + var(--write-time)) both;
}
@keyframes chalk-x-draw { from { clip-path: inset(-20% 100% -20% -20%); } to { clip-path: inset(-20% -20% -20% -20%); } }
@keyframes chalk-dim { from { opacity: 1; } to { opacity: 0.55; } }
@keyframes chalk-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.chalk-line.writing .chalk-circle::after {
  animation: chalk-ring 520ms ease-out calc(var(--write-delay) + var(--write-time) + 180ms) both;
}
.chalk-line.writing .chalk-cancel {
  stroke-dasharray: 1;
  animation: chalk-draw 420ms ease-out calc(var(--write-delay) + var(--write-time) + 180ms) both;
}
@keyframes chalk-ring { from { clip-path: inset(0 100% 0 0); opacity: 0.4; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes chalk-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.chalk-sketch { width: 100%; max-width: 100%; }
.chalk-sketch-svg { display: block; height: calc(var(--sketch, 2.5) * 1em); width: auto; max-width: 100%; overflow: visible; }
.scene-tool .blackboard-surface { display: flex; flex-direction: column; }
.scene-tool .blackboard-surface > .chalk-line, .scene-tool .blackboard-surface > .chalk-gap { flex: none; }
.scene-tool .blackboard-surface > .chalk-sketch { flex: 1 1 0; min-height: min(calc(var(--sketch, 2.5) * 1em), 34cqh); display: flex; }
.scene-tool .chalk-sketch-svg { width: 100%; height: 100%; max-width: 100%; }
.scene-tool .blackboard:not(.measuring) .blackboard-surface > .waiting { display: none; }
.chalk-math-box { overflow: visible; }
.chalk-math-label { display: flex; align-items: center; height: 100%; white-space: nowrap; line-height: 1; color: currentColor; }
.chalk-math-label.middle { justify-content: center; }
.chalk-math-label.start { justify-content: flex-start; }
.chalk-math-label.end { justify-content: flex-end; }
.chalk-math-label .katex { font-size: 1.05em; }
.chalk-stroke { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chalk-dot { fill: currentColor; }
.chalk-text { fill: currentColor; font-family: inherit; }
.chalk-line.writing .chalk-stroke {
  stroke-dasharray: 1;
  animation: chalk-draw var(--write-time) ease-out var(--write-delay) both;
}

.scene-leaving { pointer-events: none; animation: scene-out 0.4s ease forwards; z-index: 1; }
.scene-entering { animation: scene-enter 0.5s ease 0.3s both; }
@keyframes scene-out { to { opacity: 0; transform: scale(0.985); } }
@keyframes scene-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.scene.scene-arriving { animation: scene-arrive 0.5s ease both; }
@keyframes scene-arrive { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .chalk-line.writing .chalk-x, .chalk-line.writing .chalk-struck, .chalk-line.writing .chalk-circle::after, .chalk-line.writing .chalk-cancel, .chalk-line.writing .chalk-stroke,
  .chalk-line.writing .chalk-double::before, .chalk-line.writing .chalk-double::after, .chalk-later.crossing > .chalk-x, .chalk-later.crossing > .chalk-struck,
  .chalk-later-line.crossing, .chalk-later.crossing.chalk-double::before, .chalk-later.crossing.chalk-double::after, .chalk-later-under.crossing { animation: none; }
  .scene-leaving, .scene-entering, .scene.scene-arriving { animation: none; }
  .scene-leaving { display: none; }
}

.board-next .next-count {
  background: var(--on-accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--on-accent) 40%, transparent);
}
.board-next:not(.primary) .next-count { background: var(--accent); color: var(--on-accent); box-shadow: none; }

.scene.asking .scene-bar, .scene.asking .scene-transcript { display: none; }
.scene-leaving.scene-swapping { animation: scene-swap 0.4s ease forwards; }
@keyframes scene-swap { to { opacity: 0; } }

.tutoring-home { grid-template-columns: minmax(0, 1fr); max-width: 1080px; margin: 0 auto; }
.tutoring-home .recent-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.topic-box textarea { min-height: calc(1.5em * 2 + 18px); max-height: min(60vh, calc(1.5em * 20 + 18px)); line-height: 1.5; field-sizing: content; resize: none; overflow-y: auto; }
.start-actions { display: flex; gap: 12px; margin-top: 12px; }
.start-actions .start-button { flex: 1 1 auto; width: auto; }
.practice-button { flex: none; min-width: 150px; }

.mode-field { display: grid; gap: 4px; justify-items: start; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.segmented button { padding: 7px 18px; border: none; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 500; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.speak-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 600;
}
.speak-button:disabled { opacity: 0.6; }
.speak-button.recording { background: var(--red); border-color: var(--red); animation: speak-pulse 1.4s ease-in-out infinite; }
.speak-icon { font-size: 20px; line-height: 1; }
@keyframes speak-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--red) 25%, transparent); } }
.composer.speaking .speak-first { width: 100%; }
.composer.speaking textarea { min-height: 40px; }
.spoken-answer { display: grid; gap: 8px; justify-items: start; margin-top: 8px; }
.spoken-heard { margin: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 15px; }
.spoken-answer.big { justify-items: center; gap: 16px; }
.spoken-answer.big .speak-button { min-width: 260px; min-height: 72px; border-radius: 999px; font-size: 18px; }
.spoken-answer.big .spoken-heard { font-size: 20px; text-align: center; }

body.with-flashcards { overflow: hidden; }
.flashcards {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px max(16px, 4vw) 22px;
  background: var(--bg);
}
.flashcards-top { display: flex; align-items: center; gap: 12px; }
.flashcards-title { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.flashcards-progress { color: var(--muted); font-variant-numeric: tabular-nums; }
.flashcards-bar { height: 4px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.flashcards-fill { height: 100%; background: var(--accent); transition: width 0.3s ease; }
.flashcards-stage { display: grid; place-items: center; min-height: 0; overflow-y: auto; padding: 6px 4px 18px; }
.flashcard {
  display: grid;
  gap: 28px;
  width: min(880px, 100%);
  padding: clamp(20px, 5vw, 48px);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  animation: flashcard-in 0.3s ease;
}
.flashcard-prompt { margin: 0; font-size: clamp(22px, 3.4vw, 34px); font-weight: 600; line-height: 1.35; text-align: center; }
.flashcard-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.flashcard-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-size: clamp(16px, 2vw, 20px);
  text-align: left;
}
.flashcard-option:hover { border-color: var(--accent); }
.flashcard-option.chosen { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.flashcard-key { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 13px; }
.flashcard-option.chosen .flashcard-key { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.flashcard-text { font-size: 18px; }
.flashcards-nav { display: flex; justify-content: space-between; gap: 12px; width: min(880px, 100%); justify-self: center; }
.flashcards-nav button { min-width: 120px; }
.flashcards-nav .primary { margin-left: auto; }
@keyframes flashcard-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 620px) {
  .flashcard-options { grid-template-columns: minmax(0, 1fr); }
  .flashcard { gap: 18px; }
  .start-actions { flex-direction: column; }
  .practice-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .flashcard, .speak-button.recording, .quiz-timer.starting, .challenge-countdown .challenge-countdown-number { animation: none; }
  .scene-leaving.scene-swapping { display: none; }
}

/* ------------------------------------------------------------ domain wallpaper */

.scene-screen, .scene-outline { position: relative; isolation: isolate; }
.board[data-domain] .scene-screen::before, .board[data-domain] .scene-outline::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--wallpaper);
  -webkit-mask-image: var(--wallpaper-tile);
  mask-image: var(--wallpaper-tile);
  -webkit-mask-size: 260px 260px;
  mask-size: 260px 260px;
  opacity: var(--wallpaper-strength);
}
.board[data-domain] .scene-screen, .board[data-domain] .scene-outline {
  background-image: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--wallpaper) 9%, transparent), transparent 60%);
}
.board { --wallpaper-strength: 0.07; }
:root[data-theme="dark"] .board, :root[data-theme="slateBlue"] .board, :root[data-theme="ocean"] .board, :root[data-theme="forest"] .board, :root[data-theme="plum"] .board { --wallpaper-strength: 0.1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .board { --wallpaper-strength: 0.1; } }
:root[data-theme="highContrast"] .board[data-domain] .scene-screen::before, :root[data-theme="highContrast"] .board[data-domain] .scene-outline::before { display: none; }
:root[data-theme="highContrast"] .board[data-domain] .scene-screen, :root[data-theme="highContrast"] .board[data-domain] .scene-outline { background-image: none; }
.board[data-domain="MAT-000"] { --wallpaper: var(--series-1); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%22228%22 y=%22159%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2222%22 transform=%22rotate(0 228 159)%22 fill=%22%23000%22%3E%CF%80%3C/text%3E%3Ctext x=%22101%22 y=%22231%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(-10 101 231)%22 fill=%22%23000%22%3E%E2%88%91%3C/text%3E%3Ctext x=%2237%22 y=%22227%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(0 37 227)%22 fill=%22%23000%22%3E%E2%88%9Ax%3C/text%3E%3Ctext x=%22156%22 y=%22175%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2222%22 transform=%22rotate(-10 156 175)%22 fill=%22%23000%22%3E%E2%88%AB%3C/text%3E%3Ctext x=%2281%22 y=%22157%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2226%22 transform=%22rotate(-10 81 157)%22 fill=%22%23000%22%3E%E2%88%9E%3C/text%3E%3Ctext x=%22222%22 y=%2232%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(0 222 32)%22 fill=%22%23000%22%3E%E2%89%88%3C/text%3E%3Ctext x=%22164%22 y=%22226%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2220%22 transform=%22rotate(6 164 226)%22 fill=%22%23000%22%3E%C3%B7%3C/text%3E%3Ctext x=%22139%22 y=%2297%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2220%22 transform=%22rotate(-18 139 97)%22 fill=%22%23000%22%3E%C3%97%3C/text%3E%3Ctext x=%2220%22 y=%22166%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2222%22 transform=%22rotate(-6 20 166)%22 fill=%22%23000%22%3E%2B%3C/text%3E%3Ctext x=%22105%22 y=%2299%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(6 105 99)%22 fill=%22%23000%22%3E=%3C/text%3E%3Ctext x=%2230%22 y=%22109%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(12 30 109)%22 fill=%22%23000%22%3Ex%C2%B2%3C/text%3E%3Ctext x=%22225%22 y=%22106%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2218%22 transform=%22rotate(16 225 106)%22 fill=%22%23000%22%3Ef(x)%3C/text%3E%3Cpath d=%22M14 196 Q 54 120 94 196%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.6%22/%3E%3Cpath d=%22M170 40 l40 0 l-40 52 z%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.6%22/%3E%3Ccircle cx=%22216%22 cy=%22210%22 r=%2218%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.6%22/%3E%3Cpath d=%22M216 210 l18 0%22 stroke=%22%23000%22 stroke-width=%221.6%22/%3E%3C/svg%3E"); }
.board[data-domain="SCI-000"] { --wallpaper: var(--series-3); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%22164%22 y=%22156%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(-18 164 156)%22 fill=%22%23000%22%3EH%E2%82%82O%3C/text%3E%3Ctext x=%2299%22 y=%22238%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(6 99 238)%22 fill=%22%23000%22%3ECO%E2%82%82%3C/text%3E%3Ctext x=%22218%22 y=%22101%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(16 218 101)%22 fill=%22%23000%22%3EE=mc%C2%B2%3C/text%3E%3Ctext x=%22103%22 y=%2248%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(0 103 48)%22 fill=%22%23000%22%3E%CE%BB%3C/text%3E%3Ctext x=%22164%22 y=%22243%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(0 164 243)%22 fill=%22%23000%22%3E%CE%A9%3C/text%3E%3Ctext x=%22224%22 y=%22163%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(-6 224 163)%22 fill=%22%23000%22%3E%C2%B0C%3C/text%3E%3Ctext x=%2217%22 y=%22221%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2220%22 transform=%22rotate(12 17 221)%22 fill=%22%23000%22%3ENa%3C/text%3E%3Ctext x=%2277%22 y=%2296%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2222%22 transform=%22rotate(-10 77 96)%22 fill=%22%23000%22%3EO%E2%82%82%3C/text%3E%3Ctext x=%22227%22 y=%2237%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2218%22 transform=%22rotate(6 227 37)%22 fill=%22%23000%22%3EF=ma%3C/text%3E%3Ctext x=%2240%22 y=%22113%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(-6 40 113)%22 fill=%22%23000%22%3EpH%3C/text%3E%3Ctext x=%228%22 y=%22157%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2222%22 transform=%22rotate(-18 8 157)%22 fill=%22%23000%22%3Ee%E2%81%BB%3C/text%3E%3Ctext x=%22166%22 y=%22109%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(16 166 109)%22 fill=%22%23000%22%3EFe%3C/text%3E%3Cg fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.5%22%3E%3Cellipse cx=%22200%22 cy=%22200%22 rx=%2226%22 ry=%229%22/%3E%3Cellipse cx=%22200%22 cy=%22200%22 rx=%2226%22 ry=%229%22 transform=%22rotate(60 200 200)%22/%3E%3Cellipse cx=%22200%22 cy=%22200%22 rx=%2226%22 ry=%229%22 transform=%22rotate(120 200 200)%22/%3E%3C/g%3E%3Ccircle cx=%22200%22 cy=%22200%22 r=%223.5%22 fill=%22%23000%22/%3E%3Cpath d=%22M52 150 v28 l-18 34 h50 l-18 -34 v-28 z%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.6%22/%3E%3Cpath d=%22M150 30 q12 12 0 24 q-12 12 0 24 q12 12 0 24 M170 30 q-12 12 0 24 q12 12 0 24 q-12 12 0 24%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.4%22/%3E%3C/svg%3E"); }
.board[data-domain="LAN-000"] { --wallpaper: var(--series-5); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%2230%22 y=%22223%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2218%22 transform=%22rotate(-6 30 223)%22 fill=%22%23000%22%3EAa%3C/text%3E%3Ctext x=%2294%22 y=%2296%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2220%22 transform=%22rotate(-6 94 96)%22 fill=%22%23000%22%3E%E2%80%9C %E2%80%9D%3C/text%3E%3Ctext x=%2222%22 y=%2297%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(-18 22 97)%22 fill=%22%23000%22%3E%C2%BF%3C/text%3E%3Ctext x=%22162%22 y=%2239%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2226%22 transform=%22rotate(16 162 39)%22 fill=%22%23000%22%3E%21%3C/text%3E%3Ctext x=%22222%22 y=%22230%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(0 222 230)%22 fill=%22%23000%22%3E%C3%A9%3C/text%3E%3Ctext x=%2239%22 y=%2247%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2218%22 transform=%22rotate(-10 39 47)%22 fill=%22%23000%22%3E%C3%B1%3C/text%3E%3Ctext x=%22217%22 y=%2230%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(16 217 30)%22 fill=%22%23000%22%3E%C3%9F%3C/text%3E%3Ctext x=%22226%22 y=%2297%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(0 226 97)%22 fill=%22%23000%22%3E%E3%81%82%3C/text%3E%3Ctext x=%2296%22 y=%2232%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(16 96 32)%22 fill=%22%23000%22%3E%E5%AD%97%3C/text%3E%3Ctext x=%22157%22 y=%22110%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2226%22 transform=%22rotate(-10 157 110)%22 fill=%22%23000%22%3Eabc%3C/text%3E%3Ctext x=%22220%22 y=%22157%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2220%22 transform=%22rotate(0 220 157)%22 fill=%22%23000%22%3E%C2%B6%3C/text%3E%3Ctext x=%2299%22 y=%22179%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2226%22 transform=%22rotate(0 99 179)%22 fill=%22%23000%22%3E%26amp;%3C/text%3E%3Cpath d=%22M20 210 h70 M20 222 h52 M20 234 h62%22 stroke=%22%23000%22 stroke-width=%221.5%22/%3E%3Cpath d=%22M190 36 c 18 -10 40 -6 44 10%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.5%22/%3E%3C/svg%3E"); }
.board[data-domain="HIS-000"] { --wallpaper: var(--series-4); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%22142%22 y=%22230%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2218%22 transform=%22rotate(16 142 230)%22 fill=%22%23000%22%3EXII%3C/text%3E%3Ctext x=%2211%22 y=%22235%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(-18 11 235)%22 fill=%22%23000%22%3EMCM%3C/text%3E%3Ctext x=%2299%22 y=%2239%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2222%22 transform=%22rotate(16 99 39)%22 fill=%22%23000%22%3E1066%3C/text%3E%3Ctext x=%2229%22 y=%2244%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2220%22 transform=%22rotate(-6 29 44)%22 fill=%22%23000%22%3E1492%3C/text%3E%3Ctext x=%2277%22 y=%2297%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2226%22 transform=%22rotate(0 77 97)%22 fill=%22%23000%22%3E1776%3C/text%3E%3Ctext x=%2219%22 y=%22161%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2220%22 transform=%22rotate(0 19 161)%22 fill=%22%23000%22%3EAD%3C/text%3E%3Ctext x=%22208%22 y=%2295%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2222%22 transform=%22rotate(16 208 95)%22 fill=%22%23000%22%3EBC%3C/text%3E%3Ctext x=%22148%22 y=%22115%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(16 148 115)%22 fill=%22%23000%22%3EIV%3C/text%3E%3Ctext x=%2293%22 y=%22177%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2218%22 transform=%22rotate(-10 93 177)%22 fill=%22%23000%22%3EIX%3C/text%3E%3Ctext x=%22216%22 y=%22172%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2230%22 transform=%22rotate(12 216 172)%22 fill=%22%23000%22%3EMMXX%3C/text%3E%3Ctext x=%22235%22 y=%22234%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2216%22 transform=%22rotate(0 235 234)%22 fill=%22%23000%22%3E%C2%A7%3C/text%3E%3Ctext x=%2237%22 y=%2294%22 font-family=%22Georgia,'Times New Roman',serif%22 font-size=%2220%22 transform=%22rotate(6 37 94)%22 fill=%22%23000%22%3E1215%3C/text%3E%3Cg fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.5%22%3E%3Cpath d=%22M176 236 h56 M180 230 h48 M184 230 v-56 M196 230 v-56 M212 230 v-56 M224 230 v-56 M180 174 h48 M176 168 h56 l-28 -16 z%22/%3E%3C/g%3E%3Cpath d=%22M40 30 h28 l-14 18 l14 18 h-28 l14 -18 z%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.5%22/%3E%3C/svg%3E"); }
.board[data-domain="GEO-000"] { --wallpaper: var(--series-6); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%22160%22 y=%22163%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(16 160 163)%22 fill=%22%23000%22%3EN%3C/text%3E%3Ctext x=%22222%22 y=%22226%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(16 222 226)%22 fill=%22%23000%22%3EE%3C/text%3E%3Ctext x=%2236%22 y=%22243%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2226%22 transform=%22rotate(16 36 243)%22 fill=%22%23000%22%3ES%3C/text%3E%3Ctext x=%22102%22 y=%22167%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(16 102 167)%22 fill=%22%23000%22%3EW%3C/text%3E%3Ctext x=%22146%22 y=%2247%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(0 146 47)%22 fill=%22%23000%22%3E0%C2%B0%3C/text%3E%3Ctext x=%22101%22 y=%22224%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(12 101 224)%22 fill=%22%23000%22%3E45%C2%B0N%3C/text%3E%3Ctext x=%22207%22 y=%2298%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2226%22 transform=%22rotate(-6 207 98)%22 fill=%22%23000%22%3E90%C2%B0%3C/text%3E%3Ctext x=%2292%22 y=%22102%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(-18 92 102)%22 fill=%22%23000%22%3E180%C2%B0%3C/text%3E%3Ctext x=%2296%22 y=%2242%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2226%22 transform=%22rotate(-18 96 42)%22 fill=%22%23000%22%3E23.5%C2%B0%3C/text%3E%3Ctext x=%22142%22 y=%22245%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(-10 142 245)%22 fill=%22%23000%22%3E%E2%89%88%3C/text%3E%3Ctext x=%22222%22 y=%2244%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(-18 222 44)%22 fill=%22%23000%22%3E%E2%96%B2%3C/text%3E%3Ctext x=%22170%22 y=%22114%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2226%22 transform=%22rotate(16 170 114)%22 fill=%22%23000%22%3E%E2%97%A6%3C/text%3E%3Cg fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.4%22%3E%3Cpath d=%22M30 190 q30 -30 60 0 t60 0%22/%3E%3Cpath d=%22M20 210 q40 -40 80 0 t80 0%22/%3E%3Cpath d=%22M40 170 q20 -18 40 0%22/%3E%3C/g%3E%3Cg stroke=%22%23000%22 stroke-width=%221.5%22 fill=%22none%22%3E%3Ccircle cx=%22200%22 cy=%2260%22 r=%2222%22/%3E%3Cpath d=%22M200 34 v52 M174 60 h52%22/%3E%3Cpath d=%22M200 40 l5 20 l-5 20 l-5 -20 z%22 fill=%22%23000%22/%3E%3C/g%3E%3C/svg%3E"); }
.board[data-domain="COM-000"] { --wallpaper: var(--series-7); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%22205%22 y=%22172%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(12 205 172)%22 fill=%22%23000%22%3E%26lt;/%26gt;%3C/text%3E%3Ctext x=%2231%22 y=%22102%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(0 31 102)%22 fill=%22%23000%22%3E%7B %7D%3C/text%3E%3Ctext x=%22158%22 y=%22107%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(-10 158 107)%22 fill=%22%23000%22%3E0%3C/text%3E%3Ctext x=%22156%22 y=%2249%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(-18 156 49)%22 fill=%22%23000%22%3E1%3C/text%3E%3Ctext x=%22211%22 y=%22106%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(0 211 106)%22 fill=%22%23000%22%3E01%3C/text%3E%3Ctext x=%22168%22 y=%22241%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2226%22 transform=%22rotate(6 168 241)%22 fill=%22%23000%22%3E( )%3C/text%3E%3Ctext x=%2237%22 y=%2240%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(12 37 40)%22 fill=%22%23000%22%3E;%3C/text%3E%3Ctext x=%22101%22 y=%22114%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(-10 101 114)%22 fill=%22%23000%22%3E=%26gt;%3C/text%3E%3Ctext x=%22101%22 y=%2233%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(0 101 33)%22 fill=%22%23000%22%3E%23%3C/text%3E%3Ctext x=%2287%22 y=%22237%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(0 87 237)%22 fill=%22%23000%22%3E%5B %5D%3C/text%3E%3Ctext x=%2293%22 y=%22167%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(-6 93 167)%22 fill=%22%23000%22%3E%CE%BB%3C/text%3E%3Ctext x=%22220%22 y=%2235%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(12 220 35)%22 fill=%22%23000%22%3E%26amp;%26amp;%3C/text%3E%3Crect x=%22160%22 y=%22170%22 width=%2270%22 height=%2246%22 rx=%225%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.5%22/%3E%3Cpath d=%22M172 186 l8 6 l-8 6 M186 200 h16%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.5%22/%3E%3Cpath d=%22M30 40 h30 v20 h30 M60 60 v24 h-30%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.4%22/%3E%3Ccircle cx=%2230%22 cy=%2240%22 r=%223%22 fill=%22%23000%22/%3E%3Ccircle cx=%2290%22 cy=%2260%22 r=%223%22 fill=%22%23000%22/%3E%3Ccircle cx=%2230%22 cy=%2284%22 r=%223%22 fill=%22%23000%22/%3E%3C/svg%3E"); }
.board[data-domain="ART-000"] { --wallpaper: var(--series-2); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%2289%22 y=%22157%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(12 89 157)%22 fill=%22%23000%22%3E%E2%9C%8E%3C/text%3E%3Ctext x=%2240%22 y=%2293%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(0 40 93)%22 fill=%22%23000%22%3E%E2%97%90%3C/text%3E%3Ctext x=%2210%22 y=%22169%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(16 10 169)%22 fill=%22%23000%22%3E%E2%96%B3%3C/text%3E%3Ctext x=%22169%22 y=%2293%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(16 169 93)%22 fill=%22%23000%22%3E%E2%97%8B%3C/text%3E%3Ctext x=%22213%22 y=%22221%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(0 213 221)%22 fill=%22%23000%22%3E%E2%96%A1%3C/text%3E%3Ctext x=%22219%22 y=%2291%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(0 219 91)%22 fill=%22%23000%22%3E%E2%97%87%3C/text%3E%3Ctext x=%2275%22 y=%22222%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(0 75 222)%22 fill=%22%23000%22%3E%E2%9C%A6%3C/text%3E%3Ctext x=%22224%22 y=%22165%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(16 224 165)%22 fill=%22%23000%22%3E%E2%97%8D%3C/text%3E%3Ctext x=%2215%22 y=%2231%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(0 15 31)%22 fill=%22%23000%22%3E%E2%AC%AD%3C/text%3E%3Ctext x=%2290%22 y=%2227%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(6 90 27)%22 fill=%22%23000%22%3E%E2%9C%A7%3C/text%3E%3Ctext x=%2275%22 y=%22110%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(-6 75 110)%22 fill=%22%23000%22%3E%E2%9C%8E%3C/text%3E%3Ctext x=%22151%22 y=%22235%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(0 151 235)%22 fill=%22%23000%22%3E%E2%97%90%3C/text%3E%3Cpath d=%22M20 200 c30 -40 60 20 90 -10 s40 -30 60 0%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%222.2%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M190 40 c22 -14 50 4 40 26 c-6 12 -22 6 -26 16 c-4 10 -28 6 -26 -12 c1 -12 4 -22 12 -30 z%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.5%22/%3E%3C/svg%3E"); }
.board[data-domain="MUS-000"] { --wallpaper: var(--series-8); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%22151%22 y=%2231%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(-18 151 31)%22 fill=%22%23000%22%3E%E2%99%AA%3C/text%3E%3Ctext x=%2237%22 y=%2249%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(16 37 49)%22 fill=%22%23000%22%3E%E2%99%AB%3C/text%3E%3Ctext x=%22102%22 y=%22166%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(6 102 166)%22 fill=%22%23000%22%3E%E2%99%A9%3C/text%3E%3Ctext x=%2215%22 y=%22244%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(0 15 244)%22 fill=%22%23000%22%3E%E2%99%AC%3C/text%3E%3Ctext x=%22212%22 y=%22231%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(16 212 231)%22 fill=%22%23000%22%3E%E2%99%AD%3C/text%3E%3Ctext x=%22232%22 y=%2226%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(-18 232 26)%22 fill=%22%23000%22%3E%E2%99%AF%3C/text%3E%3Ctext x=%2222%22 y=%22175%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(16 22 175)%22 fill=%22%23000%22%3E%F0%9D%84%9E%3C/text%3E%3Ctext x=%2280%22 y=%22230%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(-6 80 230)%22 fill=%22%23000%22%3E%E2%99%AE%3C/text%3E%3Ctext x=%2289%22 y=%2241%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(0 89 41)%22 fill=%22%23000%22%3Eff%3C/text%3E%3Ctext x=%22140%22 y=%22238%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(16 140 238)%22 fill=%22%23000%22%3Epp%3C/text%3E%3Ctext x=%22152%22 y=%22156%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(0 152 156)%22 fill=%22%23000%22%3E3/4%3C/text%3E%3Ctext x=%2240%22 y=%22104%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(16 40 104)%22 fill=%22%23000%22%3E4/4%3C/text%3E%3Cpath d=%22M10 200 h240 M10 210 h240 M10 220 h240 M10 230 h240 M10 240 h240%22 stroke=%22%23000%22 stroke-width=%221%22/%3E%3C/svg%3E"); }
.board[data-domain="BUS-000"] { --wallpaper: var(--series-4); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%22103%22 y=%22110%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(12 103 110)%22 fill=%22%23000%22%3E%24%3C/text%3E%3Ctext x=%2280%22 y=%22224%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(-10 80 224)%22 fill=%22%23000%22%3E%E2%82%AC%3C/text%3E%3Ctext x=%2275%22 y=%22165%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(-10 75 165)%22 fill=%22%23000%22%3E%C2%A3%3C/text%3E%3Ctext x=%2230%22 y=%2248%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2226%22 transform=%22rotate(12 30 48)%22 fill=%22%23000%22%3E%C2%A5%3C/text%3E%3Ctext x=%22169%22 y=%22173%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(0 169 173)%22 fill=%22%23000%22%3E%25%3C/text%3E%3Ctext x=%22212%22 y=%22108%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(0 212 108)%22 fill=%22%23000%22%3E%E2%86%91%3C/text%3E%3Ctext x=%22157%22 y=%22237%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(0 157 237)%22 fill=%22%23000%22%3E%E2%86%97%3C/text%3E%3Ctext x=%22228%22 y=%22179%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(-18 228 179)%22 fill=%22%23000%22%3E%2B%25%3C/text%3E%3Ctext x=%2211%22 y=%22109%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(-18 11 109)%22 fill=%22%23000%22%3E%CE%A3%3C/text%3E%3Ctext x=%22217%22 y=%22232%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2220%22 transform=%22rotate(0 217 232)%22 fill=%22%23000%22%3EROI%3C/text%3E%3Ctext x=%2228%22 y=%22228%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(-6 28 228)%22 fill=%22%23000%22%3EP%26amp;L%3C/text%3E%3Ctext x=%22158%22 y=%2231%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(-18 158 31)%22 fill=%22%23000%22%3E%E2%88%86%3C/text%3E%3Cg fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.5%22%3E%3Cpath d=%22M160 236 v-20 h14 v20 M182 236 v-38 h14 v38 M204 236 v-56 h14 v56 M154 236 h72%22/%3E%3C/g%3E%3Cpath d=%22M30 70 l26 -22 l18 12 l30 -28 M92 32 h12 v12%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.6%22/%3E%3C/svg%3E"); }
.board[data-domain="GEN-000"] { --wallpaper: var(--accent); --wallpaper-tile: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Ctext x=%2276%22 y=%22227%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(-10 76 227)%22 fill=%22%23000%22%3E%E2%9C%A6%3C/text%3E%3Ctext x=%22143%22 y=%22158%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(-10 143 158)%22 fill=%22%23000%22%3E%E2%97%8B%3C/text%3E%3Ctext x=%2226%22 y=%22161%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2226%22 transform=%22rotate(-18 26 161)%22 fill=%22%23000%22%3E%2B%3C/text%3E%3Ctext x=%2299%22 y=%2233%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2226%22 transform=%22rotate(6 99 33)%22 fill=%22%23000%22%3E%C2%B7%3C/text%3E%3Ctext x=%22221%22 y=%22104%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(6 221 104)%22 fill=%22%23000%22%3E%E2%97%87%3C/text%3E%3Ctext x=%2228%22 y=%2239%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(6 28 39)%22 fill=%22%23000%22%3E%E2%96%B3%3C/text%3E%3Ctext x=%22230%22 y=%2250%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(16 230 50)%22 fill=%22%23000%22%3E%E2%96%A1%3C/text%3E%3Ctext x=%22205%22 y=%22157%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2216%22 transform=%22rotate(16 205 157)%22 fill=%22%23000%22%3E%E2%9C%A7%3C/text%3E%3Ctext x=%22149%22 y=%22229%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(6 149 229)%22 fill=%22%23000%22%3E%E2%9C%A6%3C/text%3E%3Ctext x=%2227%22 y=%22240%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2230%22 transform=%22rotate(-18 27 240)%22 fill=%22%23000%22%3E%E2%97%8B%3C/text%3E%3Ctext x=%22162%22 y=%2236%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2218%22 transform=%22rotate(-6 162 36)%22 fill=%22%23000%22%3E%2B%3C/text%3E%3Ctext x=%2281%22 y=%22115%22 font-family=%22Segoe UI Symbol,'Noto Sans Symbols',sans-serif%22 font-size=%2222%22 transform=%22rotate(-10 81 115)%22 fill=%22%23000%22%3E%C2%B7%3C/text%3E%3Ccircle cx=%22129%22 cy=%2243%22 r=%222.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22232%22 cy=%22133%22 r=%221.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22254%22 cy=%2232%22 r=%222.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22139%22 cy=%2253%22 r=%221.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22240%22 cy=%22200%22 r=%222.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22111%22 cy=%22171%22 r=%221.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22168%22 cy=%22163%22 r=%222%22 fill=%22%23000%22/%3E%3Ccircle cx=%22137%22 cy=%2215%22 r=%222%22 fill=%22%23000%22/%3E%3Ccircle cx=%22163%22 cy=%22253%22 r=%222.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%2213%22 cy=%22117%22 r=%222.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%2292%22 cy=%22154%22 r=%222.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22218%22 cy=%2271%22 r=%222.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22231%22 cy=%22117%22 r=%221.5%22 fill=%22%23000%22/%3E%3Ccircle cx=%22118%22 cy=%2292%22 r=%222.5%22 fill=%22%23000%22/%3E%3C/svg%3E"); }

/* -------------------------------------------------------------------- equation */

.equation-board { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: clamp(6px, 3cqh, 26px); margin: 0; padding: clamp(14px, 5cqh, 44px) clamp(14px, 4cqw, 44px); overflow: hidden; text-align: center; }
.equation-title { color: var(--muted); font-size: clamp(13px, 3.4cqh, 20px); letter-spacing: 0.02em; }
.equation-row { font-size: clamp(22px, 9cqh, 56px); max-width: 100%; padding-top: calc(0.55em + var(--eq-room-top, 0px)); padding-bottom: var(--eq-room-bottom, 0px); transition: opacity 0.35s ease, transform 0.35s ease; }
.equation-row + .equation-row { font-size: clamp(18px, 7cqh, 44px); padding-top: calc(0.45em + var(--eq-room-top, 0px)); }
.equation-row.waiting { visibility: hidden; opacity: 0; transform: translateY(6px); }
.equation-row .katex-display { margin: 0; }
.eq-mark { position: relative; border-radius: 0.18em; transition: color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease; }
.eq-c-blue { --eq: var(--series-1); }
.eq-c-green { --eq: var(--series-3); }
.eq-c-orange { --eq: var(--series-2); }
.eq-c-purple { --eq: var(--series-7); }
.eq-c-red { --eq: var(--series-8); }
.eq-color, .eq-label { color: var(--eq); background-color: color-mix(in srgb, var(--eq) 15%, transparent); box-shadow: 0 0 0 0.08em color-mix(in srgb, var(--eq) 15%, transparent); }
.eq-box, .eq-circle, .eq-underline, .eq-double { color: var(--eq); }
.eq-ink { position: absolute; inset: 0; pointer-events: none; }
.eq-stroke { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke: var(--eq); stroke-linecap: round; stroke-linejoin: round; }
.eq-stroke-cross, .eq-stroke-strike { opacity: 0.92; }
.eq-stroke.drawing path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: eq-draw 0.42s cubic-bezier(0.55, 0.1, 0.35, 1) forwards; }
.eq-stroke-circle.drawing path { animation-duration: 0.55s; }
.eq-stroke.drawing path + path { animation-delay: 0.2s; }
@keyframes eq-draw { to { stroke-dashoffset: 0; } }
.eq-tags { position: absolute; inset: 0; pointer-events: none; }
.eq-tag { position: absolute; padding: 0.18em 0.5em; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--eq) 45%, transparent); background: color-mix(in srgb, var(--eq) 16%, var(--surface)); color: var(--eq); font-weight: 600; line-height: 1.15; font-family: system-ui, "Segoe UI", sans-serif; letter-spacing: 0.02em; white-space: nowrap; animation: eq-tag-in 0.3s ease; }
.equation-board { --eq-blue: var(--series-1); --eq-green: var(--series-3); --eq-orange: var(--series-2); --eq-purple: var(--series-7); --eq-red: var(--series-8); }
.eq-crossed { color: color-mix(in srgb, currentColor 45%, transparent); transition: color 0.4s ease 0.15s; }
.eq-spotlight .katex { color: color-mix(in srgb, var(--text) 26%, transparent); transition: color 0.3s ease; }
.eq-spotlight .eq-mark { color: var(--eq); }
@keyframes eq-tag-in { from { opacity: 0; transform: translateY(0.3em); } to { opacity: 1; transform: none; } }
.eq-tag.below { animation-name: eq-tag-in-below; }
@keyframes eq-tag-in-below { from { opacity: 0; transform: translateY(-0.3em); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .equation-row, .eq-mark { transition: none; }
  .eq-tag { animation: none; }
  .eq-stroke.drawing path { animation: none; stroke-dashoffset: 0; }
}

/* ---------------------------------------------------------------- side by side */

.scene-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; width: 100%; height: 100%; }
.scene-pane { position: relative; display: flex; align-items: stretch; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; container-type: size; border-radius: 10px; }
.scene-pane > * { flex: 1 1 auto; min-width: 0; max-height: 100%; margin: 0; }
.scene-pane + .scene-pane::before { content: ""; position: absolute; left: -6px; top: 12%; bottom: 12%; width: 1px; background: var(--border); }
@container (max-width: 620px) {
  .scene-pair { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .scene-pane + .scene-pane::before { left: 12%; right: 12%; top: -6px; bottom: auto; width: auto; height: 1px; }
}

/* ------------------------------------------------------------- assessment timer */

.quiz-timer { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); background: var(--surface-2); }
.quiz-timer.low { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); }
.quiz-timer.out { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.quiz-timer.starting { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); animation: timer-start 0.85s ease-out 3; }
@keyframes timer-start { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); transform: scale(1.12); } to { box-shadow: 0 0 0 12px transparent; transform: scale(1); } }
.quiz-head-actions { display: flex; align-items: center; gap: 10px; }

.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.subject { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.subject-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.subject-level { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.subject-meter { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 12px; }
.subject-label { color: var(--muted); }
.subject-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.subject-fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.subject-value { min-width: 92px; text-align: right; color: var(--text); }

.scene-tool .picture { width: fit-content; max-width: 100%; align-self: center; margin-inline: auto; }
.scene-tool .picture + .figure-credit { align-self: center; }

.chat-toggle { position: relative; }
.chat-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.chat-toggle.unread::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.session.chat-closed { grid-template-columns: clamp(250px, 18vw, 340px) minmax(0, 1fr); grid-template-areas: "plan centre"; }
.session.chat-closed .session-chat { display: none; }
@media (max-width: 1100px) {
  .session.chat-closed { grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "plan centre"; }
}
@media (max-width: 860px) {
  .session.chat-closed { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
}

.feedback-backdrop { z-index: 60; }
.feedback-modal { width: min(440px, 100%); }
.feedback-modal h3 { margin: 0; }
.feedback-lesson { margin: -8px 0 0; }
.feedback-stars { display: flex; gap: 2px; }
.feedback-star { font-size: 32px; line-height: 1; padding: 2px 4px; background: none; border: 0; color: var(--muted); cursor: pointer; }
.feedback-star.on { color: #e8a400; }
.feedback-star:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.feedback-comment { display: grid; gap: 6px; font-size: 14px; }
.feedback-comment textarea { width: 100%; resize: vertical; }
.feedback-actions { justify-content: flex-end; }

.course-plan-lesson > button { font-weight: 600; }
.course-plan-lesson.current > button { color: var(--accent); }
.course-plan-steps { margin: 4px 0 6px 22px; }
.course-plan-steps .plan-lesson-note { display: block; margin-bottom: 2px; }

.course-rating { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 0; }
.course-rating-stars { color: #e8a400; letter-spacing: 1px; font-size: 18px; }
.course-updated { color: var(--accent); font-weight: 600; }
.course-overview { display: grid; gap: 10px; }
.course-overview h3 { margin: 0; }
.course-outcomes { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.course-overview-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
.course-overview-facts dt { color: var(--muted); font-weight: 600; }
.course-overview-facts dd { margin: 0; }

@font-face { font-family: "Fredoka"; src: url("vendor/playful/fredoka-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("vendor/playful/nunito-latin.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root[data-theme="playful"] {
  --on-accent: #ffffff;
  --on-strong: #ffffff;
  --canvas: #ffffff;
  --ink: #2b2147;
  --bg: #fff6e5;
  --surface: #ffffff;
  --surface-2: #ffefd1;
  --border: #f1d29c;
  --text: #2b2147;
  --muted: #6e5f8c;
  --accent: #6c47e0;
  --accent-soft: rgba(108, 71, 224, 0.12);
  --green: #2b8a3e;
  --amber: #c2410c;
  --red: #d6336c;
  --chart-grid: #fbe7c3;
  --chart-axis: #e8c48a;
}
.theme-swatch.playful { background: linear-gradient(135deg, #ffd43b 0 34%, #ff6b6b 34% 67%, #6c47e0 67%); }

:root[data-young] { --radius: 18px; }
:root[data-young] body { font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; }
:root[data-young] :is(h1, h2, h3, h4, .brand strong, .chrome-nav .nav-link, .board-kicker, .plan-concept, .course-title, .tab) { font-family: "Fredoka", "Nunito", system-ui, sans-serif; font-weight: 600; letter-spacing: 0.01em; }
:root[data-young] :is(button.primary, button.ghost, .chip, .board-question-option) { border-radius: 999px; font-family: "Fredoka", "Nunito", system-ui, sans-serif; font-weight: 500; }
:root[data-young] .card { border-radius: 20px; }
:root[data-young][data-theme="playful"] body { background: radial-gradient(circle at 12% 8%, #ffe3a3 0, transparent 28%), radial-gradient(circle at 88% 0%, #ffd6e7 0, transparent 26%), var(--bg); background-attachment: fixed; }

@font-face { font-family: "Teachers"; src: url("vendor/teachers/teachers-latin.woff2") format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Teachers"; src: url("vendor/teachers/teachers-latin-italic.woff2") format("woff2"); font-weight: 400 800; font-style: italic; font-display: swap; }
button, input, select, textarea { font-family: inherit; }

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  flex: none;
  margin: 0;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s ease;
}
input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}
input[type="checkbox"]:checked { background: var(--accent); }
input[type="checkbox"]:checked::before { transform: translateX(16px); }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }

:root[data-theme="slateBlue"] {
  --on-accent: #0b1a2b;
  --on-strong: #0b1a2b;
  --canvas: #16191c;
  --ink: #e9ebee;
  --bg: #121416;
  --surface: #1a1d21;
  --surface-2: #22262b;
  --border: #30353c;
  --text: #e9ebee;
  --muted: #a0a6af;
  --accent: #7cc4fa;
  --accent-soft: rgba(124, 196, 250, 0.15);
  --green: #5cc98f;
  --amber: #e8b965;
  --red: #f07b72;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --chart-grid: #262b31;
  --chart-axis: #3d444d;
}
.theme-swatch.slateBlue { background: linear-gradient(135deg, #1a1d21 50%, #7cc4fa 50%); }

.session.plan-closed { grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 420px); grid-template-areas: "centre chat"; }
.session.plan-closed.chat-closed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "centre"; }
.session.plan-closed .session-plan { display: none; }
.board-head { align-items: center; }
.board-back { flex: none; width: 30px; height: 30px; font-size: 18px; line-height: 1; }
.board-back[hidden] { display: none; }
@media (max-width: 1100px) {
  .session.plan-closed { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; grid-template-areas: "centre" "chat"; }
  .session.plan-closed.chat-closed { grid-template-areas: "centre"; }
}
@media (max-width: 860px) {
  .session.plan-closed, .session.plan-closed.chat-closed { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
}

.scene-tool[data-kind="question"] { display: flex; align-items: center; justify-content: center; }
.board-question { display: grid; gap: clamp(14px, 3cqh, 24px); justify-items: center; text-align: center; width: min(100%, 860px); margin: auto; padding: 16px; }
.board-question-label { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.board-question.answered .board-question-label { color: var(--green); }
.board-question-text { margin: 0; max-width: 40ch; font-size: clamp(22px, 5.5cqh, 38px); line-height: 1.3; font-weight: 600; }
.board-question-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; width: min(100%, 760px); }
.board-question-options.long { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.board-question-option { position: relative; min-height: 64px; padding: 16px 22px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font-size: clamp(18px, 4.2cqh, 26px); font-weight: 600; line-height: 1.25; cursor: pointer; box-shadow: 0 2px 0 var(--border); transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
.board-question-option:hover:not(:disabled), .board-question-option:focus-visible { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 0 var(--accent-soft); outline: none; }
.board-question-option:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.board-question-option:disabled { cursor: default; opacity: 0.7; box-shadow: none; }
.board-question-answer { display: flex; gap: 10px; width: min(100%, 620px); }
.board-question-answer input { flex: 1 1 auto; min-width: 0; padding: 14px 18px; font-size: clamp(17px, 3.6cqh, 22px); border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); }
.board-question-answer input:focus { border-color: var(--accent); outline: none; }
.board-question-answer button { padding: 0 26px; font-size: 17px; border-radius: 14px; }
.board-question-speak { justify-self: center; }
.board-question-typed { width: min(100%, 620px); display: grid; justify-items: center; gap: 10px; }
.board-question-typed summary { cursor: pointer; font-size: 14px; color: var(--muted); }

.nav-panels { display: flex; align-items: center; gap: 6px; }
.nav-panels[hidden] { display: none; }
.nav-tool { position: relative; width: 36px; height: 34px; color: var(--muted); }
.nav-tool svg, .plan-hide svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-tool[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.side-actions { display: flex; align-items: center; gap: 6px; }
.plan-hide { color: var(--muted); }
.plan-hide:hover { color: var(--accent); }

.practice-run { display: grid; gap: 14px; max-width: 980px; margin: 0 auto; }
.practice-back { justify-self: start; }
.practice-status { margin: 0; }
.quiz-more { justify-self: start; margin-top: 4px; }

.course-hero.with-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 28px; align-items: start; }
.course-hero-main { display: grid; gap: 8px; min-width: 0; align-content: start; }
.course-hero-main .course-description, .course-hero-main .course-progress { max-width: none; }
.course-hero-side { display: grid; gap: 10px; min-width: 0; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.course-hero-side h3 { margin: 0; font-size: 15px; }
.course-hero-side .course-outcomes { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.course-hero-side .course-overview-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; font-size: 13px; }
.course-hero-side .course-overview-facts dt { color: var(--muted); font-weight: 600; margin-top: 6px; }
.course-hero-side .course-overview-facts dd { margin: 0; }
@media (max-width: 860px) {
  .course-hero.with-side { grid-template-columns: minmax(0, 1fr); }
}

.simulation { display: grid; gap: 10px; width: 100%; }
.simulation-canvas { width: 100%; display: block; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.simulation-readouts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; }
.simulation-readout { display: grid; gap: 1px; }
.simulation-readout dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.simulation-readout dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.simulation-controls { display: grid; gap: 8px; }
.simulation-control { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) minmax(70px, auto); align-items: center; gap: 12px; font-size: 14px; }
.simulation-control input[type="range"] { width: 100%; accent-color: var(--accent); }
.simulation-control-value { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.simulation-bar { display: flex; gap: 8px; }

.progress-page { display: grid; gap: 16px; max-width: 1080px; margin: 0 auto; width: 100%; }
.progress-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.progress-subject { display: grid; gap: 14px; border-top: 4px solid var(--banner, var(--accent)); }
.progress-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.progress-title { display: grid; gap: 2px; }
.progress-title h3 { margin: 0; font-size: 18px; }
.progress-meters { display: grid; gap: 6px; }
.progress-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
.progress-metric { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.progress-metric strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.progress-metric-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.progress-areas { display: grid; border-top: 1px solid var(--border); }
.progress-area { display: grid; grid-template-columns: minmax(0, 1fr) auto 48px; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.progress-area:last-child { border-bottom: 0; }
.progress-area-name { display: grid; gap: 2px; min-width: 0; }
.progress-area-rating { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

@keyframes choice-tap { 0% { transform: scale(1); } 35% { transform: scale(0.95); } 70% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes choice-ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } to { box-shadow: 0 0 0 14px transparent; } }
.tapped { animation: choice-tap 0.32s ease-out, choice-ring 0.55s ease-out; }
.choice:has(input:checked) .choice-text, .board-question-option.picked { animation: choice-pop 0.28s ease-out; }
@keyframes choice-pop { 0% { transform: scale(0.97); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .tapped, .choice:has(input:checked) .choice-text, .board-question-option.picked { animation: none; }
}

.music-switch.off { color: var(--muted); }
.checkpoint-head { display: flex; justify-content: flex-end; }
.quiz-head-actions #quiz-music:empty { display: none; }
.q-hint { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.arrange-inline { border: 0; padding: 0; background: none; box-shadow: none; }
.question-sort .arrange-help { margin-top: 0; }
.plan-step-kind { color: var(--accent); font-size: 12px; margin-left: auto; padding-left: 6px; flex: none; }
.plan-mark .bi { font-size: 10px; vertical-align: 0; }
.plan-step.done .plan-mark .bi { font-size: 12px; }

.tutoring-home.has-pins { grid-template-columns: minmax(220px, 270px) minmax(0, 1fr); gap: 18px; }
.tutoring-main { display: grid; gap: 18px; min-width: 0; align-items: start; }
.tutoring-home.has-pins .tutoring-main { grid-template-columns: minmax(0, 1fr); }
.tutoring-home:not(.has-pins) .tutoring-main { display: contents; }
.pinned-panel { position: sticky; top: 88px; display: grid; gap: 10px; padding: 16px; }
.pinned-title { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.pinned-title .bi { color: var(--accent); }
.pinned-list { display: grid; gap: 6px; }
.pinned-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px; border-radius: 10px; }
.pinned-item:hover { background: var(--surface-2); }
.pinned-open { display: grid; gap: 1px; text-align: left; background: none; border: 0; padding: 8px 10px; color: inherit; min-width: 0; }
.pinned-open strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-button { color: var(--muted); }
.pin-button.on { color: var(--accent); }
.recent-item { position: relative; display: flex; min-width: 0; }
.recent-item .pin-button { position: absolute; top: 10px; right: 10px; }
.recent-item .recent-card { display: flex; flex-direction: column; align-items: flex-start; width: 100%; height: 100%; padding-right: 48px; }
.recent-card .session-item-top { min-height: calc(2 * 1.6em); align-items: flex-start; }
.recent-card .recent-meta { margin-top: auto; }
.topic-choice { display: grid; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.topic-choice-text { margin: 0; font-weight: 600; }
.domain-warning .topic-choice-text .bi { color: var(--amber); }
.topic-choice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.start-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.start-mode { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; text-align: left; transition: border-color 0.15s ease, background 0.15s ease; }
.start-mode:hover, .start-mode:focus-visible { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.start-mode-icon { font-size: 24px; color: var(--accent); }
@media (max-width: 860px) {
  .tutoring-home.has-pins { grid-template-columns: 1fr; }
  .pinned-panel { position: static; }
}

.home-card { display: grid; gap: 12px; align-content: start; }
.home-card h3 { margin: 0; }
.home-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.home-fact { display: flex; align-items: flex-start; gap: 16px; padding: 18px 20px; border-left: 5px solid var(--amber); }
.home-fact[hidden] { display: none; }
.home-fact-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: color-mix(in srgb, var(--amber) 20%, transparent); color: var(--amber); font-size: 22px; }
.home-fact-body { display: grid; gap: 8px; min-width: 0; justify-items: start; }
.home-fact-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.home-fact-head h3 { margin: 0; font-size: 17px; }
.home-fact-domain { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.home-fact-domain::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--banner, var(--accent)); }
.home-fact-text { margin: 0; max-width: 75ch; font-size: 15.5px; line-height: 1.55; }
.home-fact-start { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-fact-picture { flex: none; display: grid; gap: 4px; width: 184px; margin: 0 0 0 auto; }
.home-fact-picture img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.home-fact-credit { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.35; overflow-wrap: anywhere; }
.home-fact-credit a { color: inherit; }
@media (max-width: 620px) {
  .home-fact { flex-wrap: wrap; }
  .home-fact-body { flex: 1 1 calc(100% - 64px); }
  .home-fact-picture { order: -1; width: 100%; }
  .home-fact-picture img { aspect-ratio: 16 / 9; max-height: 200px; }
}
.home-stat { display: grid; gap: 4px; padding: 16px 18px; }
.home-stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.home-stat-label .bi { color: var(--accent); }
.home-stat-value { font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.home-list { display: grid; gap: 4px; }
.home-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: inherit; text-align: left; width: 100%; border-left: 3px solid var(--banner, transparent); }
button.home-row:hover { background: var(--surface-2); }
.home-row-main { display: grid; gap: 4px; min-width: 0; flex: 1; }
.home-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.home-row-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.home-row-value.good { color: var(--green); }
.home-row-value.bad { color: var(--red); }
.home-row-go { color: var(--muted); }
.home-row .progress { margin-top: 2px; }
.home-profile { min-height: 150px; }
.home-trends { display: grid; gap: 12px; align-content: start; }
.home-trend { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.home-trend-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.home-delta { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.home-delta .bi { font-size: 18px; }
.home-delta.up { color: var(--green); }
.home-delta.down { color: var(--red); }
.home-spark { width: 100%; max-width: 320px; height: auto; display: block; overflow: visible; }
.home-spark-base { stroke: var(--border); stroke-width: 1; }
.home-spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.home-spark-dot { fill: var(--accent); stroke: var(--surface-2); stroke-width: 2; }
.home-spark-hit { fill: transparent; }
.home-spark g:hover .home-spark-dot { r: 6; }
.home-days { display: grid; grid-template-columns: repeat(7, 14px); gap: 4px; }
.home-day { width: 14px; height: 14px; border-radius: 4px; background: var(--border); }
.home-day.on { background: var(--accent); }
.home-day.today { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 3px var(--muted); }
.home-skills { display: grid; gap: 10px; align-content: start; }
.home-skill { display: grid; gap: 2px; }
.home-skill .subject-meter { grid-template-columns: 112px minmax(0, 1fr) auto; font-size: 13px; }
.home-skill .subject-value { min-width: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }
.home-skill > .small { padding-left: 120px; }
@media (max-width: 520px) {
  .home-skill > .small { padding-left: 0; }
}

.challenge-setup { display: grid; gap: 20px; }
.challenge-topic { display: grid; gap: 8px; }
.challenge-topic .form-label { margin: 0; font-weight: 600; }
.challenge-search { position: relative; }
.challenge-search > .bi { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.challenge-search .form-control { padding-left: 44px; }
.challenge-picks { display: grid; gap: 12px; min-width: 0; }
.challenge-chosen, .challenge-picks-list { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.challenge-chosen { padding: 10px; border-radius: 16px; background: var(--surface-2); }
.challenge-pick-remove { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-right: -4px; border-radius: 50%; font-size: 11px; opacity: 0.75; }
.challenge-pick.chosen:hover .challenge-pick-remove, .challenge-pick.chosen:focus-visible .challenge-pick-remove { opacity: 1; background: color-mix(in srgb, var(--accent) 16%, transparent); }
.challenge-picks[hidden] { display: none; }
.challenge-pick { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 38px; padding: 6px 14px 6px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.9rem; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease; }
.challenge-pick:hover, .challenge-pick:focus-visible { border-color: var(--accent); }
.challenge-pick-mark { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: color-mix(in srgb, var(--banner, var(--accent)) 16%, transparent); color: var(--banner, var(--accent)); font-size: 13px; }
.challenge-pick-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.challenge-pick.chosen { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.challenge-pick.chosen .challenge-pick-mark { background: var(--accent); color: var(--on-accent); }
.challenge-pick-more { padding: 6px 14px; color: var(--muted); font-weight: 500; border-style: dashed; }
.challenge-pick-more .bi { font-size: 12px; }
.quiz-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.quiz-kind { display: grid; justify-items: center; gap: 8px; padding: 18px 12px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease; }
.quiz-kind .bi { font-size: 28px; color: var(--muted); transition: color 0.15s ease; }
.quiz-kind:hover, .quiz-kind:focus-visible { border-color: var(--accent); }
.quiz-kind.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); }
.quiz-kind.active .bi { color: var(--accent); }
.assessment:not(.chosen) { min-height: calc(100vh - 180px); align-content: center; }
.assessment:not(.chosen) .quiz-kinds { gap: 18px; max-width: 880px; width: 100%; margin: 0 auto; }
.assessment:not(.chosen) .quiz-kind { gap: 14px; padding: 44px 16px; border-radius: 22px; font-size: 1.2rem; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.assessment:not(.chosen) .quiz-kind .bi { font-size: 46px; color: var(--accent); }
.assessment.chosen .quiz-kind { grid-auto-flow: column; justify-content: center; align-items: center; gap: 10px; padding: 12px; }
.assessment.chosen .quiz-kind .bi { font-size: 22px; }
.challenge-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.challenge-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.challenge-field[hidden] { display: none; }
.challenge-field .form-label { margin: 0; }
.challenge-field-wide { grid-column: 1 / -1; }
.challenge-start { min-width: 160px; }
.challenge-go { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.challenge-launch { display: grid; justify-items: center; gap: 16px; padding: 10px 0 4px; text-align: center; }
.challenge-setup.open .challenge-launch { display: flex; justify-content: flex-end; padding: 0; }
.challenge-summary { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin: 0; font-size: 1.1rem; font-weight: 700; }
.challenge-summary[hidden], .challenge-setup.open .challenge-summary { display: none; }
.challenge-summary .bi { flex: none; color: var(--accent); }
.challenge-summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.challenge-options-toggle[aria-expanded="true"] { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.challenge-options-panel { display: grid; gap: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.challenge-options-panel[hidden] { display: none; }
.challenge-countdown { --left: 1; display: grid; justify-items: center; gap: 8px; color: var(--accent); font-weight: 700; }
.challenge-countdown[hidden] { display: none; }
.challenge-countdown-ring { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--left) * 360deg), var(--surface-2) 0); }
.challenge-countdown-number { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--surface); font-size: 30px; font-variant-numeric: tabular-nums; }
.challenge-countdown-label { font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }
@property --left { syntax: "<number>"; inherits: true; initial-value: 1; }
.challenge-countdown-ring { position: relative; }
.challenge-countdown-number { position: relative; }
.challenge-countdown.counting { transition: --left 1s linear; }
.challenge-countdown.counting .challenge-countdown-number { animation: launch-pop 1s ease-out; }
.challenge-countdown.writing .challenge-countdown-ring { background: var(--surface-2); }
.challenge-countdown.writing .challenge-countdown-ring::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--accent) 0 80deg, transparent 0); animation: launch-spin 0.9s linear infinite; }
.challenge-countdown.writing .challenge-countdown-number { font-size: 24px; }
.challenge-countdown.go .challenge-countdown-ring { background: var(--green); }
.challenge-countdown.go .challenge-countdown-number { color: var(--green); animation: launch-pop 0.5s ease-out; }
.challenge-countdown.go { color: var(--green); }
.challenge-setup.launching .challenge-go, .challenge-setup.launching .challenge-options-panel { display: none; }
.challenge-setup.launching .challenge-launch { display: grid; justify-items: center; gap: 18px; padding: 28px 0 18px; }
.challenge-setup.launching .challenge-summary { display: inline-flex; }
.challenge-setup.launching .challenge-countdown-ring { width: 128px; height: 128px; box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 10%, transparent); }
.challenge-setup.launching .challenge-countdown-number { width: 104px; height: 104px; font-size: 46px; }
.challenge-setup.launching .challenge-countdown.writing .challenge-countdown-number { font-size: 32px; }
.challenge-setup.launching .challenge-countdown-label { font-size: 15px; }
@keyframes launch-spin { to { transform: rotate(360deg); } }
@keyframes launch-pop { from { transform: scale(1.35); opacity: 0.4; } 30% { transform: scale(1); opacity: 1; } }
.flashcards-nav .primary.waiting, #quiz-submit.waiting { position: relative; overflow: hidden; }
.flashcards-nav .primary.waiting::after, #quiz-submit.waiting::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: currentColor; opacity: 0.55; transform-origin: left center; animation: quiz-wait 2s linear forwards; }
@keyframes quiz-wait { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.library-suggestion .suggestion-icon { color: var(--accent); }
.readiness-page { display: grid; gap: 12px; max-width: 860px; margin: 0 auto; }
.readiness-card { display: grid; gap: 14px; }
.readiness-choice .bi-mortarboard { color: var(--accent); }
.readiness-run { display: grid; gap: 12px; }
.readiness-outcome { display: grid; gap: 10px; justify-items: start; margin-top: 12px; }
.readiness-outcome h3 { margin: 6px 0 0; font-size: 1rem; }
.challenge-main { display: grid; gap: 18px; min-width: 0; }
.challenge-main[hidden] { display: none; }
@media (max-width: 520px) {
  .quiz-kinds { gap: 8px; }
  .quiz-kind { padding: 14px 6px; }
  .assessment:not(.chosen) .quiz-kinds { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .assessment:not(.chosen) .quiz-kind { grid-auto-flow: column; justify-content: start; padding: 22px 20px; }
  .assessment.chosen .quiz-kind { grid-auto-flow: row; gap: 4px; padding: 10px 6px; }
  .challenge-go { width: 100%; }
  .challenge-go .btn { flex: 1 1 0; }
}

.choice input[type="checkbox"], .unenrol-reason input[type="checkbox"], .survey-option input[type="checkbox"] { width: 20px; height: 20px; border-radius: 6px; background: var(--surface); border: 2px solid var(--border); }
.choice input[type="checkbox"]::before, .unenrol-reason input[type="checkbox"]::before, .survey-option input[type="checkbox"]::before { content: ""; inset: 0; width: auto; height: auto; border-radius: 0; background: var(--on-accent); box-shadow: none; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l3 3 6-6.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px 14px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l3 3 6-6.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px 14px no-repeat; opacity: 0; transform: scale(0.6); transition: opacity 0.12s ease, transform 0.12s ease; }
.choice input[type="checkbox"]:checked, .unenrol-reason input[type="checkbox"]:checked, .survey-option input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.choice input[type="checkbox"]:checked::before, .unenrol-reason input[type="checkbox"]:checked::before, .survey-option input[type="checkbox"]:checked::before { opacity: 1; transform: scale(1); }

.staff { display: grid; gap: 8px; margin: 6px 0 10px; max-width: 100%; }
.staff-svg { width: min(100%, var(--staff-width, 420px)); height: auto; overflow: visible; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.staff-editable .staff-svg { cursor: crosshair; }
.staff-line { stroke: var(--text); stroke-width: 1; opacity: 0.7; }
.staff-glyph { fill: var(--text); }
.staff-time { fill: var(--text); font-weight: 800; font-size: 19px; font-family: Georgia, "Times New Roman", serif; }
.staff-head { fill: var(--text); stroke: var(--text); stroke-width: 1.2; }
.staff-head.hollow { fill: var(--surface); }
.staff-stem, .staff-flag { stroke: var(--text); stroke-width: 1.4; fill: none; }
.staff-ink { fill: var(--text); }
.staff-event.written .staff-head { fill: var(--accent); stroke: var(--accent); }
.staff-event.written .staff-head.hollow { fill: var(--surface); }
.staff-event.written .staff-stem, .staff-event.written .staff-flag, .staff-event.written .staff-glyph { stroke: var(--accent); fill: var(--accent); }
.staff-event.written .staff-stem { fill: none; }
.staff-slot { fill: var(--accent-soft); stroke: var(--accent); stroke-dasharray: 3 3; opacity: 0.55; }
.staff-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.staff-marks { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.staff-mark { border: 0; background: var(--surface); color: var(--text); width: 36px; height: 32px; font-size: 18px; font-family: 'Bravura Text', 'Noto Music', 'Segoe UI Symbol', serif; }
.staff-mark.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.expression-field { display: grid; gap: 8px; }
.expression-input { font-family: var(--mono); font-size: 17px; }
.expression-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.expression-key { min-width: 40px; font-family: var(--mono); }
.expression-preview { min-height: 28px; font-size: 1.15em; }
.code-language { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: lowercase; }
.code-input { width: 100%; font-family: var(--mono); font-size: 14px; line-height: 1.5; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--canvas); color: var(--ink); tab-size: 4; resize: vertical; }
.review-list { display: grid; gap: 10px; margin-bottom: 14px; }
.review-item { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); border-left: 4px solid var(--border); background: var(--surface); }
.review-item.right { border-left-color: var(--green); }
.review-item.part { border-left-color: var(--amber); }
.review-item.wrong { border-left-color: var(--red); }
.review-top { display: flex; align-items: baseline; gap: 8px; }
.review-mark .bi { font-size: 16px; }
.review-item.right .review-mark { color: var(--green); }
.review-item.part .review-mark { color: var(--amber); }
.review-item.wrong .review-mark { color: var(--red); }
.review-item.waiting .review-mark { color: var(--muted); }
.review-prompt { flex: 1; font-weight: 600; }
.review-part { font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.review-answers { display: grid; gap: 2px; font-size: 14px; }
.review-yours { color: var(--muted); }
.review-right { color: var(--green); font-weight: 600; }
.review-why { margin: 0; font-size: 14px; color: var(--muted); }

.study-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 16px; }
.study-domain { display: grid; justify-items: center; align-content: center; gap: 16px; min-height: 210px; padding: 28px 16px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: center; transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease; }
.study-domain:hover, .study-domain:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); transform: translateY(-2px); }
.study-domain-icon { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 24px; background: var(--accent-soft); color: var(--accent); font-size: 38px; line-height: 1; }
.study-domain-title { font-size: 1.2rem; font-weight: 700; line-height: 1.25; }
@media (max-width: 520px) {
  .study-domain { min-height: 160px; padding: 20px 12px; gap: 12px; }
  .study-domain-icon { width: 64px; height: 64px; border-radius: 20px; font-size: 30px; }
  .study-domain-title { font-size: 1.05rem; }
}
.study-panel { display: grid; gap: 12px; max-width: 760px; margin: 0 auto; }
.study-panel .start-panel { max-width: none; margin: 0; }
.study-back { justify-self: start; }
@media (prefers-reduced-motion: reduce) {
  .study-domain { transition: none; }
  .study-domain:hover, .study-domain:focus-visible { transform: none; }
}

.speaking-panel { display: grid; gap: 14px; }
.speaking-panel h2 { margin: 0; }
.speaking-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.speaking-mode { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; text-align: left; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease; }
.speaking-mode:hover, .speaking-mode:focus-visible { border-color: var(--accent); }
.speaking-mode.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.speaking-mode-icon { font-size: 24px; color: var(--accent); }
.speaking-setup { display: grid; gap: 14px; }
.speaking-setup[hidden], .speaking-fields[hidden] { display: none; }
.speaking-fields { display: grid; gap: 14px; }
.speaking-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.speaking-goals { display: flex; flex-wrap: wrap; gap: 6px; }
.speaking-start { justify-self: start; min-width: 160px; }
.speaking-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.speaking-actions [hidden] { display: none; }
@media (max-width: 520px) {
  .speaking-modes, .speaking-pair { grid-template-columns: minmax(0, 1fr); }
  .speaking-start { justify-self: stretch; }
  .speaking-actions .speaking-start { flex: 1 1 0; }
}

.speaking-call { --voice: 0; display: grid; gap: 14px; max-width: 1180px; margin: 0 auto; }
.speaking-head { display: flex; align-items: center; gap: 12px; }
.speaking-title { display: grid; min-width: 0; flex: 1; }
.speaking-title h2 { margin: 0; font-size: 1.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speaking-clock { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.speaking-body { display: grid; grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.speaking-stage { position: sticky; top: 12px; display: grid; justify-items: center; align-content: center; gap: 12px; min-height: min(560px, calc(100vh - 170px)); padding: 28px 18px; border-radius: 22px; border: 1px solid var(--border); background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface) 70%); }
.speaking-avatar { position: relative; display: grid; place-items: center; width: 148px; height: 148px; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: default; }
.speaking-avatar:not(:disabled) { cursor: pointer; }
.speaking-avatar:disabled { opacity: 1; }
.speaking-initial { position: relative; z-index: 1; font-size: 56px; font-weight: 700; line-height: 1; }
.speaking-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--accent); opacity: 0; pointer-events: none; }
.speaking-call[data-phase="listening"] .speaking-ring, .speaking-call[data-phase="hearing"] .speaking-ring { opacity: calc(0.25 + var(--voice) * 0.75); transform: scale(calc(1.06 + var(--voice) * 0.32)); transition: transform 90ms linear, opacity 90ms linear; border-color: var(--green); }
.speaking-call[data-phase="listening"] .speaking-ring.second, .speaking-call[data-phase="hearing"] .speaking-ring.second { transform: scale(calc(1.12 + var(--voice) * 0.6)); opacity: calc(var(--voice) * 0.5); }
.speaking-call[data-phase="speaking"] .speaking-ring { animation: speaking-pulse 1.6s ease-out infinite; }
.speaking-call[data-phase="speaking"] .speaking-ring.second { animation-delay: 0.8s; }
.speaking-call[data-phase="thinking"] .speaking-ring, .speaking-call[data-phase="connecting"] .speaking-ring { opacity: 0.7; border-color: transparent; border-top-color: var(--accent); transform: scale(1.1); animation: speaking-spin 1s linear infinite; }
.speaking-call[data-phase="thinking"] .speaking-ring.second, .speaking-call[data-phase="connecting"] .speaking-ring.second { display: none; }
.speaking-call[data-phase="muted"] .speaking-avatar, .speaking-call[data-phase="ended"] .speaking-avatar, .speaking-call[data-phase="off"] .speaking-avatar { background: var(--muted); }
@keyframes speaking-pulse { from { opacity: 0.7; transform: scale(1); } to { opacity: 0; transform: scale(1.45); } }
@keyframes speaking-spin { to { transform: scale(1.1) rotate(360deg); } }
.speaking-name { font-size: 1.15rem; }
.speaking-phase { color: var(--muted); font-weight: 600; min-height: 1.5em; }
.speaking-call[data-phase="hearing"] .speaking-phase { color: var(--green); }
.speaking-controls { display: flex; gap: 18px; margin-top: 10px; }
.speaking-control { display: grid; place-items: center; width: 60px; height: 60px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 24px; transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
.speaking-control:hover, .speaking-control:focus-visible { border-color: var(--accent); }
.speaking-mute.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.speaking-end { background: var(--red); border-color: var(--red); color: #fff; }
.speaking-end:hover, .speaking-end:focus-visible { border-color: var(--text); }
.speaking-help { position: relative; }
.speaking-help-button:disabled { opacity: 0.45; cursor: default; }
.speaking-help-menu { position: absolute; bottom: calc(100% + 10px); left: 50%; z-index: 20; display: grid; gap: 2px; min-width: 180px; padding: 6px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); transform: translateX(-50%); }
.speaking-help-menu[hidden] { display: none; }
.speaking-help-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 14px; text-align: left; white-space: nowrap; }
.speaking-help-item:hover:not(:disabled), .speaking-help-item:focus-visible { background: var(--surface-2); }
.speaking-help-item:disabled { opacity: 0.45; }
.speaking-help-item .bi { color: var(--muted); }
.speaking-side { display: grid; gap: 14px; min-width: 0; }
.speaking-meters { display: grid; gap: 8px; width: 100%; }
.speaking-meter { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; align-items: center; gap: 10px; font-size: 14px; }
.speaking-meter-label { color: var(--muted); }
.speaking-meter-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.speaking-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.5s ease; }
.speaking-meter-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.speaking-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 0; width: 100%; }
.speaking-stats > div { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.speaking-stats dt { font-size: 12px; font-weight: 500; color: var(--muted); }
.speaking-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.speaking-transcript { display: grid; align-content: start; gap: 10px; margin: 0; padding: 0; list-style: none; max-height: calc(100vh - 360px); min-height: 220px; overflow-y: auto; }
.speaking-line { display: grid; gap: 4px; max-width: 88%; padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.speaking-line.tutor { justify-self: start; border-bottom-left-radius: 4px; }
.speaking-line.learner { justify-self: end; background: var(--accent-soft); border-color: transparent; border-bottom-right-radius: 4px; }
.speaking-who { font-size: 12px; font-weight: 700; color: var(--muted); }
.speaking-words { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.speaking-words.pending { color: var(--muted); letter-spacing: 0.2em; }
.speaking-feedback { display: grid; gap: 2px; margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border-left: 3px solid var(--amber); animation: speaking-note 0.35s ease both; }
.speaking-feedback.perfect { border-left-color: var(--green); }
.speaking-feedback-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.speaking-feedback p { margin: 0; font-size: 14px; white-space: pre-wrap; }
@keyframes speaking-note { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.speaking-summary { display: grid; justify-items: center; gap: 16px; width: 100%; max-width: 420px; box-shadow: none; }
.speaking-overall { display: grid; justify-items: center; }
.speaking-overall-value { font-size: 64px; font-weight: 800; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.speaking-summary-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
@media (max-width: 860px) {
  .speaking-body { grid-template-columns: minmax(0, 1fr); }
  .speaking-stage { position: static; min-height: 0; padding: 22px 14px; }
  .speaking-avatar { width: 116px; height: 116px; }
  .speaking-initial { font-size: 44px; }
  .speaking-transcript { max-height: none; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .speaking-call .speaking-ring { animation: none !important; transition: none; }
  .speaking-feedback { animation: none; }
}

:root { --backdrop: url("wallpapers/brand.svg"); --backdrop-size: 260px; --backdrop-ink: color-mix(in srgb, var(--accent) 12%, transparent); }
:root[data-bs-theme="dark"] { --backdrop-ink: color-mix(in srgb, var(--accent) 15%, transparent); }
:root[data-wallpaper="sections"][data-module="library"] { --backdrop: url("wallpapers/library.svg"); --backdrop-size: 300px; }
:root[data-wallpaper="sections"][data-module="study"] { --backdrop: url("wallpapers/study.svg"); --backdrop-size: 300px; }
:root[data-wallpaper="sections"][data-module="challenges"] { --backdrop: url("wallpapers/challenges.svg"); --backdrop-size: 280px; }
:root[data-module]:not([data-wallpaper="plain"]):not([data-theme="highContrast"]) body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--backdrop-ink);
  -webkit-mask: var(--backdrop) 0 0 / var(--backdrop-size) repeat;
  mask: var(--backdrop) 0 0 / var(--backdrop-size) repeat;
}
.wallpaper-switch { display: flex; width: 100%; }
.wallpaper-switch button { flex: 1 1 0; padding: 6px 8px; font-size: 13px; white-space: nowrap; }
.unenrol-backdrop { z-index: 60; }
.unenrol-modal { width: min(460px, 100%); }
.unenrol-modal h3 { margin: 0; }
.unenrol-course { margin: -8px 0 0; }
.unenrol-reasons { display: grid; gap: 6px; }
.unenrol-reason { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.unenrol-reason:hover { border-color: var(--accent); }
.unenrol-reason:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.unenrol-reason input { margin: 0; flex: none; }
.unenrol-comment { display: grid; gap: 6px; font-size: 14px; }
.unenrol-comment textarea { width: 100%; resize: vertical; }
.unenrol-actions { display: flex; justify-content: flex-end; gap: 8px; }

:root { --medal-1: #b8743a; --medal-2: #8e9aab; --medal-3: #d4a017; }

.assessment.running .quiz-kinds, .assessment.running #quiz-setup, .assessment.running #quiz-history { display: none; }
.assessment.reviewed #quiz-history { display: none; }

.retry-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.achievements { display: grid; gap: 18px; width: min(820px, 100%); margin: 0 auto; }
.achievements-heading { margin: 0; }
.achievements-hero { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: 22px 24px; overflow: hidden; border: 0; color: #ffffff; background: linear-gradient(135deg, #3d5ee0 0%, #7b4fd8 55%, #c45bc4 100%); }
.achievements-hero::after { content: ""; position: absolute; inset: auto -60px -90px auto; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); pointer-events: none; }
.achievements-trophy { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.22); color: #ffd23f; font-size: 42px; }
.achievements-hero-main { display: grid; gap: 10px; min-width: 0; }
.achievements-count { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.achievements-count strong { font-size: 40px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.achievements-count span { font-size: 16px; font-weight: 600; opacity: 0.85; }
.achievements-hero-bar { height: 12px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.22); }
.achievements-hero-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffd23f, #ffb020); transition: width 0.8s ease; }
.achievements-tally { display: flex; flex-wrap: wrap; gap: 8px; }
.achievements-tally-medal { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-size: 14px; }
.achievements-tally-medal .bi { font-size: 16px; }
.achievements-tally-medal.medal-1 .bi { color: #f0a76b; }
.achievements-tally-medal.medal-2 .bi { color: #dfe6ef; }
.achievements-tally-medal.medal-3 .bi { color: #ffd23f; }
.achievements-hero-stats { display: grid; gap: 8px; }
.achievements-chip { display: flex; align-items: center; gap: 10px; min-width: 150px; padding: 8px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.14); }
.achievements-chip-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(255, 255, 255, 0.92); font-size: 17px; }
.achievements-chip.points .achievements-chip-icon { color: #1cb0f6; }
.achievements-chip.streak .achievements-chip-icon { color: #ff7a00; }
.achievements-chip.longest .achievements-chip-icon { color: #7b4fd8; }
.achievements-chip-text { display: grid; line-height: 1.15; }
.achievements-chip-text strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.achievements-chip-text span { font-size: 12px; opacity: 0.85; }
.achievement-list { display: grid; padding: 4px 0; }
.achievement-wait { margin: 0; padding: 16px 20px; }
.achievement { --badge: var(--accent); display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 18px; padding: 16px 22px; }
.achievement + .achievement { border-top: 1px solid var(--border); }
.achievement-badge { position: relative; display: grid; justify-items: center; padding-bottom: 8px; }
.achievement-shape { display: grid; place-items: center; width: 68px; height: 74px; clip-path: polygon(50% 0, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%); background: linear-gradient(160deg, color-mix(in srgb, var(--badge) 78%, #ffffff), var(--badge) 45%, color-mix(in srgb, var(--badge) 72%, #000000)); color: #ffffff; font-size: 30px; filter: drop-shadow(0 2px 0 color-mix(in srgb, var(--badge) 60%, #000000)); }
.achievement-shape .bi { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.achievement-level { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); padding: 1px 8px; border-radius: 999px; border: 2px solid var(--surface); background: color-mix(in srgb, var(--badge) 82%, #000000); color: #ffffff; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.achievement.locked .achievement-shape { background: linear-gradient(160deg, var(--surface-2), color-mix(in srgb, var(--border) 80%, var(--surface-2))); color: var(--muted); filter: none; }
.achievement.locked .achievement-shape .bi { filter: none; opacity: 0.7; }
.achievement.locked .achievement-level { background: var(--muted); }
.achievement.complete .achievement-level { background: linear-gradient(90deg, #f5b301, #e08e00); color: #2b1a00; }
.achievement-body { display: grid; gap: 7px; min-width: 0; }
.achievement-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.achievement-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.achievement-medals { display: inline-flex; flex: none; gap: 2px; font-size: 15px; color: var(--border); }
.achievement-medal.won.medal-1 { color: var(--medal-1); }
.achievement-medal.won.medal-2 { color: var(--medal-2); }
.achievement-medal.won.medal-3 { color: var(--medal-3); }
.achievement-track { display: flex; align-items: center; gap: 12px; }
.achievement-bar { flex: 1 1 auto; height: 14px; overflow: hidden; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06); }
.achievement-fill { display: block; width: 0; height: 100%; border-radius: 999px; background: linear-gradient(180deg, color-mix(in srgb, var(--badge) 80%, #ffffff), var(--badge)); transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.achievements.shown .achievement-fill { width: var(--share); }
.achievement.complete .achievement-fill { background: linear-gradient(180deg, #ffd23f, #f5a400); }
.achievement-count { flex: none; min-width: 64px; text-align: right; color: var(--muted); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.achievement.complete .achievement-count { color: var(--medal-3); }
.achievement-goal { color: var(--muted); font-size: 14px; line-height: 1.35; }
@media (max-width: 720px) {
  .achievements-hero { grid-template-columns: auto minmax(0, 1fr); gap: 16px; padding: 18px; }
  .achievements-hero-stats { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .achievements-chip { min-width: 0; padding: 8px; gap: 8px; }
  .achievements-trophy { width: 64px; height: 64px; font-size: 32px; }
  .achievements-count strong { font-size: 32px; }
}
@media (max-width: 480px) {
  .achievements-chip { flex-direction: column; align-items: flex-start; gap: 6px; }
  .achievement { grid-template-columns: 60px minmax(0, 1fr); gap: 14px; padding: 14px 16px; }
  .achievement-shape { width: 54px; height: 60px; font-size: 24px; }
  .achievement-count { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .achievement-fill, .achievements-hero-bar span { transition: none; }
}

body.with-lingo { overflow: hidden; }
.lingo { position: fixed; inset: 0; z-index: 85; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--bg); }
.lingo-top { display: flex; align-items: center; gap: 14px; width: min(1000px, 100%); justify-self: center; padding: 18px 16px 8px; }
.lingo-bar { flex: 1 1 auto; height: 16px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.lingo-fill { width: 0; height: 100%; border-radius: 999px; background: var(--green); transition: width 0.35s ease; }
.lingo-stage { display: grid; justify-items: center; align-content: start; overflow-y: auto; padding: clamp(12px, 4vh, 40px) 16px 24px; }
.lingo-card { display: grid; gap: 20px; width: min(640px, 100%); }
.lingo-title { margin: 0; font-size: clamp(22px, 3vw, 30px); font-weight: 700; }
.lingo-again { color: var(--amber); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.lingo-prompt { margin: 0; font-size: clamp(20px, 2.6vw, 26px); line-height: 1.4; }
.lingo-translation { margin: -8px 0 0; color: var(--muted); }
.lingo-source { display: flex; align-items: center; gap: 14px; }
.lingo-bubble { min-width: 0; padding: 12px 16px; border: 2px solid var(--border); border-radius: 16px; background: var(--surface); }
.lingo-speakers { display: inline-flex; flex: none; align-items: center; gap: 8px; }
.lingo-speakers.big { justify-content: center; width: 100%; }
.lingo-speaker { display: grid; place-items: center; width: 52px; height: 52px; border: 0; border-radius: 14px; background: var(--accent); color: var(--on-accent); font-size: 22px; box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.lingo-speaker.slow { width: 44px; height: 44px; font-size: 14px; font-weight: 700; }
.lingo-speakers.big .lingo-speaker:not(.slow) { width: 96px; height: 96px; border-radius: 24px; font-size: 42px; }
.lingo-speaker.playing { opacity: 0.8; }
.lingo-options { display: grid; gap: 12px; }
.lingo-option { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 16px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 16px; background: var(--surface); color: var(--text); font-size: 18px; text-align: left; }
.lingo-option:hover:not(:disabled) { background: var(--surface-2); }
.lingo-option.chosen { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.lingo-option.right { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--text); }
.lingo-option.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--text); }
.lingo-option:disabled { opacity: 1; }
.lingo-key { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border: 2px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.lingo-gap { display: inline-block; min-width: 80px; margin: 0 4px; border-bottom: 3px solid var(--border); text-align: center; }
.lingo-gap.filled { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.lingo-line { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; min-height: 124px; padding: 6px 0; background: repeating-linear-gradient(to bottom, transparent 0 58px, var(--border) 58px 60px); }
.lingo-line[hidden], .lingo-bank[hidden], .lingo-typed[hidden], .lingo-switch[hidden] { display: none; }
.lingo-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.lingo-slot { display: inline-flex; min-width: 48px; min-height: 50px; border-radius: 14px; background: var(--surface-2); }
.lingo-tile { min-height: 50px; padding: 8px 14px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 14px; background: var(--surface); color: var(--text); font-size: 18px; }
.lingo-tile:disabled { opacity: 1; }
.lingo-typed { width: 100%; padding: 12px 14px; border-radius: 14px; font-size: 18px; }
.lingo-switch { justify-self: start; }
.lingo-match { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lingo-column { display: grid; align-content: start; gap: 12px; }
.lingo-pair { min-height: 56px; padding: 10px 14px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 16px; background: var(--surface); color: var(--text); font-size: 17px; }
.lingo-pair.chosen { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.lingo-pair.matched { border-color: var(--border); background: var(--surface-2); opacity: 0.45; }
.lingo-pair.missed { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--surface)); animation: lingo-shake 0.35s; }
.lingo-mic { display: inline-flex; justify-self: center; align-items: center; gap: 12px; padding: 16px 28px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 999px; background: var(--surface); color: var(--accent); font-size: 18px; font-weight: 700; }
.lingo-mic .bi { font-size: 24px; }
.lingo-mic.recording { border-color: var(--red); color: var(--red); animation: lingo-pulse 1.2s ease-in-out infinite; }
.lingo-mic-status { margin: 0; text-align: center; }
.lingo-foot { border-top: 2px solid var(--border); background: var(--surface); }
.lingo-foot > * { width: min(1000px, 100%); margin: 0 auto; padding-right: 16px; padding-left: 16px; }
.lingo-verdict { display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; padding-top: 16px; }
.lingo-verdict:empty { display: none; }
.lingo-verdict-head { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.lingo-correction, .lingo-issue, .lingo-note { margin: 0; }
.lingo-correction { font-size: 17px; }
.lingo-note { color: var(--muted); }
.lingo-change s { opacity: 0.75; }
.lingo-said { margin: 4px 0; line-height: 2; }
.lingo-word { padding: 2px 6px; border-radius: 6px; font-weight: 600; }
.lingo-word.right { color: var(--green); }
.lingo-word.unclear { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.lingo-word.missed { color: var(--red); text-decoration: line-through; }
.lingo-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; padding-bottom: 20px; }
.lingo-actions .primary { min-width: 160px; margin-left: auto; }
.lingo-foot.right { border-top-color: transparent; background: color-mix(in srgb, var(--green) 14%, var(--surface)); }
.lingo-foot.right .lingo-verdict-head { color: var(--green); }
.lingo-foot.wrong { border-top-color: transparent; background: color-mix(in srgb, var(--red) 12%, var(--surface)); }
.lingo-foot.wrong .lingo-verdict-head { color: var(--red); }
.lingo-foot.right .lingo-go { border-color: var(--green); background: var(--green); }
.lingo-retry { border-width: 2px; border-radius: 12px; background: var(--surface); font-weight: 700; }
.lingo-foot.right .lingo-retry { border-color: var(--green); color: var(--green); }
.lingo-foot.wrong .lingo-retry { border-color: var(--red); color: var(--red); }
.lingo-foot.wrong .lingo-go { border-color: var(--red); background: var(--red); }
.lingo-done { justify-items: center; text-align: center; }
.lingo-done h2, .lingo-done h3 { margin: 0; }
.lingo-done h3 { justify-self: start; }
.lingo-done-icon { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 28px; background: color-mix(in srgb, var(--medal-3) 22%, var(--surface)); color: var(--medal-3); font-size: 48px; }
.lingo-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; }
.lingo-stat { display: grid; gap: 4px; padding: 12px; border: 2px solid var(--border); border-radius: 16px; background: var(--surface); }
.lingo-stat-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.lingo-stat strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.lingo-review { display: grid; gap: 10px; width: 100%; text-align: left; }
.lingo-review-row { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.lingo-review-row p { margin: 0; }
.lingo-review-yours { color: var(--red); text-decoration: line-through; }
.lingo-go { position: relative; overflow: hidden; }
.lingo-go.lingo-timed::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, 0.24); transform-origin: right center; animation: lingo-drain var(--lingo-timer, 5s) linear forwards; pointer-events: none; }
@keyframes lingo-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.lingo-map-button { flex: none; }
.lingo-clock { flex: none; padding: 3px 10px; font-size: 14px; }
.lingo-map-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.lingo-map-reset { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.lingo-map-reset-ask { font-weight: 600; font-size: 14px; }
@media (max-width: 560px) {
  .lingo-map-top:has(.lingo-map-reset.asking) { flex-wrap: wrap; }
  .lingo-map-top:has(.lingo-map-reset.asking) .lingo-map-tools { width: 100%; justify-content: flex-end; }
}
.lingo-map { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--bg); }
.lingo-map-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(640px, 100%); justify-self: center; padding: 16px 16px 10px; }
.lingo-map-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.lingo-map-title h2 { margin: 0; font-size: 24px; }
.lingo-map-language { color: var(--muted); font-weight: 600; }
.lingo-map-body { overflow-x: hidden; overflow-y: auto; padding: 8px 16px 64px; }
.lingo-map-body > * { width: min(560px, 100%); margin-right: auto; margin-left: auto; }
.lingo-map-wait { text-align: center; }
.lingo-map-custom { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; padding: 14px 16px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 18px; background: var(--surface); }
.lingo-map-custom .lingo-map-node { position: static; flex: none; width: 52px; height: 48px; transform: none; font-size: 22px; animation: none; }
.lingo-map-custom-name { flex: 1 1 auto; min-width: 0; font-size: 17px; }
.lingo-map-stage { margin-bottom: 32px; }
.lingo-map-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-size: 18px; box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.lingo-map-stage.locked .lingo-map-banner { background: var(--surface-2); color: var(--muted); box-shadow: 0 4px 0 var(--border); }
.lingo-map-count { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lingo-map-banner-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.lingo-map-exam-name { font-size: 13px; font-weight: 600; opacity: 0.85; }
.lingo-map-unit { margin: 22px 0 -2px; color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: 0.04em; text-align: center; text-transform: uppercase; }
.lingo-map-stage { --sim: #845ec2; --exam: #d99a00; }
.lingo-map-node.simulation.open { border-color: var(--sim); color: var(--sim); box-shadow: 0 6px 0 color-mix(in srgb, var(--sim) 45%, var(--border)); }
.lingo-map-node.simulation.done { background: var(--sim); color: #fff; box-shadow: 0 6px 0 color-mix(in srgb, var(--sim) 62%, #000); }
.lingo-map-node.exam { width: 76px; height: 70px; font-size: 30px; }
.lingo-map-node.exam.open { border-color: var(--exam); color: var(--exam); box-shadow: 0 6px 0 color-mix(in srgb, var(--exam) 45%, var(--border)); }
.lingo-map-node.exam.done { background: var(--exam); color: #fff; box-shadow: 0 6px 0 color-mix(in srgb, var(--exam) 62%, #000); }
.lingo-map-tag { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sim); }
.lingo-map-label.exam .lingo-map-tag { color: var(--exam); }
.lingo-map-trail { position: relative; margin-top: 12px; }
.lingo-map-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lingo-map-road { fill: none; stroke: var(--border); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 1 16; }
.lingo-map-road.travelled { stroke: color-mix(in srgb, var(--green) 70%, var(--surface)); stroke-dasharray: none; }
.lingo-map-node { position: absolute; z-index: 1; display: grid; place-items: center; width: 64px; height: 58px; padding: 0; border: 0; border-radius: 50%; transform: translate(-50%, -50%); background: var(--surface-2); color: var(--muted); font-size: 24px; box-shadow: 0 6px 0 var(--border); }
.lingo-map-node:disabled { opacity: 1; cursor: default; }
.lingo-map-node.done { background: var(--green); color: #fff; box-shadow: 0 6px 0 color-mix(in srgb, var(--green) 62%, #000); }
.lingo-map-node.open { border: 3px solid var(--accent); background: var(--surface); color: var(--accent); box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 45%, var(--border)); }
.lingo-map-node.current { width: 78px; height: 72px; background: var(--accent); color: var(--on-accent); font-size: 30px; box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 62%, #000), 0 0 0 8px color-mix(in srgb, var(--accent) 22%, transparent); animation: lingo-map-pulse 1.8s ease-in-out infinite; }
.lingo-map-node:not(:disabled):hover { filter: brightness(1.07); }
.lingo-map-node:not(:disabled):active { transform: translate(-50%, calc(-50% + 4px)); box-shadow: none; }
.lingo-map-node:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.lingo-map-label { position: absolute; z-index: 1; display: grid; gap: 3px; max-width: calc(50% - 56px); padding: 3px 8px; transform: translateY(-50%); border-radius: 10px; background: var(--bg); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.lingo-map-label.left { justify-items: end; text-align: right; }
.lingo-map-label.locked { color: var(--muted); font-weight: 600; }
.lingo-map-label.current { color: var(--accent); }
.lingo-map-stars { display: inline-flex; gap: 2px; color: var(--border); font-size: 12px; }
.lingo-map-stars .won { color: var(--amber); }
.lingo-map-here { position: absolute; z-index: 2; padding: 6px 12px; transform: translate(-50%, calc(-100% - 46px)); border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; pointer-events: none; animation: lingo-map-bob 1.6s ease-in-out infinite; }
.lingo-map-here::after { content: ""; position: absolute; bottom: -8px; left: 50%; width: 12px; height: 12px; transform: translateX(-50%) rotate(45deg); border-right: 2px solid var(--border); border-bottom: 2px solid var(--border); background: var(--surface); }
@keyframes lingo-map-pulse { 50% { box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 62%, #000), 0 0 0 14px color-mix(in srgb, var(--accent) 8%, transparent); } }
@keyframes lingo-map-bob { 50% { transform: translate(-50%, calc(-100% - 52px)); } }
@media (prefers-reduced-motion: reduce) { .lingo-map-node.current, .lingo-map-here { animation: none; } }
.lingo-review-right { color: var(--green); font-weight: 600; }
@keyframes lingo-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes lingo-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 40%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }

@media (max-width: 620px) {
  .lingo-stats { grid-template-columns: minmax(0, 1fr); }
  .lingo-actions .primary { flex: 1 1 auto; min-width: 0; }
  .lingo-source { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .lingo-pair.missed, .lingo-mic.recording { animation: none; }
  .lingo-fill { transition: none; }
}

.google-sign-in { display: grid; justify-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.google-sign-in[hidden] { display: none; }
.google-button { width: 100%; justify-content: center; }
#p-reminders-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
#p-reminders-box[hidden] { display: none; }
.delete-account h3 { color: var(--red); }

.musical-staff, .piano-keys { --ms-mark: var(--accent); }
.musical-staff [data-color="blue"], .piano-keys [data-color="blue"] { --ms-mark: var(--series-1); }
.musical-staff [data-color="orange"], .piano-keys [data-color="orange"] { --ms-mark: var(--series-2); }
.musical-staff [data-color="green"], .piano-keys [data-color="green"] { --ms-mark: var(--series-3); }
.musical-staff [data-color="yellow"], .piano-keys [data-color="yellow"] { --ms-mark: var(--series-4); }
.musical-staff [data-color="pink"], .piano-keys [data-color="pink"] { --ms-mark: var(--series-5); }
.musical-staff [data-color="purple"], .piano-keys [data-color="purple"] { --ms-mark: var(--series-7); }
.musical-staff [data-color="red"], .piano-keys [data-color="red"] { --ms-mark: var(--series-8); }
.musical-staff { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; max-width: 100%; }
.ms-title { color: var(--muted); font-size: 14px; text-align: center; }
.ms-frame { position: relative; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.ms-svg { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; user-select: none; -webkit-user-select: none; }
.musical-staff-inline .ms-svg { margin: 0; }
.ms-rises .ms-frame { padding-right: 52px; }
.ms-line, .ms-ledger, .ms-barline, .ms-thin { fill: none; stroke: var(--text); stroke-width: 1; }
.ms-line { opacity: 0.8; transition: stroke 0.25s ease, stroke-width 0.25s ease, opacity 0.25s ease; }
.ms-ledger { stroke-width: 1.2; }
.ms-barline { stroke-width: 1.3; transition: stroke 0.25s ease, stroke-width 0.25s ease; }
.ms-thick { stroke: var(--text); stroke-width: 2.6; }
.ms-stem { stroke: var(--text); stroke-width: 1.3; }
.ms-ink { fill: var(--text); }
.ms-glyph-line { fill: none; stroke: var(--text); stroke-linecap: round; stroke-linejoin: round; }
.ms-head { fill: var(--text); stroke: var(--text); stroke-width: 1; }
.ms-hollow { fill: var(--surface); stroke-width: 1.7; }
.ms-whole { stroke-width: 2.2; }
.ms-hit { fill: transparent; }
.ms-ev:not(.ms-spacer) { cursor: pointer; }
.ms-dynamic { fill: var(--text); font: italic 700 15px Georgia, "Times New Roman", serif; }
.ms-name { fill: var(--accent); font: 700 13px system-ui, -apple-system, "Segoe UI", sans-serif; text-anchor: middle; opacity: 0; transition: opacity 0.3s ease; }
.ms-show-names .ms-name { opacity: 1; }
.ms-count { fill: var(--muted); font: 600 12px system-ui, -apple-system, "Segoe UI", sans-serif; text-anchor: middle; opacity: 0; transition: opacity 0.3s ease; }
.ms-count.ms-beat { fill: var(--text); font-weight: 800; }
.ms-show-counts .ms-count { opacity: 1; }
.ms-num { fill: var(--ms-mark); font: 800 10px system-ui, -apple-system, "Segoe UI", sans-serif; opacity: 0; transition: opacity 0.25s ease; }
.ms-num.ms-lit { opacity: 1; }
.ms-space, .ms-measure { fill: transparent; transition: fill 0.3s ease; }
.ms-space.ms-lit { fill: color-mix(in srgb, var(--ms-mark) 34%, transparent); }
.ms-measure.ms-lit { fill: color-mix(in srgb, var(--ms-mark) 18%, transparent); }
.ms-line.ms-lit { stroke: var(--ms-mark); stroke-width: 2.8; opacity: 1; }
.ms-lit-staff .ms-space { fill: color-mix(in srgb, var(--ms-mark) 14%, transparent); }
.ms-clef.ms-lit .ms-glyph-line, .ms-key.ms-lit .ms-glyph-line, .ms-key.ms-lit .ms-thin, .ms-key.ms-lit .ms-thick, .ms-time.ms-lit .ms-glyph-line, .ms-time.ms-lit .ms-thick { stroke: var(--ms-mark); }
.ms-clef.ms-lit .ms-ink, .ms-key.ms-lit .ms-ink, .ms-time.ms-lit .ms-ink { fill: var(--ms-mark); }
.ms-bar.ms-lit .ms-barline { stroke: var(--ms-mark); stroke-width: 3; }
.ms-bar.ms-lit .ms-ink { fill: var(--ms-mark); }
.ms-ev .ms-head, .ms-ev .ms-ink, .ms-ev .ms-stem { transition: fill 0.15s ease, stroke 0.15s ease; }
.ms-ev.ms-lit .ms-head { fill: var(--ms-mark); stroke: var(--ms-mark); }
.ms-ev.ms-lit .ms-hollow { fill: color-mix(in srgb, var(--ms-mark) 22%, var(--surface)); }
.ms-ev.ms-lit .ms-ink { fill: var(--ms-mark); }
.ms-ev.ms-lit .ms-stem, .ms-ev.ms-lit .ms-ledger, .ms-ev.ms-lit .ms-thin, .ms-ev.ms-lit .ms-thick, .ms-ev.ms-lit .ms-glyph-line { stroke: var(--ms-mark); }
.ms-ev.ms-sounding .ms-head { fill: var(--accent); stroke: var(--accent); }
.ms-ev.ms-sounding .ms-hollow { fill: var(--accent-soft); }
.ms-ev.ms-sounding .ms-ink { fill: var(--accent); }
.ms-ev.ms-sounding .ms-stem, .ms-ev.ms-sounding .ms-ledger, .ms-ev.ms-sounding .ms-thin, .ms-ev.ms-sounding .ms-thick, .ms-ev.ms-sounding .ms-glyph-line { stroke: var(--accent); }
.ms-ev.ms-sounding { filter: drop-shadow(0 0 4px var(--accent)); }
.ms-arrow { opacity: 0; transition: opacity 0.3s ease; }
.ms-arrow-line { stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 8 6; }
.ms-arrow-head { fill: var(--accent); }
.ms-show-arrow .ms-arrow:not(.ms-rise):not(.ms-fall), .ms-show-up .ms-rise, .ms-show-down .ms-fall { opacity: 1; }
.ms-show-arrow .ms-arrow:not(.ms-rise):not(.ms-fall) .ms-arrow-line, .ms-show-up .ms-rise .ms-arrow-line, .ms-show-down .ms-fall .ms-arrow-line { animation: ms-march 1.1s linear infinite; }
@keyframes ms-march { to { stroke-dashoffset: -14; } }
.ms-play { position: absolute; top: 8px; right: 8px; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--accent); font-size: 17px; cursor: pointer; }
.ms-play:hover { background: var(--accent-soft); }
.ms-play:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ms-playing .ms-play { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.scene-tool[data-kind="staff"], .scene-tool[data-kind="piano"] { align-items: center; }
.scene-tool .musical-staff, .scene-tool .piano-keys:not(.piano-embedded) { justify-content: center; gap: clamp(4px, 2cqh, 14px); margin: 0; padding: clamp(10px, 4cqh, 34px) clamp(12px, 4cqw, 40px); }
.scene-tool .ms-title, .scene-tool .pk-title { font-size: clamp(14px, 3.6cqh, 22px); }
.scene-tool .ms-frame, .scene-tool .pk-frame { padding: clamp(10px, 3cqh, 22px) clamp(12px, 3cqw, 26px); }
.scene-tool .ms-svg { max-height: 70cqh; }
.scene-tool .musical-staff:has(.piano-embedded) .ms-svg { max-height: 44cqh; }
.scene-tool .ms-play { width: 40px; height: 40px; font-size: 20px; }
.piano-keys { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; max-width: 100%; }
.piano-embedded { margin: 2px 0 0; }
.pk-title { color: var(--muted); font-size: 14px; text-align: center; }
.pk-frame { position: relative; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.piano-embedded .pk-frame { padding: 8px 10px; }
.pk-svg { display: block; width: min(100%, calc(var(--pk-width, 400px) * 1.7)); height: auto; margin: 0 auto; overflow: visible; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.piano-inline .pk-svg { margin: 0; }
.pk-key { cursor: pointer; transition: fill 0.12s ease; }
.pk-white { fill: #fbfbf8; stroke: #7d8592; stroke-width: 1; }
.pk-black { fill: #1c2028; stroke: #1c2028; stroke-width: 1; }
.pk-white:hover { fill: #f0f2f6; }
.pk-white.pk-lit { fill: color-mix(in srgb, var(--ms-mark) 42%, #fbfbf8); }
.pk-black.pk-lit { fill: color-mix(in srgb, var(--ms-mark) 72%, #1c2028); }
.pk-white.pk-down { fill: color-mix(in srgb, var(--accent) 62%, #fbfbf8); }
.pk-black.pk-down { fill: var(--accent); }
.pk-label { fill: #4f5868; font: 700 10px system-ui, -apple-system, "Segoe UI", sans-serif; text-anchor: middle; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.pk-label.pk-c { opacity: 1; }
.pk-label-black { fill: #ffffff; font-size: 7.5px; }
.pk-show-names .pk-label:not(.pk-label-black), .pk-label.pk-lit { opacity: 1; }
.pk-label.pk-lit:not(.pk-label-black) { fill: #1c2028; }
.scene-tool .pk-svg { max-height: 58cqh; }
.scene-tool .piano-embedded .pk-svg { max-height: 26cqh; }

.flip-deck { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
.flip-head { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.flip-title { font-weight: 700; }
.flip-status { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; color: var(--muted); font-weight: 700; }
.flip-pips { display: inline-flex; gap: 5px; }
.flip-pip { width: 9px; height: 9px; border-radius: 50%; background: var(--border); transition: background 0.3s ease, transform 0.3s ease; }
.flip-pip.on { background: var(--accent); transform: scale(1.15); }
.flip-deck.complete .flip-pip { background: var(--green); }
.flip-stat { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.flip-deck.complete .flip-stat:last-of-type { color: var(--green); }
.flip-again { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; }
.flip-again:hover { background: var(--accent-soft); color: var(--accent); }
.flip-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px; }
.flip-card { position: relative; min-height: 92px; aspect-ratio: 5 / 4; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; perspective: 900px; }
.flip-tile { aspect-ratio: 1 / 1; min-height: 72px; }
.flip-inline[data-mode="flip"] .flip-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); max-width: 640px; }
.flip-inline[data-mode="match"] .flip-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 104px)); }
.flip-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1); }
.flip-card.turned .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); text-align: center; overflow-wrap: anywhere; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease; }
.flip-b { transform: rotateY(180deg); border-color: var(--accent); background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface); }
.flip-cover { border-color: var(--accent); background: repeating-linear-gradient(45deg, var(--accent) 0 9px, transparent 9px 18px), var(--surface-2); color: var(--on-accent); font-size: 28px; }
.flip-cover .bi { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); }
.flip-text { font-weight: 650; line-height: 1.25; }
.flip-deck[data-size="big"] .flip-text { font-size: 22px; }
.flip-deck[data-size="mid"] .flip-text { font-size: 16px; }
.flip-deck[data-size="small"] .flip-text { font-size: 13px; }
.flip-card:hover .flip-face { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14); }
.flip-card:focus-visible { outline: none; }
.flip-card:focus-visible .flip-face { box-shadow: 0 0 0 3px var(--accent); }
.flip-card.spot .flip-face { box-shadow: 0 0 0 3px var(--accent), 0 6px 18px rgba(0, 0, 0, 0.16); }
.flip-card.seen:not(.turned) .flip-a { border-color: var(--accent); }
.flip-card.matched { cursor: default; }
.flip-card.matched .flip-b { border-color: var(--green); background: linear-gradient(color-mix(in srgb, var(--green) 16%, transparent), color-mix(in srgb, var(--green) 16%, transparent)), var(--surface); animation: flip-pop 0.45s ease; }
.flip-card.wrong .flip-b { border-color: var(--red); animation: flip-shake 0.4s ease 0.3s; }
.flip-deck.locked .flip-card { cursor: default; }
.flip-instant .flip-inner, .flip-instant .flip-face { transition: none !important; }
.flip-deck.flip-cheer .flip-grid { animation: flip-cheer 0.9s ease; }
@keyframes flip-pop { 0% { transform: rotateY(180deg) scale(1); } 45% { transform: rotateY(180deg) scale(1.07); } 100% { transform: rotateY(180deg) scale(1); } }
@keyframes flip-shake { 0%, 100% { transform: rotateY(180deg) translateX(0); } 25% { transform: rotateY(180deg) translateX(-5px); } 75% { transform: rotateY(180deg) translateX(5px); } }
@keyframes flip-cheer { 0% { transform: scale(1); } 30% { transform: scale(1.03); } 60% { transform: scale(0.99); } 100% { transform: scale(1); } }
.scene-tool[data-kind="cards"] { align-items: stretch; }
.scene-tool .flip-deck { height: 100%; margin: 0; padding: clamp(10px, 3cqh, 26px) clamp(12px, 3cqw, 30px); }
.scene-tool .flip-grid { flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(0, 1fr); gap: clamp(8px, 2cqh, 16px); }
.scene-tool .flip-card { aspect-ratio: auto; min-height: 0; }
.scene-tool .flip-deck[data-size="big"] .flip-text { font-size: clamp(18px, 6cqh, 40px); }
.scene-tool .flip-deck[data-size="mid"] .flip-text { font-size: clamp(15px, 4cqh, 26px); }
.scene-tool .flip-deck[data-size="small"] .flip-text { font-size: clamp(13px, 3cqh, 19px); }
.scene-tool .flip-title { font-size: clamp(15px, 3.6cqh, 22px); }
@media (max-width: 560px) {
  .flip-grid { gap: 8px; }
  .flip-deck[data-mode="flip"]:not(.flip-inline) .flip-grid { grid-template-columns: repeat(var(--cols-small, 3), minmax(0, 1fr)); }
  .flip-deck[data-mode="match"]:not(.flip-inline) .flip-grid { grid-template-columns: repeat(var(--cols-four, 4), minmax(0, 1fr)); }
  .flip-tile { min-height: 60px; }
  .flip-deck[data-mode="match"] .flip-text { font-size: 13px; }
  .flip-cover { font-size: 20px; }
  .flip-cover .bi { width: 34px; height: 34px; }
  .flip-deck[data-size="big"] .flip-text { font-size: 18px; }
  .flip-deck[data-size="mid"] .flip-text { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .flip-inner { transition: none; }
  .flip-card.matched .flip-b, .flip-card.wrong .flip-b, .flip-deck.flip-cheer .flip-grid { animation: none; }
  .ms-arrow-line { animation: none !important; }
  .ms-ev.ms-sounding { filter: none; }
}
.little { --little-ink: #2b2350; --little-paper: #fffdf7; position: fixed; inset: 0; z-index: 95; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; color: var(--little-ink); font-family: "Fredoka", "Nunito", system-ui, sans-serif; background: linear-gradient(180deg, #8fd3fe 0%, #c9ecff 55%, #fff1c9 100%); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.little button { font-family: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.little-sky { position: absolute; inset: 0; pointer-events: none; }
.little-sky::before { content: ""; position: absolute; top: 6%; right: 9%; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, #ffe066 0 55%, rgba(255, 224, 102, 0.35) 56% 70%, transparent 71%); animation: little-glow 6s ease-in-out infinite; }
.little-sky::after { content: ""; position: absolute; top: 14%; left: -220px; width: 200px; height: 60px; border-radius: 60px; background: #fff; box-shadow: 60px -26px 0 8px #fff, 120px 0 0 -4px #fff, 640px 120px 0 -6px rgba(255, 255, 255, 0.9), 700px 96px 0 4px rgba(255, 255, 255, 0.9); animation: little-drift 60s linear infinite; }
.little.resting { background: linear-gradient(180deg, #1b1f4b 0%, #2d2a6e 60%, #3d3a80 100%); color: #fff; }
.little.resting .little-sky::after { opacity: 0.18; }
.little.resting .little-sky::before { background: radial-gradient(circle at 40% 40%, transparent 0 34%, #fff7c2 35% 55%, transparent 56%); }
.little-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 18px 6px; }
.little-round { display: grid; place-items: center; width: 76px; height: 76px; padding: 0; border: 0; border-radius: 50%; background: var(--little-paper); box-shadow: 0 6px 0 rgba(43, 35, 80, 0.18); font-size: 38px; transition: transform 0.12s ease; }
.little-round:active { transform: translateY(4px) scale(0.96); box-shadow: 0 2px 0 rgba(43, 35, 80, 0.18); }
.little-home.away { visibility: hidden; }
.little-stars { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px; background: var(--little-paper); color: var(--little-ink); box-shadow: 0 5px 0 rgba(43, 35, 80, 0.15); font-size: 30px; }
.little-stars strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.little-stars.pop { animation: little-pop 0.6s ease; }
.little-gate { position: relative; display: grid; place-items: center; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.55); font-size: 22px; opacity: 0.75; }
.little-gate-ring { position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(#845ec2 calc(var(--hold, 0) * 1turn), transparent 0); -webkit-mask: radial-gradient(circle, transparent 0 60%, #000 61%); mask: radial-gradient(circle, transparent 0 60%, #000 61%); }
.little-gate.holding .little-gate-ring { animation: little-hold 2s linear forwards; }
@property --hold { syntax: "<number>"; inherits: false; initial-value: 0; }
.little-scene { position: relative; z-index: 1; display: grid; place-items: center; min-height: 0; overflow-y: auto; padding: 8px 18px max(24px, env(safe-area-inset-bottom)); }
.little-emoji { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; line-height: 1; }
.little-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 40vw), 1fr)); grid-auto-rows: 1fr; gap: clamp(14px, 3vw, 26px); width: min(980px, 100%); }
.little .little-tile, .little .little-pack-head { color: #fff; }
.little-tile { display: grid; justify-items: center; align-content: center; gap: 10px; aspect-ratio: 1; padding: 12px; border: 0; border-radius: 36px; background: var(--tile); box-shadow: 0 10px 0 color-mix(in srgb, var(--tile) 62%, #000), inset 0 -10px 0 rgba(255, 255, 255, 0.18); color: #fff; animation: little-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: var(--delay, 0ms); transition: transform 0.12s ease; }
.little-tile:active { transform: translateY(6px) scale(0.97); box-shadow: 0 4px 0 color-mix(in srgb, var(--tile) 62%, #000); }
.little-tile-show { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: clamp(56px, 10vw, 92px); line-height: 1; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.12)); }
.little-tile-name { font-size: clamp(17px, 2.2vw, 24px); font-weight: 600; line-height: 1.1; text-align: center; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22); }
.little-pack { display: grid; justify-items: center; gap: clamp(20px, 5vh, 44px); width: min(760px, 100%); }
.little-pack-head { display: inline-flex; align-items: center; gap: 16px; padding: 14px 30px 14px 18px; border: 0; border-radius: 999px; background: var(--tile); box-shadow: 0 8px 0 color-mix(in srgb, var(--tile) 62%, #000); color: #fff; animation: little-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.little-pack-show { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 64px; line-height: 1; }
.little-pack-name { font-size: clamp(26px, 4vw, 40px); font-weight: 600; }
.little-activities { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(18px, 4vw, 40px); }
.little-activity { display: grid; place-items: center; width: clamp(130px, 22vw, 190px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: var(--little-paper); box-shadow: 0 10px 0 rgba(43, 35, 80, 0.18), inset 0 0 0 10px color-mix(in srgb, var(--tile) 35%, #fff); animation: little-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; transition: transform 0.12s ease; }
.little-activity:nth-child(2) { animation-delay: 80ms; }
.little-activity:nth-child(3) { animation-delay: 160ms; }
.little-activity:active { transform: translateY(6px) scale(0.97); }
.little-activity-show { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: clamp(60px, 9vw, 88px); line-height: 1; }
.little-picture { display: grid; place-items: center; width: 100%; height: 100%; }
.little-picture .little-emoji { font-size: clamp(72px, 13vw, 130px); filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.1)); }
.little-picture.big .little-emoji { font-size: clamp(140px, min(32vw, 38vh), 300px); }
.little-swatch { display: block; width: 72%; aspect-ratio: 1; border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%; box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.14), 0 8px 0 rgba(0, 0, 0, 0.08); }
.little-shape { width: 74%; height: 74%; fill: var(--tile); stroke: color-mix(in srgb, var(--tile) 60%, #000); stroke-width: 4; stroke-linejoin: round; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.1)); }
.little-number { font-size: clamp(90px, 18vw, 180px); font-weight: 700; color: var(--tile); text-shadow: 0 8px 0 rgba(0, 0, 0, 0.1); }
.little-look { display: grid; justify-items: center; gap: 12px; width: min(720px, 100%); }
.little-look-picture { display: grid; place-items: center; width: min(78vw, 56vh, 520px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 48px; background: var(--little-paper); box-shadow: 0 12px 0 rgba(43, 35, 80, 0.15), inset 0 0 0 12px color-mix(in srgb, var(--tile) 30%, #fff); animation: little-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.little-word { font-size: clamp(40px, 7vw, 72px); font-weight: 600; letter-spacing: 0.02em; text-transform: lowercase; }
.little-next { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); width: 96px; height: 96px; font-size: 48px; background: #ffd43b; animation: little-nudge 2.4s ease-in-out 3s infinite; }
.little-dots { display: flex; justify-content: center; gap: 10px; padding-top: 6px; }
.little-dot { width: 16px; height: 16px; border-radius: 50%; background: rgba(43, 35, 80, 0.18); }
.little-dot.done { background: #51cf66; }
.little-dot.now { background: #ffd43b; transform: scale(1.35); }
.little-find { display: grid; justify-items: center; gap: clamp(16px, 4vh, 34px); width: min(980px, 100%); }
.little-ask { width: 96px; height: 96px; font-size: 46px; animation: little-nudge 2.4s ease-in-out 2s infinite; }
.little-options { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: clamp(14px, 3vw, 30px); width: 100%; }
.little-options.n3 { --n: 3; }
.little-option { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; border-radius: 40px; background: var(--little-paper); box-shadow: 0 10px 0 rgba(43, 35, 80, 0.16); transition: transform 0.12s ease, box-shadow 0.2s ease; animation: little-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.little-option:nth-child(2) { animation-delay: 70ms; }
.little-option:nth-child(3) { animation-delay: 140ms; }
.little-option:active { transform: translateY(6px) scale(0.97); }
.little-option .little-emoji { font-size: clamp(88px, min(15vw, 26vh), 220px); }
.little-option .little-swatch, .little-option .little-shape { width: 66%; }
.little-option.right { box-shadow: 0 10px 0 #2b8a3e, 0 0 0 10px #8ce99a; animation: little-pop 0.6s ease; }
.little-option.nope { animation: little-shake 0.45s ease; }
.little-count { display: grid; justify-items: center; gap: 14px; width: min(900px, 100%); }
.little-tally { display: grid; place-items: center; min-width: 120px; height: 120px; padding: 0 20px; border-radius: 60px; background: var(--little-paper); box-shadow: 0 8px 0 rgba(43, 35, 80, 0.15); color: var(--tile); font-size: 84px; font-weight: 700; }
.little-tally:empty::before { content: "?"; opacity: 0.3; }
.little-field { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(10px, 3vw, 28px); padding: 10px; }
.little-piece { position: relative; display: grid; place-items: center; width: clamp(110px, 18vw, 160px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.7); transform: rotate(var(--tilt, 0deg)); animation: little-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.little-piece .little-emoji { font-size: clamp(70px, 11vw, 104px); }
.little-piece.counted { background: color-mix(in srgb, var(--tile) 28%, #fff); animation: little-pop 0.45s ease; }
.little-piece-number { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--tile); box-shadow: 0 4px 0 color-mix(in srgb, var(--tile) 62%, #000); color: #fff; font-size: 30px; font-weight: 700; }
.little-party, .little-rest { position: relative; display: grid; place-items: center; width: min(420px, 80vw); aspect-ratio: 1; }
.little-party-star { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: clamp(160px, 34vw, 280px); animation: little-spin-in 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.little-party-friends { position: absolute; right: 4%; bottom: 6%; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 96px; animation: little-pop 0.8s ease 0.4s both; }
.little-rest-moon { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: clamp(160px, 34vw, 260px); animation: little-glow 5s ease-in-out infinite; }
.little-rest-zz { position: absolute; top: 4%; right: 6%; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 80px; animation: little-float 3s ease-in-out infinite; }
.little-burst { position: fixed; z-index: 99; width: 0; height: 0; pointer-events: none; }
.little-bit { position: absolute; width: 14px; height: 14px; border-radius: 4px; animation: little-fly 1s ease-out forwards; }
.little .bounce { animation: little-pop 0.5s ease; }
.little-grownups { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(20, 16, 44, 0.55); font-family: "Nunito", system-ui, sans-serif; color: var(--text); user-select: text; -webkit-user-select: text; }
.little-grownups-card { display: grid; gap: 14px; width: min(440px, 100%); max-height: 90vh; overflow-y: auto; }
.little-grownups-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.little-grownups-head h2 { margin: 0; }
.little-grownups-time { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.little-grownups-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.little-grownups-links { display: grid; gap: 10px; }
.little-grownups-link { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.little-grownups-form { display: grid; gap: 10px; }
body.with-little { overflow: hidden; }
@keyframes little-in { from { opacity: 0; transform: translateY(24px) scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes little-pop { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 70% { transform: scale(0.96); } 100% { transform: scale(1); } }
@keyframes little-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-14px) rotate(-3deg); } 40% { transform: translateX(12px) rotate(3deg); } 60% { transform: translateX(-8px); } 80% { transform: translateX(6px); } }
@keyframes little-nudge { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.12); } 90% { transform: scale(0.96); } }
@keyframes little-fly { from { opacity: 1; transform: translate(0, 0) rotate(0); } to { opacity: 0; transform: translate(var(--x), var(--y)) rotate(320deg); } }
@keyframes little-spin-in { from { opacity: 0; transform: scale(0.2) rotate(-200deg); } to { opacity: 1; transform: none; } }
@keyframes little-glow { 50% { transform: scale(1.06); } }
@keyframes little-float { 50% { transform: translateY(-14px); } }
@keyframes little-drift { to { transform: translateX(calc(100vw + 460px)); } }
@keyframes little-hold { to { --hold: 1; } }
@media (prefers-reduced-motion: reduce) {
  .little *, .little-sky::before, .little-sky::after { animation: none !important; }
  .little-gate.holding .little-gate-ring { --hold: 1; transition: --hold 2s linear; }
}
.family { display: grid; gap: 18px; width: min(820px, 100%); }
.family-head h2 { margin: 0; }
.family-link { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.family-link label { flex: 1 1 260px; }
.family-list { display: grid; gap: 14px; }
.family-card { display: grid; gap: 14px; }
.family-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.family-who { display: grid; gap: 2px; min-width: 0; }
.family-controls { display: grid; gap: 14px; }
.family-packs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.family-packs legend { margin-bottom: 6px; padding: 0; font-weight: 600; }
.form .family-pack, .family-pack { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.family-pack input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.family-pack:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.family-pack:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.family-pack-show { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 20px; line-height: 1; filter: grayscale(1); opacity: 0.6; }
.family-pack:has(input:checked) .family-pack-show { filter: none; opacity: 1; }
.family-hours { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.family-revoke { justify-self: start; }

.brand-icon { display: block; flex: none; width: 48px; height: 48px; object-fit: contain; user-select: none; -webkit-user-drag: none; }

.stage:has(> .gate) { max-width: none; padding: 0; }
.gate { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: 0; align-items: stretch; min-height: 100vh; min-height: 100dvh; max-width: none; margin: 0; padding: 0; }
.gate-hero { position: relative; isolation: isolate; display: grid; align-content: center; gap: 22px; padding: clamp(32px, 6vw, 80px); overflow: hidden; color: #ffffff; background: linear-gradient(150deg, #2d59d2 0%, #4840c8 52%, #7a3dbd 100%); }
.gate-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url("wallpapers/brand.svg") 0 0 / 240px repeat; opacity: 0.07; filter: invert(1); }
.gate-hero::after { content: ""; position: absolute; z-index: -1; right: -120px; bottom: -160px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 68%); }
.gate-brand { display: flex; align-items: center; gap: 12px; }
.gate-mark { width: 42px; height: 42px; flex: none; }
.gate-brand-words { display: grid; line-height: 1.15; }
.gate-brand-words strong { font-size: 22px; letter-spacing: 0.04em; }
.gate-brand-words span { font-size: 12.5px; opacity: 0.8; }
.gate-title { margin: 0; font-size: clamp(30px, 4.2vw, 50px); font-weight: 800; line-height: 1.08; letter-spacing: -0.01em; }
.gate-lead { margin: 0; max-width: 46ch; font-size: 17px; line-height: 1.55; opacity: 0.92; }
.gate-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 6px 0 0; padding: 0; list-style: none; max-width: 640px; }
.gate-features li { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(2px); }
.gate-features img { width: 44px; height: 44px; flex: none; border-radius: 13px; box-shadow: 0 4px 12px rgba(10, 14, 40, 0.25); }
.gate-features li > span { display: grid; gap: 1px; min-width: 0; }
.gate-features strong { font-size: 15px; }
.gate-features li > span > span { font-size: 13px; opacity: 0.85; line-height: 1.35; }
.gate-panel { display: grid; place-items: center; padding: clamp(24px, 5vw, 64px) 20px; background: var(--bg); }
.gate-form { width: min(420px, 100%); padding: 28px 28px 24px; border-radius: 20px; box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12); }
.gate-heading { margin: 0; font-size: 26px; }
.gate-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 16px 0 18px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.gate-tab { padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; }
.gate-tab:hover { color: var(--text); }
.gate-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14); }
.gate-fields input:not([type="checkbox"]) { min-height: 44px; }
.gate-submit { width: 100%; min-height: 46px; margin-top: 4px; font-size: 15px; }
.gate-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--muted); font-size: 13px; }
.gate-or::before, .gate-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.gate-or[hidden] { display: none; }
.gate .google-sign-in { margin-top: 0; padding-top: 0; border-top: 0; }
.gate-note { margin: 12px 0 0; text-align: center; }
.gate-note:empty { display: none; }
@media (max-width: 900px) {
  .gate { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 0; gap: 0; }
  .gate-hero { gap: 14px; padding: 28px 20px 52px; align-content: start; }
  .gate-title { font-size: clamp(26px, 7vw, 36px); }
  .gate-lead { font-size: 15px; }
  .gate-features { gap: 8px; }
  .gate-features li { padding: 9px 10px; gap: 10px; border-radius: 14px; }
  .gate-features img { width: 36px; height: 36px; border-radius: 11px; }
  .gate-panel { place-items: start center; padding: 0 16px 40px; }
  .gate-form { margin-top: -30px; position: relative; padding: 22px 18px 18px; }
}
@media (max-width: 480px) {
  .gate-features li > span > span { display: none; }
  .gate-features strong { font-size: 13.5px; }
  .gate-brand-words span { display: none; }
}

.who-initial.has-default, .profile-avatar.has-default { background: transparent; overflow: hidden; }
.avatar-default { display: block; width: 100%; height: 100%; object-fit: cover; }

.study-domain-icon { background: none; width: 92px; height: 92px; border-radius: 26px; }
.study-domain-icon .brand-icon { width: 100%; height: 100%; }
@media (max-width: 640px) {
  .study-domain-icon { width: 70px; height: 70px; }
}
.speaking-mode .brand-icon { width: 44px; height: 44px; }
.speaking-topics { display: grid; gap: 10px; }
.speaking-topics[hidden] { display: none; }
.speaking-start[hidden] { display: none; }

.quiz-kind .brand-icon { width: 40px; height: 40px; }
.assessment:not(.chosen) .quiz-kind .brand-icon { width: 80px; height: 80px; }
.assessment.chosen .quiz-kind .brand-icon { width: 30px; height: 30px; }
.assessment.chosen .quiz-kind:not(.active) .brand-icon { filter: saturate(0.35); opacity: 0.75; }
@media (max-width: 640px) {
  .assessment:not(.chosen) .quiz-kind .brand-icon { width: 56px; height: 56px; }
  .assessment.chosen .quiz-kind .brand-icon { width: 28px; height: 28px; }
}

.home-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.home-hello h2 { margin: 2px 0 0; font-size: clamp(24px, 3vw, 32px); }
.home-date { margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.home-streak { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: color-mix(in srgb, #ff7a1a 14%, var(--surface)); border: 1px solid color-mix(in srgb, #ff7a1a 30%, var(--border)); color: color-mix(in srgb, #e0620a 85%, var(--text)); font-weight: 700; }
.home-streak .bi { color: #ff7a1a; font-size: 18px; }
.home-streak strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.home-streak[hidden] { display: none; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 18px; align-items: start; }
.home-main, .home-side { display: grid; gap: 18px; align-content: start; min-width: 0; }
.home-next { padding: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, var(--surface)), var(--surface) 70%); }
.home-next-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.home-next-tile { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 6px 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); text-align: left; transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
.home-next-tile:hover, .home-next-tile:focus-visible { border-color: var(--accent); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08); transform: translateY(-1px); }
.home-next-icon { width: 52px; height: 52px; }
.home-next-words { display: grid; gap: 4px; min-width: 0; }
.home-next-kicker { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.home-next-title { display: -webkit-box; overflow: hidden; font-size: 17px; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.home-next-words .library-progress { max-width: 260px; }
.home-next-go { grid-column: 2; justify-self: start; margin-top: 4px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 700; white-space: nowrap; }
.home-quick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.home-quick-tile { display: grid; justify-items: center; align-content: start; gap: 8px; min-width: 0; padding: 14px 6px 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; text-align: center; line-height: 1.2; transition: border-color 0.15s ease, transform 0.15s ease; }
.home-quick-tile:hover, .home-quick-tile:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.home-quick-tile .brand-icon { width: 52px; height: 52px; }
.home-courses { display: grid; gap: 6px; }
.home-course { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: inherit; text-align: left; }
.home-course:hover { background: var(--surface-2); }
.home-course-words { display: grid; gap: 6px; flex: 1; min-width: 0; }
.home-course-words strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-week-body { display: grid; gap: 14px; }
.home-week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.home-week-day { display: grid; justify-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.home-week-dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface-2); }
.home-week-day.on .home-week-dot { border-color: var(--accent); background: var(--accent); }
.home-week-day.on .home-week-dot::after { content: "\f633"; font-family: "bootstrap-icons"; color: var(--on-accent); font-size: 14px; line-height: 1; }
.home-week-day.today { color: var(--accent); }
.home-week-day.today:not(.on) .home-week-dot { border-color: var(--accent); }
.home-week-day.future .home-week-dot { border-style: dashed; opacity: 0.6; }
.home-week-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.home-week-stat { display: grid; gap: 2px; align-content: start; min-width: 0; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.home-week-stat .small { line-height: 1.3; }
.home-week-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.home-week-value .bi { color: var(--accent); font-size: 15px; }
.home-row-icon { flex: none; color: var(--muted); font-size: 17px; }
.home-row .home-row-brand { width: 34px; height: 34px; }
.home-level { flex: none; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 800; }
.home-tutor { display: grid; gap: 10px; }
.home-tutor-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-tutor .home-tutor-art { width: 52px; height: 52px; margin: 0; flex: none; }
.home-tutor-words { display: grid; gap: 2px; min-width: 0; }
.home-tutor .home-voice { margin-top: 0; }
.home-tutor-change { justify-self: start; }
@media (max-width: 1040px) {
  .home-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .home-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .home-quick-tile .brand-icon { width: 44px; height: 44px; }
}
@media (max-width: 520px) {
  .home-next { padding: 10px; }
  .home-next-tile { padding: 12px; }
  .home-next-icon { width: 44px; height: 44px; }
  .home-quick-tile { font-size: 12.5px; padding: 12px 4px 10px; }
}

.progress-profile { display: grid; gap: 12px; }
.progress-profile h3 { margin: 0; }

.form-field { display: grid; gap: 8px; }
.form-field[hidden] { display: none; }
.form-field-label { font-size: 13px; color: var(--muted); }
.success-options { display: flex; flex-wrap: wrap; gap: 8px; }
.success-option { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 14px; }
.success-option:hover { border-color: var(--accent); }
.success-option.chosen { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.success-check { display: grid; place-items: center; flex: none; width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 50%; }
.success-option.chosen .success-check { background: var(--accent); border-color: var(--accent); }
.success-option.chosen .success-check::after { content: "\f633"; font-family: "bootstrap-icons"; color: var(--on-accent); font-size: 10px; line-height: 1; }

.persona-grid.specialist-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.specialist { display: grid; grid-template-rows: auto 1fr auto; gap: 12px; padding: 16px; text-align: left; }
.specialist-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.specialist .specialist-art { width: 56px; height: 56px; margin: 0; flex: none; }
.specialist .specialist-art .persona-initial { font-size: 24px; }
.specialist-who { display: grid; gap: 2px; min-width: 0; }
.specialist-who h3 { margin: 0; font-size: 17px; }
.specialist-tagline { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.4; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.specialist-facts { display: grid; gap: 6px; align-content: start; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.specialist-fact { display: flex; align-items: flex-start; gap: 8px; min-width: 0; color: var(--text); line-height: 1.4; }
.specialist-fact .bi { flex: none; margin-top: 1px; color: var(--accent); }
.specialist-fact.good, .specialist-fact.good .bi { color: var(--green); }
.specialist-fact.quiet, .specialist-fact.quiet .bi { color: var(--muted); }
.specialist-actions { display: flex; gap: 8px; }
.specialist-actions .primary { flex: 1; }

.library-card-wrap { position: relative; display: grid; min-width: 0; }
.library-card-wrap > .library-card { height: 100%; }
.library-track > .library-card-wrap { scroll-snap-align: start; }
.library-favourite { position: absolute; z-index: 3; top: 22px; right: 22px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 20px; box-shadow: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55)); transition: transform 0.15s ease, color 0.15s ease; }
.library-favourite:hover, .library-favourite:focus-visible { color: #e5484d; }
.library-favourite.on { color: #e5484d; }
.library-card-wrap:hover .library-favourite { transform: translateY(-2px); }
:root[data-bs-theme="dark"] .library-favourite.on, :root[data-bs-theme="dark"] .library-favourite:hover { color: #ff6b70; }
.course-bar-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.course-favourite.on, .course-favourite.on .bi, .course-favourite:hover .bi { color: #e5484d; }
.course-favourite.on { border-color: color-mix(in srgb, #e5484d 40%, var(--border)); }

.lingo-intro { gap: 18px; }
.lingo-new-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.lingo-new-word { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px; border: 2px solid var(--border); border-radius: 16px; background: var(--surface); }
.lingo-new-word .lingo-speaker { flex: none; width: 44px; height: 44px; font-size: 18px; }
.lingo-new-text { display: grid; gap: 2px; min-width: 0; }
.lingo-new-word-text { font-size: 19px; overflow-wrap: anywhere; }
.lingo-new-meaning { color: var(--muted); font-size: 15px; }
.lingo-new-base { color: var(--accent); font-size: 12.5px; font-weight: 700; }
.lingo-also { margin: 4px 0 0; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.lingo-also-words { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lingo-also-word { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 14px; }
.lingo-also-word span { color: var(--muted); }
.lingo-also-word:hover, .lingo-also-word.playing { border-color: var(--accent); }
.lingo-hint { display: inline; margin: 0; padding: 0; border: 0; border-bottom: 2px dotted color-mix(in srgb, var(--muted) 70%, transparent); border-radius: 0; background: none; color: inherit; font: inherit; line-height: inherit; cursor: pointer; }
.lingo-hint.new { border-bottom-color: var(--accent); }
.lingo-hint:hover, .lingo-hint.open { border-radius: 4px 4px 0 0; background: var(--accent-soft); }
.lingo-hint-pop { position: fixed; z-index: 95; display: grid; gap: 4px; min-width: 150px; max-width: min(300px, calc(100vw - 16px)); padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2); }
.lingo-hint-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lingo-hint-head strong { font-size: 16px; }
.lingo-hint-play { display: grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 14px; }
.lingo-hint-base { color: var(--accent); font-size: 12.5px; font-weight: 700; }

.notices { display: grid; gap: 10px; max-width: 1120px; margin: 14px auto 0; padding: 0 24px; }
.notices[hidden] { display: none; }
.notice-banner { --tone: var(--accent); display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--border)); border-radius: 14px; background: color-mix(in srgb, var(--tone) 9%, var(--surface)); }
.tone-success { --tone: var(--green); }
.tone-warning { --tone: var(--amber); }
.notice-icon, .announcement-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--tone, var(--accent)) 18%, transparent); color: var(--tone, var(--accent)); font-size: 18px; }
.notice-words { display: grid; gap: 1px; flex: 1; min-width: 0; }
.notice-words span { overflow: hidden; color: var(--muted); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.notice-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.notice-close { color: var(--muted); }
@media (max-width: 620px) {
  .notices { padding: 0 16px; }
  .notice-banner { flex-wrap: wrap; }
  .notice-words span { white-space: normal; }
  .notice-actions { margin-left: auto; }
}
.announcement-backdrop { z-index: 90; }
.announcement-modal { --tone: var(--accent); width: min(520px, 100%); max-height: calc(100dvh - 48px); overflow-y: auto; gap: 16px; border-top: 5px solid var(--tone); }
.announcement-modal.tone-success { --tone: var(--green); }
.announcement-modal.tone-warning { --tone: var(--amber); }
.announcement-head { display: flex; align-items: center; gap: 12px; }
.announcement-head h3 { margin: 0; font-size: 20px; }
.announcement-icon { width: 44px; height: 44px; border-radius: 13px; font-size: 20px; }
.announcement-body { display: grid; gap: 8px; }
.announcement-body p { margin: 0; line-height: 1.55; }
.announcement-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.survey { display: grid; gap: 16px; }
.survey-question { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.survey-text { float: none; margin: 0; font-size: 15px; font-weight: 700; }
.survey-optional { color: var(--muted); font-weight: 400; }
.survey-options { display: grid; gap: 6px; }
.survey-option { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.survey-option:hover { border-color: var(--accent); }
.survey-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.survey-option input { flex: none; margin: 0; }
.survey-rating { display: flex; flex-wrap: wrap; gap: 6px; }
.survey-star { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--border); font-size: 20px; }
.survey-star:hover { border-color: #f5a623; }
.survey-star.on { border-color: color-mix(in srgb, #f5a623 60%, var(--border)); color: #f5a623; }
.survey-written { width: 100%; resize: vertical; }
