/* AI Uroki — one design system for the whole app.
   Light, friendly, educational. Tokens first, then components. */
:root {
  --bg: #f3f7ff;          /* app background (soft bright blue-white) */
  --panel: #ffffff;       /* cards / surfaces */
  --panel-2: #eef4ff;     /* subtle raised / hover */
  --line: #e2e9f5;        /* borders */
  --text: #16233a;        /* primary readable text */
  --muted: #687891;       /* secondary text */
  --accent: #22c55e;      /* primary / success (vivid green) */
  --accent-ink: #15994a;  /* darker green for 3D button ledge / pressed */
  --accent-2: #4f6ef7;    /* links / info (bright blue) */
  --accent-3: #f59e0b;    /* playful amber highlight (XP, streak) */
  --purple: #8b5cf6;      /* accent for quests / special */
  --danger: #f43f5e;
  --warn: #f59e0b;
  --tint: #e7faef;        /* green tint (selected/success bg) */
  --tint-2: #eaf0ff;      /* blue tint (info bg) */
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 4px rgba(16, 24, 40, 0.04), 0 10px 30px rgba(40, 80, 200, 0.08);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- buttons ---------- */
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 550;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.05s, opacity 0.12s;
}
button:hover { background: var(--panel-2); }
button:active { transform: translateY(1px); }
button.primary {
  background: var(--accent);
  border-color: var(--accent-ink);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  /* chunky "game button" — a solid bottom ledge that presses down on click */
  box-shadow: 0 4px 0 var(--accent-ink);
}
button.primary:hover { background: #2bd169; }
button.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-ink); }
button.secondary { background: var(--tint-2); border-color: transparent; color: var(--accent-2); font-weight: 600; }
button.secondary:hover { background: #dde9fe; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--panel-2); color: var(--text); }
button.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: #fdeef2; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- inputs ---------- */
input, select, textarea {
  font: inherit;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #9aa6b5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}
input:disabled { background: var(--panel-2); color: var(--muted); }
label { display: block; font-size: 13px; font-weight: 550; color: var(--text); margin: 14px 0 6px; }

/* ---------- auth (landing + login) ---------- */
.auth {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 40px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 28px;
}
.auth-hero { max-width: 460px; }
.auth-hero .brand { margin-bottom: 22px; }
.auth-hero h2 { font-size: clamp(24px, 3.5vw, 34px); line-height: 1.2; margin: 0 0 14px; letter-spacing: -0.02em; }
.auth-hero .lead { color: var(--muted); font-size: 16px; margin: 0 0 22px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text); }
.auth-points .ic { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--tint); font-size: 14px; }
.auth-points li.blue .ic { background: var(--tint-2); }
.auth-card { width: 100%; max-width: 420px; justify-self: end; }

/* ---------- card ---------- */
.lobby { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1, .brand strong { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.brand .dot { width: 30px; height: 30px; }
.card h2 { margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.full { width: 100%; }
.center { text-align: center; }
.mt8 { margin-top: 8px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; position: relative; }
.divider[data-label]::after {
  content: attr(data-label); position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--panel); padding: 0 10px; color: var(--muted); font-size: 12px;
}
.form-error { color: var(--danger); font-size: 13px; margin: 10px 0 0; }

/* demo block on login */
.demo-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.demo-box .demo-label { font-size: 12px; color: var(--muted); margin: 0 0 8px; }

.role-pick { display: flex; gap: 10px; margin-top: 6px; }
.role-pick button { flex: 1; }
.role-pick button[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); color: var(--text); }

/* lobby home / generic lists kept for compatibility */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; gap: 10px; }
.section-title { font-size: 16px; margin: 0; }
.lesson-list { display: flex; flex-direction: column; gap: 8px; }
.lesson-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.lesson-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.lesson-actions { display: flex; gap: 6px; flex-shrink: 0; }
.lesson-actions button { padding: 7px 12px; }
.badge { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 11px; color: var(--muted); }
.invite-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--tint); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 12px 14px; margin: 8px 0 12px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 13px; }
textarea.code {
  width: 100%; min-height: 280px; resize: vertical;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #fbfdff; color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; white-space: pre;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* ---------- Room layout ---------- */
.room { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .grow { flex: 1; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.pill .led { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.online .led { background: var(--accent); }
.pill.connecting .led, .pill.reconnecting .led { background: var(--warn); animation: blink 1s infinite; }
.pill.closed .led { background: var(--danger); }
@keyframes blink { 50% { opacity: 0.3; } }

.stage { display: grid; grid-template-columns: 1fr auto; min-height: 0; }
.main { min-width: 0; display: grid; grid-template-rows: 1fr auto; }
.side { border-left: 1px solid var(--line); background: var(--panel); display: flex; min-height: 0; }

/* ---------- side dock: one tab strip, one full-height body at a time ---------- */
.dock { display: flex; flex-direction: column; width: 340px; min-height: 0; transition: width .12s ease; }
.dock-head { display: flex; align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); }
.dock-tabs { display: flex; flex: 1 1 auto; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.dock-tabs::-webkit-scrollbar { display: none; }
.dock-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.dock-tab:hover { background: var(--panel-2); }
.dock-tab[aria-selected="true"] { color: var(--accent-2); background: var(--tint-2); }
.dock-tab[hidden] { display: none; }
.dock-tab-ic { font-size: 15px; line-height: 1; }
.dock-badge { background: var(--danger); color: #fff; font-size: 10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; display: inline-grid; place-items: center; }
.dock-collapse { padding: 6px 9px; color: var(--muted); border-radius: 8px; }
.dock-collapse:hover { background: var(--panel-2); }
.dock-bodies { flex: 1 1 auto; min-height: 0; display: flex; }
.dock-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dock-body[hidden] { display: none; }
.dock-body > .panel, .dock-body > .aipanel, .dock-body > .lessonpanel { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; border-bottom: 0; }
.dock-body > .composer { flex: none; }
.dock-body .lp-toggle { display: none; } /* the dock owns collapse, not the panel */
/* collapsed: thin vertical icon rail, frees width for the slide/board */
.dock.collapsed { width: 46px; }
.dock.collapsed .dock-head { flex-direction: column; }
.dock.collapsed .dock-tabs { flex-direction: column; overflow: visible; }
.dock.collapsed .dock-tab-lbl { display: none; }
.dock.collapsed .dock-bodies { display: none; }

/* ---------- camera dock: floating, draggable, collapsible PiP over the stage --- */
.camdock { position: absolute; top: 14px; right: 14px; z-index: 20; width: 196px; display: flex; flex-direction: column;
  background: rgba(11,14,19,.92); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(16,24,40,.32); }
.camdock.dragging { opacity: .92; }
.camdock.min { width: auto; }
.camdock-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 10px; cursor: move; touch-action: none; color: #cdd6e0; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.06); user-select: none; }
.camdock-tools { display: flex; align-items: center; gap: 2px; }
.camdock-min, .camdock-tool { background: transparent; border: 0; color: #cdd6e0; padding: 2px 7px; border-radius: 6px; line-height: 1; cursor: pointer; font-size: 12px; }
.camdock-min:hover, .camdock-tool:hover { background: rgba(255,255,255,.14); }
.camdock-tool.on { background: var(--accent, #1f8cf9); color: #fff; }
.camdock-body { display: flex; flex-direction: column; gap: 6px; padding: 6px; max-height: 62vh; overflow: auto; }
.camdock.min .camdock-body, .camdock.min .camdock-resize { display: none; }
/* Fit toggle: full frame (no crop) for the P2P tiles; the LiveKit iframe is told over postMessage. */
.camdock.fit-contain .tile video { object-fit: contain; }
/* Corner resize grip. */
.camdock-resize { height: 14px; cursor: nwse-resize; touch-action: none; position: relative; background: rgba(255,255,255,.04); }
.camdock-resize::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; border-right: 2px solid #6b7785; border-bottom: 2px solid #6b7785; }
body.mode-livekit .camdock { width: 300px; }

/* LiveKit conference iframe — now hosted inside the camera dock (movable). */
.callframe-wrap { display: none; }
.callframe-wrap.on { display: block; width: 100%; height: 210px; background: #0b0e13; }
.callframe { width: 100%; height: 100%; border: 0; display: block; }
.mode-livekit #videos { display: none !important; }

.surface { position: relative; margin: 0; background: var(--panel-2); overflow: hidden; }
.slide { position: absolute; inset: 0; padding: 5% 8%; padding-bottom: 96px; overflow: auto; }
.slide h2 { font-size: clamp(20px, 3.5vw, 34px); margin: 0 0 18px; }
.slide p, .slide li { font-size: clamp(15px, 2vw, 20px); color: #33414f; }
.choice { display: block; width: 100%; text-align: left; margin: 8px 0; padding: 12px 14px; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); }
.fill { max-width: 360px; margin-top: 10px; }
.canvas-wrap { position: absolute; inset: 0; pointer-events: none; }
canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.tb-sep { width: 1px; height: 24px; background: var(--line); }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0,0,0,.1); padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--text); }

.feedback { font-size: 14px; font-weight: 600; margin-top: 12px; }
.feedback.ok { color: var(--accent); }
.feedback.bad { color: var(--danger); }

/* Participant tiles — stacked inside the movable camera dock (#camdock). */
.videos { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; }
.videos:empty { display: none; }
.tile { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #0b0e13; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; overflow: hidden; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .name { position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 7px; max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.muted .name::after { content: " 🔇"; }
.tile .vstatus { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: #9aa7b4; background: #0b0e13; }
.tile.connecting .vstatus { color: var(--warn); }
.tile.failed .vstatus { color: var(--danger); }
.tile.connected .vstatus { display: none; }
/* avatar placeholder shown when a participant has no live video (mic-only / cam off) */
.tile .avatar { position: absolute; inset: 0; display: none; place-items: center; background: linear-gradient(135deg, #283548, #0b0e13); color: #e7edf5; font-weight: 700; font-size: 30px; letter-spacing: .02em; }
.tile.novideo video { display: none; }
.tile.novideo .avatar { display: grid; }
.tile .vmic { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; display: none; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.tile .vmic svg { width: 13px; height: 13px; }
.tile.amuted .vmic { display: inline-flex; }

/* ---------- floating call control bar (mic / camera / screen / leave) ----------
   A pinned, translucent pill centered at the bottom of the stage — the standard
   video-call control surface. */
.callbar-wrap { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20; max-width: calc(100% - 24px); }
.callbar { display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 4px; position: relative;
  background: rgba(255,255,255,.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(16,24,40,.08); border-radius: 999px; box-shadow: 0 10px 34px rgba(16,24,40,.22); padding: 7px 10px; }
.callbar .cb-div { width: 1px; align-self: stretch; background: var(--line); margin: 4px 4px; }
.cb-ico { display: inline-grid; place-items: center; }
.cb-ico svg { width: 21px; height: 21px; display: block; }
.cb-count { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-radius: 999px; }
.cb-count .cb-ico svg { width: 15px; height: 15px; }

.cb-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 56px; padding: 6px 8px 5px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--text); font-weight: 600; line-height: 1; }
.cb-btn .cb-cap { font-size: 10.5px; font-weight: 600; letter-spacing: -.01em; }
.cb-btn:hover { background: rgba(16,24,40,.06); }
.cb-btn.cb-busy { opacity: .55; pointer-events: none; }
.cb-btn.active { background: var(--tint-2); color: var(--accent-2); }                            /* device in use */
.cb-btn.muted { background: #fde7eb; color: var(--danger); }                                     /* off / muted = red */
.cb-btn.cb-ghost { min-width: 0; padding: 11px; align-self: center; border-radius: 50%; }
.cb-btn.cb-ghost .cb-ico svg { width: 20px; height: 20px; }
.cb-btn.cb-ghost.active { background: rgba(16,24,40,.06); color: var(--text); }
.cb-leave { background: var(--danger); color: #fff; min-width: 56px; }
.cb-leave:hover { background: #c4153b; }
.cb-leave svg { transform: rotate(135deg); }

.cb-menu { position: absolute; right: 0; bottom: calc(100% + 10px); min-width: 230px; max-width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.cb-menu[hidden] { display: none; }
.cb-mh { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px 2px; }
.cb-msep { height: 1px; background: var(--line); margin: 4px 0; }
.cb-mi { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--text); }
.cb-mi:hover { background: var(--panel-2); }
.cb-mi-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.cb-mi.on .cb-mi-dot { border-color: var(--accent); background: var(--accent); }
.cb-mi.on { color: var(--accent); }

.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 12px; font-weight: 550; }
.tabs button:hover { background: var(--panel-2); }
.tabs button[aria-selected="true"] { color: var(--accent-2); box-shadow: inset 0 -2px 0 var(--accent-2); }
.panel { overflow: auto; padding: 12px; min-height: 0; }
.panel[hidden] { display: none; }

.member { display: flex; align-items: center; gap: 8px; padding: 6px 4px; }
.member .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-2); color: #fff; }
.member.tutor .av { background: var(--accent); color: #fff; }
.tag { font-size: 12px; color: var(--muted); }
.group-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 4px 4px; }

.answer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 8px; }
.answer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.answer .who { font-size: 13px; font-weight: 600; }
.answer-slide { font-size: 11px; color: var(--muted); margin: 2px 0; }
.answer-val { font-size: 14px; }
.answer-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
.verdict { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); }
.verdict.correct { color: var(--accent); border-color: var(--accent); }
.verdict.wrong { color: var(--danger); border-color: var(--danger); }
.answer.correct { border-color: var(--accent); }
.answer.wrong { border-color: var(--danger); }

/* answer dashboard: grouped by slide with coverage + reveal */
.ans-group { margin-bottom: 14px; }
.ans-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.ans-group-title { font-size: 12px; font-weight: 600; flex: 1 1 auto; min-width: 0; }
.ans-cover { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ans-reveal { font-size: 11px; padding: 3px 8px; }
.feedback.reveal { color: var(--accent); background: var(--tint); border-radius: 8px; padding: 8px 10px; }

/* ---------- in-call lesson panel (tutor) ---------- */
.lessonpanel { flex: none; max-height: 30vh; overflow: auto; border-bottom: 1px solid var(--line); padding: 8px 10px; }
.lessonpanel:empty { display: none; padding: 0; border: 0; }
.lp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.lp-head strong { font-size: 13px; }
.lp-title { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.lp-toggle { padding: 2px 6px; line-height: 1; }
.lp-switch { font-size: 11px; padding: 3px 8px; }
.lp-picker { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 24vh; overflow: auto; }
.lp-pick { display: flex; align-items: center; gap: 6px; text-align: left; font-size: 12px; padding: 6px 8px; }
.lp-pick.on { border-color: var(--accent); background: var(--tint); }
.lp-pick-title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-pick-loading { font-size: 12px; color: var(--muted); padding: 6px; }
.lp-list { display: flex; flex-direction: column; gap: 4px; }
.lp-row { display: flex; align-items: stretch; gap: 4px; border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 8px; background: var(--panel); overflow: hidden; }
.lp-row.cat-explain { border-left-color: var(--accent-2); }
.lp-row.cat-question { border-left-color: var(--accent); }
.lp-row.cat-exercise { border-left-color: var(--warn); }
.lp-row.active { outline: 2px solid var(--accent); outline-offset: -2px; }
.lp-jump { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; text-align: left; background: transparent; border: 0; padding: 7px 8px; min-width: 0; }
.lp-n { font-size: 11px; color: var(--muted); min-width: 16px; text-align: right; }
.lp-ic { font-size: 15px; }
.lp-textcol { display: flex; flex-direction: column; min-width: 0; }
.lp-row-title { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-row-sum { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-eye { border: 0; background: transparent; padding: 0 8px; opacity: .6; }
.lp-eye:hover { opacity: 1; }
.lp-preview-wrap { flex-basis: 100%; border-top: 1px dashed var(--line); padding: 6px; background: var(--panel-2); }
.lp-preview { position: static; inset: auto; padding: 8px 10px; transform: scale(.92); transform-origin: top left; max-height: 200px; overflow: auto; }
body.mode-livekit .side { overflow-y: auto; }
body.mode-livekit .lessonpanel { max-height: 24vh; }

.chat-msg { margin-bottom: 8px; }
.chat-msg .who { font-size: 12px; color: var(--muted); }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }

/* ---------- empty / loading states ---------- */
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 36px 16px; }
.empty-state { text-align: center; padding: 44px 20px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); }
.empty-state .ic { font-size: 34px; }
.empty-state h3 { margin: 12px 0 6px; }
.empty-state p { color: var(--muted); margin: 0 auto 16px; max-width: 360px; font-size: 14px; }
.skeleton { background: linear-gradient(90deg, var(--panel-2) 25%, #e9eef5 37%, var(--panel-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--radius-sm); }
.sk-row { height: 60px; margin-bottom: 8px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.loader { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); max-width: min(520px, 92vw); background: var(--text); color: #fff; border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow); font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- AI-lesson panel ---- */
.aipanel { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); max-height: 44vh; overflow: auto; min-height: 0; }
.aipanel:empty { display: none; padding: 0; border: 0; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-head strong { font-size: 13px; }
.ai-status { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-led { font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.ai-led.on { color: var(--accent); border-color: var(--accent); background: var(--tint); }
.ai-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-gen-box { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--accent); border-radius: 8px; background: var(--tint); }
.ai-gen-fields { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-gen-topic { flex: 1 1 140px; min-width: 120px; }
.ai-gen-type { flex: 0 1 auto; }
.ai-gen-level { width: 56px; flex: none; }
.ai-gen-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-gen-note { font-size: 12px; color: var(--muted); }
.ai-btn { font-size: 12px; padding: 6px 10px; border-radius: 8px; }
.ai-btn.sm { font-size: 11px; padding: 4px 8px; }
.ai-btn.ghost { background: transparent; }
.ai-btn.on { border-color: var(--accent-2); color: var(--accent-2); }
.ai-btn.rec { border-color: var(--danger); color: var(--danger); animation: blink 1.2s infinite; }
.ai-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ai-hints { display: flex; flex-direction: column; gap: 8px; padding: 0; overflow: visible; }
.ai-hint { border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 8px; padding: 8px 10px; background: var(--panel); }
.ai-hint.high { border-left-color: var(--danger); }
.ai-hint.medium { border-left-color: var(--warn); }
.ai-hint.low { border-left-color: var(--accent-2); }
.ai-hint.soft { background: var(--tint); border-left-color: var(--accent); }
.ai-hint-top { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.ai-tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ai-prio { font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.ai-prio.high { color: var(--danger); border-color: var(--danger); }
.ai-prio.medium { color: var(--warn); border-color: var(--warn); }
.ai-hint-title { font-weight: 600; font-size: 13px; }
.ai-hint-msg { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ai-hint-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ai-transcript { display: flex; flex-direction: column; gap: 4px; max-height: 22vh; }
.tr-line { font-size: 12px; line-height: 1.35; }
.tr-who { color: var(--muted); margin-right: 6px; font-weight: 600; }
.tr-line.tutor .tr-who { color: var(--accent-2); }
.tr-line.student .tr-who { color: var(--accent); }
.ai-exercise { border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--tint); padding: 10px; }
.ai-ex-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13px; margin-bottom: 8px; }

/* ---- extended exercises ---- */
.ex-line, .ai-ex-body p { font-size: clamp(15px, 2vw, 19px); line-height: 1.8; }
.ex-gap { width: 8em; margin: 0 4px; padding: 2px 8px; border-radius: 6px; }
.ex-preview { color: var(--accent); font-weight: 600; }
.ex-answer-row, .ex-bank { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; min-height: 36px; }
.ex-answer-row { border: 1px dashed var(--line); border-radius: 8px; padding: 6px; }
.ex-chip { font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.ex-chip.picked { border-color: var(--accent-2); background: var(--tint-2); }
.ex-chip.used { opacity: 0.35; }
.ex-pair { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 15px; }
.ex-select { min-width: 140px; }

/* multi-item exercises (student): one block per item with a ✓/✗ mark */
.ex-count { font-size: 12px; color: var(--muted); margin: -6px 0 10px; }
.ex-item { padding: 10px 0; border-top: 1px solid var(--line); }
.ex-item:first-of-type { border-top: 0; }
.ex-item-n { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.ex-opts { display: flex; flex-direction: column; gap: 6px; }
.ex-mark { font-weight: 800; font-size: 13px; }
.ex-mark.ok { color: var(--accent); }
.ex-mark.bad { color: var(--danger); }

.ex-opts.tf { flex-direction: row; gap: 8px; }
.ex-opts.tf .choice { width: auto; flex: 1; text-align: center; }
/* flashcards */
.flash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.flash-card { position: relative; min-height: 96px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; justify-content: center; padding: 10px; font-size: 16px; font-weight: 600; text-align: center; }
.flash-card .flash-back { display: none; color: var(--accent-2); }
.flash-card.flipped { background: var(--tint-2); }
.flash-card.flipped .flash-front { display: none; }
.flash-card.flipped .flash-back { display: block; }

/* multi-item editor (builder): one card per item */
.item-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-2); }
.item-card-h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.add-item-btn { margin-top: 2px; }

/* ---------- Cabinet ---------- */
.cab { min-height: 100%; display: grid; grid-template-columns: 248px 1fr; }
.cab-nav { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.cab-brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 14px; }
.cab-brand strong { font-size: 17px; letter-spacing: -0.01em; }
.cab-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); background: var(--panel-2); margin-bottom: 10px; }
.cab-user .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--accent-2); color: #fff; }
.cab-user .av.tutor { background: var(--accent); color: #fff; }
.cab-link { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; }
.cab-link:hover { background: var(--panel-2); text-decoration: none; }
.cab-link.active { background: var(--tint); color: #157f3b; font-weight: 600; }
.cab-link .ncount { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.cab-row.notif { cursor: pointer; }
.cab-row.notif:hover { border-color: var(--accent-2); }
.cab-row.notif.unread { border-left: 3px solid var(--accent); background: var(--tint); }

/* ---------- chips (lesson configurator) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; font-weight: 550; }
.chip:hover { border-color: var(--accent-2); background: var(--panel-2); }
.chip.on { border-color: var(--accent); background: var(--tint); color: #157f3b; }
.lesson-cfg input[type="range"] { width: 100%; accent-color: var(--accent); padding: 0; margin-top: 6px; }
.lesson-cfg label { margin: 12px 0 6px; }
.cfg-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.cfg-title h3 { margin: 0; }
.topic-row { display: flex; gap: 8px; }
.topic-row > input { flex: 1; }
.btn-icon-lg { flex: none; padding: 0 14px; min-width: 46px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm); font-size: 17px; line-height: 1; }
.btn-icon-lg:hover { border-color: var(--accent); background: var(--tint); }
.lang-row { display: flex; align-items: flex-end; gap: 8px; }
.lang-col { flex: 1; min-width: 0; }
.lang-cap { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.lang-select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-size: 14px; }
.lang-select:focus { border-color: var(--accent); outline: none; }
.btn-swap { height: 44px; }
/* AI/static topic suggestions under the topic field — one click to pick. */
.topic-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.topic-chips .chip { font-size: 12px; }
.cfg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.cfg-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.cfg-manual { font-size: 13px; color: var(--muted); }
.cfg-manual:hover { color: var(--accent-2); }
@media (max-width: 560px) { .cfg-row { grid-template-columns: 1fr; } }

/* ---------- deck builder ---------- */
.builder-head { margin-bottom: 14px; }
.builder-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.builder-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }

.slide-card { background: var(--panel); border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .12s; }
.slide-card:hover { box-shadow: var(--shadow); }
.slide-card.cat-explain { border-left-color: #cbd5e1; }
.slide-card.cat-question { border-left-color: var(--accent-2); }
.slide-card.cat-exercise { border-left-color: var(--accent); }

.slide-card-h { display: flex; align-items: center; gap: 8px; padding: 11px 14px; cursor: pointer; user-select: none; }
.slide-card-h:hover { background: var(--panel-2); }
.drag-dots { color: #c2cad6; font-size: 13px; letter-spacing: -2px; cursor: grab; }
.slide-badge { background: var(--panel-2); color: var(--text); font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.cat-question .slide-badge { background: var(--tint-2); color: var(--accent-2); }
.cat-exercise .slide-badge { background: var(--tint); color: #157f3b; }
.slide-num { color: var(--muted); font-size: 12px; font-weight: 600; }
.slide-sum { flex: 1; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: 12px; width: 14px; text-align: center; }

.slide-edit { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.slide-title { font-weight: 600; margin: 10px 0 8px; }
.slide-body { display: flex; flex-direction: column; gap: 8px; }
.slide-body .cab-field { margin: 0; }
.slide-body .cab-field label { margin: 4px 0 4px; }
.ai-gen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; margin-bottom: 6px; background: var(--tint); border: 1px solid var(--accent); border-radius: 8px; }
.ai-gen-row .tag { color: var(--accent); }

/* Per-item AI handles (regenerate / variants / explain) — lighter than the
   per-slide row so they read as a footer to each item. */
.ai-item-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.ai-item-row .tag { color: var(--accent); }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 7px; }

/* Validation: per-slide warning badge + offending-card outline + jump flash. */
.slide-issue { font-size: 12px; font-weight: 700; color: var(--danger); background: #fdeef2; border: 1px solid var(--danger); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.slide-card.has-issue { border-color: var(--danger); }
.slide-card.flash { animation: cardflash 1.2s ease; }
@keyframes cardflash { 0%,100% { box-shadow: none; } 25% { box-shadow: 0 0 0 3px var(--accent); } }

/* Live validation banner above the save bar. */
.valid-banner { margin: 8px 0; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.valid-banner.ok { background: #e9f9ee; border: 1px solid #34a853; color: #18794e; font-weight: 600; }
.valid-banner.bad { background: #fdeef2; border: 1px solid var(--danger); color: var(--danger); }
.valid-banner .vb-head { font-weight: 700; margin-bottom: 6px; }
.vb-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.vb-list .vi-row { list-style: none; margin-left: -18px; display: flex; justify-content: space-between; gap: 10px; cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.vb-list .vi-row:hover { background: rgba(0,0,0,0.04); }
.vi-go { color: var(--accent); white-space: nowrap; font-weight: 600; }

.icon-btn { padding: 5px 9px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); line-height: 1; font-size: 13px; }
.icon-btn:hover { background: var(--panel); border-color: var(--line); color: var(--text); }
.icon-btn.on { color: var(--accent-2); background: var(--tint-2); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); background: #fdeef2; }

.opt-row { display: flex; align-items: center; gap: 8px; }
.opt-row > input { flex: 1; }
.opt-row > input.opt-radio { flex: none; }
.opt-radio { width: 18px; height: 18px; accent-color: var(--accent); }

.preview-wrap { margin-top: 12px; padding: 12px 14px; background: #fbfdff; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.preview-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.preview-wrap .slide h2 { margin: 0 0 8px; font-size: 18px; }
.preview-wrap .slide .choice, .preview-wrap .slide .fill { margin: 4px 0; }

.add-slide { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 16px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel-2); }
.builder-bar { display: flex; align-items: center; gap: 8px; position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }
.cab-nav-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.cab-main { padding: 28px 32px; overflow: auto; min-width: 0; max-width: 1040px; }
.cab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.cab-head h1 { font-size: 24px; margin: 0; }
.cab-head-actions { display: flex; gap: 8px; }
.cab-lede { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.cab-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 8px; }
.cab-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .12s, transform .06s; }
.cab-card:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.cab-card-v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.cab-card-l { color: var(--muted); font-size: 13px; margin-top: 2px; }
/* Segmented switcher — toggle sub-views within a tab. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-bottom: 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 0; background: transparent; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-c { font-size: 11px; line-height: 1; background: var(--line); color: var(--muted); border-radius: 99px; padding: 2px 7px; font-weight: 700; }
.seg-btn.on .seg-c { background: var(--tint); color: #157f3b; }
.tab-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Home progress / level card — a warm gradient hero. */
.level-card { margin: 4px 0 18px; padding: 18px 20px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, #16a34a 0%, #2f6fed 100%); box-shadow: 0 6px 20px rgba(47,111,237,0.18); }
.lv-top { display: flex; align-items: center; gap: 14px; }
.lv-badge { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 28px; background: rgba(255,255,255,0.18); }
.lv-meta { flex: 1; min-width: 0; }
.lv-name { font-size: 20px; font-weight: 750; letter-spacing: -0.01em; }
.lv-sub { font-size: 13px; opacity: 0.85; }
.lv-xp { font-size: 26px; font-weight: 750; line-height: 1; }
.lv-xp span { font-size: 12px; font-weight: 600; opacity: 0.8; margin-left: 3px; }
.lv-bar { height: 9px; border-radius: 99px; background: rgba(255,255,255,0.25); margin: 14px 0 8px; overflow: hidden; }
.lv-fill { height: 100%; border-radius: 99px; background: #fff; transition: width .5s ease; }
.lv-next { font-size: 13px; opacity: 0.95; }
.lv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.lv-stat { background: rgba(255,255,255,0.14); border-radius: 10px; padding: 10px 8px; text-align: center; }
.lv-stat-v { font-size: 20px; font-weight: 750; }
.lv-stat-l { font-size: 11px; opacity: 0.85; margin-top: 2px; }
@media (max-width: 640px) { .lv-stats { grid-template-columns: repeat(2, 1fr); } }

.lv-streak { font-size: 13px; font-weight: 700; margin-left: 8px; background: rgba(255,255,255,0.22); border-radius: 99px; padding: 2px 9px; }

/* Home hero — level card + daily goal side by side. */
.home-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: stretch; margin: 4px 0 16px; }
.home-hero .level-card { margin: 0; }
@media (max-width: 760px) { .home-hero { grid-template-columns: 1fr; } }

/* Daily goal card — ring + 7-day streak strip. */
.daily-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; justify-content: space-between; }
.dg-top { display: flex; gap: 14px; align-items: center; }
.dg-meta { flex: 1; min-width: 0; }
.dg-title { font-weight: 750; font-size: 17px; letter-spacing: -0.01em; }
.dg-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.35; }
.dg-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 14px; }
.dg-day { text-align: center; }
.dg-dot { display: grid; place-items: center; height: 30px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); font-size: 15px; }
.dg-day.on .dg-dot { background: var(--tint); border-color: var(--accent); }
.dg-day.today .dg-dot { box-shadow: 0 0 0 2px var(--accent) inset; }
.dg-wl { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }

/* SVG progress ring. */
.ring-wrap { position: relative; width: 80px; height: 80px; flex: none; }
.ring { width: 80px; height: 80px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--panel-2); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-v { font-size: 17px; font-weight: 750; }
.ring-s { font-size: 9.5px; color: var(--muted); }

/* Continue-learning hero CTA. */
.continue-card { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 8px; }
.continue-card.empty { background: var(--tint); border-color: var(--accent); }
.cc-ic { font-size: 30px; flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); }
.cc-body { flex: 1; min-width: 0; }
.cc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.cc-t { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cc-acts { display: flex; gap: 8px; flex: none; }
@media (max-width: 560px) { .continue-card { flex-wrap: wrap; } .cc-acts { width: 100%; } .cc-acts button { flex: 1; } }

/* Leaderboard. */
.lb { display: flex; flex-direction: column; gap: 2px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; }
.lb-row:nth-child(odd) { background: var(--panel); }
.lb-row.me { background: var(--tint); border: 1px solid var(--accent); font-weight: 650; }
.lb-rank { width: 30px; font-weight: 750; font-size: 14px; text-align: center; flex: none; }
.lb-ic { font-size: 17px; flex: none; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-xp { color: var(--muted); font-size: 13px; font-weight: 650; flex: none; }

/* Mistake-review banner (Работа над ошибками). */
.mistakes-banner { display: flex; align-items: center; gap: 14px; border-radius: var(--radius); padding: 14px 18px; margin: 0 0 14px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); color: #fff; box-shadow: 0 4px 14px rgba(239,68,68,0.22); }
.mb-ic { font-size: 26px; flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,0.2); }
.mb-body { flex: 1; min-width: 0; }
.mb-t { font-weight: 750; font-size: 16px; }
.mb-sub { font-size: 12.5px; opacity: 0.92; margin-top: 2px; }
.mistakes-banner .primary { background: #fff; color: #b91c1c; flex: none; }
.result-note { text-align: center; color: var(--muted); font-size: 13.5px; margin: 12px 0 0; }

/* Daily quests. */
.quests { display: flex; flex-direction: column; gap: 8px; }
.quest { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; transition: border-color .15s, background .15s; }
.quest.done { border-color: var(--accent); background: var(--tint); }
.q-ic { font-size: 22px; flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); }
.quest.done .q-ic { background: rgba(34,197,94,.18); }
.q-body { flex: 1; min-width: 0; }
.q-t { font-weight: 650; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.q-prog { color: var(--muted); font-weight: 600; font-size: 12.5px; flex: none; }
.q-bar { height: 7px; border-radius: 99px; background: var(--panel-2); overflow: hidden; margin-top: 6px; }
.q-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-3) 130%); transition: width .5s ease; }
.q-xp { flex: none; font-weight: 750; font-size: 13px; color: var(--accent-3); background: rgba(245,158,11,.12); border-radius: 99px; padding: 4px 10px; }
.quest.done .q-xp { color: var(--accent); background: rgba(34,197,94,.14); }
.tag-done { background: var(--tint); color: var(--accent); border-color: var(--accent); }

/* Weekly league chip. */
.league-chip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 10px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #4f6ef7 0%, #8b5cf6 100%); color: #fff; box-shadow: 0 4px 14px rgba(79,110,247,0.22); }
.lc-ic { font-size: 28px; flex: none; }
.lc-name { font-weight: 750; font-size: 15px; }
.lc-sub { font-size: 12px; opacity: 0.9; margin-top: 1px; }

/* Train hub — lesson cards to practice. */
.train-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.train-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; transition: border-color .12s, transform .1s, box-shadow .12s; }
.train-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.tc-ic { transition: transform .15s; }
.train-card:hover .tc-ic { transform: scale(1.15) rotate(-6deg); }
.tc-ic { font-size: 26px; }
.tc-t { font-weight: 700; font-size: 15px; line-height: 1.25; }
.tc-sub { color: var(--muted); font-size: 12px; flex: 1; }
.train-card button { margin-top: 6px; }

/* Achievements grid. */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; opacity: 0.55; filter: grayscale(0.6); }
.ach.on { opacity: 1; filter: none; border-color: var(--accent); background: var(--tint); }
.ach-ic { font-size: 26px; }
.ach-name { font-weight: 650; font-size: 13px; margin-top: 4px; }
.ach-desc { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* Solo practice runner — step-by-step, one exercise per screen. */
.prac-top { margin-bottom: 16px; }
.prac-bar { height: 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.prac-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.prac-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; color: var(--muted); }
.prac-ok { color: var(--accent); font-weight: 650; }
.prac-num { font-size: 12px; font-weight: 650; color: var(--muted); margin: 16px 0 6px; }
/* Audio / picture / pronunciation. */
.ex-prompt { display: flex; align-items: center; gap: 8px; }
.ex-prompt-t { flex: 1; }
.ex-emoji { font-size: 56px; text-align: center; line-height: 1.1; margin: 4px 0 8px; }
.tts-btn { flex: none; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 16px; }
.tts-btn:hover { border-color: var(--accent-2); background: var(--tint-2); }
.mic-btn { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 13px; }
.mic-btn.rec { border-color: var(--danger); color: var(--danger); background: #fdeef2; }
.flash-tools { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.flash-flip { display: block; width: 100%; border: 0; background: transparent; cursor: pointer; padding: 0; }
.flash-emoji { display: block; font-size: 40px; margin-bottom: 4px; }
.flash-card.said-ok { outline: 2px solid var(--accent); }
.flash-card.said-bad { outline: 2px solid var(--danger); }

.prac-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.prac-topic { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
.ex-gap-slot { display: inline-block; min-width: 64px; padding: 2px 10px; margin: 0 3px; border: 1px dashed var(--accent-2); border-radius: 7px; background: var(--tint-2); color: var(--accent-2); font-weight: 600; cursor: pointer; }
.ex-gap-slot.filled { border-style: solid; background: var(--panel); }
.prac-nav { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.prac-nav .primary, .prac-nav .ghost { min-width: 130px; }
.prac-dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 16px; }
.prac-dot { width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
.prac-dot.cur { box-shadow: 0 0 0 3px var(--tint); border-color: var(--accent); }
.prac-dot.ok { background: var(--accent); border-color: var(--accent); }
.prac-dot.bad { background: var(--danger); border-color: var(--danger); }
.prac-theory { margin: 8px 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.prac-theory summary { cursor: pointer; font-weight: 600; }
.prac-finish { margin-top: 18px; }
.result-card { text-align: center; padding: 28px 20px; border-radius: var(--radius); color: #fff; background: linear-gradient(135deg, #22c55e 0%, #4f6ef7 100%); box-shadow: 0 10px 30px rgba(79,110,247,0.28); animation: pop-in .45s cubic-bezier(.2,1.35,.45,1); }
@keyframes pop-in { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.04); } 100% { transform: scale(1); opacity: 1; } }

/* Confetti celebration (self-cleaning DOM layer). */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.cf { position: absolute; top: -18px; width: 10px; height: 14px; border-radius: 2px; opacity: 0; animation-name: cf-fall; animation-timing-function: cubic-bezier(.25,.6,.45,1); animation-fill-mode: forwards; }
@keyframes cf-fall { 0% { transform: translate3d(0,-12vh,0) rotate(0); opacity: 1; } 100% { transform: translate3d(var(--dx,0),106vh,0) rotate(var(--rot,180deg)); opacity: .85; } }
.result-score { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; }
.result-pct { font-size: 15px; opacity: 0.95; margin-top: 4px; }
.result-xp { text-align: center; margin-top: 14px; font-size: 15px; }
.result-streak { color: var(--warn); font-weight: 700; }

/* Quick-action shortcuts on the dashboard. */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 18px 0 8px; }
.qa { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .12s, transform .06s; }
.qa:hover { border-color: var(--accent); transform: translateY(-1px); }
.qa-ic { font-size: 22px; line-height: 1.2; }
.qa-t { font-weight: 650; font-size: 14px; }
.qa-sub { color: var(--muted); font-size: 12px; }

/* "Учить язык" — goal-first flow. Dashboard launchpad strip + picker cards. */
.goal-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.goal-chip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .12s, transform .06s; }
.goal-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.goal-chip-ic { font-size: 18px; }
.learn-flow label { display: block; margin: 14px 0 6px; font-weight: 650; }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.goal-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color .12s, transform .1s, box-shadow .12s; }
.goal-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.goal-card.on { border-color: var(--accent); background: var(--tint); box-shadow: 0 0 0 2px var(--tint) inset; }
.goal-ic { font-size: 28px; transition: transform .15s; }
.goal-card:hover .goal-ic { transform: scale(1.15) rotate(-6deg); }
.goal-t { font-weight: 700; font-size: 15px; line-height: 1.2; }
.goal-sub { color: var(--muted); font-size: 12px; }
.learn-preview { display: grid; gap: 12px; margin: 8px 0 4px; }
.preview-card { padding: 14px 16px; background: #fbfdff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.preview-card .slide h2 { margin: 0 0 8px; font-size: 18px; }

/* Ordered track — a vertical path of stages with a connecting rail. */
.track { display: flex; flex-direction: column; }
.track-stage { display: flex; align-items: stretch; gap: 14px; }
.ts-rail { display: flex; flex-direction: column; align-items: center; width: 36px; flex: none; }
.ts-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; border: 2px solid var(--line); background: var(--panel); }
.ts-line { flex: 1; width: 2px; background: var(--line); margin: 2px 0; min-height: 14px; }
.ts-body { flex: 1; padding: 4px 0 18px; }
.ts-t { font-weight: 700; font-size: 15px; }
.ts-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ts-act { display: flex; align-items: flex-start; padding-top: 2px; }
.track-stage.done .ts-dot { border-color: var(--accent); background: var(--tint); color: var(--accent-ink); }
.track-stage.done .ts-line { background: var(--accent); }
.track-stage.current .ts-dot { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--tint-2); }
.track-stage.current .ts-t { color: var(--accent-2); }
.track-stage.locked .ts-dot,
.track-stage.locked .ts-body { opacity: .5; }

/* ===================== Gamified learning map ===================== */
.learn-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.lb-lang .lang-select { min-width: 180px; }
.lb-game { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; }
.lb-chip.hot { border-color: var(--accent-3); color: #b25e00; }
.branch-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.branch-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; }
.branch-pill:hover { border-color: var(--accent-2); }
.branch-pill.on { border-color: var(--accent); background: var(--tint); color: #157f3b; }
.branch-pill.ghosty { border-style: dashed; color: var(--muted); }
.branch-pill .bp-pct { font-size: 11px; color: var(--muted); }
.branch-pill.on .bp-pct { color: #157f3b; }
.rec-dot { color: var(--accent-3); }
.branch-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.branch-head h2 { margin: 0; }
.branch-head .sub { margin: 2px 0 0; }
.branch-prog { min-width: 160px; flex: 1; max-width: 280px; }
.bp-bar { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; margin-bottom: 4px; }
.bp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .4s; }

.lmap { display: flex; flex-direction: column; margin-top: 8px; }
.lnode { display: flex; gap: 14px; }
.ln-rail { display: flex; flex-direction: column; align-items: center; width: 42px; flex: none; }
.ln-dot { width: 42px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 18px; border: 2px solid var(--line); background: var(--panel); flex: none; }
.ln-dot.mission { border-radius: 50%; }
.ln-dot.boss { border-radius: 12px; transform: rotate(45deg); }
.ln-dot.boss > * { transform: rotate(-45deg); }
.ln-line { flex: 1; width: 2px; background: var(--line); margin: 2px 0; min-height: 16px; }
.ln-body { flex: 1; min-width: 0; padding: 2px 0 18px; }
.ln-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ln-t { font-weight: 700; font-size: 15px; }
.ln-sub { color: var(--muted); font-size: 13px; margin: 2px 0; }
.ln-meta { color: var(--muted); font-size: 12px; }
.ln-act { margin-top: 8px; }
.ln-badge { font-size: 11px; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.ln-badge.opt { border-color: var(--accent-2); color: var(--accent-2); }
.ln-badge.diff.easy { background: var(--tint); color: #157f3b; border-color: transparent; }
.ln-badge.diff.normal { background: var(--tint-2); color: var(--accent-2); border-color: transparent; }
.ln-badge.diff.hard { background: #fdeaea; color: #c0392b; border-color: transparent; }
.lnode.done .ln-dot { border-color: var(--accent); background: var(--tint); color: var(--accent-ink); }
.lnode.done .ln-line { background: var(--accent); }
.lnode.current .ln-dot { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--tint-2); }
.lnode.current .ln-t { color: var(--accent-2); }
.lnode.locked .ln-dot { opacity: .55; }
.lnode.locked .ln-body { opacity: .55; }
.lnode.optional .ln-dot { border-style: dashed; }

/* mission / boss framing */
.mission-card, .boss-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.mission-card { border-left: 4px solid var(--accent-2); }
.boss-card { border-left: 4px solid var(--accent-3); background: linear-gradient(180deg, #fffaf0, var(--panel)); }
.mc-label, .bc-label { font-size: 11px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.mc-context, .bc-intro { font-size: 15px; line-height: 1.5; margin: 8px 0; }
.mc-task { display: flex; gap: 10px; align-items: baseline; background: var(--tint-2); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px; }
.mc-task-l { font-weight: 700; white-space: nowrap; }
.bc-checks { margin: 8px 0; font-size: 14px; }
.bc-crit { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.boss-result { text-align: center; padding: 22px; border-radius: var(--radius); border: 1px solid var(--line); }
.boss-result.win { background: var(--tint); border-color: var(--accent); }
.boss-result.again { background: var(--tint-2); }
.br-emoji { font-size: 46px; }
.br-t { font-size: 20px; font-weight: 800; margin: 6px 0; }
.br-score { color: var(--muted); }
.br-block { margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.br-block.ok { background: var(--tint); }
.br-block.warn { background: #fff6e6; }

/* recovery (soft, never a red fail) */
.recovery-card { display: flex; gap: 14px; align-items: center; background: var(--tint-2); border: 1px solid var(--accent-2); border-radius: var(--radius); padding: 16px 18px; }
.rc-ic { font-size: 32px; }
.rc-t { font-weight: 700; }
.rc-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* AI study companion */
.coach { margin-top: 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: #fbfdff; }
.coach-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.coach-hint { font-weight: 400; color: var(--muted); font-size: 11px; }
.coach-log { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.coach-log:empty { display: none; }
.coach-msg { font-size: 13px; line-height: 1.45; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.coach-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* entry choices */
.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.entry-card { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-align: left; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color .12s, transform .1s; }
.entry-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.ec-ic { font-size: 30px; }
.ec-t { font-weight: 700; font-size: 16px; }
.ec-sub { color: var(--muted); font-size: 13px; }

/* dashboard "Продолжить путь" */
.continue-path { display: flex; gap: 16px; align-items: stretch; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; flex-wrap: wrap; }
.cp-main { flex: 1; min-width: 220px; }
.cp-label { font-size: 11px; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.cp-cur { display: flex; gap: 10px; align-items: center; margin: 6px 0 10px; }
.cp-ic { font-size: 26px; }
.cp-t { font-weight: 700; font-size: 16px; }
.cp-sub { color: var(--muted); font-size: 12px; }
.cp-bar { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.cp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.cp-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 6px; }
.cp-meta .hot { color: #b25e00; }
.cp-act { display: flex; flex-direction: column; gap: 8px; justify-content: center; align-items: stretch; }
.cp-rec { font-size: 12px; color: var(--muted); text-align: center; }
.skill-mini { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.smini { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.smini-ic { font-size: 15px; }
.smini-bar { width: 10px; height: 38px; background: var(--panel-2); border-radius: 5px; display: flex; align-items: flex-end; overflow: hidden; border: 1px solid var(--line); }
.smini-fill { width: 100%; background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.smini-v { font-size: 10px; color: var(--muted); }

/* "Мой прогресс" */
.prog-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.ph-lvl { display: flex; align-items: center; gap: 12px; }
.ph-ic { font-size: 34px; }
.ph-name { font-weight: 800; font-size: 18px; }
.ph-next { color: var(--muted); font-size: 13px; }
.prog-rec { background: var(--tint-2); border-radius: var(--radius-sm); padding: 10px 14px; margin: 14px 0; font-size: 14px; }
.skill-grid { display: flex; flex-direction: column; gap: 10px; }
.skill-row { display: flex; align-items: center; gap: 12px; }
.sk-ic { font-size: 20px; width: 26px; text-align: center; }
.sk-body { flex: 1; }
.sk-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.sk-v { color: var(--muted); }
.sk-bar { height: 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; margin-top: 3px; }
.sk-fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s; }

/* reward toast */
.learn-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #14223d; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transition: opacity .25s, transform .25s; z-index: 9999; pointer-events: none; }
.learn-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== AI Teacher ===================== */
.tch-av { width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.tch-av.big { width: 56px; height: 56px; font-size: 28px; border-radius: 16px; }
.tch-name { font-weight: 700; font-size: 16px; }
.tch-role { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.tch-tone { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.tch-hero { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tch-hero-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tch-plan { margin: 6px 0; padding-left: 20px; }
.tch-plan li { margin: 3px 0; }
.tch-note { background: var(--tint-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.tch-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tch-thread { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; max-height: 380px; overflow-y: auto; }
.tch-thread:empty { display: none; }
.tch-msg { font-size: 14px; line-height: 1.45; padding: 9px 12px; border-radius: 12px; max-width: 90%; }
.tch-msg.ai { background: var(--panel); border: 1px solid var(--line); align-self: flex-start; }
.tch-msg.me { background: var(--tint-2); align-self: flex-end; }
.tch-msg-who { display: block; font-weight: 700; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.tch-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tch-choice { display: flex; gap: 10px; align-items: center; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
.tch-choice:hover { border-color: var(--accent); }
.tch-choice.on { border-color: var(--accent); background: var(--tint); }
.tch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 10px; }
.tch-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.tch-card-h { display: flex; gap: 10px; align-items: center; }
.tch-card-d { color: var(--muted); font-size: 13px; flex: 1; }
.tch-card-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.tch-card-a { display: flex; gap: 6px; flex-wrap: wrap; }
.tch-policy { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px; }
.tch-sect { display: block; margin: 14px 0 6px; font-weight: 650; font-size: 14px; }
.tch-gen-prev { margin: 8px 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.tch-gen-prev summary { cursor: pointer; font-weight: 600; }
.tch-gen-prev p { font-size: 13px; margin: 6px 0; }
.emoji-pal { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick { width: 40px; height: 40px; font-size: 20px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.emoji-pick:hover { border-color: var(--accent-2); }
.emoji-pick.on { border-color: var(--accent); background: var(--tint); box-shadow: 0 0 0 2px var(--tint); }
.color-pal { display: flex; flex-wrap: wrap; gap: 8px; }
.color-pick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.color-pick.on { border-color: #fff; box-shadow: 0 0 0 2px var(--text); }
.tch-preview-out { margin-top: 10px; }
.tch-prev-block { margin: 8px 0; }
.tch-pre { background: #0f1b30; color: #d6e2ff; padding: 12px; border-radius: var(--radius-sm); white-space: pre-wrap; font-size: 12px; overflow-x: auto; }
.tch-dash { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tch-dash-b { flex: 1; }
.tch-dash-label { font-size: 11px; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.tch-dash-rec { color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.tch-dash-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tch-review { margin: 14px 0; border: 1px solid var(--line); border-left: 4px solid var(--accent-2); border-radius: var(--radius-sm); padding: 12px 14px; background: #fbfdff; }
.tch-review-h { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.tch-review-b { font-size: 14px; line-height: 1.45; }
.tch-advice { display: flex; gap: 10px; align-items: center; background: var(--tint-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.tch-advice.loading { color: var(--muted); }
.ta-who { font-size: 18px; }

@media (max-width: 560px) {
  .continue-path { flex-direction: column; }
  .cp-act { flex-direction: row; }
  .branch-head { flex-direction: column; align-items: stretch; }
  .branch-prog { max-width: none; }
  .tch-hero { flex-direction: column; align-items: flex-start; }
}

/* ===================== Live AI Teacher (LiveKit room) ===================== */
.live-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
.live-tile { background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.live-av { width: 96px; height: 96px; border-radius: 28px; display: flex; align-items: center; justify-content: center; font-size: 46px; border: 1px solid var(--line); }
.live-tname { font-weight: 800; font-size: 18px; }
.live-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.live-status { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.live-status.s-speaking { background: var(--tint); color: #157f3b; border-color: var(--accent); }
.live-status.s-thinking { background: #fff6e6; color: #b25e00; }
.live-status.s-listening { background: var(--tint-2); color: var(--accent-2); }
.live-status.s-paused { background: var(--panel-2); color: var(--muted); }
.live-status.s-failed { background: #fdeaea; color: #c0392b; }
.live-wave { display: flex; gap: 4px; align-items: flex-end; height: 22px; }
.live-wave span { width: 4px; height: 6px; background: var(--line); border-radius: 2px; }
.live-wave.on span { background: var(--accent); animation: lw 0.8s ease-in-out infinite; }
.live-wave.on span:nth-child(2) { animation-delay: .1s } .live-wave.on span:nth-child(3) { animation-delay: .2s } .live-wave.on span:nth-child(4) { animation-delay: .3s } .live-wave.on span:nth-child(5) { animation-delay: .15s }
@keyframes lw { 0%,100% { height: 6px } 50% { height: 22px } }
.live-subtitle { font-size: 15px; line-height: 1.45; color: var(--text); min-height: 44px; background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px 14px; width: 100%; }
.live-side { display: flex; flex-direction: column; gap: 12px; }
.live-plan { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.lp-h { font-weight: 700; font-size: 13px; }
.lp-goal { color: var(--muted); font-size: 13px; margin: 4px 0; }
.lp-steps { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.live-controls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.lc-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.live-convo { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.live-convo-h { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.live-thread { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; margin-bottom: 10px; }
.live-thread.sm { max-height: 220px; }
.live-line { font-size: 14px; line-height: 1.4; padding: 8px 11px; border-radius: 11px; max-width: 92%; }
.live-line.teacher { background: var(--panel-2); border: 1px solid var(--line); align-self: flex-start; }
.live-line.learner { background: var(--tint-2); align-self: flex-end; }
.ll-who { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
/* admin console */
.live-console { display: grid; grid-template-columns: 320px 1fr; gap: 14px; }
.live-sess-row { cursor: pointer; }
.live-sess-row:hover { border-color: var(--accent-2); }
.live-sess-row.bad { border-color: #f0b4b4; }
.live-sess-detail { min-width: 0; }
.lsd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lsd-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.lsd-events { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.lsd-ev { display: flex; gap: 8px; }
.live-console details { margin: 8px 0; }
.live-console summary { cursor: pointer; font-weight: 600; }
/* lesson board (the AI-generated slides the teacher walks through) */
.live-board { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.live-board-top { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.live-board .slide { min-height: 80px; }
.live-board .slide h2 { margin: 0 0 8px; font-size: 19px; }
.live-board-nav { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }
.live-board-wait { color: var(--muted); padding: 24px; text-align: center; }
.live-voice-note { background: #fff6e6; color: #b25e00; border: 1px solid #f0d6a8; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.live-mic.on { border-color: var(--accent); background: var(--tint); color: #157f3b; }

@media (max-width: 760px) { .live-grid { grid-template-columns: 1fr; } .live-console { grid-template-columns: 1fr; } }

/* AI-teacher panel inside a real lesson room */
.roomai { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 8px; gap: 7px; position: relative; }
.rai-head { display: flex; gap: 9px; align-items: center; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-sm); padding: 7px 9px; flex: none; }
.rai-head-t { min-width: 0; flex: 1; }
.rai-av { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.rai-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
/* segmented view switch (Урок / Студия) */
.rai-seg-row { display: flex; gap: 4px; flex: none; background: var(--panel-2); padding: 3px; border-radius: 10px; }
.rai-seg { flex: 1; padding: 6px 8px; border: 0; background: transparent; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.rai-seg.on { background: var(--panel); color: var(--accent-2); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
/* each view fills the remaining height; only one shown at a time */
.rai-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 7px; }
.rai-view[hidden] { display: none; }
.rai-view-studio { overflow-y: auto; gap: 0; padding-right: 2px; }
/* sticky bottom: quick actions + input */
.rai-foot { flex: none; display: flex; flex-direction: column; gap: 6px; padding-top: 7px; border-top: 1px solid var(--line); }
.rai-quick { display: flex; gap: 4px; flex-wrap: wrap; }
.rai-q { width: 34px; height: 32px; font-size: 15px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.rai-q:hover { background: var(--panel-2); border-color: var(--accent-2); }
.rai-q.danger:hover { border-color: var(--danger); background: var(--tint); }
.rai-tip { font-size: 11px; color: var(--muted); text-align: center; }
.rai-empty { font-size: 12.5px; color: var(--muted); line-height: 1.5; padding: 14px 10px; text-align: center; margin: auto; }
.rai-ctl-hint { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.rai-co { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px 1px 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); vertical-align: middle; }
.rai-av.sm { width: 20px; height: 20px; border-radius: 7px; font-size: 12px; border-width: 1px; }
.rai-vibe { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 8px; }
.rai-chip { font-size: 12px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2, #fff); cursor: pointer; }
.rai-chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.rai-studio-body { margin-top: 6px; }
.rai-pkg { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; background: var(--surface-2, #fafafa); }
.rai-pkg-t { font-weight: 700; }
.rai-pkg-p { font-size: 13px; color: var(--muted); margin: 3px 0; }
.rai-pkg-role { font-size: 12px; font-weight: 600; }
.rai-cast-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.rai-cast { flex: 1 1 45%; min-width: 120px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; padding: 5px 8px; font-size: 12px; }
.rai-cast-i { margin-right: 4px; }
.rai-cast-h { color: var(--muted); font-style: italic; margin-top: 2px; }
.rai-pkg-note, .rai-pkg-err { font-size: 11px; color: var(--muted); margin-top: 4px; }
.rai-pkg-err { color: #c0392b; }
.rai-pkg-ok { font-size: 12px; color: #157f3b; padding: 6px 2px; }
.rai-pkg-load { font-size: 13px; color: var(--muted); padding: 8px 2px; }
.rai-studio-sec { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rai-studio-sec:last-child { border-bottom: 0; }
.rai-sec-t { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.rai-cand { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 6px 9px; margin-bottom: 6px; }
.rai-cand.lead { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.rai-cand.partner { background: color-mix(in srgb, #22d3ee 10%, transparent); }
.rai-cand-h { display: flex; align-items: center; gap: 6px; }
.rai-cand-p { font-size: 12px; color: var(--muted); margin: 3px 0; }
.rai-cand-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.rai-rolesel { flex: 1; font-size: 12px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; }
.rai-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.rai-tag.lead { background: var(--accent); color: #fff; }
.rai-tag.partner { background: #22d3ee; color: #06303a; }
.rai-cbtn.sm { padding: 3px 9px; }
.rai-beats { margin: 6px 0 4px; padding-left: 20px; font-size: 12px; color: var(--muted); }
.rai-beats li { margin: 2px 0; }
.rai-field { margin: 7px 0; }
.rai-field > .rai-ctl-l { margin-bottom: 4px; }
.rai-sel { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 13px; }
.rai-agents { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.rai-agent { display: flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-left-width: 4px; background: var(--panel); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; cursor: pointer; text-align: left; }
.rai-agent:hover { background: var(--panel-2); }
.rai-agent.on { background: var(--tint-2); border-color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--accent-2); }
.rai-agent-i { font-size: 15px; }
.rai-slot { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 8px 10px; margin: 6px 0; background: var(--panel-2); }
.rai-slot.empty { background: transparent; border-style: dashed; }
.rai-slot-h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.rai-slot-tag { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
/* collapsible accordion sections in the studio */
.rai-acc { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; background: var(--panel); }
.rai-acc.open { box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.rai-acc-h { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 11px 12px; cursor: pointer; text-align: left; font: inherit; }
.rai-acc-h:hover { background: var(--panel-2); }
.rai-acc-t { font-weight: 700; font-size: 14px; }
.rai-acc-sub { color: var(--muted); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rai-acc-x { margin-left: auto; color: var(--muted); font-size: 13px; }
.rai-acc-b { padding: 4px 12px 12px; border-top: 1px solid var(--line); }
.rai-miclang { display: flex; align-items: center; gap: 6px; }
.rai-mic-lang { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 12px; }
.rai-voice-row { display: flex; gap: 6px; align-items: center; }
.rai-voice-row .rai-sel { flex: 1; }
.rai-play { flex: none; font-size: 14px; line-height: 1; }
.rai-sub { font-size: 12px; color: var(--muted); }
.rai-status { font-weight: 600; }
.rai-status.s-speaking { color: #157f3b; } .rai-status.s-thinking { color: #b25e00; } .rai-status.s-listening { color: var(--accent-2); }
.rai-caption { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; line-height: 1.4; }
.rai-log { flex: 1; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.rai-line { font-size: 13px; line-height: 1.4; padding: 6px 9px; border-radius: 10px; max-width: 94%; }
.rai-line.teacher { background: var(--panel-2); border: 1px solid var(--line); align-self: flex-start; }
.rai-line.learner { background: var(--tint-2); align-self: flex-end; }
.rai-who { display: block; font-size: 10px; font-weight: 700; color: var(--muted); margin-bottom: 1px; }
.rai-interim { font-size: 13px; color: var(--muted); font-style: italic; }
.rai-controls { display: flex; gap: 6px; }
.rai-mic { white-space: nowrap; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 12px; font-weight: 600; cursor: pointer; }
.rai-mic.on { border-color: var(--accent); background: var(--tint); color: #157f3b; }
.rai-input { flex: 1; min-width: 0; }
.rai-ctl-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.rai-cbtn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; }
.rai-cbtn:hover { border-color: var(--accent-2); }
.rai-ctl-l { font-size: 12px; color: var(--muted); }
.rai-mode { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.rai-mode.on { border-color: var(--accent); background: var(--tint); color: #157f3b; }
.rai-flash { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: #14223d; color: #fff; padding: 5px 12px; border-radius: 999px; font-size: 12px; z-index: 5; }
.roomai { position: relative; }

/* Small helper text under a form field. */
.field-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.cab-section { margin: 26px 0; }
.cab-section > h2 { font-size: 16px; margin: 0 0 12px; }
.lib-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.lib-head h2 { font-size: 16px; margin: 0; }
.lib-search { width: 100%; margin-bottom: 12px; }
.cab-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.cab-row-t { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cab-row-a { display: flex; gap: 6px; flex-shrink: 0; }
.cab-row-a button, .cab-row-a a { padding: 7px 12px; font-size: 13px; }
.cab-badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-weight: 550; }
.cab-badge.s-scheduled, .cab-badge.s-assigned { color: var(--accent-2); border-color: var(--accent-2); background: var(--tint-2); }
.cab-badge.s-submitted { color: var(--warn); border-color: var(--warn); background: #fdf3e6; }
.cab-badge.s-completed, .cab-badge.s-reviewed { color: #157f3b; border-color: var(--accent); background: var(--tint); }
.cab-badge.s-cancelled, .cab-badge.s-missed, .cab-badge.s-overdue { color: var(--danger); border-color: var(--danger); background: #fdeef2; }
.cab-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.cab-form h3 { margin: 0 0 10px; font-size: 15px; }
.cab-field { margin-bottom: 12px; }
.cab-field label { margin: 0 0 5px; }
.cab-checks { display: flex; flex-direction: column; gap: 6px; }
.cab-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.cab-check input { width: auto; }
.cab-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px; box-shadow: var(--shadow-sm); }
.cab-kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cab-kv:last-child { border-bottom: 0; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; gap: 24px; padding: 28px 18px; max-width: 460px; }
  .auth-hero { max-width: none; }
  .auth-card { justify-self: stretch; max-width: none; }
}
@media (max-width: 760px) {
  /* Stack: stage on top, dock as a bottom panel (tabs horizontal, one body). */
  .stage { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .side { border-left: 0; border-top: 1px solid var(--line); max-height: 50vh; padding-bottom: 70px; }
  .dock, .dock.collapsed { width: 100%; }
  .dock.collapsed .dock-head { flex-direction: row; }
  .dock.collapsed .dock-tabs { flex-direction: row; overflow-x: auto; }
  .dock.collapsed .dock-bodies { display: none; }
  /* Camera PiP stays small and draggable; LiveKit iframe a bit larger. */
  .camdock { width: 124px; top: 8px; right: 8px; }
  body.mode-livekit .camdock { width: 172px; }
  .callframe-wrap.on { height: 116px; }
  .camdock-body { max-height: 38vh; }
  /* Call bar pinned to viewport bottom as a centered pill. */
  .callbar-wrap { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 60; }
  .callbar { gap: 2px; padding: 6px 8px; }
  .cb-btn { min-width: 50px; padding: 6px 6px 5px; }
  .cb-count { display: none; }
  .topbar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .topbar #roomtitle { font-size: 15px; }
  .topbar #invite { margin-left: auto; }
  .lesson-row, .cab-row { flex-direction: column; align-items: stretch; }
  .cab-row-a { justify-content: flex-end; }
  .invite-banner { flex-direction: column; align-items: stretch; }

  /* cabinet: sidebar -> sticky bottom nav */
  .cab { grid-template-columns: 1fr; }
  .cab-nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto;
    flex-direction: row; align-items: center; gap: 2px; padding: 6px 8px;
    border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; z-index: 30;
    box-shadow: 0 -4px 16px rgba(16,24,40,.06);
  }
  .cab-brand, .cab-user, .cab-nav-foot { display: none; }
  .cab-nav nav { display: flex; gap: 2px; width: 100%; justify-content: space-around; }
  .cab-link { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; white-space: nowrap; }
  .cab-main { padding: 18px 16px 84px; max-width: none; }
  .cab-kv { grid-template-columns: 1fr; gap: 2px; }
}

/* ---- dictionary-style per-item hint ---- */
.ex-hint { margin: 6px 0 2px; }
.ex-hint-btn { background: none; border: 1px dashed var(--border, #cbd5e1); border-radius: 8px; padding: 2px 8px; font-size: 12px; color: var(--muted, #64748b); cursor: pointer; }
.ex-hint-btn:hover { background: rgba(0,0,0,.03); }
.ex-hint-body { margin-top: 4px; padding: 6px 10px; font-size: 13px; background: rgba(99,102,241,.07); border-radius: 8px; color: var(--text, #1e293b); }
.flash-def { display: block; margin-top: 6px; font-size: 11px; opacity: .8; font-style: italic; }

/* ---- AI live transcript ---- */
.ai-transcript-head { font-size: 12px; font-weight: 600; color: var(--muted, #64748b); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.ai-stt-status { font-size: 11px; font-weight: 500; margin-left: auto; }
.ai-stt-status.ok { color: #16a34a; }
.ai-stt-status.bad { color: #dc2626; }
.ai-transcript-log { max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.ai-transcript-log .tr-line { font-size: 13px; line-height: 1.35; }
.ai-transcript-log .tr-line.tutor .tr-who { color: #2563eb; }
.tr-who { font-weight: 600; margin-right: 6px; }
.tr-interim { font-size: 13px; opacity: .6; font-style: italic; margin-top: 3px; }
.ai-stt-lang { font-size: 12px; padding: 2px 4px; border-radius: 8px; border: 1px solid var(--border, #cbd5e1); }

/* ---- exercise homework (student) ---- */
.hw-exercises { display: flex; flex-direction: column; gap: 14px; }
.hw-ex { padding: 12px; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; background: var(--card, #fff); }

/* ---- RU/EN language toggle ---- */
.lang-toggle { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line, #cbd5e1); border-radius: 8px; background: var(--panel, #fff); }
.lang-toggle-btn { border: 0; background: transparent; color: var(--muted, #64748b); font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; cursor: pointer; line-height: 1; }
.lang-toggle-btn:hover { background: rgba(0,0,0,.05); }
.lang-toggle-btn.on { background: var(--accent, #1f8cf9); color: #fff; }
.cab-nav-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar .lang-toggle { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.topbar .lang-toggle-btn { color: #cdd6e0; }
.lobby-lang { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* ---------- Room dock declutter (Phase 1 redesign) ---------- */
/* Primary views show a label; secondary collapse to just their glyph so the
   strip reads as "Разговор · Чат · ▫ ▫ ▫" instead of six equal tabs. */
.dock { width: 360px; }
.dock-tab.icon-only .dock-tab-lbl { display: none; }
.dock-tab.icon-only { padding: 8px 9px; }
.dock-head { gap: 4px; padding: 6px; }
.dock-tab { border-radius: 999px; padding: 8px 14px; transition: background .12s ease, color .12s ease; }
.dock-tab[aria-selected="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.dock-tab.icon-only .dock-tab-ic { font-size: 16px; }

/* ---------- Room studio chrome (Phase 2 — safe: dark frame, board stays light) ----------
   Scoped to .room so cabinet/home are untouched. We darken ONLY the chrome
   (topbar, stage background, side frame) and turn the board into a light card —
   the slide surface keeps its light background so slide text stays readable. */
.room { background: #0b0f18; }
.room .topbar { background: linear-gradient(180deg,#151b2b,#10141f); border-bottom: 1px solid #232d44; }
.room .topbar #roomtitle { color: #f1f4fb; }
.room .topbar .pill { background: #1a2236; border-color: #2b3754; color: #a6b4d4; }
.room .topbar .pill.online .led { background: #34d399; box-shadow: 0 0 8px #34d399; }
.room .topbar .ghost { color: #b3c0dd; border: 1px solid #2b3754; background: #161d2e; border-radius: 9px; }
.room .topbar .ghost:hover { background: #1e2840; }
.room .stage { background: #0b0f18; padding: 14px; gap: 14px; }
.room .main { gap: 12px; }
/* board = light card floating on the dark stage */
.room .surface { background: #fbfdff; border: 1px solid #1d2740; border-radius: 16px;
  box-shadow: 0 14px 36px rgba(0,0,0,.40); }
/* side panel = its own rounded card, not a flush column */
.room .side { border: 1px solid #1d2740; border-left: 1px solid #1d2740; border-radius: 16px;
  background: var(--panel); overflow: hidden; }
/* floating toolbar pill under the board */
.room .toolbar { background: rgba(20,26,40,.92); border: 1px solid #232d44; border-radius: 14px;
  padding: 8px 10px; margin: 0; backdrop-filter: blur(6px); }
.room .toolbar button { color: #cdd8f0; }
.room .toolbar .pill { background: #1a2236; border-color: #2b3754; color: #a6b4d4; }

/* toolbar buttons sit on the dark pill */
.room .toolbar button:not(.swatch) { background: #1a2236; border: 1px solid #2b3754; color: #cdd8f0; }
.room .toolbar button:not(.swatch):hover { background: #222c46; }
.room .toolbar button.primary { background: linear-gradient(180deg,#5570e6,#4459c8); border-color: transparent; color: #fff; }
.room .toolbar .tb-sep { background: #2b3754; }
