/* ==========================================================================
   Platforma de curs — sistem de design.

   Doua teme (intunecata implicita + luminoasa), comutate prin data-theme pe
   <html>. Totul trece prin variabilele de mai jos, asa ca o culoare se schimba
   intr-un singur loc. Fara gradiente decorative, fara glow: suprafete plate,
   contrast bun, un singur accent cald.

   Sectiuni: tokeni -> primitive -> componente -> mascota -> ecrane.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Suprafete */
  --bg: #101219;
  --bg-deep: #0b0d13;
  --surface: #171a23;
  --surface-2: #1e222d;
  --surface-3: #262b38;

  /* Text */
  --ink: #e9ecf2;
  --ink-2: #99a1b3;
  --ink-3: #646d80;

  /* Linii */
  --line: #262b38;
  --line-2: #333a4a;

  /* Accent principal — chihlimbar */
  --accent: #f5b83d;
  --accent-dark: #d99c22;
  --accent-bright: #ffcb63;
  --accent-text: #201603;
  --accent-soft: rgba(245, 184, 61, 0.12);
  --gold: #f5b83d;
  --gold-soft: rgba(245, 184, 61, 0.12);

  /* Tonurile unitatilor de pe traseul de lectii. Nu sunt culori noi: sunt
     menta, chihlimbarul, violetul si albastrul de mai jos, cu muchia lor
     inchisa (buza de sub buton) si cerneala care se citeste peste ele. */
  --u1: #3ecf8e; --u1-edge: #2a9e6a; --u1-ink: #07281a;
  --u2: #f5b83d; --u2-edge: #cf941e; --u2-ink: #201603;
  --u3: #a78bfa; --u3-edge: #7f5fe6; --u3-ink: #190f33;
  --u4: #6f9dee; --u4-edge: #4a79cd; --u4-ink: #07172c;

  /* Accente secundare */
  --blue: #6f9dee;
  --blue-soft: rgba(111, 157, 238, 0.13);
  --mint: #3ecf8e;
  --mint-soft: rgba(62, 207, 142, 0.13);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);

  /* Semantice */
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.13);
  --danger: #f0736a;
  --danger-soft: rgba(240, 115, 106, 0.13);
  --warn: #e0b45a;
  --warn-soft: rgba(224, 180, 90, 0.13);

  /* Bara laterala */
  --sidebar-bg: #0c0e14;
  --sidebar-ink: #b5bccb;
  --sidebar-dim: #5c6577;

  /* Editorul de cod ramane intunecat in ambele teme — asa e peste tot. */
  --ide-bg: #1c1f26;
  --ide-surface: #23272f;
  --ide-ink: #c5cdd8;
  --ide-line: #333a45;

  /* Forma */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 18px 44px -18px rgba(0, 0, 0, 0.7);
  --glow: none;
  --ring: 0 0 0 3px rgba(245, 184, 61, 0.28);

  /* Trei fonturi, fiecare cu treaba lui: titluri, interfata, date. */
  --display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Scara de spatiere — multipli de 4, folositi peste tot. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f6f7f9;
  --bg-deep: #eceef2;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e7eaf0;

  --ink: #171a21;
  --ink-2: #5a6373;
  --ink-3: #8b94a5;

  --line: #e2e6ec;
  --line-2: #cfd5df;

  --accent: #b7791f;
  --accent-dark: #96620f;
  --accent-bright: #d99c22;
  --accent-text: #ffffff;
  --accent-soft: rgba(183, 121, 31, 0.11);
  --gold: #b7791f;
  --gold-soft: rgba(183, 121, 31, 0.11);

  --u1: #12855c; --u1-edge: #0b6142; --u1-ink: #ffffff;
  --u2: #b7791f; --u2-edge: #8e5c11; --u2-ink: #ffffff;
  --u3: #6d4ad6; --u3-edge: #5233b0; --u3-ink: #ffffff;
  --u4: #2f6fd0; --u4-edge: #2153a2; --u4-ink: #ffffff;

  --blue: #2f6fd0;
  --blue-soft: rgba(47, 111, 208, 0.1);
  --mint: #12855c;
  --mint-soft: rgba(18, 133, 92, 0.1);
  --violet: #6d4ad6;
  --violet-soft: rgba(109, 74, 214, 0.1);

  --ok: #12855c;
  --ok-soft: rgba(18, 133, 92, 0.1);
  --danger: #c93b32;
  --danger-soft: rgba(201, 59, 50, 0.1);
  --warn: #9a6b12;
  --warn-soft: rgba(154, 107, 18, 0.1);

  --sidebar-bg: #12141b;
  --sidebar-ink: #c3cad8;
  --sidebar-dim: #6b7488;

  --shadow-sm: 0 1px 2px rgba(16, 20, 30, 0.07);
  --shadow: 0 6px 18px -10px rgba(16, 20, 30, 0.28);
  --shadow-lg: 0 20px 46px -22px rgba(16, 20, 30, 0.35);
  --ring: 0 0 0 3px rgba(183, 121, 31, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app,
.app-shell {
  min-height: 100vh;
}

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

/* Titlurile poarta personalitatea paginii: Space Grotesk, tracking negativ care
   creste cu marimea. */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 { letter-spacing: -0.03em; }

/* Eticheta monospace de deasupra titlului principal — o singura data pe ecran.
   Cursorul din fata e motivul care leaga interfata de editor. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow::before {
  content: "";
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 1px;
  animation: caret-blink 1.15s steps(2, start) infinite;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .eyebrow::before { animation: none; }
}

a {
  color: var(--accent-bright);
}

::selection { background: rgba(240, 180, 41, 0.3); }

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted-line { color: var(--ink-2); font-size: 12.5px; }
.grow { flex: 1; }

/* ---- Layout primitives --------------------------------------------------- */

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }

/* ---- Panels ---------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.panel-head {
  padding: 15px 19px 13px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-head p {
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 13px;
  max-width: 68ch;
}

.panel-body {
  padding: 16px 19px;
}

.narrow-panel { max-width: 540px; }

.danger-panel { border-color: rgba(242, 105, 92, 0.35); }
.danger-panel .panel-head h2 { color: var(--danger); }

/* ---- Forms ------------------------------------------------------------------ */

.field { display: flex; flex-direction: column; gap: 5px; }

.field label,
label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.input,
.select,
.textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 8px 11px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}

.input::placeholder,
.textarea::placeholder { color: var(--ink-3); }

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.textarea.code-like { font-family: var(--mono); font-size: 13px; }

.select option { background: var(--surface); }

input[type="date"], input[type="datetime-local"] { color-scheme: dark; }

/* ---- Buttons ----------------------------------------------------------------- */

.button {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius);
  padding: 8px 15px;
  cursor: pointer;
  transition: background 120ms, transform 60ms;
  white-space: nowrap;
}

.button:hover { background: var(--accent-bright); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: 0.5; cursor: default; }

.button.secondary {
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--ink);
  font-weight: 600;
}
.button.secondary:hover { background: var(--surface-3); border-color: var(--line-2); }

.button.danger {
  background: transparent;
  border-color: rgba(242, 105, 92, 0.45);
  color: var(--danger);
}
.button.danger:hover { background: var(--danger-soft); }

.button.ghost {
  background: none;
  border: none;
  color: var(--accent-bright);
  padding: 0;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent-bright);
  cursor: pointer;
  text-decoration: none;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger-link { color: var(--danger); }

.icon-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
}
.icon-btn:hover { background: var(--surface-2); }

.row-actions { display: flex; gap: 12px; align-items: center; }

/* ---- Pills & notices ---------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}

.pill.ok { background: var(--ok-soft); border-color: rgba(62, 207, 142, 0.4); color: var(--ok); }
.pill.warning { background: var(--warn-soft); border-color: rgba(224, 177, 83, 0.4); color: var(--warn); }
.pill.danger { background: var(--danger-soft); border-color: rgba(242, 105, 92, 0.4); color: var(--danger); }

.pill.type-single { background: rgba(96, 165, 250, 0.13); border-color: rgba(96, 165, 250, 0.4); color: #7eb3f7; }
.pill.type-open { background: var(--surface-2); }
.pill.type-code { background: var(--blue-soft); border-color: rgba(106, 155, 239, 0.4); color: var(--blue); }

.pill.kind-curs { background: rgba(96, 165, 250, 0.13); border-color: rgba(96, 165, 250, 0.4); color: #7eb3f7; }
.pill.kind-seminar { background: var(--ok-soft); border-color: rgba(62, 207, 142, 0.4); color: var(--ok); }
.pill.kind-laborator { background: var(--blue-soft); border-color: rgba(106, 155, 239, 0.4); color: var(--blue); }

/* Chenar simplu, fara bara colorata si fara fundal tentat: un mesaj, nu un afis.
   Doar erorile isi pastreaza culoarea, ca sa se vada ca ceva e in neregula. */
.notice {
  border: 1px solid var(--line-2);
  background: transparent;
  border-radius: var(--radius);
  padding: 10px 13px;
  font-size: 13px;
  color: var(--ink-2);
}
.notice.danger { border-color: var(--danger); color: var(--danger); }

.empty {
  color: var(--ink-3);
  padding: 34px 18px;
  text-align: center;
  font-size: 13.5px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.empty-cta {
  text-align: center;
  padding: 26px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  color: var(--ink-2);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 200;
  animation: toast-pop 200ms ease-out;
}

.toast.xp {
  background: var(--gold-soft);
  border-color: rgba(240, 182, 73, 0.5);
  color: var(--gold);
  box-shadow: 0 0 22px rgba(240, 182, 73, 0.25), 0 8px 30px rgba(0, 0, 0, 0.5);
}

.toast.level {
  background: var(--accent-soft);
  border-color: rgba(240, 180, 41, 0.5);
  color: var(--accent-bright);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

@keyframes toast-pop {
  from { transform: translateX(-50%) translateY(12px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ==========================================================================
   Autentificare
   ========================================================================== */

.start-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  gap: 26px;
  background: var(--bg);
}

/* ==========================================================================
   Ecranul de autentificare — locul in care cheltuim indrazneala
   ========================================================================== */

.auth-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s7) var(--s5);
  background: var(--bg);
}

/* Un caroiaj discret, ca hartia milimetrica de sub un desen tehnic. */
.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 30%, transparent 100%);
  pointer-events: none;
}

.auth-prefs {
  position: absolute;
  top: var(--s5);
  right: var(--s5);
  z-index: 3;
}

.auth-column {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s5);
}

.auth-wordmark {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  animation: auth-in 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-mark {
  color: var(--accent);
  animation: caret-blink 1.15s steps(2, start) infinite;
}

/* ---- Coloana din dreapta: Nano si cardul ---- */

.auth-panel {
  position: relative;
  width: 100%;
  /* Cat exact cat sa para ca labele din fata se sprijina pe marginea cardului. */
  padding-top: 116px;
  animation: auth-in 620ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}

/* Pisica sta pe marginea de sus a cardului. */
.auth-cat {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 132px;
  height: 132px;
  z-index: 2;
  animation: cat-drop 700ms cubic-bezier(0.34, 1.4, 0.64, 1) 220ms both;
  pointer-events: none;
}

@keyframes cat-drop {
  from { opacity: 0; transform: translateX(-50%) translateY(-22px) scale(0.86); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes auth-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.auth-role-tab {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  padding: 13px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 120ms, background 120ms;
}

.auth-role-tab:hover { color: var(--ink-2); }

.auth-role-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.auth-card-body {
  padding: var(--s5) var(--s5) var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.auth-heading {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.auth-sub {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: var(--s4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  font-size: 14px;
  margin-top: var(--s1);
}

.auth-switch {
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  margin-top: var(--s1);
}

.field-hint {
  font-size: 12px;
  color: var(--ink-3);
}

.input-with-action { position: relative; display: flex; }
.input-with-action .input { width: 100%; padding-right: 42px; }

.input-action {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.input-action:hover { color: var(--accent); }

@media (max-width: 560px) {
  .auth-screen { padding: var(--s6) var(--s4); }
  .auth-prefs { top: var(--s4); right: var(--s4); }
  .auth-panel { padding-top: 96px; }
  .auth-cat { width: 106px; height: 106px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-column, .auth-wordmark, .auth-panel, .auth-cat { animation: none; }
  .auth-mark { animation: none; }
}

/* ==========================================================================
   Layout cu sidebar (profesor + student)
   ========================================================================== */

.admin-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.sb-brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 2px 8px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sb-brand-name { font-weight: 700; font-size: 14px; color: #fff; letter-spacing: -0.01em; }
.sb-brand-sub { font-size: 11.5px; color: var(--sidebar-dim); }

.sb-section { display: flex; flex-direction: column; gap: 6px; }

.sb-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-dim);
  padding: 0 8px;
}

.sb-add {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--sidebar-ink);
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.sb-add:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--ink-3); }

.sb-list { display: flex; flex-direction: column; gap: 2px; }

.sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--sidebar-ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.sb-item:hover { background: rgba(255, 255, 255, 0.05); }

.sb-item.active {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--accent);
}

.sb-item-badge {
  flex-shrink: 0;
  min-width: 30px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: #c9c9e2;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sb-item.active .sb-item-badge { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.sb-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-count {
  font-size: 11px;
  font-weight: 650;
  color: var(--sidebar-dim);
  font-variant-numeric: tabular-nums;
}

.sb-count.alert {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sb-empty { font-size: 12.5px; color: var(--sidebar-dim); padding: 4px 8px; }

.sb-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sb-gami {
  display: flex;
  gap: 6px;
  padding: 0 8px;
  flex-wrap: wrap;
}

.sb-gami-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(240, 182, 73, 0.35);
  background: var(--gold-soft);
  color: var(--gold);
}

.sb-gami-chip.streak {
  border-color: rgba(106, 155, 239, 0.35);
  background: var(--blue-soft);
  color: var(--blue);
}

.sb-user { padding: 0 8px; overflow: hidden; }
.sb-user-name { font-size: 13px; font-weight: 650; color: #fff; }
.sb-user-email {
  font-size: 11.5px;
  color: var(--sidebar-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-logout {
  margin: 0 8px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--sidebar-ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  padding: 6px 0;
  border-radius: 7px;
  cursor: pointer;
}
.sb-logout:hover { background: rgba(255, 255, 255, 0.06); }

.admin-content {
  padding: 30px 34px 60px;
  max-width: 1060px;
  width: 100%;
}

.page-pad { padding-top: 8px; }

/* ---- Course page ------------------------------------------------------------- */

.course-head { margin-bottom: 18px; }

.course-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  margin-bottom: 4px;
}

.course-kicker::before {
  content: "";
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 1px;
  animation: caret-blink 1.15s steps(2, start) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .course-kicker::before { animation: none; }
}

.course-title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.course-meta { color: var(--ink-2); font-size: 13px; margin-top: 3px; }

.course-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.course-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 13px;
  margin-bottom: -1px;
  cursor: pointer;
}

.course-tab:hover { color: var(--ink); }
.course-tab.active { color: var(--accent-bright); border-bottom-color: var(--accent); }

.tab-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---- Materiale ------------------------------------------------------------------ */

.upload-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1.2fr) 170px auto;
  gap: 10px;
  align-items: center;
}

.file-drop {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 8px 11px;
  cursor: pointer;
  background: var(--bg);
  overflow: hidden;
}
.file-drop:hover { border-color: var(--accent); }
.file-drop-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.file-drop.small { max-width: 320px; }

.hidden-file { display: none; }
.file-button { position: relative; overflow: hidden; }

.mat-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.mat-ext {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 6px 7px;
  min-width: 42px;
  text-align: center;
}

.mat-info { flex: 1; min-width: 0; }
.mat-title {
  font-weight: 650;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
}
.mat-title:hover { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Tabele ------------------------------------------------------------------------ */

.table-wrap { overflow-x: auto; }

.data-table,
.bank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th,
.bank-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
}

.data-table td,
.bank-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:hover,
.bank-row:hover { background: var(--surface-2); }

.bank-row { cursor: pointer; }
.col-idx { width: 40px; }
.col-type { width: 84px; }
.col-info { width: 190px; }
.col-act { width: 150px; }
.tab-count { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px; }

/* ---- Prezenta ---------------------------------------------------------------------- */

.att-new-row {
  display: grid;
  grid-template-columns: 130px 150px 1fr auto;
  gap: 10px;
  align-items: center;
}

.att-session-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 13px 18px;
  cursor: pointer;
}

.att-session-head:hover { background: var(--surface-2); }
.att-summary { flex: 1; text-align: right; }
.att-chevron { color: var(--ink-3); font-size: 12px; flex-shrink: 0; }

.att-session-body {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.att-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px 22px;
}

.att-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 6px;
}
.att-row:hover { background: var(--surface-2); }

.att-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.att-buttons { display: inline-flex; gap: 4px; flex-shrink: 0; }

.att-btn {
  width: 28px;
  height: 26px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-3);
  border-radius: 6px;
  cursor: pointer;
}

.att-btn:hover { border-color: var(--ink-3); }
.att-btn.att-prezent.active { background: #1e8f5f; border-color: #27ab74; color: #fff; }
.att-btn.att-absent.active { background: #c2493d; border-color: #d95c50; color: #fff; }
.att-btn.att-motivat.active { background: #a87f2c; border-color: #c0963c; color: #fff; }

.att-tools { padding-top: 12px; border-top: 1px solid var(--line); }

.att-name { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.att-sub { font-size: 11px; }

/* ---- Bara de cautare + filtru grupa ---- */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  flex-wrap: wrap;
}

.filter-bar .filter-search {
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}

.filter-bar .filter-group { min-width: 140px; }
.filter-count { margin-left: auto; }

/* ---- Task-uri ---------------------------------------------------------------------- */

.task-form-row { display: flex; gap: 10px; flex-wrap: wrap; }

.task-head {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  color: var(--ink);
  padding: 13px 18px;
  cursor: pointer;
}

.task-head:hover { background: var(--surface-2); }
.task-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.task-title { font-size: 14.5px; font-weight: 700; }

.task-body {
  border-top: 1px solid var(--line);
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-desc { font-size: 14px; color: var(--ink); white-space: pre-wrap; max-width: 76ch; }

.task-sub-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.sub-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
}

.sub-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.upload-inline { justify-content: space-between; }

/* ---- Dashboard student ---------------------------------------------------------------- */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 14px;
}

.dash-card {
  text-align: left;
  font-family: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 17px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 120ms, box-shadow 120ms, transform 60ms;
}

.dash-card:hover { border-color: var(--accent); }

.dash-card-kicker {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-bright);
}

.dash-card h3 { font-size: 15.5px; font-weight: 700; color: var(--ink); }

.dash-card-stats {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.dash-alert { color: var(--danger); font-weight: 650; }

.pending-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 13px;
  cursor: pointer;
}
.pending-row:hover { border-color: var(--accent); }
.pending-row .sb-item-badge {
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--ink-2);
}
.pending-title { flex: 1; font-weight: 650; }

/* ---- Statistici (examene) --------------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  margin-top: 2px;
}

.stat-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-top: 6px;
}

.stat-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
}
.seg { display: block; height: 100%; }
.seg-ok { background: var(--ok); }
.seg-bad { background: var(--danger); }
.seg-blank { background: var(--line-2); }

.fail-list { gap: 14px; }
.fail-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fail-head { display: flex; align-items: center; gap: 10px; }
.fail-rank {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.fail-q { flex: 1; font-weight: 650; font-size: 13.5px; }
.fail-legend { font-size: 12px; }

.opt-dist { display: flex; flex-direction: column; gap: 3px; }
.opt-row { display: grid; grid-template-columns: 18px minmax(90px, 1fr) 2fr 76px; gap: 8px; align-items: center; font-size: 12.5px; }
.opt-row.correct .opt-label { font-weight: 650; color: var(--ok); }
.opt-mark { text-align: center; color: var(--ink-3); }
.opt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-bar { height: 7px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.opt-bar-fill { display: block; height: 100%; background: var(--line-2); }
.opt-bar-fill.ok { background: var(--ok); }
.opt-bar-fill.bad { background: var(--danger); }
.opt-count { color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }

.hist { display: flex; flex-direction: column; gap: 4px; }
.hist-row { display: grid; grid-template-columns: 46px 1fr 90px; gap: 10px; align-items: center; font-size: 12.5px; }
.hist-label { font-family: var(--mono); color: var(--ink-2); text-align: right; }
.hist-bar { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.hist-bar-fill { display: block; height: 100%; background: var(--accent); }
.hist-count { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---- Examene: liste, carduri, picker ------------------------------------------------------ */

.admin-grid { grid-template-columns: 290px 1fr; align-items: start; }

.question-card {
  text-align: left;
  font-family: inherit;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.question-card:hover { border-color: var(--ink-3); }
.question-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.question-card h4 { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.question-card p { font-size: 12.5px; color: var(--ink-2); }

.picker-list { display: flex; flex-direction: column; gap: 4px; max-height: 430px; overflow-y: auto; }
.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}
.picker-row:hover { background: var(--surface-2); }
.picker-row.checked { border-color: var(--accent); background: var(--accent-soft); }
.picker-text { flex: 1; }

.copy-row .input { flex: 1; }

.submission-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.submission-card h4 { font-size: 14px; font-weight: 650; }
/* Incercarea inlocuita ramane vizibila, dar retrasa: conteaza ultima. */
.submission-card.is-superseded { opacity: 0.55; }
.submission-card > p { font-size: 12.5px; color: var(--ink-2); }
.meta { display: flex; gap: 7px; flex-wrap: wrap; }

.code-snapshot {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--ide-bg);
  color: var(--ide-ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  overflow-x: auto;
  margin: 4px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

details.stack summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent-bright);
}

.import-preview { display: flex; flex-direction: column; gap: 9px; }
.import-list { gap: 4px; }
.import-row { display: flex; gap: 8px; align-items: center; font-size: 13px; }

.editor-block { gap: 13px; }
.correct-toggle { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--ink-2); }

/* ---- Modale --------------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 12, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.modal.modal-wide { max-width: 640px; max-height: 88vh; overflow-y: auto; }

/* ==========================================================================
   Examen (student) — topbar + zona de examen
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; gap: 11px; align-items: center; }
.brand h1 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.brand span { font-size: 12.5px; color: var(--ink-2); display: block; }
.top-actions { display: flex; gap: 9px; align-items: center; }
.account-chip {
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
}

.main { padding: 22px; }

.student-grid {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  align-items: start;
}

.exam-header h2 { font-size: 17px; margin-top: 7px; }
.question-area { display: flex; flex-direction: column; gap: 16px; }
.question-title h3 { font-size: 15.5px; font-weight: 650; line-height: 1.45; }

.option {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  cursor: pointer;
  font-size: 14px;
  background: var(--surface);
}
.option:hover { border-color: var(--ink-3); }
.option.checked { border-color: var(--accent); background: var(--accent-soft); }

.answer-textarea { min-height: 170px; }

.exam-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.exam-nav-end { color: var(--ink-3); font-size: 13px; }

.submit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 13px 16px;
}
.submit-hint { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.submit-button { background: var(--accent); }

.navigator { position: sticky; top: 16px; }
.question-nav { display: flex; flex-wrap: wrap; gap: 6px; }

.nav-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  cursor: pointer;
}
.nav-dot.answered { background: var(--ok-soft); border-color: rgba(62, 207, 142, 0.4); color: var(--ok); }
.nav-dot.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--accent-bright); }

.integrity-box {
  border-top: 1px solid var(--line);
  padding-top: 11px;
  font-size: 13px;
}

/* ---- IDE ------------------------------------------------------------------------ */

.ide-shell {
  border: 1px solid #34344f;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #2b2b2b;
}

.ide-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #3c3f41;
  padding: 7px 11px;
}

.ide-tabname { color: #a9b7c6; font-size: 12.5px; gap: 7px; }
.ide-dot { width: 8px; height: 8px; border-radius: 50%; background: #6a8759; display: inline-block; }
.ide-meta { color: #808080; font-size: 11.5px; }

.ide-run-button {
  background: #365880;
  border-color: #2d4a6b;
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  padding: 5px 12px;
}
.ide-run-button:hover { background: #2d4a6b; box-shadow: none; }

.python-editor { min-height: 220px; }
.python-editor .cm-editor { min-height: 220px; max-height: 430px; }
.lesson-ide .python-editor .cm-editor { min-height: 300px; }

.code-editor-fallback {
  width: 100%;
  min-height: 220px;
  background: #2b2b2b;
  color: #a9b7c6;
  font-family: var(--mono);
  font-size: 13px;
  border: none;
  outline: none;
  padding: 11px 13px;
  resize: vertical;
  line-height: 1.55;
}

.ide-statusbar {
  display: flex;
  gap: 15px;
  background: #313335;
  color: #808080;
  font-size: 11px;
  padding: 4px 11px;
  border-top: 1px solid var(--ide-line);
}
.ide-status-hint { margin-left: auto; }

.code-output {
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 0;
  padding: 11px 13px;
  border-top: 1px solid var(--ide-line);
  background: var(--ide-surface);
  color: var(--ide-ink);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}
.muted-output { color: #6d777f; }
.ok-output { color: #9ec99a; }
.error-output { color: #e08a83; }

/* ---- Note & catalog ------------------------------------------------------------------------------ */

.grade-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.grade-input { width: 84px; }

.catalog-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.final-grade {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ok);
}

/* ---- Lectii: lista redesenata ------------------------------------------------------------------------ */

.progress-bar {
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar.slim { height: 7px; }

.progress-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 300ms ease;
}

/* ---- Continut lectii: proza vs cod (renderLessonText) ---- */

.lesson-md {
  display: flex;
  flex-direction: column;
  gap: 13px;
  max-width: 78ch;
}

.lesson-md .md-p {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink);
}

.lesson-md .md-code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  background: var(--ide-bg);
  color: var(--ide-ink);
  border: 1px solid var(--ide-line);
  border-left: 3px solid var(--accent-dark);
  border-radius: var(--radius);
  padding: 12px 15px;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}

.lesson-md .md-list {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}

.md-inline,
.lesson-md code.md-inline {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--accent-bright);
}

.lesson-md.task-desc { max-width: 76ch; }

.quiz-opt-code {
  font-family: var(--mono);
  font-size: 13px;
}

/* ---- Capitole: carduri stil boot.dev ---- */

.lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.lesson-editor { border-color: var(--accent); }

/* ---- Lectii: player ------------------------------------------------------------------------------------ */

/* Ecranul de lectie e singurul loc care are voie sa iasa din latimea paginii:
   textul are nevoie de o coloana ingusta, editorul de una lata. */
.admin-content:has(.player-wide) { max-width: 1420px; }

.player { display: flex; flex-direction: column; gap: 16px; }

.player-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.player-back { font-size: 13.5px; }

.player-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 420px;
}
.player-progress .progress-bar { flex: 1; }
.player-chapter {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

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

@media (min-width: 1000px) {
  .player-split { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
  .player:not(.player-wide) .player-split {
    grid-template-columns: minmax(320px, 1fr) minmax(0, 1fr);
    max-width: 1060px;
  }
  .player-brief {
    position: sticky;
    top: 14px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

/* ---- Lectii: coloana din stanga (cat trebuie sa stii) ---------------------- */

.player-brief {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brief-kind,
.work-kind,
.assignment-head,
.checks-head,
.diff-label { font-family: var(--mono); }

.brief-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.brief-eyebrow::before {
  content: "▍";
  margin-right: -6px;
  animation: caret-blink 1.15s steps(2, start) infinite;
}
.brief-xp { color: var(--ink-3); letter-spacing: 0.08em; }

.brief-title {
  font-family: var(--display);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.2;
  margin: -4px 0 0;
}

.brief-intro { font-size: 14.5px; line-height: 1.72; max-width: 62ch; }
.brief-intro .md-p { color: var(--ink); }

.deep-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 11px 14px;
}
.deep-box > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.deep-box > summary::-webkit-details-marker { display: none; }
.deep-box > summary::before { content: "▸"; color: var(--violet); }
.deep-box[open] > summary::before { content: "▾"; }
.deep-box[open] > summary { margin-bottom: 10px; }
.deep-box .deep-body { font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }

.assignment {
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px 14px;
}
.assignment-head {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 7px;
}
.assignment-body { font-size: 14px; line-height: 1.65; }

/* ---- Lectii: coloana din dreapta (ce ai de facut) -------------------------- */

.player-work { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.work-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.work-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.work-body { padding: 18px 18px 20px; }
.work-lead { font-size: 14px; color: var(--ink-2); }
.work-question { font-size: 15px; line-height: 1.6; }

.predict-code {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  background: var(--ide-bg);
  color: var(--ide-ink);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre;
}

.predict-field { gap: 7px; }
.predict-input { font-size: 13.5px; line-height: 1.6; }

/* ---- Lectii: lista de verificari ------------------------------------------ */

.checks-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.checks-box.all-ok { border-color: var(--ok); }
.checks-box.has-fail { border-color: var(--danger); }
.checks-head {
  padding: 9px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.checks-list { list-style: none; margin: 0; padding: 6px 0; }
.check-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: baseline;
  gap: 4px 8px;
  padding: 6px 15px;
  font-size: 13.5px;
}
.check-item .diff-row,
.check-item .check-detail { grid-column: 2; margin-top: 6px; }
.check-item.idle .check-label { color: var(--ink-3); }
.check-item.fail .check-label { color: var(--ink); }
.check-mark {
  font-family: var(--mono);
  font-size: 13px;
  text-align: center;
  color: var(--ink-3);
}
.check-mark.ok { color: var(--ok); }
.check-mark.fail { color: var(--danger); }

.diff-row { display: flex; flex-wrap: wrap; gap: 12px; }
.diff-cell { display: flex; flex-direction: column; gap: 5px; min-width: 130px; flex: 1; }
.diff-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.code-snapshot.ok { border-color: var(--ok); }
.code-snapshot.bad { border-color: var(--danger); }

.player-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.player-nav-right { gap: 10px; align-items: center; }

.lesson-passed-row { align-items: center; }
.lesson-passed-row .notice { flex: 1; }

.expected-box { display: flex; flex-direction: column; gap: 6px; }

.quiz-option { width: 100%; font-family: inherit; text-align: left; }
.quiz-option.correct { border-color: var(--ok); background: var(--ok-soft); }
.quiz-option.wrong { border-color: var(--danger); background: var(--danger-soft); }
.quiz-letter {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

/* ---- Lectii: IDE ----------------------------------------------------------------------------------------- */

.lesson-ide { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); }

.ide-actions { gap: 7px; }

.ide-secondary-button {
  background: #4b4f52;
  border-color: #5a5e61;
  color: #d4d8db;
  font-weight: 600;
  font-size: 12.5px;
  padding: 5px 12px;
}
.ide-secondary-button:hover { background: #5a5e61; box-shadow: none; }

.ide-reset-button {
  background: none;
  border: none;
  color: #808080;
  font-size: 12px;
  cursor: pointer;
  padding: 5px 6px;
  font-family: inherit;
}
.ide-reset-button:hover { color: #d4d8db; }

.ide-error-hint { color: #e08a83; }

.code-output.standalone {
  border: 1px solid var(--ide-line);
  border-radius: var(--radius);
}

/* ---- Progress & gamification ------------------------------------------------------------------------ */

.gami-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.gami-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gami-value {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gold);
}

.gami-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.dash-progress {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
}
.dash-progress .progress-bar { flex: 1; }

/* ---- Responsive -------------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .admin-content { padding: 20px 16px 50px; }
  .upload-row, .att-new-row { grid-template-columns: 1fr; }
  .student-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .att-grid { grid-template-columns: 1fr; }
  .player-brief { padding: 18px 16px 20px; }
  .brief-title { font-size: 21px; }
  .player-progress { max-width: none; }
  .player-chapter { display: none; }
}

/* ==========================================================================
   Adaugiri: mascota, comutatoare, task-uri cronometrate
   ========================================================================== */

/* ---- Focus vizibil, consecvent peste tot ---------------------------------- */

:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

body {
  letter-spacing: -0.006em;
}

h1, h2, h3 {
  letter-spacing: -0.018em;
}

/* ---- Cezar si Cleo, pisicile platformei ------------------------------------
   Doua portrete cu aceleasi oase: aceleasi clase, aceleasi animatii, blana
   diferita. Culorile lor sunt fixe (sunt pisici, nu elemente de brand), doar
   conturul se adapteaza la tema ca sa se vada si pe fundal deschis.
   -------------------------------------------------------------------------- */

.cat {
  display: inline-block;
  line-height: 0;
  flex: none;
  --cat-look-x: 0px;
  --cat-look-y: 0px;
  --cat-outline: rgba(0, 0, 0, 0.16);
}

[data-theme="dark"] .cat { --cat-outline: rgba(0, 0, 0, 0.3); }

.cat svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* --- Cezar: alb, cu caciula tigrata gri --- */

.cat-cezar {
  --fur: #f7f4ef;
  --fur-shade: #e4ded4;
  --fur-dark: #9b9287;
  --fur-darker: #7c7368;
  --ear-back: #9b9287;
  --ear-inner: #edb0aa;
  --nose: #eda7ab;
  --nose-line: #cf8288;
  --iris: #d7a13c;
  --whisker: #ffffff;
}

/* --- Cleo: tigrata aurie, cu bot crem si bandana --- */

.cat-cleo {
  --fur: #c99a5b;
  --fur-shade: #efe2c9;
  --fur-dark: #9d7038;
  --fur-darker: #7d5729;
  --ear-back: #c99a5b;
  --ear-inner: #dda49c;
  --nose: #bd7461;
  --nose-line: #8f5140;
  --iris: #8d9a55;
  --whisker: #fdfaf3;
}

/* --- piese comune --- */

/* Silueta e o singura forma: cap, obraji, gat si corp intr-un contur. */
.cat .cat-silhouette {
  fill: var(--fur);
  stroke: var(--cat-outline);
  stroke-width: 2;
  stroke-linejoin: round;
}

/* Urechile si coada stau in spatele siluetei, cu baza ingropata sub ea. */
.cat .cat-ear-outer {
  fill: var(--ear-back);
  stroke: var(--cat-outline);
  stroke-width: 2;
  stroke-linejoin: round;
}

.cat .cat-ear-inner { fill: var(--ear-inner); }

.cat .cat-tail {
  fill: var(--fur);
  stroke: var(--cat-outline);
  stroke-width: 2;
  stroke-linejoin: round;
}

.cat .cat-tail-ring {
  fill: none;
  stroke: var(--fur-dark);
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.85;
}

/* semne de blana, decupate dupa silueta */
.cat .cat-cap { fill: var(--fur-dark); }
.cat .cat-chest { fill: var(--fur-shade); }
.cat .cat-muzzle { fill: var(--fur-shade); }

.cat .cat-mark {
  fill: none;
  stroke: var(--fur-darker);
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.9;
}

.cat-cleo .cat-mark { stroke: var(--fur-dark); }
.cat .cat-mark-body { stroke-width: 6; opacity: 0.55; }

.cat .cat-foot { fill: var(--fur-shade); opacity: 0.6; }

.cat .cat-toe {
  stroke: var(--fur-dark);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.5;
}

.cat .cat-cover-paw {
  fill: var(--fur);
  stroke: var(--cat-outline);
  stroke-width: 2;
}

.cat .cat-cover-arm {
  fill: none;
  stroke: var(--fur);
  stroke-width: 17;
  stroke-linecap: round;
}

.cat .cat-iris { fill: var(--iris); }

.cat .cat-pupil {
  fill: #14161c;
  transform: translate(var(--cat-look-x), var(--cat-look-y));
}

.cat .cat-glint { fill: #fff; opacity: 0.92; }

.cat .cat-eye-happy,
.cat .cat-eye-shut {
  fill: none;
  stroke: #14161c;
  stroke-width: 4.5;
  stroke-linecap: round;
  opacity: 0;
}

.cat .cat-nose {
  fill: var(--nose);
  stroke: var(--nose-line);
  stroke-width: 1.4;
}

.cat .cat-mouth {
  fill: none;
  stroke: var(--fur-dark);
  stroke-width: 3;
  stroke-linecap: round;
}

/* Mustatile: o umbra subtire dedesubt, ca sa se vada si peste blana deschisa,
   si peste fundalul paginii. */
.cat .cat-whiskers-shadow path {
  fill: none;
  stroke: var(--cat-outline);
  stroke-width: 3.6;
  stroke-linecap: round;
}

.cat .cat-whiskers path {
  fill: none;
  stroke: var(--whisker);
  stroke-width: 2;
  stroke-linecap: round;
}

/* bandana lui Cleo */
.cat .cat-bandana-cloth,
.cat .cat-bandana-knot {
  fill: #5b87a8;
  stroke: #46708f;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.cat .cat-bandana-knot { fill: #517b9a; }

.cat .cat-bandana-fold {
  fill: none;
  stroke: #eef3f7;
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.5;
}

.cat .cat-bandana-hem {
  fill: none;
  stroke: #eef3f7;
  stroke-width: 1.8;
  opacity: 0.75;
}

.cat .cat-bandana-art {
  fill: none;
  stroke: #eef3f7;
  stroke-width: 1.7;
  stroke-linecap: round;
  opacity: 0.8;
}

.cat .cat-cover,
.cat .cat-sparkles,
.cat .cat-zzz {
  opacity: 0;
  pointer-events: none;
}

.cat .cat-sparkles path { fill: var(--accent-bright); }

.cat .cat-z {
  fill: var(--ink-2);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
}

.cat .cat-z2 { font-size: 14px; }

/* --- animatii de fond: respira, clipeste, da din coada --- */

.cat .cat-figure {
  transform-box: view-box;
  transform-origin: 100px 186px;
  animation: cat-breathe 4s ease-in-out infinite;
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cat .cat-tail-group {
  transform-box: view-box;
  transform-origin: 152px 172px;
  animation: cat-tail 3.4s ease-in-out infinite;
}

.cat .cat-ear {
  transform-box: view-box;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cat .cat-ear-l { transform-origin: 70px 66px; }
.cat .cat-ear-r { transform-origin: 130px 66px; }

.cat .cat-eyes {
  transform-origin: 100px 74px;
  animation: cat-blink 7s infinite;
}

/* Cleo clipeste in alt ritm decat Cezar, ca sa nu para gemene. */
.cat-cleo .cat-eyes { animation-duration: 8.5s; }
.cat-cleo .cat-tail-group { animation-duration: 4.1s; }

@keyframes cat-breathe {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.022); }
}

@keyframes cat-tail {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(9deg); }
}

@keyframes cat-blink {
  0%, 93%, 100% { transform: scaleY(1); }
  95.5% { transform: scaleY(0.06); }
}

/* --- stari --- */

/* se uita la ce scrii: mijeste ochii, urechile in fata, capul putin aplecat */
.cat-focused .cat-figure { transform: rotate(1.5deg); }
.cat-focused .cat-ear-l { transform: rotate(-8deg); }
.cat-focused .cat-ear-r { transform: rotate(8deg); }
.cat-focused .cat-eyes {
  transform-origin: 100px 74px;
  transform: scaleY(0.72);
  animation-duration: 9s;
}
.cat-focused .cat-pupil { ry: 7.5; }
.cat-focused .cat-whiskers path { opacity: 1; }

/* curios: cap inclinat, o ureche lasata */
.cat-curious .cat-figure { transform: rotate(-7deg); }
.cat-curious .cat-ear-r { transform: rotate(15deg); }

/* isi acopera ochii cu labele */
.cat .cat-cover { transition: opacity 180ms ease; }
.cat-hiding .cat-cover { opacity: 1; }
.cat-hiding .cat-cover-paw { animation: cat-paws-up 320ms cubic-bezier(0.22, 1, 0.36, 1); }
.cat-hiding .cat-eyes { opacity: 0; }
.cat-hiding .cat-whiskers { opacity: 0.3; }
.cat-hiding .cat-figure { transform: translateY(2px); }

@keyframes cat-paws-up {
  from { transform: translateY(34px) scale(0.7); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* fericit: ochii devin doua arce */
.cat-happy .cat-eye,
.cat-party .cat-eye { opacity: 0; }
.cat-happy .cat-eye-happy,
.cat-party .cat-eye-happy { opacity: 1; }
.cat-happy .cat-figure { animation: cat-nod 1.6s ease-in-out infinite; }

@keyframes cat-nod {
  0%, 100% { transform: rotate(-2.5deg); }
  50% { transform: rotate(2.5deg); }
}

/* sarbatoreste: scantei, coada sus, doua salturi */
.cat-party .cat-sparkles {
  opacity: 1;
  animation: cat-sparkle 1.4s ease-in-out infinite;
}
.cat-party .cat-figure { animation: cat-hop 900ms cubic-bezier(0.34, 1.56, 0.64, 1) 2; }
.cat-party .cat-tail-group { animation: cat-tail-up 700ms ease-out forwards; }

@keyframes cat-sparkle {
  0%, 100% { opacity: 0.25; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes cat-hop {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
}

@keyframes cat-tail-up {
  to { transform: rotate(-32deg); }
}

/* speriat: urechile pe spate, pupile mari, tremur scurt */
.cat-startled .cat-ear-l { transform: rotate(-26deg); }
.cat-startled .cat-ear-r { transform: rotate(26deg); }
.cat-startled .cat-pupil { rx: 9.5; ry: 12; }
.cat-startled .cat-figure { animation: cat-shake 320ms ease-in-out 2; }
.cat-startled .cat-tail-group { animation: cat-tail-fast 400ms ease-in-out 3; }

@keyframes cat-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-2deg); }
  75% { transform: translateX(4px) rotate(2deg); }
}

@keyframes cat-tail-fast {
  0%, 100% { transform: rotate(-16deg); }
  50% { transform: rotate(18deg); }
}

/* doarme */
.cat-sleep .cat-eye { opacity: 0; }
.cat-sleep .cat-eye-shut { opacity: 1; }
.cat-sleep .cat-eyes { animation: none; }
.cat-sleep .cat-tail-group { animation-duration: 6s; }
.cat-sleep .cat-zzz { opacity: 1; }
.cat-sleep .cat-z1 { animation: cat-float 2.6s ease-in-out infinite; }
.cat-sleep .cat-z2 { animation: cat-float 2.6s ease-in-out 0.5s infinite; }

@keyframes cat-float {
  0% { opacity: 0; transform: translate(0, 6px); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translate(6px, -14px); }
}

@media (prefers-reduced-motion: reduce) {
  .cat *,
  .cat *::before,
  .cat *::after { animation: none !important; }
}

/* --- pisica + bula de dialog --- */

.cat-say {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cat-bubble {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 11px 15px;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
}

.cat-bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 20px;
  width: 12px;
  height: 12px;
  background: var(--surface-2);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}

.notice .cat-say { margin: -2px 0; }
.notice .cat-bubble { background: transparent; border: 0; padding: 0; }
.notice .cat-bubble::before { display: none; }

/* --- stari goale --- */

.cat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 44px 24px;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  color: var(--ink-2);
}

.cat-empty-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cat-empty-text strong {
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
}

.cat-empty-text span { font-size: 13px; max-width: 46ch; }

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--ink-2);
  padding: 60px 0;
}

/* ---- Comutator de limba + tema -------------------------------------------- */

.prefs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switch {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}

.lang-opt {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
}

.lang-opt:hover { color: var(--ink); }

.lang-opt.active {
  background: var(--accent);
  color: var(--accent-text);
}

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--line-2); }

.sb-prefs {
  justify-content: space-between;
  margin-bottom: 10px;
}

.sb-prefs .lang-switch,
.sb-prefs .theme-toggle {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
  color: var(--sidebar-ink);
}

.sb-brand-mark {
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
}

/* ---- Etichete mici --------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.tag.code-tag { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.tag.time-tag { background: var(--violet-soft); border-color: transparent; color: var(--violet); }
.tag.draft-tag { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

.pill.accent {
  background: var(--accent-soft);
  border-color: rgba(245, 184, 61, 0.4);
  color: var(--accent);
}


.empty.small { padding: 18px; font-size: 13px; }

.row.tight-row { gap: 7px; }

.button.big {
  font-size: 14.5px;
  padding: 11px 20px;
}

/* ---- Task-uri cronometrate ------------------------------------------------ */

.task-card.timed { border-left: 3px solid var(--violet); }

.start-timed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.timer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--violet-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.timer-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.countdown {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 19px;
  color: var(--violet);
}

.countdown.urgent {
  color: var(--danger);
  animation: countdown-flash 1s steps(2, start) infinite;
}

.countdown.expired { color: var(--ink-3); }

@keyframes countdown-flash {
  50% { opacity: 0.45; }
}

.pill.countdown-pill {
  font-size: 13px;
  padding: 3px 10px;
  background: var(--violet-soft);
  border-color: transparent;
}

/* Monitorul profesorului */
.monitor-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.monitor-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.monitor-row:last-child { border-bottom: 0; }
.monitor-row.done { background: var(--ok-soft); }
.monitor-row .countdown { font-size: 14px; }

.link-btn.danger { color: var(--danger); }

.code-task-fields {
  padding: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
}

/* ---- Indicii si solutii ---------------------------------------------------- */

.hint-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.hint-box > summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

.hint-box > summary::-webkit-details-marker { display: none; }
.hint-box > summary::marker { content: ""; }
.deep-box > summary::marker { content: ""; }

.hint-box > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 7px;
  transition: transform 0.15s ease;
}

.hint-box[open] > summary::before { content: "▾ "; }

.hint-box > *:not(summary) { margin-top: 10px; }

.lesson-passed-row { gap: 12px; }

/* ---- Ecrane inguste -------------------------------------------------------- */

@media (max-width: 720px) {
  .monitor-row {
    grid-template-columns: 1fr auto;
    row-gap: 6px;
  }
  .cat-say { flex-direction: column; align-items: flex-start; }
  .cat-bubble::before { display: none; }
}

.console-hint {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 9px 14px;
  color: var(--ink-3);
  background: var(--ide-surface);
  border-top: 1px solid var(--ide-line);
}

.task-form-row input[name="timeLimitMin"] { min-width: 190px; }

/* ---- Cardul de bun venit (Bitu) ------------------------------------------- */

.hero-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hero-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.hero-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hero-line {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}

@media (max-width: 720px) {
  .hero-card { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================================
   Banca de intrebari + planul examenului generat
   ========================================================================== */

.pill.level-usor,
.tag.level-usor { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.pill.level-mediu,
.tag.level-mediu { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pill.level-greu,
.tag.level-greu { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.bank-filters { gap: 8px; }
.bank-filters .select { min-width: 150px; }
.bank-count { margin-bottom: 6px; }

.bank-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.bank-summary-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bank-table .col-topic { width: 150px; }
.bank-table .col-level { width: 90px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

/* ---- Planul ---------------------------------------------------------------- */

.plan-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}

.plan-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}

.plan-stat-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.plan-stat-label {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.plan-generator {
  padding: 16px;
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
}

.plan-num { width: 128px; }
.plan-total { width: 90px; }

.plan-total-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  padding-top: 4px;
}

.topic-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12.5px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.topic-chip input { accent-color: var(--accent); }
.topic-chip.on { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }

.plan-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-x: auto;
}

.plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.plan-table th {
  text-align: left;
  padding: 7px 10px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}

.plan-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
}

.plan-topic { color: var(--ink-2); white-space: nowrap; }

.plan-cell {
  display: table-cell;
  white-space: nowrap;
}

.plan-input {
  width: 58px;
  padding: 5px 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.plan-supply {
  margin-left: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.plan-cell.over .plan-input { border-color: var(--danger); color: var(--danger); }
.plan-cell.tight .plan-input { border-color: var(--warn); }

.sub-answer { display: flex; flex-direction: column; gap: 8px; }

.cal-levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.cal-level-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.cal-level-value {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.cal-table .cal-hard { color: var(--danger); }
.cal-table .cal-easy { color: var(--warn); }

.question-title .lesson-md.exam-question { max-width: none; gap: 10px; }
.question-title .lesson-md .md-p { font-size: 15.5px; font-weight: 600; }

.topbar .brand-mark {
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
}

/* ---- Ecranele examenului (link public) ------------------------------------- */

.start-layout {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s7) var(--s4);
  background: var(--bg);
}

.start-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  margin-top: 74px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.start-card-top {
  position: absolute;
  top: -78px;
  left: 50%;
  transform: translateX(-50%);
  width: 112px;
  height: 112px;
  animation: cat-drop 700ms cubic-bezier(0.34, 1.4, 0.64, 1) 120ms both;
}

.start-card-body {
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.start-card-body .auth-heading { text-align: center; }
.start-card-body .auth-sub { text-align: center; margin-bottom: 0; }

.exam-meta-row {
  display: flex;
  gap: var(--s2);
  justify-content: center;
  flex-wrap: wrap;
}


/* ==========================================================================
   Convenția riglei din stânga: culoarea barei spune starea, nu decorează.
   chihlimbar = aici ești · mentă = terminat · violet = cronometrat
   ========================================================================== */

.task-card,
.panel.stateful {
  border-left: 3px solid transparent;
}

.task-card.timed { border-left-color: var(--violet); }

/* Titlurile din panouri trec pe fontul de display, ca restul titlurilor. */
.panel-head h2 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-head p {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 4px;
  max-width: 72ch;
}

.lesson-title-big {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.gami-value,
.plan-stat-value,
.cal-level-value,
.stat-value {
  font-family: var(--display);
  letter-spacing: -0.03em;
}

.sb-brand-name {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Pisica din bara laterală stă puțin mai jos, ca să pară că se sprijină. */
.sb-brand-mark .cat { margin-bottom: -4px; }

/* ==========================================================================
   TRASEUL DE LECTII SI ECRANUL DE LECTIE
   ---------------------------------------------------------------------------
   Aici platforma isi schimba forma: lectiile nu mai sunt o lista, ci un drum pe
   care urci. Patru reguli tin lucrul asta curat:

   1. O singura coloana ingusta (--path-w). Serpentina are nevoie de margini
      stramte ca sa se vada ca serpuieste; intr-o coloana lata se pierde.
   2. Un singur nod e deschis. Restul sunt terminate sau incuiate, deci nu
      exista intrebarea „cu care incep". Se desface singur doar capitolul in
      care esti.
   3. Butoanele au buza: o muchie plina dedesubt, care dispare cand apesi. E
      singura umbra colorata din platforma si spune „asta se apasa".
   4. Culorile pline (verde, rosu) apar doar in bara de verdict din josul
      exercitiului. Nicaieri altundeva in ecranul de lectie.

   Tonul unitatii intra prin --unit / --unit-edge / --unit-ink, setate pe
   <section class="unit"> din JS. Fiecare capitol isi tine culoarea.
   ========================================================================== */

.duo-path {
  --path-w: 560px;
  --lip: 4px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: var(--path-w);
  margin: 0 auto;
}

/* ---- Butonul cu buza ------------------------------------------------------ */

.duo-btn {
  --lip: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  border: none;
  border-radius: 13px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms ease;
}

.duo-btn-primary {
  background: var(--unit, var(--accent));
  color: var(--unit-ink, var(--accent-text));
  box-shadow: 0 var(--lip) 0 var(--unit-edge, var(--accent-dark));
}

.duo-btn-ghost {
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: 0 var(--lip) 0 var(--line-2), inset 0 0 0 2px var(--line);
}

.duo-btn:hover:not(:disabled) { filter: brightness(1.06); }

/* Apasarea: butonul coboara exact cat e buza, deci buza dispare. */
.duo-btn:active:not(:disabled) {
  transform: translateY(var(--lip));
  box-shadow: 0 0 0 var(--unit-edge, var(--accent-dark));
}
.duo-btn-ghost:active:not(:disabled) {
  box-shadow: 0 0 0 var(--line-2), inset 0 0 0 2px var(--line);
}

.duo-btn:disabled { opacity: 0.5; cursor: default; }
.duo-btn:focus-visible { outline: 3px solid var(--unit, var(--accent)); outline-offset: 3px; }

/* Butoanele obisnuite din cele doua ecrane imprumuta aceeasi forma, ca sa nu
   coexiste doua limbaje de buton pe acelasi ecran. Butoanele din bara
   editorului raman insa asa cum erau: sunt unelte, incap intr-un rand si nu au
   voie sa se ingrase pana rup toolbarul. */
.duo-path .button,
.player .button:not(.ide-run-button):not(.ide-secondary-button) {
  --lip: 4px;
  border: none;
  border-radius: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 12px 20px;
  box-shadow: 0 var(--lip) 0 var(--accent-dark);
  transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms ease;
}
.duo-path .button:active:not(:disabled),
.player .button:not(.ide-run-button):not(.ide-secondary-button):active:not(:disabled) {
  transform: translateY(var(--lip));
  box-shadow: 0 0 0 var(--accent-dark);
}
.player .button.secondary { box-shadow: 0 var(--lip) 0 var(--line-2); }
.player .button.secondary:active:not(:disabled) { box-shadow: 0 0 0 var(--line-2); }

/* ---- Bara de progres groasa ---------------------------------------------- */

.duo-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.duo-track-lg { height: 15px; }

.duo-track-fill {
  position: relative;
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--unit, var(--accent));
  transition: width 320ms cubic-bezier(0.2, 0.8, 0.3, 1);
}
/* Lumina de sus a barei — singurul luciu din platforma, si e acolo pentru ca
   bara sa citeasca a „umplere", nu a dreptunghi. Sub 24px nu incape. */
.duo-track-fill::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  pointer-events: none;
}

/* ---- Antetul traseului ---------------------------------------------------- */

.duo-hero {
  --unit: var(--accent);
  --unit-edge: var(--accent-dark);
  --unit-ink: var(--accent-text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.duo-hero-main { padding: 18px 20px 20px; }

.duo-hero-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.duo-hero-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.duo-hero-stats {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}

.duo-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-2);
}
.duo-stat .p-icon { color: var(--accent); }

.duo-hero-pct {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.duo-hero-big {
  display: block;
  margin: 5px 0 14px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.25;
}

/* Randul „urmeaza" sta pe propria treapta, despartit de o linie: e alta
   intrebare decat progresul de deasupra. */
.duo-hero-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.duo-hero-next-done { padding: 12px 16px; }

.duo-hero-next-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.duo-hero-next-kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.duo-hero-next-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Unitatea (capitolul) ------------------------------------------------- */

.unit { display: flex; flex-direction: column; }

/* Antetul e in intregime butonul de strans/desfacut: tinta mare, o singura
   afordanta, fara buton mic pierdut in colt.

   Culoarea capitolului NU umple antetul. O placa plina pe fiecare capitol face
   pagina sa tipe, mai ales cand sunt noua capitole unul sub altul. Tonul apare
   doar in trei locuri mici — numarul, rigla de progres si nodurile — cat sa
   recunosti capitolul, nu cat sa-l vezi de la trei metri. */
.unit-head {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 17px 14px;
  transition: border-color 120ms ease, background 120ms ease;
}
.unit-head:hover { background: var(--surface-2); border-color: var(--line-2); }
.unit-head:focus-visible { outline: 3px solid var(--unit); outline-offset: 2px; }
/* Capitolul in care esti primeste rigla din stanga, aceeasi conventie ca peste
   tot in platforma: o linie subtire spune „aici esti". */
.unit.current .unit-head { border-left: 3px solid var(--unit); }

.unit-head-top {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.unit-head-text { flex: 1; min-width: 0; }

/* Numarul capitolului, in tonul lui: singura pata de culoare din antet. */
.unit-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--unit);
  color: var(--unit-ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.unit.done .unit-badge { opacity: 0.55; }

.unit-kicker {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.unit-title {
  margin-top: 3px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.25;
}

.unit-desc {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-2);
  /* Doua randuri, ca antetele sa ramana de aceeasi inaltime intre ele. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.unit-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 9px;
}
.unit-head:hover .unit-chip { background: var(--surface-3); }
.unit-chip-count { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.unit-chip-chevron { font-size: 10px; color: var(--ink-3); }

/* Progresul capitolului: o rigla subtire in josul antetului. */
.unit-head-track {
  height: 5px;
  margin-top: 13px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.unit-head-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--unit);
  transition: width 320ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* ---- Traseul propriu-zis -------------------------------------------------- */

.unit-path {
  --step: 44px;
  /* Un rand = un nod + eticheta lui, mereu aceeasi inaltime, ca ritmul
     vertical sa nu sara cand un titlu trece pe doua randuri. */
  --node: 64px;
  --row: 122px;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Sus incape si eticheta care pluteste peste primul nod. */
  padding: 38px 8px 30px;
}

.node-row {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: var(--row);
  /* Deplasarea laterala vine din JS (--off, in pasi): ciclul de 8 deseneaza S-ul. */
  transform: translateX(calc(var(--off, 0) * var(--step)));
}

/* Randul curent e mai inalt exact cat eticheta care pluteste deasupra nodului,
   altfel „Continuă" ar sta peste titlul lectiei de dinainte. */
.node-row-current {
  height: calc(var(--row) + 30px);
  padding-top: 30px;
}

/* Cutia nodului are mereu inaltimea nodului curent (cel mai mare), deci
   randurile raman aliniate indiferent care e curent. */
.node-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--node) + 14px);
}

.node {
  position: relative;
  width: var(--node);
  height: var(--node);
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--unit);
  color: var(--unit-ink);
  box-shadow: 0 6px 0 var(--unit-edge);
  transition: transform 90ms ease, box-shadow 90ms ease, filter 140ms ease;
}

.node:hover:not(:disabled) { filter: brightness(1.07); }
.node:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 0 0 var(--unit-edge); }
.node:focus-visible { outline: 3px solid var(--unit); outline-offset: 5px; }

.p-icon,
.node-face { display: inline-flex; }

.node-locked {
  background: var(--surface-3);
  color: var(--ink-3);
  box-shadow: 0 6px 0 var(--line-2);
  cursor: default;
}
.node-locked:active { transform: none; box-shadow: 0 6px 0 var(--line-2); }

.node-done .p-icon svg { stroke-width: 3; }

/* Nodul curent e mai mare si poarta un inel care respira: singurul loc din
   traseu unde se misca ceva. */
.node-current {
  width: calc(var(--node) + 12px);
  height: calc(var(--node) + 12px);
  box-shadow: 0 7px 0 var(--unit-edge);
}
.node-current:active:not(:disabled) { transform: translateY(7px); box-shadow: 0 0 0 var(--unit-edge); }
.node-current::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid var(--unit);
  opacity: 0.4;
  animation: node-ring 2.1s ease-out infinite;
  pointer-events: none;
}

@keyframes node-ring {
  0% { transform: scale(0.97); opacity: 0.45; }
  70% { transform: scale(1.14); opacity: 0; }
  100% { transform: scale(1.14); opacity: 0; }
}

/* Eticheta „Începe" pluteste deasupra nodului curent, scoasa din flux ca sa nu
   impinga randul. */
.node-bubble {
  position: absolute;
  bottom: calc(100% - 4px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--unit);
  background: var(--surface);
  border: 2px solid var(--unit);
  border-radius: 11px;
  padding: 5px 11px;
  animation: bubble-bob 1.9s ease-in-out infinite;
}
.node-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  background: var(--surface);
  border-right: 2px solid var(--unit);
  border-bottom: 2px solid var(--unit);
  transform: rotate(45deg);
}

@keyframes bubble-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}

.node-label {
  width: 180px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--ink-2);
  /* Doua randuri fixe: randurile raman de aceeasi inaltime, titlurile lungi se
     taie in loc sa impinga traseul. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.node-row-current .node-label { color: var(--ink); font-weight: 750; }
.node-row-locked .node-label { color: var(--ink-3); }

/* Pisica sta pe partea opusa deplasarii nodului, ca sa nu-l acopere si sa nu
   iasa din coloana. */
.path-cat {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(var(--catx, -1) * 104px - 50%), -50%);
  pointer-events: none;
}

.node-row-trophy .node-slot { height: calc(var(--node) + 14px); }
/* Cupa nu e buton: marcheaza capatul capitolului, nu duce nicaieri. */
.node-trophy { cursor: default; }
.node-row-trophy.lit .node-trophy {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 6px 0 var(--accent-dark);
}
.node-row-trophy.lit .node-label { color: var(--ink); }

/* ---- Ecranul de lectie: bara de sus --------------------------------------- */

.duo-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 14px;
}

.duo-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 11px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.duo-close:hover { background: var(--surface-2); color: var(--ink); }

.duo-top-xp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--unit, var(--accent));
}

/* A doua linie a grilei: sta exact sub bara, in coloana ei. */
.duo-top-line {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-3);
}
.duo-top-chapter {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duo-top-count { flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ---- Bara de verdict ------------------------------------------------------ */

.duo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 15px 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border-top: 2px solid var(--line);
}
.duo-foot-bare { justify-content: flex-end; }

/* In interiorul cardului de lucru bara merge pana la marginile lui: asa arata a
   temelie, nu a cutie pusa peste. */
.work-body > .duo-foot {
  margin: 6px -18px -20px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.duo-foot-ok { background: var(--ok-soft); border-top-color: var(--ok); }
.duo-foot-bad { background: var(--danger-soft); border-top-color: var(--danger); }

.duo-foot-msg {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  flex: 1;
  min-width: 200px;
}

.duo-foot-mark {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.duo-foot-ok .duo-foot-mark { background: var(--ok); color: var(--bg); }
.duo-foot-bad .duo-foot-mark { background: var(--danger); color: var(--bg); }
[data-theme="light"] .duo-foot-ok .duo-foot-mark,
[data-theme="light"] .duo-foot-bad .duo-foot-mark { color: #fff; }
.duo-foot-mark svg { stroke-width: 3; }

.duo-foot-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.duo-foot-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.duo-foot-ok .duo-foot-title { color: var(--ok); }
.duo-foot-bad .duo-foot-title { color: var(--danger); }

.duo-foot-body { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.duo-foot-body .md-p { color: var(--ink-2); }
.duo-foot-action { flex-shrink: 0; margin-left: auto; }

/* ---- Variantele de raspuns la quiz ---------------------------------------- */

.player .quiz-option {
  --lip: 4px;
  align-items: flex-start;
  gap: 13px;
  padding: 14px 16px;
  border: 2px solid var(--line-2);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 var(--lip) 0 var(--line-2);
  font-size: 14.5px;
  line-height: 1.5;
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 120ms, background 120ms;
}
.player .quiz-option:hover:not(:disabled) { border-color: var(--unit, var(--accent)); background: var(--surface-2); }
.player .quiz-option:active:not(:disabled) { transform: translateY(var(--lip)); box-shadow: 0 0 0 var(--line-2); }
.player .quiz-option:focus-visible { outline: 3px solid var(--unit, var(--accent)); outline-offset: 3px; }

.player .quiz-option.correct {
  border-color: var(--ok);
  background: var(--ok-soft);
  box-shadow: 0 var(--lip) 0 var(--ok);
}
.player .quiz-option.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  box-shadow: 0 var(--lip) 0 var(--danger);
}

.player .quiz-letter {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border: 2px solid var(--line-2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
.player .quiz-option.correct .quiz-letter { border-color: var(--ok); color: var(--ok); }
.player .quiz-option.wrong .quiz-letter { border-color: var(--danger); color: var(--danger); }

/* Inelul de focus preia verdictul, altfel raspunsul gresit ramane incercuit in
   culoarea unitatii si pare ca a fost acceptat. */
.player .quiz-option.correct:focus-visible { outline-color: var(--ok); }
.player .quiz-option.wrong:focus-visible { outline-color: var(--danger); }

/* ---- Rama ecranului de lectie --------------------------------------------- */

.player .work-card { border-radius: var(--radius-lg); }
.player-nav { border-top: none; padding-top: 4px; }

/* ---- Ecrane inguste ------------------------------------------------------- */

@media (max-width: 720px) {
  .unit-path { --step: 32px; --node: 56px; --row: 112px; }
  .node-label { width: 150px; font-size: 12px; }
  /* Pe telefon pisica ar impinge traseul in afara ecranului. */
  .path-cat { display: none; }
  .duo-hero-next { flex-direction: column; align-items: stretch; gap: 12px; }
  .duo-hero-next .duo-btn { width: 100%; }
  .duo-hero-next-title { white-space: normal; }
  .duo-foot { flex-direction: column; align-items: stretch; }
  .duo-foot-action { margin-left: 0; }
  .duo-foot-action .duo-btn { width: 100%; }
}

/* ---- Fara miscare --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .node-current::after { animation: none; }
  .node-bubble { animation: none; }
  .duo-track-fill,
  .unit-head-fill { transition: none; }
  .duo-btn,
  .node,
  .player .quiz-option { transition: none; }
}
