/* InfoX – stilurile comune ale site-ului.
   Culorile sunt definite o singura data, ca variabile; tema intunecata le redefineste. */

@font-face { font-family: "Rubik"; src: url("../../media/fonts/Rubik-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("../../media/fonts/Rubik-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

/* Paleta site-ului InfoX (aceeasi ca pe versiunea veche): header albastru inchis, fundal albastru foarte deschis,
   butoane albastre, borduri albastru deschis. Site-ul este doar in tema luminoasa, ca versiunea veche;
   celelalte teme (alese in Setari, vezi themes() in helpers.php) redefinesc aceleasi variabile mai jos,
   prin <html data-theme="...">; temele intunecate au si clasa theme-dark. */
:root {
  --bg: #f0f9ff;
  --surface: #ffffff;
  --surface-2: #e6f3fd;
  --text: #1f1f1f;
  --text-muted: #5b6b7a;
  --border: #c5e2fa;
  --border-strong: #abd9ff;
  --header: #125491;
  --on-header: #ffffff;
  --ink: var(--header);   /* titluri si texte accentuate (pe temele intunecate: o culoare deschisa) */
  --link: #125491;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-soft: #dbeffd;
  --on-primary: #ffffff;
  --accent: #e8890c;
  --success: #1a7f37;
  --success-soft: #e3f4e8;
  --warning: #9a5b00;
  --warning-soft: #fdf0dc;
  --danger: #c62828;
  --danger-soft: #fde8e8;
  --focus: #00a6ff;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 4px rgba(18, 84, 145, .08);
  --container: 90rem;   /* latimea maxima a continutului (1440px) */
  --gutter: 1rem;
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="albastru-inchis"] {
  --bg: #0f1a24;
  --ink: #cfe6fb;
  --surface: #162330;
  --surface-2: #1d2d3d;
  --text: #e6eef5;
  --text-muted: #9fb0c0;
  --border: #2a3d50;
  --border-strong: #345069;
  --header: #0b2b4a;
  --link: #7cc4ff;
  --primary: #38a9f0;
  --primary-hover: #66bdf5;
  --primary-soft: #16344f;
  --on-primary: #06121d;
  --success: #5cc97b;
  --success-soft: #17301f;
  --warning: #f0b45a;
  --warning-soft: #33280f;
  --danger: #f07070;
  --danger-soft: #3a1b1b;
  --shadow: none;
}

/* --- Baza ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 400; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); }
h2 { font-size: 1.4rem; margin-top: 1.5em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

code, pre { font-family: var(--mono); font-size: .92em; }
/* Cascadia Code (instalat implicit pe Windows 11) are ligaturi: "<=" apare ca "≤", "!=" ca "≠" etc. In cod vrem caracterele reale. */
code, pre, kbd, samp, textarea, input, .CodeMirror, .marker-copy, .home-demo-tab,
.pseudo-code, .pseudo-result, .pseudo-view, .pseudo-solution, .pseudo-toolbar .btn {
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 64rem) { :root { --gutter: 1.5rem; } }
/* Headerul si footerul ocupa toata latimea ferestrei (ca pe infox.ro vechi); continutul are latimea maxima --container. */
.header-inner.container, .footer-inner.container { max-width: none; }
.muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 1rem; top: .5rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; }

/* --- Butoane si formulare ---------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem 1rem; border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .75rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
select { min-height: calc(1.6em + 1rem + 2px); } /* aceeasi inaltime ca un camp text alaturat (select-ul ignora line-height) */

.search { display: flex; gap: .5rem; width: 100%; max-width: 32rem; }
.search input { flex: 1; min-width: 0; }

.btn-sm { padding: .3rem .7rem; font-size: .9rem; }
.btn[hidden] { display: none; }   /* ex. „Inserare șablon”: apare doar cu JavaScript */
.btn-block { width: 100%; }
.btn-google { width: 100%; background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-google:hover { background: var(--surface-2); color: var(--text); }

.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .3rem; align-content: start; } /* in randuri cu campuri de inaltimi diferite (unele au explicatii), eticheta si campul raman sus, aliniate */
.field label { font-weight: 600; }
.field input { width: 100%; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .95rem; }
.label-row a { font-size: .9rem; }
.hint { margin: 0; font-size: .85rem; color: var(--text-muted); }
/* indicatiile despre sablonul problemei (intre titlu si editor): textul normal, doar marcajul (butonul) e galben */
.hint-template { margin: .1rem 0 .35rem; color: var(--text); }
.marker-copy { position: relative; font: inherit; font-family: var(--mono); font-size: .95em; padding: 0 .25rem; color: var(--warning);
  background: var(--warning-soft); border: 1px dashed currentColor; border-radius: var(--radius-sm); cursor: copy; }
.marker-copy:hover, .marker-copy:focus-visible { border-style: solid; }
.copy-toast { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap;
  padding: .2rem .5rem; font-family: var(--font); font-size: .8rem; color: #fff; background: #1f2933;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); pointer-events: none; z-index: 10; }
.field-error { margin: 0; font-size: .9rem; color: var(--danger); }
.checkbox { display: flex; align-items: flex-start; gap: .5rem; cursor: pointer; }
.checkbox input { margin-top: .3rem; accent-color: var(--primary); }

/* --- Header ---------------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header); color: var(--on-header); box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; flex-wrap: wrap; }

.logo { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; color: var(--on-header); }
.logo img { width: auto; height: 24px; }
.logo:hover { text-decoration: none; color: var(--on-header); }

.main-nav { display: flex; gap: .25rem; flex: 1; }
.main-nav a { padding: .4rem .75rem; border-radius: var(--radius-sm); color: rgba(255, 255, 255, .85); }
.main-nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.main-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .18); }

.header-account { display: flex; align-items: center; gap: .5rem; }
.account-link { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; }
.site-header .account-link, .site-header .account-link:hover { color: var(--on-header); }

/* Meniul contului (avatar + nume -> Contul meu, Profil public, Setari, Iesire) */
.account-menu { position: relative; }
.account-menu > summary {
  list-style: none; cursor: pointer; padding: .3rem .5rem; border-radius: 999px; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: rgba(255, 255, 255, .14); }
.account-menu > summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.account-caret { transition: transform .15s; opacity: .85; }
.account-menu[open] .account-caret { transform: rotate(180deg); }
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + .5rem); z-index: 50; min-width: 14rem; max-width: calc(100vw - 2rem);
  padding: .4rem; display: grid; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(18, 84, 145, .18);
}
.account-dropdown-head { display: grid; padding: .5rem .75rem .6rem; margin-bottom: .2rem; border-bottom: 1px solid var(--border); }
.account-dropdown-head strong { color: var(--text); }
.account-dropdown-head span { font-size: .8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-dropdown a, .account-logout {
  display: block; width: 100%; padding: .6rem .75rem; border-radius: 6px; text-align: left;
  font: inherit; font-size: .95rem; color: var(--text); background: none; border: 0; cursor: pointer;
}
.account-dropdown a:hover, .account-logout:hover, .account-dropdown a:focus-visible, .account-logout:focus-visible { background: var(--primary-soft); color: var(--ink); text-decoration: none; }
.account-dropdown form { margin: .2rem 0 0; padding-top: .2rem; border-top: 1px solid var(--border); }
.account-dropdown-section { display: grid; gap: 2px; margin-top: .2rem; padding-top: .2rem; border-top: 1px solid var(--border); }
.account-dropdown a[aria-current="page"] { background: var(--primary-soft); color: var(--ink); font-weight: 600; }
.account-logout { color: var(--danger); font-weight: 600; }
.account-logout:hover { background: var(--danger-soft); color: var(--danger); }
.tabs-logout { margin: 0 0 0 auto; display: flex; align-items: center; }
.site-header .btn-ghost { color: var(--on-header); border-color: rgba(255, 255, 255, .6); }
.site-header .btn-ghost:hover { background: rgba(255, 255, 255, .12); color: var(--on-header); }
.site-header .btn-primary { background: #fff; color: var(--header); }
.site-header .btn-primary:hover { background: var(--primary-soft); color: var(--header); }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.inline-form { display: inline; margin: 0; }

@media (max-width: 40rem) {
  .account-name { display: none; }
  .header-inner { gap: .5rem .6rem; padding-top: .5rem; padding-bottom: .5rem; }
  .main-nav { flex: 1 1 auto; min-width: 0; }
  .header-account { margin-left: auto; }
  .header-account .btn { padding: .35rem .55rem; font-size: .88rem; }
  .header-inner .logo span { letter-spacing: .02em; }
}

/* --- Continut -------------------------------------------------------------- */

.main { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0; flex-basis: 100%; }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .9rem; color: var(--text-muted); margin-bottom: 1rem; }

.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--primary-soft); color: var(--text); }

.empty { padding: 2rem; text-align: center; color: var(--text-muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }

/* --- Pagina de start ------------------------------------------------------- */


.stats { display: flex; flex-wrap: wrap; gap: 1rem; margin: 2rem 0; }
.stat {
  flex: 1 1 10rem; padding: 1rem 1.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat strong { display: block; font-size: 1.8rem; line-height: 1.2; }
.stat span { color: var(--text-muted); }

.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; }
.class-card {
  display: flex; flex-direction: column; gap: .2rem; padding: 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow);
}
.class-card:hover { border-color: var(--primary); text-decoration: none; color: var(--text); }
.class-card-title { font-size: 1.15rem; font-weight: 700; }

/* --- Probleme -------------------------------------------------------------- */

.class-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.class-tabs a {
  padding: .4rem .9rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-weight: 500;
}
.class-tabs a:hover { border-color: var(--primary); text-decoration: none; }

.class-section { padding-top: .5rem; }

.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1rem; } /* carduri de aceeasi inaltime pe rand */
/* Nuanta clasei (din piesele de sah): pion turcoaz (IX), cal bej-auriu (X), regina albastra (XI). */
.chapter-grid {
  --ch-accent: var(--primary); --ch-soft: var(--primary-soft); --ch-ink: var(--ink); --ch-line: var(--border);
}
.problem-list { --ch-accent: var(--primary); --ch-soft: var(--primary-soft); --ch-ink: var(--ink); --ch-line: var(--border); }
.chapter-grid--c9, .accent-c9  { --ch-accent: #129080; --ch-soft: #e2f5f2; --ch-ink: #0a5d53; --ch-line: #b9e3dc; }
.chapter-grid--c10, .accent-c10 { --ch-accent: #c08a2c; --ch-soft: #fbf1dd; --ch-ink: #74501a; --ch-line: #efd9ad; }
.chapter-grid--c11, .accent-c11 { --ch-accent: #4070c0; --ch-soft: #e5edfa; --ch-ink: #24467f; --ch-line: #c3d4f2; }

.chapter-card { padding: 0; overflow: hidden; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

/* antetul: fasie colorata cu ilustratia intr-un cerc alb, numele si progresul capitolului */
.chapter-head {
  display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem;
  background: var(--ch-soft); border-bottom: 1px solid var(--ch-line);
}
.chapter-icon {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: 0 0 0 2px var(--ch-line), 0 2px 6px rgba(0, 0, 0, .06);
}
.chapter-icon img { width: 34px; height: 34px; }
.chapter-head-text { display: grid; gap: .3rem; min-width: 0; }
.chapter-head h3 { margin: 0; font-size: 1rem; line-height: 1.3; color: var(--ch-ink); }
.chapter-meta { font-size: .8rem; color: var(--text-muted); }
.chapter-progress { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--text-muted); }
.chapter-progress-bar { width: 5rem; height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; box-shadow: inset 0 0 0 1px var(--ch-line); }
.chapter-progress-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--ch-accent); }
.chapter-progress.is-done .chapter-progress-bar > span { background: var(--success); }
.chapter-progress.is-done .chapter-progress-label { color: var(--success); font-weight: 700; }

/* subcapitolele: tot randul e link; la mouse/tastatura: fundal colorat, bara in stanga, sageata */
.subchapter-list { list-style: none; margin: 0; padding: .4rem; display: grid; gap: 2px; }
.subchapter-link {
  position: relative; display: flex; align-items: center; gap: .6rem;
  padding: .45rem .6rem .45rem .75rem; border-radius: 6px; color: var(--text);
  transition: background-color .15s, color .15s;
}
.subchapter-link::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px;
  background: var(--ch-accent); transform: scaleY(0); transition: transform .15s;
}
.subchapter-name { flex: 1; min-width: 0; }
a.subchapter-link:hover, a.subchapter-link:focus-visible { background: var(--ch-soft); color: var(--ch-ink); text-decoration: none; }
a.subchapter-link:hover::before, a.subchapter-link:focus-visible::before { transform: scaleY(1); }
a.subchapter-link:focus-visible { outline: 2px solid var(--ch-accent); outline-offset: -2px; }
/* sageata nu ocupa loc pana la hover (insigna ramane lipita de dreapta), apoi "impinge" insigna putin spre stanga */
.subchapter-arrow {
  width: 0; margin-left: -.6rem; overflow: hidden; color: var(--ch-accent); font-weight: 700; opacity: 0;
  transition: width .15s, margin-left .15s, opacity .15s;
}
a.subchapter-link:hover .subchapter-arrow, a.subchapter-link:focus-visible .subchapter-arrow { width: 1rem; margin-left: 0; opacity: 1; }
.subchapter-link.is-empty { color: var(--text-muted); }
.subchapter-link.is-empty .subchapter-name { opacity: .8; }

/* insigna cu numarul de probleme (logat: rezolvate/total cu un mic inel de progres; terminat: verde cu bifa) */
.count-badge {
  display: inline-flex; align-items: center; gap: .35rem; flex-shrink: 0;
  padding: 0 .5rem; min-width: 1.75rem; justify-content: center; border-radius: 999px;
  font-size: .8rem; font-weight: 700; line-height: 22px; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--ch-ink); background: var(--ch-soft); box-shadow: inset 0 0 0 1px var(--ch-line);
}
a.subchapter-link:hover .count-badge { background: var(--surface); }
.count-badge.is-done { color: var(--success); background: var(--success-soft); box-shadow: none; }
.count-badge.is-empty { font-weight: 500; color: var(--text-muted); background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.count-ring {
  width: 12px; height: 12px; border-radius: 50%;
  background: conic-gradient(var(--ch-accent) var(--p), var(--ch-line) 0);
  -webkit-mask: radial-gradient(circle, transparent 3px, #000 3.5px); mask: radial-gradient(circle, transparent 3px, #000 3.5px);
}
@media (prefers-reduced-motion: reduce) {
  .subchapter-link, .subchapter-link::before, .subchapter-arrow { transition: none; }
}

.problem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.problem-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius);
}
.problem-item.is-solved { border-left-color: var(--success); }
.problem-item.is-tried { border-left-color: var(--warning); }
.problem-item h3 { margin-bottom: .25rem; }
.problem-item p { margin: 0 0 .25rem; }
.problem-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; color: var(--text-muted); }
/* problemele rezolvate: fundal verzui (in ambele moduri) */
.problem-item.is-solved { background: var(--success-soft); }

/* bara de deasupra listei: numarul de probleme + butoanele lista / carduri */
.list-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.list-toolbar p { margin: 0; flex-basis: auto; }
.page-head .list-toolbar { flex-basis: 100%; }
.view-toggle { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.view-toggle a {
  display: grid; place-items: center; width: 30px; height: 26px; border-radius: 6px; color: var(--text-muted);
}
.view-toggle a:hover { color: var(--primary); background: var(--primary-soft); }
.view-toggle a[aria-pressed="true"] { color: #fff; background: var(--primary); }

/* tot randul / cardul e link: titlul se intinde peste el */
.problem-item { position: relative; transition: border-color .15s, box-shadow .15s, transform .15s; }
.problem-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.problem-link:focus-visible { outline: none; }
.problem-item:has(.problem-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.problem-item:hover .problem-link { text-decoration: none; }
/* elementele doar pentru carduri (ascunse in modul lista) */
.problem-top, .problem-cta { display: none; }

/* --- modul lista (randuri late) ----------------------------------------------------------------------------
   banda albastra sus: ID + titlu + dificultate, starea in dreapta; dedesubt rezumatul complet, autorul si "Rezolva →" */
.problem-list:not(.problem-list--cards) .problem-item {
  display: block; padding: 0; overflow: hidden;
  border: 1px solid var(--ch-line); border-left: 4px solid var(--ch-accent); box-shadow: var(--shadow);
}
.problem-list:not(.problem-list--cards) .problem-item:hover { border-color: var(--ch-accent); box-shadow: 0 6px 18px rgba(18, 84, 145, .12); }
.problem-list:not(.problem-list--cards) .problem-item.is-solved { border-left-color: var(--success); }
.problem-list:not(.problem-list--cards) .problem-item.is-solved:hover { border-color: var(--success); }
.problem-list:not(.problem-list--cards) .problem-item.is-tried, .problem-list:not(.problem-list--cards) .problem-item.is-tried:hover { border-left-color: var(--warning); }
.problem-list:not(.problem-list--cards) .badge, .problem-list:not(.problem-list--cards) .meta-difficulty { display: none; }
.problem-list:not(.problem-list--cards) .problem-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .75rem; padding: .6rem 1.25rem;
  background: var(--primary-soft); border-bottom: 1px solid var(--border);
}
.problem-list:not(.problem-list--cards) .problem-item.is-solved .problem-head { background: color-mix(in srgb, var(--primary-soft) 55%, var(--success-soft)); }
.problem-list:not(.problem-list--cards) .problem-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
.problem-list:not(.problem-list--cards) .problem-link { color: var(--text); }
.problem-list:not(.problem-list--cards) .problem-item:hover .problem-link { color: var(--ch-ink); }
.problem-list:not(.problem-list--cards) .problem-item.is-solved:hover .problem-link { color: var(--success); }
.problem-list:not(.problem-list--cards) .problem-top { display: contents; } /* dificultatea si starea: in dreapta antetului */
.problem-list:not(.problem-list--cards) .difficulty-pill { margin-left: auto; }
.problem-list:not(.problem-list--cards) .difficulty-pill + .status-dot { margin-left: 0; }
.problem-list:not(.problem-list--cards) .problem-abstract { margin: .6rem 1.25rem .25rem; color: var(--text); }
.problem-list:not(.problem-list--cards) .problem-meta { margin: 0 1.25rem .65rem; align-items: center; }
.problem-list:not(.problem-list--cards) .problem-cta {
  display: inline; margin-left: auto; font-weight: 700; color: var(--ch-accent); opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s;
}
.problem-list:not(.problem-list--cards) .problem-item.is-solved .problem-cta { color: var(--success); }
.problem-list:not(.problem-list--cards) .problem-item:hover .problem-cta,
.problem-list:not(.problem-list--cards) .problem-item:focus-within .problem-cta { opacity: 1; transform: none; }
@media (hover: none) { .problem-list:not(.problem-list--cards) .problem-cta { opacity: 1; transform: none; } }

/* elemente comune celor doua moduri: insigna cu ID-ul (alba, pe antetul albastru) */
.problem-list .problem-id {
  display: inline-block; margin-right: .3rem; padding: 0 .45rem; border-radius: 6px; vertical-align: 2px;
  font-size: .75rem; font-weight: 700; line-height: 20px; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* --- modul carduri ------------------------------------------------------------------------------------------
   grila cu carduri de aceeasi dimensiune (toate randurile au inaltimea celui mai inalt card) */
.problem-list--cards { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); grid-auto-rows: 1fr; gap: 1rem; }
.problem-list--cards .problem-item {
  flex-direction: column; justify-content: flex-start; align-items: stretch; gap: .55rem; padding: 0 1.1rem .85rem; overflow: hidden;
  border: 1px solid var(--ch-line); border-top: 4px solid var(--ch-accent); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.problem-list--cards .problem-item:hover { transform: translateY(-3px); border-color: var(--ch-accent); box-shadow: 0 10px 24px rgba(18, 84, 145, .14); }
.problem-list--cards .problem-item.is-solved { border-top-color: var(--success); }
.problem-list--cards .problem-item.is-solved:hover { border-color: var(--success); }
.problem-list--cards .problem-item.is-tried { border-top-color: var(--warning); }
.problem-list--cards .badge, .problem-list--cards .meta-difficulty { display: none; }

/* antetul cardului: fasie albastra pe toata latimea, cu ID-ul + titlul, apoi dificultatea si starea */
.problem-list--cards .problem-head {
  margin: 0 -1.1rem .65rem; padding: .75rem 1.1rem .7rem;
  background: var(--primary-soft); border-bottom: 1px solid var(--border);
}
.problem-list--cards .problem-item.is-solved .problem-head { background: color-mix(in srgb, var(--primary-soft) 55%, var(--success-soft)); }
.problem-list--cards .problem-top { display: flex; align-items: center; gap: .5rem; min-height: 26px; margin-top: .45rem; }

.difficulty-pill {
  padding: 0 .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 22px; white-space: nowrap;
  background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 35%, transparent);
}
.status-dot {
  margin-left: auto; display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 .3rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700; color: #fff;
}
.status-dot--solved { background: var(--success); }
.status-dot--tried { background: var(--warning); }

.problem-list--cards .problem-main { display: flex; flex-direction: column; height: 100%; width: 100%; }
.problem-list--cards .problem-main h3 { margin: 0; font-size: 1.1rem; font-weight: 700; line-height: 1.35; }
.problem-list--cards .problem-link { color: var(--text); }
.problem-list--cards .problem-item:hover .problem-link { color: var(--ch-ink); }
.problem-list--cards .problem-item.is-solved:hover .problem-link { color: var(--success); }
/* rezumatul se taie la 6 randuri (~210 caractere); textul complet: in modul lista sau la mouse (title, peste 180 de caractere) */
.problem-list--cards .problem-abstract {
  font-size: .92rem; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.problem-list--cards .problem-meta {
  margin-top: auto; padding-top: .6rem; border-top: 1px dashed var(--ch-line);
  flex-direction: row; justify-content: space-between; align-items: center; gap: .5rem;
}
.problem-list--cards .problem-cta {
  display: inline; font-weight: 700; color: var(--ch-accent); opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s;
}
.problem-list--cards .problem-item.is-solved .problem-cta { color: var(--success); }
.problem-list--cards .problem-item:hover .problem-cta, .problem-list--cards .problem-item:focus-within .problem-cta { opacity: 1; transform: none; }
@media (hover: none) { .problem-list--cards .problem-cta { opacity: 1; transform: none; } } /* pe telefon se vede mereu */
@media (prefers-reduced-motion: reduce) { .problem-item, .problem-cta { transition: none; } .problem-list--cards .problem-item:hover { transform: none; } }

/* --- Autentificare --------------------------------------------------------- */

.auth-card {
  max-width: 26rem; margin: 1rem auto; padding: 2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.6rem; }
.auth-card .flash a { display: block; margin-top: .25rem; font-weight: 600; }
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--text-muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-switch { margin: 1.25rem 0 0; text-align: center; color: var(--text-muted); }
@media (max-width: 30rem) { .auth-card { padding: 1.25rem; border: 0; box-shadow: none; background: transparent; } }

/* --- Pagina problemei ------------------------------------------------------- */

.problem-layout { display: grid; grid-template-columns: minmax(0, 1fr) 25rem; gap: 2.5rem; align-items: start; }
/* pe ecrane inguste: tabelul deasupra enuntului, recomandarile dupa el (aside-ul isi "imprastie" copiii in grila) */
@media (max-width: 60rem) {
  .problem-layout { grid-template-columns: minmax(0, 1fr); }
  .problem-layout > .problem-aside { display: contents; }
  .problem-aside > .facts-card { order: -1; }
  .problem-aside > .related { order: 1; }
}

.problem-header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.problem-header h1 { margin: 0; }

.statement { overflow-wrap: break-word; }
.statement h2 { font-size: 1.15rem; margin: 1.5em 0 .5em; }
.statement p { margin: 0 0 .75em; }
.statement br + br { display: none; }
/* listele din enunt / indicatii: bulina in interiorul chenarului, si pentru <li> scris fara <ul> in jur */
.statement ul, .statement ol { padding-left: 1.75rem; margin: .25rem 0 .75rem; }
.statement > li, .statement > p > li, .statement > div > li { margin-left: 1.75rem; }
.statement img, .statement svg { max-width: 100%; height: auto; }
/* Textele din desenele SVG au adesea un contur (stroke) gros, gandit ca "halou" in spatele cifrelor;
   fara paint-order, browserul il deseneaza peste text si cifrele dispar. */
.statement svg text { paint-order: stroke fill; }
.statement pre, .output {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .75rem 1rem; overflow-x: auto; white-space: pre; font-family: var(--mono); font-size: .9rem; line-height: 1.45;
}
/* butonul „Copiază” din coltul exemplelor (app.js, [data-copy-examples]) */
.pre-copy { position: relative; }
.pre-copy-btn {
  position: absolute; top: .35rem; right: .35rem; display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  color: var(--text-muted); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.pre-copy-btn svg { display: block; }
.pre-copy-btn:hover, .pre-copy-btn:focus-visible { color: var(--text); background: var(--surface); border-color: var(--border); }
.pre-copy-btn.is-done { color: var(--success); }
.statement table { border-collapse: collapse; margin: .5rem 0 1rem; display: block; overflow-x: auto; }
.statement th, .statement td { border: 1px solid var(--border); padding: .35rem .6rem; }
mjx-container { overflow-x: auto; overflow-y: hidden; max-width: 100%; }

.statement-section, .solve { margin-top: 2rem; }
.tips { margin-top: 1.5rem; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tips summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.tips[open] summary { margin-bottom: .5rem; }

/* nu mai e sticky: cu recomandarile, coloana poate fi mai inalta decat ecranul (partea de jos n-ar mai fi vizibila) */
.problem-aside { display: grid; gap: 1rem; }
/* Tabelul cu datele problemei: card cu antet, randuri despartite de linii fine.
   Inaltimile sunt in pixeli intregi (rand 24px + 2 x 7px + linie 1px), ca butoanele "i" sa cada la fel pe fiecare rand. */
/* fara overflow: hidden, ca etichetele butoanelor "i" sa poata iesi din card; colturile antetului se rotunjesc separat */
.facts-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.facts-head {
  margin: 0; padding: 8px 20px; font-size: .85rem; font-weight: 600; letter-spacing: .02em;
  color: var(--ink); background: var(--primary-soft); border-bottom: 1px solid var(--border); line-height: 24px;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.facts { margin: 0; padding: 4px 20px; display: grid; }
.facts > div { padding: 7px 0; }
.facts > div + div { border-top: 1px solid var(--border); }
/* inaltime de rand in pixeli intregi: butoanele „i” cad la fel pe pixeli pe fiecare rand (altfel litera arata diferit) */
.facts div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .5rem; font-size: .92rem; line-height: 24px; }
.facts div[hidden] { display: none; }   /* ex. randul "Temă": apare doar in modul creare tema */
.facts dt { color: var(--text-muted); font-size: .85rem; }
/* dificultatea: bara mica + procent */
.difficulty { display: inline-flex; align-items: center; gap: .5rem; }
.difficulty-bar { width: 3rem; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.difficulty-bar > span { display: block; height: 100%; border-radius: 3px; background: currentColor; }
.difficulty-value { color: var(--text); font-variant-numeric: tabular-nums; }
/* culorile nivelurilor: verde (pentru inceput), albastru (antrenament), mov (provocare), gri-albastru (noua);
   fara rosu, care pe site inseamna "gresit" */
.difficulty--easy { color: var(--success); } .difficulty--medium { color: var(--primary); } .difficulty--hard { color: #7c3aed; }
.difficulty--new { color: #4f6d8a; }
:root.theme-dark .difficulty--hard { color: #b794f6; } :root.theme-dark .difficulty--new { color: #9fb0c0; }
/* scorul utilizatorului: eticheta colorata dupa punctaj */
.score-chip { display: inline-block; padding: 0 .55rem; border-radius: 999px; font-size: .85rem; font-weight: 700; line-height: 22px; font-variant-numeric: tabular-nums; }
.score-chip--success { color: var(--success); background: var(--success-soft); }
.score-chip--warning { color: var(--warning); background: var(--warning-soft); }
.score-chip--danger { color: var(--danger); background: var(--danger-soft); }
.facts dd { margin: 0; display: flex; align-items: center; gap: .5rem; min-width: 0; }
/* butoanele mici din tabel (editează, vezi testele, soluție): aliniate la dreapta, in celula valorii */
.fact-action { margin-left: auto; flex-shrink: 0; }
.btn-xs { padding: 0 .55rem; font-size: .8rem; line-height: 20px; font-weight: 600; border-radius: 6px; }
/* Recomandari sub tabel (assets/js/related.js): carduri pe toata latimea coloanei */
.related { display: grid; gap: .6rem; }
.related[hidden] { display: none; }
.related-title { margin: .25rem 0 0; font-size: 1rem; color: var(--text-muted); font-weight: 600; }
.related-list { display: grid; gap: .6rem; }
.related-card {
  display: grid; gap: .3rem; padding: .8rem 1rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.related-card:hover { text-decoration: none; color: var(--text); border-color: var(--primary); box-shadow: 0 4px 14px rgba(2, 132, 199, .14); transform: translateY(-1px); }
.related-head { display: flex; align-items: baseline; gap: .5rem; }
.related-name { font-weight: 600; color: var(--primary); }
.related-id { margin-left: auto; font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.related-meta { font-size: .82rem; color: var(--text-muted); }
.related-abstract {
  font-size: .88rem; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
@media (prefers-reduced-motion: reduce) { .related-card { transition: none; } .related-card:hover { transform: none; } }
.info { position: relative; display: inline-flex; align-items: center; height: 24px; vertical-align: top; margin-left: -.25rem; }
.info-btn {
  /* dimensiuni in pixeli intregi + strat propriu (translateZ): litera se deseneaza identic pe orice rand;
     padding asimetric: litera italica are "cerneala" sus-dreapta fata de caseta ei, o aducem in centrul cercului */
  width: 18px; height: 18px; padding: 2px 0 0 0; box-sizing: border-box; border-radius: 50%;
  border: 1px solid var(--primary); background: var(--surface); color: var(--primary);
  font: italic 700 12px/1 Georgia, serif; cursor: pointer; display: inline-grid; place-items: center;
  transform: translateZ(0);
}
.info-btn:hover, .info-btn[aria-expanded="true"] { background: var(--primary); color: #fff; }
.info-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.info-pop {
  position: absolute; z-index: 20; right: 0; top: calc(100% + .45rem); width: 14rem;
  padding: .55rem .7rem; border-radius: 8px; background: var(--header); color: #fff;
  font-size: .82rem; line-height: 1.4; box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.info-pop::before {
  content: ""; position: absolute; right: calc(.3rem + var(--arrow-shift, 0px)); top: -.35rem; width: .7rem; height: .7rem;
  background: inherit; transform: rotate(45deg);
}
.info-pop[hidden], [data-for-lang][hidden] { display: none; }

.signature { margin: 0 0 1rem; padding: .6rem 1rem; background: var(--surface-2); border-radius: var(--radius-sm); overflow-x: auto; }
.code-input { width: 100%; font-family: var(--mono); font-size: .92rem; line-height: 1.5; tab-size: 4; resize: vertical; }
.solve-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.solve-actions[hidden], .hw-save-collection[hidden] { display: none; }   /* ex. butoanele cosului fara tema in lucru */
.section-title { margin-top: 2rem; }

/* CodeMirror, adaptat la culorile site-ului (si la temele intunecate).
   codemirror.min.css se incarca DUPA app.css si are aceeasi specificitate (.CodeMirror { background: white }),
   deci regulile de aici sunt calificate (div.CodeMirror, .CodeMirror .CodeMirror-gutters) ca sa castige. */
div.CodeMirror { height: auto; min-height: 18rem; font-family: var(--mono); font-size: .92rem; line-height: 1.5;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
div.editor-readonly.CodeMirror { min-height: 0; }
div.CodeMirror-focused { outline: 2px solid var(--focus); outline-offset: -1px; }
.CodeMirror .CodeMirror-gutters { background: var(--surface-2); border-right: 1px solid var(--border); }
.CodeMirror .CodeMirror-linenumber { color: var(--text-muted); }
.CodeMirror .CodeMirror-cursor { border-left-color: var(--text); }
.CodeMirror .CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: var(--primary-soft); }
/* paranteza pereche celei de langa cursor (implicit verde deschis #0b0, greu de citit pe alb) */
.CodeMirror .CodeMirror-matchingbracket { color: #0b5d1e !important; background: #c9efcf; font-weight: 700; }
/* temele intunecate: fundal inchis (al temei) si culori deschise pentru toate tipurile de cuvinte,
   inclusiv paranteze, acolade si operatori (textul fara culoare proprie ia culoarea textului temei) */
:root.theme-dark div.CodeMirror { background: var(--surface-2); }
:root.theme-dark .CodeMirror .CodeMirror-gutters { background: var(--surface); }
:root.theme-dark .CodeMirror .CodeMirror-selected, :root.theme-dark .CodeMirror-focused .CodeMirror-selected { background: rgba(130, 170, 255, .28); }
:root.theme-dark .cm-s-default .cm-keyword { color: #c792ea; }
:root.theme-dark .cm-s-default .cm-def { color: #82aaff; }
:root.theme-dark .cm-s-default .cm-variable { color: var(--text); }
:root.theme-dark .cm-s-default .cm-variable-2 { color: #9cdcfe; }
:root.theme-dark .cm-s-default .cm-variable-3, :root.theme-dark .cm-s-default .cm-type { color: #4fd0c9; }
:root.theme-dark .cm-s-default .cm-property { color: #9cdcfe; }
:root.theme-dark .cm-s-default .cm-atom, :root.theme-dark .cm-s-default .cm-number { color: #f78c6c; }
:root.theme-dark .cm-s-default .cm-string, :root.theme-dark .cm-s-default .cm-string-2 { color: #c3e88d; }
:root.theme-dark .cm-s-default .cm-comment { color: #8fa1b3; font-style: italic; }
:root.theme-dark .cm-s-default .cm-meta, :root.theme-dark .cm-s-default .cm-builtin,
:root.theme-dark .cm-s-default .cm-qualifier { color: #ffcb6b; }
:root.theme-dark .cm-s-default .cm-operator, :root.theme-dark .cm-s-default .cm-punctuation,
:root.theme-dark .cm-s-default .cm-bracket { color: #d7e3ee; }
:root.theme-dark .cm-s-default .cm-tag { color: #f07178; }
:root.theme-dark .cm-s-default .cm-attribute { color: #c792ea; }
:root.theme-dark .cm-s-default .cm-error { color: #ff6b6b; }
:root.theme-dark .CodeMirror .CodeMirror-matchingbracket { color: #fff !important; background: #3b5f8a; }
:root.theme-dark .CodeMirror .CodeMirror-nonmatchingbracket { color: #ff6b6b !important; }

.solution-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.solution-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; padding: .5rem .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.solution-list .points { margin-left: auto; }
.points { font-weight: 700; font-variant-numeric: tabular-nums; }
.points-success { color: var(--success); } .points-warning { color: var(--warning); }
.points-danger { color: var(--danger); } .points-pending { color: var(--text-muted); font-weight: 500; }

/* --- Rezultatul evaluarii -------------------------------------------------- */

.result-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.result-head h1 { margin: 0; }
.result-head p { margin: 0; }
.score { padding: .6rem 1.2rem; border-radius: var(--radius); font-size: 1.1rem; display: inline-flex; align-items: center; gap: .5rem; }
.score strong { font-size: 1.8rem; line-height: 1; }
.score-success { background: var(--success-soft); color: var(--success); }
.score-warning { background: var(--warning-soft); color: var(--warning); }
.score-danger { background: var(--danger-soft); color: var(--danger); }
.score-pending { background: var(--surface-2); color: var(--text-muted); }
.spinner { width: 1.1rem; height: 1.1rem; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .55rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: .85rem; color: var(--text-muted); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.results .is-ok .mark { color: var(--success); font-weight: 700; }
.results .is-fail .mark { color: var(--danger); font-weight: 700; }
/* randul intreg: verde (testul trece) / rosu (nu trece); cauza picarii (timp, memorie sau rezultat) ingrosata, in rosu */
.results tbody tr.is-ok td { background: var(--success-soft); }
.results tbody tr.is-fail td { background: var(--danger-soft); }
.results tbody tr td { border-bottom-color: var(--surface); }
.results td.cause { color: var(--danger); font-weight: 700; }
.results td.cause-limit { color: var(--danger); font-weight: 600; }
.results .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.results-ms td:nth-child(2) { white-space: nowrap; }
@media (max-width: 40rem) {
  .results-ms th, .results-ms td { padding: .5rem .55rem; font-size: .9rem; }
}
.output-error { border-color: var(--danger); color: var(--danger); white-space: pre-wrap; }
.actions-left { justify-content: flex-start; margin-top: 1.5rem; }

/* --- Teste si solutia oficiala --------------------------------------------- */

.test-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.test-item { padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.test-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.test-head h2 { font-size: 1.05rem; margin: 0; }
.test-io { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin-top: .75rem; }
.test-io h3 { font-size: .9rem; color: var(--text-muted); margin-bottom: .3rem; }
.test-io .output { max-height: 20rem; overflow: auto; margin: 0; }
.purchase-card { max-width: 36rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.purchase-card form { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --- Contul meu si profiluri --------------------------------------------- */

.badge-info { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); color: #fff; filter: brightness(.92); }

.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; margin-bottom: 1.25rem; }
.profile-head h1 { margin: 0; }
.profile-head p { margin: .15rem 0 0; }
.profile-edit { margin-left: auto; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-xl { width: 112px; height: 112px; }

/* Poza de profil: creionul de pe avatar (Contul meu) si editorul din Setari (#poza) */
.avatar-edit-link { position: relative; display: inline-block; flex: 0 0 auto; border-radius: 50%; }
.avatar-edit-badge { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--primary); color: #fff; border: 2px solid var(--surface); box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.2)); }
.avatar-edit-link:hover .avatar-edit-badge, .avatar-edit-link:focus-visible .avatar-edit-badge { filter: brightness(1.1); transform: scale(1.06); }
.avatar-edit { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.avatar-edit-actions { flex: 1 1 240px; display: grid; gap: .6rem; }
.avatar-edit-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.avatar-edit-buttons form { margin: 0; }
.avatar-cropper { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px dashed var(--border); }
.avatar-cropper[hidden] { display: none; }
.avatar-crop-frame { position: relative; width: 280px; max-width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); touch-action: none; }
.avatar-crop-frame canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.avatar-crop-frame canvas:active { cursor: grabbing; }
.avatar-crop-frame canvas:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
/* cercul: ce ramane in afara lui e intunecat (asa va arata avatarul) */
.avatar-crop-frame::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 999px rgba(15, 23, 42, .55); outline: 2px solid rgba(255, 255, 255, .9); outline-offset: -2px; }
.avatar-crop-tools { flex: 1 1 220px; display: grid; gap: .6rem; }
.avatar-zoom { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.avatar-zoom input { flex: 1; }
.avatar-crop-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tabs a { padding: .5rem .9rem; color: var(--text-muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }

.stats { margin-top: 0; }
/* alegerea rolului (setari): doua optiuni ca niste carduri */
.role-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .75rem; }
.role-option {
  display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; cursor: pointer;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s, background-color .15s;
}
.role-option:hover { border-color: var(--border-strong); }
.role-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.role-option input { margin-top: .25rem; accent-color: var(--primary); }
.role-option-body { display: grid; gap: .3rem; font-size: .92rem; color: var(--text-muted); }
.role-option-title { font-weight: 700; font-size: 1rem; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.profile-note { margin: .4rem 0 0; font-size: .85rem; color: var(--text-muted); }
.stat-coins strong { color: var(--accent); display: flex; align-items: center; gap: .35rem; }
.stat-coins strong img { width: 24px; height: 24px; }

.progress-list { display: grid; gap: .5rem; max-width: 40rem; }
.progress-row { display: grid; grid-template-columns: 8rem 1fr 4rem; align-items: center; gap: 1rem; color: var(--text); padding: .25rem 0; }
.progress-row:hover { text-decoration: none; color: var(--primary); }
.progress-bar { height: .6rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.progress-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin-top: 1.25rem; }

/* setarile: doua coloane (profil + parola | restul); pe ecrane inguste, una sub alta */
.settings { display: grid; gap: 1.25rem; align-items: start; }
.settings-col { display: grid; gap: 1.25rem; align-content: start; min-width: 0; }
@media (min-width: 62rem) { .settings { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.card { padding: 1.25rem 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card h2 { margin-top: 0; font-size: 1.2rem; }
.card-danger { border-color: var(--danger); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.plain-list { margin: 0 0 1.25rem; padding-left: 1.2rem; }
.plain-list li { margin-bottom: .25rem; }

/* --- Clasament ------------------------------------------------------------ */

.ranking-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 2rem; align-items: start; }
.ranking-grid h2 { margin-top: 0; }
.ranking .rank { width: 3rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ranking td:last-child, .ranking th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.ranking tr.is-me td { background: var(--primary-soft); }
/* randul „· · ·” dintre top 10 si pozitia utilizatorului */
.ranking tr.ranking-gap td { text-align: center; padding-top: .1rem; padding-bottom: .1rem; color: var(--text-muted); font-weight: 700; letter-spacing: .2em; line-height: 1; }
.person { display: inline-flex; align-items: center; gap: .5rem; color: var(--text); }
a.person:hover span { text-decoration: underline; }

/* --- Calendarul de activitate --------------------------------------------- */

.heatmap-wrap { overflow-x: auto; padding-bottom: .25rem; }
.heatmap { border-collapse: separate; border-spacing: 3px; font-size: .7rem; color: var(--text-muted); }
.heatmap th { font-weight: 400; text-align: left; padding: 0 .25rem 0 0; white-space: nowrap; height: 11px; line-height: 1; }
.heatmap thead th { height: 1.1em; padding: 0; position: relative; }
/* numele lunii nu largeste coloana lui (ar strica grila): sta peste coloane, de la inceputul saptamanii */
.heatmap thead th span { position: absolute; left: 0; bottom: .15rem; }
.heatmap td { width: 11px; height: 11px; min-width: 11px; padding: 0; border-radius: 2px; }
.lvl-0 { background: var(--surface-2); outline: 1px solid var(--border); outline-offset: -1px; }
.lvl-1 { background: color-mix(in srgb, var(--primary) 30%, var(--surface)); }
.lvl-2 { background: color-mix(in srgb, var(--primary) 55%, var(--surface)); }
.lvl-3 { background: color-mix(in srgb, var(--primary) 80%, var(--surface)); }
.lvl-4 { background: var(--primary); }
.heatmap th.heatmap-sunday { color: var(--danger); }
.heatmap-gap td { height: 4px; }
/* randul "7z": cate solutii in fiecare saptamana (culoarea ca la zile, detaliile la hover) */

.heatmap-legend { display: flex; align-items: center; gap: 3px; font-size: .8rem; }
.heatmap-legend span { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }

/* --- Clase ----------------------------------------------------------------- */

.small { font-size: .85rem; }
.input-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.input-row input { flex: 1; min-width: 10rem; }
.table-wrap { overflow-x: auto; position: relative; } /* relative: textele .visually-hidden (absolute) din tabel nu mai largesc pagina */

.classes-single { max-width: 48rem; }
.classes-single h2 { margin-top: 0; }
.classes-single .card { margin-top: 1rem; }
.archived-classes summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.archived-classes[open] summary { margin-bottom: .5rem; }
.archived-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.archived-item { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .7rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.archived-info { display: grid; gap: .1rem; flex: 1; min-width: 12rem; }
.archived-name { flex-basis: 100%; margin: 0; }
.classes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 2rem; align-items: start; }
.classes-grid h2 { margin-top: 0; }
.classes-grid .card { margin-top: 1rem; }
.class-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.class-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.class-list li > a { font-weight: 600; }
.class-code { padding: .1rem .45rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; }
.class-list .class-code { margin-left: auto; }
.class-code-lg { font-size: 1.3rem; padding: .25rem .75rem; font-weight: 700; }

.class-info { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; }
.class-info p { margin: 0 0 .4rem; }
.code-line { display: flex; align-items: center; gap: .75rem; }
.class-actions { display: grid; gap: .75rem; align-content: start; }
.class-actions form { margin: 0; }
.inline-details summary { cursor: pointer; color: var(--primary); font-size: .92rem; }
.inline-details[open] { display: grid; gap: .5rem; }
.inline-details[open] summary { margin-bottom: .25rem; }

.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; }

.assignment { margin-bottom: 1rem; }
.assignment h3 { margin: 0 0 .75rem; font-size: 1.05rem; }
.assignment-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.assignment-head h3 { margin: 0; }
.matrix th[scope="col"] { white-space: nowrap; }
.matrix th[scope="row"] { font-weight: 600; text-align: left; white-space: nowrap; }
.matrix td { text-align: center; }

.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.member-list li { display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .75rem .3rem .3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.member-list li.is-me { border-color: var(--primary); background: var(--primary-soft); }
.leave-form { margin-top: 2.5rem; }

.assign-form { display: grid; gap: 1.25rem; }
.assign-form fieldset { margin: 0; min-width: 0; }
.assign-form legend { font-weight: 700; font-size: 1.1rem; padding: 0 .25rem; }
.pick-class { border-top: 1px solid var(--border); padding: .5rem 0; }
.pick-class summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
.pick-group { padding: .5rem 0 .5rem 1rem; display: grid; gap: .3rem; }
.pick-title { margin: 0 0 .2rem; font-size: .9rem; color: var(--text-muted); }
.pick-title strong { color: var(--text); }
.pick-students { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .5rem; }
/* alegerea elevilor pentru o tema: butoane cu avatar si nume; fundalul se schimba cand sunt alese
   (sub fiecare e o casuta reala, ascunsa vizual: merge cu tastatura si fara JavaScript) */
.pick-all { display: flex; gap: .4rem; margin: 0 0 1rem; }   /* butoanele toti / niciunul, deasupra elevilor */
.pick-chip { position: relative; display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem .45rem .45rem;
  border: 1.5px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; user-select: none;
  transition: background-color .12s, border-color .12s, color .12s; }
.pick-chip:hover { border-color: var(--primary); }
.pick-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pick-chip .avatar { width: 32px; height: 32px; flex: 0 0 auto; }
.pick-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pick-chip-check { flex: 0 0 auto; opacity: 0; }
.pick-chip:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; }
.pick-chip:has(input:checked) .pick-chip-check { opacity: 1; }
.pick-chip:has(input:checked) .avatar { box-shadow: 0 0 0 2px #fff; }
.pick-chip:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
/* numele unui elev cu avatarul lui (lista clasei, detaliile unei teme, cosul) */
.student-name { display: inline-flex; align-items: center; gap: .5rem; vertical-align: middle; }
.student-name .avatar { flex: 0 0 auto; }
.hw-who { display: inline-flex; align-items: center; gap: .3rem; margin: .1rem .5rem .1rem 0; white-space: nowrap; }
.hw-who .avatar { width: 20px; height: 20px; }
/* celula ramane celula de tabel (cu display: flex randul ei nu se mai alinia cu celelalte) */
.solution-links a { display: inline-block; margin: .1rem .75rem .1rem 0; }

/* --- Autor ----------------------------------------------------------------- */

.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-private { background: rgba(139, 92, 246, .15); color: #7c3aed; }
:root.theme-dark .badge-private { color: #c4b5fd; }
.field select, .field textarea { width: 100%; }
.author-intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.author-intro p { margin: 0; max-width: 40rem; }
.import-result { margin: 1rem 0; }
.import-result h2 { font-size: 1.1rem; }
.import-box { margin-top: 1.5rem; }
.import-box summary, .advanced summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.import-box[open] summary { margin-bottom: .75rem; }

.section-nav { position: sticky; top: 4rem; z-index: 5; display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem 0; margin-bottom: 1rem; background: var(--bg); border-bottom: 1px solid var(--border); }
.section-nav a { padding: .3rem .75rem; border-radius: var(--radius-sm); color: var(--text-muted); font-size: .92rem; }
.section-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
@media (max-width: 40rem) { .section-nav { position: static; } }
.edit-section { margin-bottom: 1.25rem; scroll-margin-top: 7rem; }
.edit-section h2 { margin-top: 0; }
.form-row-4 { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.advanced { border-top: 1px solid var(--border); padding-top: .75rem; }
.advanced[open] summary { margin-bottom: .75rem; }

.test-edit { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .9rem; margin-bottom: .5rem; background: var(--surface); scroll-margin-top: 7rem; }
.test-edit summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; }
.test-edit[open] summary { margin-bottom: .75rem; }
.test-edit .test-io { margin-top: 0; }
.test-edit textarea { max-height: 24rem; }
.test-delete { margin-top: .5rem; }
.test-new { border-style: dashed; }
.generate-box { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.generate-box p { margin: .4rem 0 0; }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .3rem; }
.checklist li::before { content: "○ "; color: var(--text-muted); }
.checklist li.is-done::before { content: "✓ "; color: var(--success); font-weight: 700; }

/* --- Aprobare, administrare, fragmente -------------------------------------- */

.card-title { font-size: 1.05rem; margin: 0 0 .5rem; }
.review-statement { padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.decision { display: grid; gap: .75rem; }
.decision form { margin: 0; }
.reject-form { border-top: 1px solid var(--border); padding-top: .75rem; }
.test-io h4 { font-size: .85rem; color: var(--text-muted); margin: 0 0 .3rem; }
.admin-op { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.admin-op h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.admin-op p { margin: 0; }
/* pagina Fragmentele mele: cate un card pe capitol, fragmentele ca butoane verzi (deblocate) / rosii (blocate) */
.snippet-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; margin-top: 1rem; align-items: start; }
.snippet-card { padding: 1rem 1.1rem 1.1rem; background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius); }
.snippet-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.snippet-card-head h2 { margin: 0; font-size: 1.15rem; }
.snippet-count { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.snippet-count.is-complete { color: var(--success); font-weight: 600; }
.snippet-progress { height: 6px; margin: .6rem 0 .9rem; border-radius: 999px; background: var(--danger-soft); overflow: hidden; }
.snippet-progress span { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.snippet-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.snippet-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 999px; border: 1px solid transparent; font-size: .92rem; font-weight: 500; line-height: 1.3; text-decoration: none; transition: filter .15s, transform .15s; }
.snippet-chip:hover { text-decoration: none; filter: brightness(.96); transform: translateY(-1px); }
.snippet-chip.is-unlocked { background: var(--success-soft); color: var(--text); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.snippet-chip.is-locked { background: var(--danger-soft); color: var(--text); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.snippet-star { color: #e0a100; font-size: 1em; line-height: 1; }
.snippet-problems { list-style: none; margin: .75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.snippet-problems .is-disabled { opacity: .6; cursor: default; }
.locked-card { border-style: dashed; }
.locked-card p { margin: 0; }

/* --- Ecrane mici ----------------------------------------------------------- */

@media (max-width: 40rem) {
  /* meniul ramane pe randul logo-ului; daca vor fi multe linkuri, se deruleaza orizontal */
  .main-nav { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .main-nav a { padding: .35rem .5rem; }
  .main-nav::-webkit-scrollbar { display: none; }
  /* tabelele late se deruleaza in interiorul lor, nu largesc pagina */
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .main { padding-top: 1.25rem; }
  .card { padding: 1rem; }
  .stat strong { font-size: 1.5rem; }
  .class-list .class-code { margin-left: 0; }
  .row-actions { text-align: left; }
}

/* --- Stilul InfoX: carduri si butoane cu bordura albastra (ca versiunea veche) --- */

.btn { border-width: 2px; }
.btn-ghost { border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--primary); }
.card, .chapter-card, .class-card, .stat, .problem-item, .auth-card, .test-item, .purchase-card, .facts, .tips,
.class-list li, .solution-list li, .review-statement, .test-edit, .empty, .table {
  border-width: 2px; border-color: var(--border-strong);
}
.problem-item { border-left-width: 4px; }
.class-card:hover, .problem-item:hover { border-color: var(--primary); }
.chapter-card { border-color: var(--ch-line); }
.chapter-card:hover { border-color: var(--ch-accent); }
.problem-item.is-solved:hover { border-left-color: var(--success); }
.problem-item.is-tried:hover { border-left-color: var(--warning); }
.table th { background: var(--surface-2); color: var(--ink); }
.tabs a[aria-current="page"], .section-nav a:hover { color: var(--ink); }

/* --- Pagina de start: cele trei clase, pe toata latimea ------------------------ */

.home-classes { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem; padding: 1rem 0 2rem; }

/* Fiecare clasa are culoarea piesei ei (--piece) */
.home-class.home-class--9  { --piece: #15928d; --piece-soft: #e2f5f3; }
.home-class.home-class--10 { --piece: #e0912b; --piece-soft: #fdf1df; }
.home-class.home-class--11 { --piece: #3d63c9; --piece-soft: #e5ecfb; }

.home-class {
  --piece: var(--primary); --piece-soft: var(--primary-soft);
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  min-height: 24rem; padding: 2.5rem 1.5rem; text-align: center; color: var(--text);
  background: var(--surface); border: 2px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow);
  transition: border-color .25s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s ease;
  animation: home-class-in .6s cubic-bezier(.22, 1, .36, 1) both;
}
.home-class:nth-child(2) { animation-delay: .12s; }
.home-class:nth-child(3) { animation-delay: .24s; }

/* Tabla de sah in culoarea clasei, care apare si aluneca la hover */
.home-class::before {
  content: ""; position: absolute; inset: -40px; z-index: -1; opacity: 0;
  background:
    radial-gradient(circle at 50% 38%, var(--piece-soft) 0 28%, transparent 62%),
    repeating-conic-gradient(var(--piece-soft) 0 25%, transparent 0 50%) 0 0 / 48px 48px;
  transform: translate(0, 0);
  transition: opacity .35s ease;
}
.home-class:hover::before, .home-class:focus-visible::before { opacity: 1; animation: home-board-slide 6s linear infinite; }

.home-class:hover, .home-class:focus-visible {
  border-color: var(--piece); color: var(--text); text-decoration: none;
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 18px 40px -12px color-mix(in srgb, var(--piece) 55%, transparent);
}
.home-class:active { transform: translateY(-2px) scale(.98); transition-duration: .1s; }

/* Piesa: in repaus sta pe loc, cu o umbra sub ea; se misca doar la hover */
.home-class-piece { position: relative; display: block; width: 160px; height: 160px; margin-bottom: .75rem; }
.home-class-piece img { position: relative; z-index: 1; width: 100%; height: 100%; }
.home-class-piece::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 60%; height: 14px; border-radius: 50%;
  background: color-mix(in srgb, var(--piece) 35%, transparent); filter: blur(3px);
  transform: translateX(-50%); transition: transform .4s ease, opacity .4s ease;
}

/* La hover, fiecare piesa face mutarea ei */
.home-class--9:hover .home-class-piece img, .home-class--9:focus-visible .home-class-piece img { animation: pawn-advance .9s cubic-bezier(.34, 1.56, .64, 1) both; }
.home-class--10:hover .home-class-piece img, .home-class--10:focus-visible .home-class-piece img { animation: knight-jump 1s cubic-bezier(.45, 0, .2, 1) both; }
.home-class--11:hover .home-class-piece img, .home-class--11:focus-visible .home-class-piece img { animation: queen-glow 1.6s ease-in-out infinite; }
.home-class:hover .home-class-piece::after, .home-class:focus-visible .home-class-piece::after { transform: translateX(-50%) scale(.75); opacity: .6; }

.home-class-title { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem); font-weight: 700; color: var(--ink); transition: color .25s ease; }
.home-class:hover .home-class-title, .home-class:focus-visible .home-class-title { color: var(--piece); }
.home-class-count { font-size: 1.1rem; color: var(--text-muted); }
.home-class-progress { display: grid; gap: .35rem; width: min(14rem, 100%); margin-top: .5rem; }
.home-class-progress .progress-bar span { background: var(--piece); animation: progress-fill 1.2s .5s cubic-bezier(.22, 1, .36, 1) both; transform-origin: left; }

/* Indemnul care apare la hover */
.home-class-cta {
  margin-top: .25rem; padding: .45rem 1rem; border-radius: 999px; font-weight: 700; color: #fff; background: var(--piece);
  opacity: 0; transform: translateY(10px); transition: opacity .25s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.home-class-cta span { display: inline-block; transition: transform .25s ease; }
.home-class:hover .home-class-cta, .home-class:focus-visible .home-class-cta { opacity: 1; transform: translateY(0); }
.home-class:hover .home-class-cta span { transform: translateX(4px); }

/* „Examene și concursuri”: sub cele trei clase, pe toata latimea, destul de joasa cat sa se vada si subsolul paginii;
   nu e o clasa, ci o sectiune cu mai multe examene */
.home-exams {
  --piece: #8a4fc7; --piece-soft: #f1e8fb;
  display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center;
  margin: -.5rem 0 1.5rem; padding: .9rem 1.5rem;
  background: var(--surface); border: 2px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow);
  animation: home-class-in .6s .36s cubic-bezier(.22, 1, .36, 1) both;
}
.home-exams-head { display: flex; align-items: center; gap: 1rem; }
.home-exams-icon {
  flex: none; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%;
  color: var(--piece); background: var(--piece-soft);
}
.home-exams:hover .home-exams-icon svg { animation: exams-cup 1s cubic-bezier(.34, 1.56, .64, 1) both; }
.home-exams-body { display: grid; gap: .15rem; min-width: 0; }
.home-exams-title { margin: 0; font-size: clamp(1.4rem, 1.1rem + .8vw, 1.75rem); font-weight: 700; line-height: 1.2; color: var(--ink); white-space: nowrap; }
.home-exams-count { margin: 0; color: var(--text-muted); }
.home-exams-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; margin: 0; padding: 0; list-style: none; }
.home-exams-list li { display: flex; }
.home-exam {
  flex: 1; display: flex; flex-direction: column; gap: .15rem; padding: .6rem .95rem; border-radius: 12px; color: var(--text);
  background: var(--surface-2); border: 2px solid transparent;
  transition: border-color .2s ease, transform .25s cubic-bezier(.34, 1.56, .64, 1), background .2s ease;
}
a.home-exam:hover, a.home-exam:focus-visible { border-color: var(--piece); background: var(--piece-soft); color: var(--text); text-decoration: none; transform: translateY(-3px); }
.home-exam-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem .6rem; }
.home-exam-name { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.home-exam-count { font-weight: 700; color: var(--piece); white-space: nowrap; }
.home-exam-note { font-size: .88rem; color: var(--text-muted); }
/* progresul fiecarui examen: bara si „ai rezolvat X” pe acelasi rand, jos in card */
.home-exam-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem; margin-top: auto; padding-top: .25rem; font-size: .85rem; }
.home-exam-progress .progress-bar span { background: var(--piece); animation: progress-fill 1.2s .5s cubic-bezier(.22, 1, .36, 1) both; transform-origin: left; }
.home-exam.is-soon { opacity: .6; }
.home-exam.is-soon .home-exam-count { color: var(--text-muted); font-weight: 400; font-style: italic; }
/* Pagina Bacalaureat din „Examene și concursuri” (/probleme/bacalaureat, /grile/bacalaureat) */
.bac-h1-kind { font-weight: 500; color: var(--text-muted); }
.bac-sim-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.1rem; margin: 0 0 1.5rem; padding: 1rem 1.25rem;
  border-radius: 14px; color: #fff; background: linear-gradient(120deg, #6d35b0, #8a4fc7 55%, #a56ad9);
  box-shadow: 0 10px 24px -12px rgba(109, 53, 176, .7); transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s ease;
}
.bac-sim-banner:hover, .bac-sim-banner:focus-visible { color: #fff; text-decoration: none; transform: translateY(-3px); box-shadow: 0 16px 30px -12px rgba(109, 53, 176, .8); }
.bac-sim-icon { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.bac-sim-text { flex: 1 1 18rem; display: grid; gap: .15rem; }
.bac-sim-text strong { font-size: 1.2rem; }
.bac-sim-text span { opacity: .92; }
.bac-sim-cta { flex: none; padding: .55rem 1.1rem; border-radius: 999px; font-weight: 700; color: #6d35b0; background: #fff; }
.bac-sim-cta span { display: inline-block; transition: transform .2s ease; }
.bac-sim-banner:hover .bac-sim-cta span { transform: translateX(4px); }
@media (prefers-reduced-motion: reduce) { .bac-sim-banner, .bac-sim-cta span { transition: none; } .bac-sim-banner:hover { transform: none; } }
.chapter-grid--exam { --ch-accent: #8a4fc7; --ch-soft: #f1e8fb; --ch-ink: #5a2d8c; --ch-line: #dcc8f2; }
/* sigla facultatii in cerc (admitere): patratul siglei incape intreg in cerc; golurile siglei (SVG transparent) lasa
   sa se vada cercul, alb pe ambele teme, ca sigla sa iasa in evidenta */
.faculty-logo, :root.theme-dark .faculty-logo { background: #fff; }
.faculty-logo img { display: block; width: 40px; height: 40px; border-radius: 3px; }
.bac-year-badge { width: 60px; height: 60px; font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; color: var(--ch-ink); font-variant-numeric: tabular-nums; }
.chapter-grid--exam .chapter-card { scroll-margin-top: 1rem; }
.bac-subject-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: 1rem; }
.bac-subject-head h2 { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .75rem; margin: 0; font-size: 1.5rem; }
.bac-subject-head h2 .muted { font-size: .95rem; font-weight: 400; }
.bac-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.bac-type {
  display: grid; gap: .25rem; align-content: start; padding: .9rem 1rem; border-radius: 12px; color: var(--text);
  background: var(--surface); border: 2px solid var(--border); transition: border-color .2s ease, transform .2s ease;
}
.bac-type:hover { border-color: #8a4fc7; color: var(--text); text-decoration: none; transform: translateY(-2px); }
.bac-type[aria-current="true"] { border-color: #8a4fc7; background: #f1e8fb; }
.bac-type-name { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.bac-type-where { font-size: .85rem; color: var(--text-muted); }
.bac-type-count { margin-top: .2rem; font-weight: 600; color: #8a4fc7; }
.bac-type .progress-bar span { background: #8a4fc7; }
.bac-type-list { scroll-margin-top: 1rem; }
.bac-type-list h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .75rem; font-size: 1.4rem; }
.bac-type-list h2 .muted { font-size: .95rem; font-weight: 400; }
:root.theme-dark .bac-type[aria-current="true"] { background: #2a1f3d; }
:root.theme-dark .chapter-grid--exam { --ch-accent: #b58be8; --ch-soft: #2a1f3d; --ch-ink: #dcc8f7; --ch-line: #44315f; }

@keyframes exams-cup { 0% { transform: none; } 40% { transform: translateY(-6px) rotate(-8deg); } 70% { transform: translateY(0) rotate(5deg); } 100% { transform: none; } }
@media (max-width: 900px) {
  .home-exams { grid-template-columns: 1fr; gap: 1rem; padding: 1rem; }
  .home-exams-icon { width: 60px; height: 60px; }
  .home-exams-icon svg { width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-exams, .home-exams:hover .home-exams-icon svg { animation: none; }
  .home-exam { transition: none; }
  a.home-exam:hover { transform: none; }
}

@keyframes home-class-in { from { opacity: 0; transform: translateY(28px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes home-board-slide { to { transform: translate(48px, 48px); } }
@keyframes pawn-advance {
  0% { transform: translateY(0); }
  30% { transform: translateY(-22px) scaleY(1.04); }
  45% { transform: translateY(-15px); }
  70% { transform: translateY(-34px) scaleY(1.04); }
  100% { transform: translateY(-26px); }
}
@keyframes knight-jump {
  0% { transform: translate(0, 0) rotate(0); }
  35% { transform: translate(0, -28px) rotate(-12deg); }
  70% { transform: translate(30px, -28px) rotate(8deg); }
  85% { transform: translate(30px, -6px) rotate(0); }
  100% { transform: translate(26px, -12px) rotate(0); }
}
@keyframes queen-glow {
  0%, 100% { transform: translateY(-8px) rotate(-4deg); filter: drop-shadow(0 0 0 transparent); }
  50% { transform: translateY(-16px) rotate(4deg) scale(1.06); filter: drop-shadow(0 0 14px color-mix(in srgb, var(--piece) 70%, #fff)); }
}
@keyframes progress-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  .home-class, .home-class::before, .home-class-piece img, .home-class-piece::after, .home-class-progress .progress-bar span { animation: none !important; }
  .home-class, .home-class:hover, .home-class:focus-visible, .home-class-cta { transition: none; transform: none; }
}
@media (max-width: 40rem) {
  .home-class { min-height: 0; padding: 1.75rem 1rem; }
  .home-class-piece { width: 110px; height: 110px; }
  .home-class-cta { opacity: 1; transform: none; }
}
@media (hover: none) { .home-class-cta { opacity: 1; transform: none; } }


/* --- Cautarea (campul din header si pagina /cautare) -------------------------- */

.header-search { flex: 0 1 18rem; margin: 0; }
.header-search input {
  width: 100%; padding: .45rem .8rem; border: 0; border-radius: var(--radius-sm);
  background: var(--search-bg, rgba(255, 255, 255, .95)); color: var(--search-ink, #1f1f1f);
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search input:focus { outline: 2px solid var(--search-focus, #fff); outline-offset: 1px; background: var(--search-bg-focus, #fff); }
@media (max-width: 64rem) { .header-search { flex-basis: 12rem; } }
@media (max-width: 40rem) { .header-search { order: 4; flex: 1 1 100%; padding-bottom: .25rem; } }

.search-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .6rem; }
.search-item { padding: .8rem 1.1rem; background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius); }
.search-title { font-weight: 700; font-size: 1.05rem; }
.search-id { color: var(--text-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.search-meta { margin: .15rem 0 0; font-size: .85rem; color: var(--text-muted); }
.search-abstract { margin: .35rem 0 0; }
.search-group h2 { margin-top: 1.25rem; }
/* tab-urile cautarii: butoane rotunjite (ca alegerea elevilor la tema), lipite sub bara de sus la derulare */
.search-tabs { position: sticky; top: var(--header-h, 4rem); z-index: 5; display: flex; flex-wrap: wrap; gap: .45rem;
  margin: 0 0 1rem; padding: .6rem 0; background: var(--bg); }
.search-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .55rem .4rem .9rem; border-radius: 999px;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .92rem; }
.search-tab:hover { border-color: var(--primary); text-decoration: none; }
.search-tab[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.search-tab-count { min-width: 1.6rem; padding: .05rem .45rem; border-radius: 999px; background: var(--surface-2); font-size: .8rem; text-align: center; font-variant-numeric: tabular-nums; }
.search-tab[aria-current="true"] .search-tab-count { background: rgba(255, 255, 255, .25); color: #fff; }
.search-points { font-size: .88rem; }
@media (max-width: 40rem) {   /* pe telefon: un singur rand de tab-uri, derulat lateral (ocupa mai putin loc sus) */
  .search-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .search-tabs::-webkit-scrollbar { display: none; }
  .search-tab { flex: none; }
}
#search-results mark { background: #ffe58f; color: inherit; border-radius: 2px; padding: 0 1px; }

/* --- Pagina unei clase: piesele de sah ale claselor, sus pe centru -------------- */

.class-pieces { display: flex; justify-content: center; align-items: flex-end; gap: clamp(1rem, 4vw, 3rem); margin: .5rem 0 2rem; }
.class-piece { display: block; opacity: .35; border-radius: var(--radius); padding: .25rem; }
.class-piece img { display: block; width: 72px; height: 72px; }
.class-piece.is-current { opacity: 1; }
.class-piece span { display: grid; place-items: center; width: 72px; height: 72px; font-size: 1.5rem; font-weight: 700; color: var(--ink); }
@media (max-width: 40rem) { .class-piece img, .class-piece span { width: 56px; height: 56px; } }

/* --- Pagina de eroare ------------------------------------------------------ */

.error-page { text-align: center; padding: 3rem 0; max-width: 32rem; margin: 0 auto; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--primary); margin: 0; line-height: 1; }
.actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* --- Footer ---------------------------------------------------------------- */

.site-footer { background: var(--header); color: rgba(255, 255, 255, .85); font-size: .9rem; }
.site-footer a { color: #fff; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1.5rem; padding-top: .9rem; padding-bottom: .9rem; }
.footer-inner p { margin: 0; }
.footer-about p { line-height: 1.35; }
.footer-about p + p { margin-top: .1rem; font-size: .85rem; }
.footer-faculty { font-weight: 700; }
.footer-inner nav { display: flex; gap: 1rem; }
/* linkurile din subsol, pe un singur rand, grupate dupa sens (unelte | comunitate | despre), cu o linie intre grupuri */
.footer-inner .footer-links { flex-wrap: wrap; align-items: center; gap: .25rem 0; }
.footer-group { display: inline-flex; gap: 1rem; padding: 0 1rem; border-left: 1px solid rgba(255, 255, 255, .3); }
.footer-group:first-child { border-left: 0; padding-left: 0; }
.footer-group:last-child { padding-right: 0; }

/* --- Grile ----------------------------------------------------------------- */
/* Grilele folosesc culorile site-ului (albastru). In locul pieselor de sah de la probleme, fiecare clasa are un
   simbol din cresterea unei plante (IX rasad, X planta, XI copac) si culoarea ei (accent-c9 / c10 / c11: --ch-*). */
.btn-lg { padding: .7rem 1.4rem; font-size: 1.05rem; }
.quiz-kicker { display: inline-block; margin: 0 0 .35rem; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ch-accent, var(--primary)); }
.quiz-chip { display: inline-flex; align-items: center; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; color: var(--ch-ink, var(--ink)); background: var(--ch-soft, var(--primary-soft)); white-space: nowrap; }
.quiz-note { margin-top: 1.5rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.quiz-done { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: 999px; font-weight: 600; color: var(--success); background: var(--success-soft); }
.quiz-done::before { content: "\2713"; }

.quiz-class-icon svg, .quiz-page-icon svg { width: 72%; height: 72%; }
.quiz-page-icon {
  flex: 0 0 auto; display: grid; place-items: center; width: 3.6rem; height: 3.6rem; border-radius: 14px;
  color: var(--ch-accent, var(--primary)); background: var(--ch-soft, var(--primary-soft));
}
.quiz-page-title { flex: 1; min-width: 0; }
.quiz-class-title { font-size: 1.2rem; font-weight: 700; }
.quiz-progress, .quiz-sub-progress { display: block; height: 6px; border-radius: 999px; background: var(--ch-soft, var(--primary-soft)); overflow: hidden; }
.quiz-progress > span, .quiz-sub-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--ch-accent, var(--primary)); }

/* clasa: capitolele si subcapitolele */
.quiz-page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.quiz-page-head h1 { margin-bottom: .25rem; }
.quiz-page-head p { margin: 0; }
.quiz-class-switch { display: flex; gap: .35rem; }
.quiz-class-switch a { display: grid; place-items: center; min-width: 2.6rem; height: 2.4rem; padding: 0 .6rem; border-radius: 10px; font-weight: 700; color: var(--primary); background: var(--primary-soft); }
.quiz-class-switch a:hover { text-decoration: none; background: var(--border); }
.quiz-class-switch a { color: var(--ch-ink, var(--primary)); background: var(--ch-soft, var(--primary-soft)); }
.quiz-class-switch a[aria-current="page"] { color: #fff; background: var(--ch-accent, var(--primary)); }
.quiz-chapters { columns: 2 26rem; column-gap: 1.25rem; }
.quiz-chapter { break-inside: avoid; margin: 0 0 1.25rem; padding: 1.1rem 1.2rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--ch-accent, var(--primary)); }
.quiz-chapter h2 { margin: 0 0 .6rem; font-size: 1.1rem; font-weight: 700; color: var(--ch-ink, var(--text)); }
.quiz-subs { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.quiz-sub { display: flex; align-items: center; gap: .75rem; padding: .5rem .6rem; border-radius: 8px; color: var(--text); }
a.quiz-sub:hover { text-decoration: none; color: var(--text); background: var(--ch-soft, var(--primary-soft)); }
.quiz-sub-name { flex: 1; min-width: 0; }
.quiz-sub .quiz-sub-progress { width: 4.5rem; }
.quiz-sub.is-empty { color: var(--text-muted); }

/* subcapitol: lista grilelor */
.quiz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.quiz-item {
  display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border-radius: 12px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, transform .15s;
}
.quiz-item:hover { text-decoration: none; color: var(--text); border-color: var(--primary); transform: translateX(3px); }
.quiz-item-num { flex: 0 0 auto; display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; font-weight: 700; color: var(--ch-ink, var(--primary)); background: var(--ch-soft, var(--primary-soft)); }
.quiz-item-body { flex: 1; min-width: 0; display: grid; gap: .15rem; }
.quiz-item-text { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.quiz-item-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .82rem; color: var(--text-muted); }
.quiz-state { flex: 0 0 auto; padding: .15rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.quiz-state.is-solved { color: var(--success); background: var(--success-soft); }
.quiz-state.is-wrong { color: var(--warning); background: var(--warning-soft); }
.quiz-state.is-new { color: var(--text-muted); background: var(--surface-2); }
.quiz-item.is-solved { border-left: 4px solid var(--success); }
.quiz-item.is-solved .quiz-item-num { color: var(--success); background: var(--success-soft); }
.quiz-item.is-wrong { border-left: 4px solid #e6a23c; }

/* o grila */
.quiz-card { padding: 1.5rem 1.6rem; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--ch-accent, var(--primary)); box-shadow: 0 6px 20px rgba(18, 84, 145, .07); }
.quiz-card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px dashed var(--border); }
.quiz-card-head .quiz-kicker { margin: 0; }
/* titlul (optional) al grilei: scris normal, nu cu majuscule ca "Grila 8 din 9" */
.quiz-kicker .quiz-title { font-size: 1rem; letter-spacing: 0; text-transform: none; color: var(--ink); }
.quiz-card-tags { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.quiz-statement { font-size: 1.08rem; margin-bottom: 1.25rem; }
.quiz-statement pre { background: var(--surface-2); padding: .75rem 1rem; border-radius: var(--radius-sm); overflow-x: auto; }
.quiz-options { display: grid; gap: .6rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.quiz-option {
  position: relative; display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--border); transition: border-color .12s, background .12s, box-shadow .12s;
}
.quiz-option input { position: absolute; opacity: 0; pointer-events: none; }
.quiz-option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.quiz-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(2, 132, 199, .15); }
.quiz-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.quiz-options:disabled .quiz-option, div.quiz-options .quiz-option { cursor: default; }
.quiz-letter {
  flex: 0 0 auto; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  font-weight: 700; text-transform: lowercase; color: var(--primary); background: var(--primary-soft); border: 2px solid transparent;
}
.quiz-option:has(input:checked) .quiz-letter { color: #fff; background: var(--primary); }
.quiz-option-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.quiz-option-text code { background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; }
.quiz-option-mark { flex: 0 0 auto; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.quiz-option.is-right { border-color: var(--success); background: var(--success-soft); }
.quiz-option.is-right .quiz-letter { color: #fff; background: var(--success); }
.quiz-option.is-right .quiz-option-mark { color: var(--success); }
.quiz-option.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.quiz-option.is-wrong .quiz-letter { color: #fff; background: var(--danger); }
.quiz-option.is-wrong .quiz-option-mark { color: var(--danger); }
.quiz-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem; }
.quiz-result { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin: 1.25rem 0 0; padding: .9rem 1.2rem; border-radius: 12px; font-size: 1.05rem; }
.quiz-result strong { font-size: 1.2rem; }
.quiz-result.is-right { color: var(--success); background: var(--success-soft); border: 1px solid #b7e1c3; }
.quiz-result.is-wrong { color: var(--danger); background: var(--danger-soft); border: 1px solid #f3c1c1; }
.quiz-result.is-info { background: var(--surface-2); border: 1px solid var(--border); }
/* incercarile anterioare la o grila: data fiecarei incercari, pe verde (corect) sau rosu (gresit) */
.quiz-history { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 1rem; font-size: .92rem; }
.quiz-history-label { color: var(--text-muted); margin-right: .2rem; }
.quiz-attempt { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.quiz-attempt.is-right { color: var(--success); background: var(--success-soft); border: 1px solid #b7e1c3; }
.quiz-attempt.is-wrong { color: var(--danger); background: var(--danger-soft); border: 1px solid #f3c1c1; }
.quiz-explanation { margin-top: 1.5rem; padding: 1.25rem 1.4rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.quiz-explanation h2 { margin: 0 0 .75rem; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.quiz-locked { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.1rem; border-radius: 10px; background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px); border: 1px dashed var(--border-strong); }
.quiz-locked p { margin: 0; flex: 1 1 20rem; }
.quiz-locked form { margin: 0; }
.quiz-nav { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.quiz-source { margin-top: 1rem; }

/* formularul autorului */
.quiz-type-choice { display: grid; gap: .3rem; padding-top: .3rem; }
.quiz-type-choice label { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.quiz-type-choice input { width: auto; margin: 0; }
.quiz-edit .label { display: block; font-weight: 600; }
.quiz-edit-options { border: 0; padding: 0; margin: 0; display: grid; gap: .5rem; }
.quiz-edit-options legend { font-weight: 600; margin-bottom: .4rem; }
.quiz-edit-option { display: flex; align-items: center; gap: .75rem; }
.quiz-edit-option textarea { flex: 1; min-height: 2.6rem; }
.quiz-edit-correct { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .3rem; font-weight: 400 !important; white-space: nowrap; }

@media (max-width: 40rem) {
    .quiz-card { padding: 1.1rem 1rem; }
  .quiz-item-num { display: none; }
  .quiz-edit-option { flex-wrap: wrap; }
  .quiz-edit-option textarea { flex-basis: calc(100% - 3rem); }
}

/* --- Grile: cardurile claselor (ca pe /probleme), cu plante in loc de piese de sah ---------------------------- */
/* Fundalul care apare la hover: puncte (ca o gradina vazuta de sus), in locul tablei de sah. */
.home-class--quiz::before {
  background:
    radial-gradient(circle at 50% 38%, var(--piece-soft) 0 28%, transparent 62%),
    radial-gradient(circle, var(--piece-soft) 0 5px, transparent 6px) 0 0 / 32px 32px;
}
.home-class--quiz:hover::before, .home-class--quiz:focus-visible::before { animation: home-garden-drift 8s linear infinite; }
.home-class-plant { display: grid; place-items: end center; }
.home-class-plant::after { display: none; } /* plantele au pamantul lor (umbra pieselor de sah nu mai e necesara) */
.plant { width: 100%; height: 100%; overflow: visible; color: var(--piece); }
.plant * { transform-box: fill-box; }
.plant-soil { fill: var(--piece); opacity: .22; }
.plant-stem { fill: none; stroke: var(--piece); stroke-width: 5; stroke-linecap: round; }
.plant-leaf { fill: var(--piece); }
.plant-leaf--l, .plant-leaf--l2 { opacity: .78; }
.plant-pot { fill: color-mix(in srgb, var(--piece) 55%, #8a5a2b); }
.plant-pot-rim { fill: color-mix(in srgb, var(--piece) 70%, #8a5a2b); }
.plant-flower circle { fill: color-mix(in srgb, var(--piece) 55%, #fff); }
.plant-flower .plant-flower-heart { fill: var(--piece); }
.plant-trunk { fill: color-mix(in srgb, var(--piece) 18%, #7a5230); }
.plant-crown circle { fill: var(--piece); }
.plant-crown .plant-crown-back { opacity: .7; }
.plant-fall { fill: var(--piece); opacity: 0; }

/* Repaus: plantele "respira" usor (frunzele se misca putin, copacul sta in vant slab) */
.plant-leaf--l { transform-origin: right bottom; animation: leaf-breathe-l 4s ease-in-out infinite; }
.plant-leaf--r { transform-origin: left bottom; animation: leaf-breathe-r 4s ease-in-out infinite; }
.plant-leaf--l2 { transform-origin: right bottom; animation: leaf-breathe-l 4s 1s ease-in-out infinite; }
.plant-sway { transform-origin: center bottom; animation: plant-idle-sway 6s ease-in-out infinite; }
.plant-flower { transform-origin: center; transform: scale(.45); transition: transform .5s cubic-bezier(.34, 1.56, .64, 1); }
.plant-crown { transform-origin: center bottom; animation: crown-idle 7s ease-in-out infinite; }
.plant-grow { transform-origin: center bottom; }

/* Hover: fiecare planta face "miscarea" ei */
/* IX: rasadul creste din pamant, iar frunzele se deschid */
.home-class--9:hover .plant-grow, .home-class--9:focus-visible .plant-grow { animation: sprout-grow 1s cubic-bezier(.34, 1.56, .64, 1) both; }
.home-class--9:hover .plant-leaf--l, .home-class--9:focus-visible .plant-leaf--l { animation: leaf-open-l 1.1s cubic-bezier(.34, 1.56, .64, 1) both; }
.home-class--9:hover .plant-leaf--r, .home-class--9:focus-visible .plant-leaf--r { animation: leaf-open-r 1.1s .1s cubic-bezier(.34, 1.56, .64, 1) both; }
/* X: planta se leagana, iar bobocul infloreste si se roteste */
.home-class--10:hover .plant-sway, .home-class--10:focus-visible .plant-sway { animation: plant-sway 1.6s ease-in-out infinite; }
.home-class--10:hover .plant-flower, .home-class--10:focus-visible .plant-flower { transform: scale(1) rotate(36deg); }
/* XI: coroana se misca in vant si cad cateva frunze */
.home-class--11:hover .plant-crown, .home-class--11:focus-visible .plant-crown { animation: crown-wind 1.4s ease-in-out infinite; }
.home-class--11:hover .plant-fall--1, .home-class--11:focus-visible .plant-fall--1 { animation: leaf-fall 2.2s .1s ease-in infinite; }
.home-class--11:hover .plant-fall--2, .home-class--11:focus-visible .plant-fall--2 { animation: leaf-fall 2.4s .8s ease-in infinite; }
.home-class--11:hover .plant-fall--3, .home-class--11:focus-visible .plant-fall--3 { animation: leaf-fall 2s 1.4s ease-in infinite; }

@keyframes home-garden-drift { to { background-position: 0 0, 32px 32px; } }
@keyframes leaf-breathe-l { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-5deg); } }
@keyframes leaf-breathe-r { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(5deg); } }
@keyframes plant-idle-sway { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }
@keyframes crown-idle { 0%, 100% { transform: rotate(-1deg); } 50% { transform: rotate(1deg) scale(1.01); } }
@keyframes sprout-grow { 0% { transform: scaleY(.55) scaleX(.9); } 60% { transform: scaleY(1.12); } 100% { transform: scaleY(1.05); } }
@keyframes leaf-open-l { 0% { transform: rotate(35deg) scale(.6); } 100% { transform: rotate(-8deg) scale(1.08); } }
@keyframes leaf-open-r { 0% { transform: rotate(-35deg) scale(.6); } 100% { transform: rotate(8deg) scale(1.08); } }
@keyframes plant-sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes crown-wind { 0%, 100% { transform: rotate(-3deg) skewX(-2deg); } 50% { transform: rotate(3deg) skewX(2deg) scale(1.03); } }
@keyframes leaf-fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-14px, 46px) rotate(220deg); }
}


@media (prefers-reduced-motion: reduce) {
  .plant *, .plant-sway, .plant-crown, .plant-grow { animation: none !important; transition: none !important; }
  .plant-flower { transform: scale(1); }
}

/* Plantele claselor, in afara cardurilor de pe /grile (randul de clase de pe pagina clasei) */
.plant--c9 { --piece: #15928d; }
.plant--c10 { --piece: #e0912b; }
.plant--c11 { --piece: #3d63c9; }
.class-piece--plant svg { display: block; width: 72px; height: 72px; }
.class-piece--plant .plant * { animation: none; }
.class-piece--plant.is-current .plant-flower { transform: scale(1); }
@media (max-width: 40rem) { .class-piece--plant svg { width: 56px; height: 56px; } }

/* Grile: raspunsul scris si codul colorat */
.quiz-text-answer { display: grid; gap: .4rem; max-width: 28rem; }
.quiz-text-answer label { font-weight: 600; }
.quiz-text-answer input { font: inherit; font-size: 1.1rem; padding: .7rem .9rem; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); }
.quiz-text-answer input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2, 132, 199, .15); }
.quiz-text-answer.is-right input { border-color: var(--success); background: var(--success-soft); }
.quiz-text-answer.is-wrong input { border-color: var(--danger); background: var(--danger-soft); }
.quiz-accepted { margin: .25rem 0 0; color: var(--text-muted); }
.quiz-accepted code { padding: .05rem .4rem; border-radius: 4px; background: var(--success-soft); color: var(--success); font-weight: 600; }
pre.code-highlight { background: var(--surface-2); padding: .75rem 1rem; border-radius: var(--radius-sm); overflow-x: auto; line-height: 1.5; font-size: .92rem; }
.quiz-option-text pre { margin: 0; }
.quiz-option-text pre.code-highlight { padding: .5rem .75rem; }
.quiz-edit-accepted[hidden], .quiz-edit-options[hidden], [data-quiz-type][hidden] { display: none !important; }

/* --- Teme de culori (Setari -> Tema) --------------------------------------- */
/* Fiecare tema redefineste variabilele de culoare de la inceputul fisierului. Temele intunecate au si clasa
   theme-dark, folosita mai jos pentru detaliile care nu sunt variabile (culorile claselor, codul colorat). */
:root[data-theme="verde"] {
  --bg: #f2faf6;
  --surface-2: #e3f4ec;
  --border: #c4e6d6;
  --border-strong: #9fd6be;
  --header: #1d6b52;
  --link: #1d6b52;
  --primary: #12936b;
  --primary-hover: #0e7a59;
  --primary-soft: #d9f2e7;
  --focus: #1fbf8a;
  --shadow: 0 2px 4px rgba(29, 107, 82, .08);
}
:root[data-theme="cald"] {
  --bg: #fbf6ee;
  --surface: #fffdf9;
  --surface-2: #f4ead9;
  --text: #2a2420;
  --text-muted: #6f6458;
  --border: #e8d9c0;
  --border-strong: #d9c19b;
  --header: #6b4a2f;
  --link: #8a5a2b;
  --primary: #b5651d;
  --primary-hover: #96521a;
  --primary-soft: #f6e6d2;
  --focus: #e08a3c;
  --shadow: 0 2px 4px rgba(107, 74, 47, .1);
}
:root[data-theme="grafit"] {
  --bg: #17181b;
  --ink: #dfe6f3;
  --surface: #202226;
  --surface-2: #2a2d32;
  --text: #e8e8ea;
  --text-muted: #a3a6ad;
  --border: #34373d;
  --border-strong: #44484f;
  --header: #111214;
  --link: #8ab4f8;
  --primary: #5b8def;
  --primary-hover: #7aa2f2;
  --primary-soft: #26344d;
  --on-primary: #0b0f17;
  --success: #5cc97b;
  --success-soft: #17301f;
  --warning: #f0b45a;
  --warning-soft: #33280f;
  --danger: #f07070;
  --danger-soft: #3a1b1b;
  --focus: #7aa2f2;
  --shadow: none;
}

/* caramiziu: fundal maro-roscat inchis, header caramiziu, accent teracota */
:root[data-theme="caramiziu"] {
  --bg: #1b1311;
  --ink: #f6d9cf;
  --surface: #251a17;
  --surface-2: #30221e;
  --text: #f1e7e3;
  --text-muted: #bda9a2;
  --border: #45302a;
  --border-strong: #5c4037;
  --header: #4a1c13;
  --link: #f6a88d;
  --primary: #e2785a;
  --primary-hover: #ec9478;
  --primary-soft: #4b2920;
  --on-primary: #1a0c08;
  --success: #6fcf8a;
  --success-soft: #18301f;
  --warning: #f2c063;
  --warning-soft: #352a10;
  --danger: #ff8080;
  --danger-soft: #431c1c;
  --focus: #ec9478;
  --shadow: none;
}

/* Temele intunecate: controalele native (campuri, bare de derulare) in varianta intunecata */
:root.theme-dark { color-scheme: dark; }
/* culorile claselor (verzui / gălbui / albăstrui), mai inchise pe fundal intunecat */
:root.theme-dark .chapter-grid--c9, :root.theme-dark .accent-c9 { --ch-accent: #3cc2b3; --ch-soft: #12302d; --ch-ink: #9ee6dc; --ch-line: #1f4a45; }
:root.theme-dark .chapter-grid--c10, :root.theme-dark .accent-c10 { --ch-accent: #e0a94a; --ch-soft: #33270f; --ch-ink: #f3d398; --ch-line: #4d3b17; }
:root.theme-dark .chapter-grid--c11, :root.theme-dark .accent-c11 { --ch-accent: #7aa2f2; --ch-soft: #1b2a47; --ch-ink: #c3d4fa; --ch-line: #2b3f66; }
:root.theme-dark .home-class.home-class--9 { --piece-soft: #12302d; }
:root.theme-dark .home-class.home-class--10 { --piece-soft: #33270f; }
:root.theme-dark .home-class.home-class--11 { --piece-soft: #1b2a47; }
:root.theme-dark .home-exams { --piece: #b58be8; --piece-soft: #2a1f3d; }
:root.theme-dark .site-header .btn-primary { background: var(--primary); color: var(--on-primary); }
:root.theme-dark .quiz-result.is-right { border-color: #2c5a3a; }
:root.theme-dark .quiz-result.is-wrong { border-color: #6b2c2c; }
:root.theme-dark .quiz-attempt.is-right { border-color: #2c5a3a; }
:root.theme-dark .quiz-attempt.is-wrong { border-color: #6b2c2c; }

/* Setari: alegerea temei */
.theme-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .75rem; }
.theme-option { position: relative; display: grid; gap: .45rem; padding: .6rem; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); cursor: pointer; }
.theme-option:hover { border-color: var(--border-strong); }
.theme-option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-swatch { display: grid; grid-template-rows: 14px 1fr; gap: 6px; height: 64px; padding: 0 0 8px; border-radius: 8px; overflow: hidden; background: var(--sw-bg); border: 1px solid rgba(0, 0, 0, .08); }
.theme-swatch-head { background: var(--sw-head); }
.theme-swatch-line { width: 60%; height: 6px; margin-left: 8px; border-radius: 3px; background: color-mix(in srgb, var(--sw-head) 35%, transparent); align-self: start; }
.theme-swatch-btn { width: 36%; height: 12px; margin-left: 8px; border-radius: 4px; background: var(--sw-accent); align-self: end; }
.theme-name { font-weight: 600; }
.theme-submit { margin-top: .9rem; }

/* Temele intunecate: campul de cautare din bara de sus inchis la culoare (textul deschis al temei pe fundal alb
   nu se vedea), evidentierea din rezultate si textul pe fundalurile colorate care devin deschise */
:root.theme-dark { --search-bg: var(--surface-2); --search-bg-focus: var(--surface); --search-ink: var(--text); --search-focus: var(--focus); }
:root.theme-dark .header-search input { box-shadow: inset 0 0 0 1px var(--border-strong); }
:root.theme-dark #search-results mark { background: #7a6210; color: #fff8dc; }
:root.theme-dark .view-toggle a[aria-pressed="true"],
:root.theme-dark .info-btn:hover, :root.theme-dark .info-btn[aria-expanded="true"],
:root.theme-dark .quiz-option:has(input:checked) .quiz-letter,
:root.theme-dark .quiz-class-switch a[aria-current="page"] { color: var(--on-primary); }
:root.theme-dark .quiz-option.is-right .quiz-letter, :root.theme-dark .quiz-option.is-wrong .quiz-letter { color: #10161c; }
:root.theme-dark .status-dot { color: #10161c; }

/* listele de aprobare din Admin folosesc .problem-item, dar nu au aspectul listelor publice (banda, rezumatul):
   pastreaza randul simplu, cu butonul / eticheta "problema ta" in dreapta */
.problem-list.review-list .problem-item {
  display: flex; padding: 1rem 1.25rem; overflow: visible;
  border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: none;
}
.problem-list.review-list .problem-item:hover { border-color: var(--border); border-left-color: var(--primary); box-shadow: none; }
.problem-list.review-list .badge { display: inline-block; flex: none; }
.problem-list.review-list .btn { flex: none; }
.problem-list.review-list .problem-meta { margin: 0; }

/* alegerea limbajului deasupra editorului (C/C++ / Python) */
.language-choice { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.language-choice label { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; background: var(--surface); }
.language-choice label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--ink, var(--text)); font-weight: 600; }
.language-choice input { margin: 0; accent-color: var(--primary); }

/* rezultatul pe teste: separator intre grupurile de coloane Timp / Memorie */
.results .group-start { border-left: 1px solid var(--border); }
.results thead tr:first-child th[colspan] { text-align: center; }

/* eticheta "Python" (problemele care accepta si Python) si nota filtrului din setari */
.lang-pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.5;
  background: #fff4cc; color: #6b4e00; border: 1px solid #f0d77a; white-space: nowrap; }
:root.theme-dark .lang-pill { background: #3a3010; color: #f5dc8a; border-color: #6b5718; }
.lang-pill-no { background: var(--surface-2); color: var(--text-muted); border-color: var(--border-strong); text-decoration: line-through; text-decoration-thickness: 2px; }
:root.theme-dark .lang-pill-no { background: var(--surface-2); color: var(--text-muted); border-color: var(--border-strong); }
.filter-note { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: 0 0 1rem; padding: .5rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.choice-list { display: grid; gap: .5rem; }
.choice-list label { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.choice-list label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice-list input { margin-top: .3rem; accent-color: var(--primary); }

/* Setari > Interfata: previzualizarea barei de sus + alegerea Sus / In meniu pentru fiecare buton */
.nav-preview { display: flex; align-items: center; gap: .35rem; padding: .5rem .75rem; border-radius: var(--radius-sm); background: var(--header); color: var(--on-header); font-size: .85rem; min-height: 2.4rem; overflow: hidden; }
.nav-preview-logo { font-weight: 700; letter-spacing: .04em; margin-right: .5rem; }
.nav-preview-item { padding: .15rem .55rem; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .14); }
.nav-preview-item[hidden] { display: none; }
.nav-preview-account { margin-left: auto; display: flex; }
.nav-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .5rem; }
.nav-choice { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.nav-choice legend { float: left; padding: 0; font-weight: 600; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: .25rem .7rem; font-size: .85rem; white-space: nowrap; }
.segmented label + label { border-left: 1px solid var(--border); }
.segmented input:checked + span { background: var(--primary); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }

/* generarea iesirilor: starea (se genereaza / gata); .spinner e definit mai sus */
.generation-status { display: flex; align-items: center; gap: .6rem; margin: .5rem 0 0; padding: .5rem .75rem;
  border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--text); }
.generation-status.is-done { background: var(--success-soft); color: var(--success); font-weight: 600; }
.generation-status .spinner { flex: none; }
.test-edit.is-generated > summary { background: var(--success-soft); }

/* limbajul grilei (C/C++ / Python), langa tipul ei */
.quiz-chip--lang { background: #fff4cc; color: #6b4e00; border-color: #f0d77a; font-weight: 600; }
:root.theme-dark .quiz-chip--lang { background: #3a3010; color: #f5dc8a; border-color: #6b5718; }

/* Modul "creare tema" (assets/js/homework.js): butonul "+ temă", eticheta "7/10" si cosul din dreapta jos */
.hw-slot { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: .35rem; vertical-align: middle; }
.hw-slot:empty { display: none; }
.hw-add { border: 1px solid var(--primary); background: var(--surface); color: var(--primary); font-weight: 600; white-space: nowrap; }
.hw-add:hover { background: var(--primary-soft); }
.hw-add.is-on { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.hw-info { margin-left: 0; height: auto; }
.info-btn.hw-count {
  width: auto; height: auto; min-width: 2.6rem; padding: .1rem .45rem; border-radius: 999px;
  font: 600 .78rem/1.3 inherit; font-family: inherit; font-style: normal;
}
.info-btn.hw-count.is-done { border-color: var(--success); color: var(--success); }
.info-btn.hw-count.is-done:hover, .info-btn.hw-count.is-done[aria-expanded="true"] { background: var(--success); color: #fff; }
.hw-pop { width: 18rem; text-align: left; font-weight: 400; }
/* cosul (colectia activa), in dreapta jos; destul de sus incat sa nu acopere linkurile din subsol */
.hw-cart {
  position: fixed; right: 1rem; bottom: 5.5rem; z-index: 50; display: inline-flex; align-items: center; gap: .6rem;
  max-width: min(22rem, calc(100vw - 2rem)); padding: .45rem 1rem .45rem .55rem; border-radius: 1.25rem;
  background: var(--primary); color: #fff; text-decoration: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.hw-cart:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
.hw-cart-icon { flex: none; width: 40px; height: 40px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.hw-cart-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.hw-cart-line { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.hw-cart-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-cart-class { font-size: .8rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-cart-count { flex: none; display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: #fff; color: var(--primary); font-size: .8rem; font-weight: 700;
  line-height: 1; padding-top: .12em; }   /* cifrele fontului stau putin sus: le coboram in cerc */
.hw-matrix td, .hw-matrix th { text-align: center; }
.hw-matrix th[scope="row"] { text-align: left; }
.hw-matrix .hw-done { color: var(--success); font-weight: 700; }
.hw-matrix .hw-left { font-weight: 600; white-space: nowrap; }
.hw-remove { padding: 0 .3rem; }
@media print { .hw-cart, .hw-slot { display: none !important; } }
.info-btn.hw-id {
  width: auto; height: auto; padding: .1rem .45rem; border-radius: 999px;
  font: 700 .85rem/1.3 inherit; font-family: inherit; font-style: normal;
}
/* grilele din teme (G#ID): alta culoare decat problemele */
.info-btn.hw-id--quiz { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.hw-problem-pop { width: 20rem; left: 50%; right: auto; transform: translateX(-50%); white-space: normal; text-align: left; font-weight: 400; }
.hw-problem-pop::before { left: calc(50% - .35rem); right: auto; }
.hw-pop-title { display: block; margin-bottom: .3rem; font-size: .9rem; }
.hw-pop-abstract { display: block; margin-bottom: .5rem; }
.hw-pop-go { background: #fff; color: var(--primary); border: 1px solid #fff; }
.hw-pop-go:hover { background: var(--primary-soft); color: var(--primary); }
.hw-matrix thead th { position: relative; }
.hw-pop-meta { display: block; margin-bottom: .5rem; font-size: .78rem; opacity: .85; }
.hw-pop.is-fixed { position: fixed; transform: none; }
.hw-pop.is-fixed::before { left: var(--hw-arrow-left, 50%); right: auto; }
.hw-group { display: block; padding: .4rem 0; }
.hw-group:first-child { padding-top: 0; }
.hw-group:last-child { padding-bottom: 0; }
.hw-group + .hw-group { border-top: 1px dashed rgba(255, 255, 255, .45); }

/* Pagina clasei: temele din ultimele saptamani, cate un card pe tema (#ID si cati elevi au rezolvat-o) */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.weeks-form { align-items: center; gap: .4rem; }
.weeks-form .weeks-input { width: 5.5rem; min-width: 0; max-width: 5.5rem; flex: 0 0 5.5rem; }
.assignment-cards { display: grid; gap: .75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .assignment-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .assignment-cards { grid-template-columns: 1fr; } }
.assignment-card { padding: .75rem .9rem; font-size: .9rem; }
.assignment-card h3 { font-size: .92rem; }
.assignment-problems { gap: .35rem; }
.assignment-problems li { padding: .15rem .45rem; font-size: .85rem; }
.assignment-card h3 { margin: 0 0 .6rem; }
.assignment-problems { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.assignment-problems li { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .5rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.assignment-id { font-weight: 700; text-decoration: none; }
.assignment-score { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--warning); }
.assignment-score.is-done { color: var(--success); }
a.assignment-score { text-decoration: none; border-radius: 4px; padding: 0 .15rem; }
a.assignment-score:hover, a.assignment-score:focus-visible { text-decoration: underline; background: var(--surface-2); }
.assignment-card { display: flex; flex-direction: column; height: 100%; }
.assignment-actions { margin: auto 0 0; padding-top: .75rem; }
.hw-matrix th .assignment-score { font-size: .85rem; }
/* antetul unei probleme: #ID deasupra, scorul (rezolvat/primit) dedesubt - coloane inguste */
.hw-col-head { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.hw-matrix th, .hw-matrix td { padding: .5rem .55rem; }
.hw-matrix th[scope="row"] { padding-right: .9rem; }
.assignment-card h3 { margin-bottom: .15rem; }
.assignment-meta { margin: 0 0 .6rem; }

/* Clasa (profesor): coloana „Notă” din tabelul elevilor, cu formularul de calcul in fereastra butonului „i” */
.grade-col { white-space: nowrap; }
.grade-col .info { margin-left: .2rem; }
.grade-pop { width: 19rem; font-weight: 400; text-align: left; white-space: normal; }
.grade-pop-text { display: block; margin-bottom: .6rem; }
.grade-form { display: grid; gap: .45rem; justify-items: start; }
.grade-form label { display: flex; align-items: center; gap: .45rem; color: #fff; font-weight: 400; margin: 0; }
.grade-form input[type="number"] { width: 5.5rem; padding: .2rem .4rem; }
.grade-form input[type="checkbox"] { flex: none; width: 1rem; height: 1rem; margin: 0; }
.grade-form .btn { margin-top: .2rem; }
/* tabelul se poate derula orizontal; cat timp fereastra e deschisa nu o taiem */
.table-wrap:has(.grade-pop:not([hidden])), .table:has(.grade-pop:not([hidden])) { overflow: visible; }
.grade-cell { white-space: nowrap; }
.grade-flag { color: var(--danger); font-weight: 700; cursor: help; }
/* nota se apasa: tabelul cu justificarea ei (problema cu problema) */
.grade-link { text-decoration: none; color: inherit; border-bottom: 1px dashed currentColor; }
.grade-link:hover, .grade-link:focus-visible { color: var(--primary); }
.grade-cell.is-selected { background: var(--surface-2); }
.grade-detail { margin-top: 1rem; scroll-margin-top: 5rem; }
.grade-detail .section-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.grade-detail h3 { margin: 0; }
.grade-detail-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grade-detail-table tr.is-excluded td { opacity: .6; }
.grade-detail-table tr.is-zeroed td.grade-why { color: var(--danger); }
.grade-detail-table tfoot th, .grade-detail-table tfoot td { border-top: 2px solid var(--border); font-weight: 400; }
.grade-detail-table td:nth-child(3) { white-space: nowrap; }
/* „Exclude ultimele N zile” din fereastra notei */
.grade-form .grade-exclude { display: flex; align-items: center; gap: .45rem; color: #fff; }
.grade-form .grade-exclude input[type="number"] { width: 4.5rem; padding: .2rem .4rem; }
.grade-form .grade-exclude input[type="checkbox"] { flex: none; width: 1rem; height: 1rem; margin: 0; }
/* tabelul elevilor: redenumeste / scoate ca iconite, lipite de marginea din dreapta */
.table td.row-icons { width: 1%; padding-right: .35rem; padding-left: .25rem; text-align: right; white-space: nowrap; }
.row-icons form { display: inline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; vertical-align: middle; }
.icon-btn svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover, .icon-btn:focus-visible { color: var(--primary); background: var(--surface-2); }
.icon-btn--danger:hover, .icon-btn--danger:focus-visible { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ============================================================================================
   Pagina de start (/): vizitatori (home/visitor.php) si utilizatori autentificati (home/user.php)
   ============================================================================================ */
.home-section { margin-top: 2.75rem; }
.home-section > .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.home-section > .section-head h2 { margin: 0; }
.home-section > .section-head a { font-weight: 600; }

/* --- Antetul (vizitatori): text + demonstratia evaluarii --- */
.home-hero {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2.5rem; align-items: center;
  padding: 2.5rem; border-radius: 20px; border: 2px solid var(--border-strong);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--primary) 14%, transparent) 0, transparent 55%),
    radial-gradient(circle at 0% 100%, color-mix(in srgb, var(--accent) 12%, transparent) 0, transparent 50%),
    var(--surface);
  box-shadow: var(--shadow);
}
.home-eyebrow { margin: 0 0 .6rem; font-size: .85rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.home-hero h1 { margin: 0 0 1rem; font-size: clamp(2rem, 1.3rem + 2.6vw, 3.2rem); font-weight: 700; line-height: 1.1; color: var(--ink); }
.home-hero h1 span { display: block; color: var(--primary); }
.home-lead { font-size: 1.15rem; line-height: 1.6; margin: 0 0 1.5rem; max-width: 36rem; }
.home-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.home-hint { margin: 1rem 0 0; color: var(--text-muted); font-size: .95rem; }

.home-demo { position: relative; padding: 0 0 2.5rem 0; }
.home-demo-window {
  border-radius: 12px; overflow: hidden; background: #0f1b2a; color: #d8e3ee; box-shadow: 0 24px 48px -20px rgba(8, 30, 60, .55);
  transform: rotate(-1.2deg);
}
.home-demo-bar { display: flex; align-items: center; gap: .4rem; padding: .6rem .85rem; background: #17263a; }
.home-demo-bar span { width: .7rem; height: .7rem; border-radius: 50%; background: #ff6b6b; }
.home-demo-bar span:nth-child(2) { background: #ffc94a; }
.home-demo-bar span:nth-child(3) { background: #47d18c; }
.home-demo-tabs { display: flex; gap: .25rem; margin-left: .6rem; min-width: 0; }
.home-demo-tab {
  padding: .2rem .6rem; border: 0; border-radius: 6px; background: none; cursor: pointer;
  font: .8rem var(--mono); color: #8ea4bb; white-space: nowrap;
}
.home-demo-tab:hover { color: #d8e3ee; }
.home-demo-tab[aria-selected="true"] { background: #0f1b2a; color: #fff; }
.home-demo-tab:focus-visible { outline: 2px solid #82aaff; outline-offset: 1px; }
.home-demo-panes { display: grid; }
.home-demo-panes > .home-demo-code { grid-area: 1 / 1; }
.home-demo-code.is-off { visibility: hidden; }
.home-demo-lang { font-weight: 400; color: var(--text-muted); }
.home-hint-python { margin-top: 1.1rem; }
.home-hint-python + .home-hint { margin-top: .35rem; }
.home-demo-code { margin: 0; padding: 1rem 1.2rem 1.3rem; font: .88rem/1.55 var(--mono); background: none; border: 0; color: inherit; overflow: hidden; white-space: pre; }
.home-demo-code i { font-style: normal; }
.home-demo-code .k { color: #c792ea; } .home-demo-code .t { color: #82aaff; } .home-demo-code .s { color: #c3e88d; } .home-demo-code .n { color: #f78c6c; } .home-demo-code .c { color: #6f8499; }
.home-demo-result {
  position: absolute; right: -.5rem; bottom: 0; width: min(15rem, 70%); padding: .9rem 1.1rem;
  background: var(--surface); color: var(--text); border: 2px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 18px 36px -16px rgba(8, 30, 60, .45); transform: rotate(1.5deg);
}
.home-demo-title { margin: 0 0 .4rem; font-weight: 700; color: var(--ink); }
.home-demo-tests { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; font-size: .9rem; }
.home-demo-tests li { display: flex; align-items: center; gap: .45rem; opacity: 0; animation: home-test-in .35s ease forwards; animation-delay: calc(.6s + var(--i) * .35s); }
.home-demo-tests li .muted { margin-left: auto; font-variant-numeric: tabular-nums; }
.home-demo-ok { display: grid; place-items: center; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--success); color: #fff; font-size: .7rem; font-weight: 700; }
.home-demo-score { margin: .55rem 0 0; padding-top: .5rem; border-top: 1px solid var(--border); color: var(--success); opacity: 0; animation: home-test-in .4s ease forwards 2.6s; }
.home-demo-score strong { font-size: 1.6rem; }
@keyframes home-test-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* --- Cifrele site-ului --- */
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.home-stats div { padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.home-stats strong { display: block; font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.home-stats span { color: var(--text-muted); font-size: .95rem; }

/* --- Cum functioneaza --- */
.home-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.home-steps li { display: flex; gap: .9rem; align-items: flex-start; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.home-steps strong { display: block; margin-bottom: .2rem; color: var(--ink); font-size: 1.05rem; }
.home-steps div > span { color: var(--text-muted); }
.home-step-no { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 700; }

/* --- Clasele, compact: piesa in stanga, textul in dreapta --- */
.home-classes--compact { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; padding: 0; }
.home-classes--compact .home-class { flex-direction: row; justify-content: flex-start; gap: 1.1rem; min-height: 0; padding: 1.1rem 1.3rem; text-align: left; border-radius: 14px; }
.home-classes--compact .home-class:hover, .home-classes--compact .home-class:focus-visible { transform: translateY(-4px); }
.home-classes--compact .home-class-piece { flex: none; width: 76px; height: 76px; margin: 0; }
.home-classes--compact .home-class-body { display: grid; gap: .2rem; min-width: 0; flex: 1; }
.home-classes--compact .home-class-title { font-size: 1.4rem; }
.home-classes--compact .home-class-count { font-size: 1rem; }
.home-classes--compact .home-class-progress { width: 100%; margin-top: .3rem; }

/* --- Pentru cine --- */
.home-audience { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.home-aud { --aud: var(--primary); display: flex; flex-direction: column; padding: 1.4rem 1.4rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--aud); border-radius: var(--radius); }
.home-aud--teachers { --aud: var(--accent); }
.home-aud--quizzes { --aud: var(--success); }
.home-aud h3 { margin: 0 0 .7rem; font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.home-aud ul { margin: 0 0 1.1rem; padding: 0; list-style: none; display: grid; gap: .5rem; flex: 1; align-content: start; }
.home-aud li { position: relative; padding-left: 1.5rem; }
.home-aud li::before { content: "✓"; position: absolute; left: 0; top: 0; font-weight: 700; color: var(--aud); }
.home-aud .btn { align-self: flex-start; }

/* --- Indemnul de la final --- */
.home-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  margin-top: 3rem; padding: 1.75rem 2rem; border-radius: 16px; background: var(--header); color: var(--on-header);
}
.home-cta h2 { margin: 0 0 .3rem; color: inherit; font-weight: 700; }
.home-cta p { margin: 0; opacity: .9; }
.home-cta .btn-ghost { color: var(--on-header); border-color: color-mix(in srgb, var(--on-header) 60%, transparent); background: transparent; }
.home-cta .btn-ghost:hover { border-color: var(--on-header); color: var(--on-header); }
.home-cta .btn-primary { background: var(--on-header); color: var(--header); border-color: var(--on-header); }

/* --- Utilizator autentificat: salutul --- */
.home-welcome { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; padding: 1.4rem 1.6rem; background: var(--surface); border: 2px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); }
.home-welcome-text { flex: 1; min-width: 14rem; }
.home-welcome h1 { margin: 0 0 .2rem; font-weight: 700; color: var(--ink); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.home-welcome p { margin: 0; }
.home-welcome-stats { display: flex; gap: .75rem; }
.home-mini-stat { display: grid; justify-items: center; min-width: 6.5rem; padding: .55rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--surface-2); }
.home-mini-stat:hover { text-decoration: none; border-color: var(--primary); }
.home-mini-stat strong { display: flex; align-items: center; gap: .3rem; font-size: 1.35rem; color: var(--ink); }
.home-mini-stat span { font-size: .85rem; color: var(--text-muted); }

/* --- Temele elevului, clasele profesorului --- */
.home-hw-grid, .home-tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.home-hw h3, .home-tc h3 { margin: 0 0 .6rem; font-size: 1.15rem; font-weight: 700; }
.home-hw-item + .home-hw-item { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.home-hw-meta { display: flex; justify-content: space-between; gap: .75rem; margin: 0 0 .5rem; font-size: .9rem; color: var(--text-muted); }
.home-hw-count { font-weight: 700; color: var(--warning); white-space: nowrap; }
.home-hw-count.is-done { color: var(--success); }
.home-hw-problems { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.home-hw-problems li { display: flex; align-items: center; gap: .6rem; padding: .4rem .6rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.home-hw-problems li a, .home-hw-problems li > span:first-child { flex: 1; min-width: 0; }
.home-hw-problems li.is-solved a { color: var(--text-muted); }
.home-hw-problems .status-dot, .home-continue .status-dot { margin-left: 0; flex: none; }
.home-hw-item.is-done .home-hw-problems { display: none; }   /* tema rezolvata integral: doar randul cu 7/7 */
.status-dot--none { background: transparent; border: 2px solid var(--border-strong); min-width: 22px; height: 22px; }

.home-tc-last { margin: .4rem 0 .5rem; font-size: .95rem; }
.home-tc-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem; }
.home-tc-actions { display: flex; gap: .5rem; margin: .9rem 0 0; }

/* --- Continua + problema zilei, alaturate --- */
.home-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 0 1.5rem; align-items: start; }
.home-continue { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.home-continue li { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.home-continue li:hover { border-color: var(--primary); }
.home-continue a { flex: 1; min-width: 0; display: grid; gap: .15rem; color: var(--text); }
.home-continue a:hover { text-decoration: none; }
.home-continue-title { font-weight: 600; color: var(--link); }

.home-daily { display: grid; gap: .55rem; padding: 1.2rem 1.3rem; color: var(--text); border-left: 5px solid var(--ch-accent, var(--primary)); transition: transform .2s ease; }
.home-daily:hover { text-decoration: none; transform: translateY(-2px); color: var(--text); }
.home-daily-where { font-size: .85rem; font-weight: 600; color: var(--ch-ink, var(--text-muted)); }
.home-daily-title { font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.home-daily-abstract { color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.home-daily-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-top: .2rem; }
.home-daily-cta { font-weight: 700; color: var(--primary); }

/* --- Ecrane inguste --- */
@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; padding: 1.75rem 1.4rem; gap: 1.5rem; }
  .home-demo { max-width: 32rem; }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-steps, .home-audience { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .home-hero { padding: 1.4rem 1rem; }
  .home-demo-code { font-size: .78rem; padding: .8rem .9rem 1rem; }
  .home-demo-result { right: 0; width: 72%; }
  .home-actions .btn { flex: 1 1 auto; text-align: center; }
  .home-welcome { padding: 1.1rem; }
  .home-welcome-stats { width: 100%; }
  .home-mini-stat { flex: 1; }
  .home-cta { padding: 1.4rem 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .home-demo-tests li, .home-demo-score { animation: none; opacity: 1; }
}

/* ---- Semnalarile "posibil greșită" (partials/report_form, admin/index) ---- */
.report { margin-top: .9rem; font-size: .88rem; }
.report summary { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; color: var(--text-muted); list-style: none; }
.report summary::-webkit-details-marker { display: none; }
.report summary:hover, .report details[open] summary { color: var(--danger); text-decoration: underline; }
.report-form { display: grid; gap: .45rem; margin-top: .6rem; }
.report-form label { font-weight: 600; color: var(--ink); }
.report-form textarea { width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); resize: vertical; }
.report-form .hint { margin: 0; }
.report-form .btn { justify-self: start; }
.report-thanks { margin: 0; color: var(--success); font-weight: 600; }
/* in caseta cu detaliile problemei: aceeasi margine ca randurile ei, separat de ele printr-o linie */
.facts-card > .report { margin: 0; padding: 10px 20px 14px; border-top: 1px solid var(--border); }
.report-admin-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.report-admin-head { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.report-admin-head h3 { margin: 0 0 .2rem; font-size: 1.05rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.report-admin-head p { margin: 0; }
.report-reasons { list-style: none; padding: 0; margin: .7rem 0 0; display: grid; gap: .6rem; }
.report-reasons li { border-left: 3px solid var(--warning); padding: .1rem 0 .1rem .7rem; }
.report-reasons p { margin: 0; }
.report-reason { white-space: normal; overflow-wrap: anywhere; }

/* Colectiile de probleme: cardul de pe pagina subcapitolului (profesori), "Colecțiile mele", Admin */
.collections-card { margin-bottom: 1.5rem; }
.collections-card > .hint { margin-bottom: .75rem; }
/* randul de butoane (cate unul pe colectie) si panoul colectiei alese, sub el */
.collection-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.collection-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .75rem .3rem .35rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; }
.collection-chip:hover { border-color: var(--primary); }
.collection-chip[aria-expanded="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.collection-chip-icon { width: 22px; height: 22px; flex: 0 0 auto; }
.collection-official-icon { display: inline-grid; place-items: center; border-radius: 50%; background: #000; box-shadow: 0 0 0 1px var(--border); }
.collection-official-icon img { display: block; width: 13px; height: 13px; }
.collection-chip-title { font-weight: 600; }
.collection-chip-count { min-width: 1.4em; padding: 0 .35rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: .8rem; text-align: center; }
.collection-panel { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--border); }
.collection-panel > p { margin: 0 0 .5rem; }
.collection-problems { margin: 0 0 .75rem; padding-left: .2rem; list-style-position: inside; }
.collection-problems li { margin: .2rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collection-abstract { color: var(--text-muted); font-size: .88rem; margin-left: .35rem; }
.collection-abstract::before { content: "– "; }
.collection-assign { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.collection-assign select { min-width: 8rem; }
.collections-mine { display: grid; gap: 1rem; margin-top: 1.25rem; }
.collection-mine .card-title { margin-bottom: .4rem; }
.collection-mine > p { margin: 0 0 .5rem; }
.collection-edit summary { cursor: pointer; color: var(--text-muted); font-size: .9rem; }
.collection-edit-form { display: grid; gap: .75rem; margin: .75rem 0 .5rem; max-width: 36rem; }
.collection-edit-form .solve-actions { margin: 0; }
.collection-delete { margin-bottom: .5rem; }
.assignment-collection { margin: -.25rem 0 .5rem; }
.hw-cart-collection { margin: 0 0 1rem; }
.hw-save-collection { margin-top: 1.5rem; }
.hw-save-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.hw-save-row input { flex: 1 1 16rem; min-width: 0; }
/* colectia in lucru (/colectie): clasa urmarita, compararea claselor, elevii bifati, actiunile */
.hw-class-card, .hw-load-card { margin-bottom: 1rem; }
.hw-load-card .hw-save-row { margin-top: 0; }
.hw-load-card select { flex: 1 1 16rem; min-width: 0; }
.hw-class-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.hw-class-row .field { margin: 0; flex: 0 1 22rem; }
.hw-compare { margin-top: .75rem; }
.hw-compare th[scope="row"] { font-weight: 500; max-width: 22rem; }
.hw-compare th .hw-compare-n { display: block; font-weight: 400; }
.hw-compare td.num { text-align: center; }
.hw-compare-total th, .hw-compare-total td { font-weight: 700; border-top: 2px solid var(--border); }
.hw-pick { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; }
.hw-matrix tr.hw-unpicked th, .hw-matrix tr.hw-unpicked td { opacity: .45; }
.hw-matrix thead th:first-child .btn { margin-left: .25rem; }
.hw-matrix-students th { text-align: left; }
.hw-actions { margin-top: 1.25rem; }
.hw-actions .solve-actions { margin-top: .25rem; }
.hw-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.hw-inline-form { display: contents; }
.hw-save-inline { display: flex; flex: 1 1 22rem; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; }
.hw-save-inline[hidden] { display: none; }
.hw-save-inline input { flex: 1 1 12rem; min-width: 0; }
/* butoanele si campul cu numele au aceeasi inaltime: randul nu se mareste cand apare campul */
.hw-actions-row .btn, .hw-save-inline input { box-sizing: border-box; height: 2.5rem; }
.hw-save-inline input { padding-top: 0; padding-bottom: 0; }
.hw-actions-row [data-hw-save-toggle][aria-expanded="true"] { background: var(--primary-hover); }
/* inputurile ascunse ale formularului (span gol) ar fi un element flex in plus: butoanele s-ar muta spre dreapta */
.hw-actions [data-hw-cart-inputs] { display: none; }
.hw-actions [data-hw-actions-hint] { margin-top: .75rem; }
.hw-actions h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.hw-actions .btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.hw-cart-none { text-align: center; }
.hw-cart-none .btn { margin: .25rem; }
.class-hw-actions { flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.class-hw-actions .btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.class-hw-msg { flex: 1 0 100%; margin: .25rem 0 0; text-align: right; }
.collections-intro { margin: 0 0 1.25rem; }
/* solutiile clasei la o problema: elevul si punctajul cat le trebuie, restul pentru solutiile trimise */
.class-solutions th:nth-child(1), .class-solutions td:nth-child(1),
.class-solutions th:nth-child(2), .class-solutions td:nth-child(2) { width: 1%; white-space: nowrap; padding-right: 2.5rem; }
.collections-intro p { margin: 0; }
.collections-intro ul { margin: .5rem 0 0; padding-left: 1.25rem; }
.collections-more summary { display: inline-block; cursor: pointer; color: var(--primary); font-size: .9rem; margin-top: .35rem; list-style: none; }
.collections-more summary::-webkit-details-marker { display: none; }
.collections-more summary:hover { text-decoration: underline; }
.collections-more .when-open, .collections-more[open] .when-closed { display: none; }
.collections-more[open] .when-open { display: inline; }
.collections-intro li + li { margin-top: .35rem; }
.collection-chip.is-active { border-color: var(--success); }
.collection-chip .collection-active-badge { font-size: .7rem; padding: .05rem .45rem; }
.collection-active-badge[hidden] { display: none; }   /* .badge are display: inline-block, care ar anula hidden */
.collections-mine-card .collection-chips { margin-top: 0; }
/* fara iconita in stanga (ca pe pagina subcapitolului): spatiu egal stanga / dreapta */
.collections-mine-card .collection-chip { padding-left: .85rem; padding-right: .7rem; }
.collections-pick-hint { margin-top: .75rem; }
.collections-mine-card:has(.collection-panel:not([hidden])) .collections-pick-hint { display: none; }
.collection-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .5rem; }
.collection-panel-head .card-title { margin: 0; }
.collections-admin-table td { vertical-align: top; }
.collections-admin-table .badge { margin: 0 .25rem .25rem 0; display: inline-block; }
.collections-matrix th.collection-col { white-space: normal; vertical-align: top; min-width: 11rem; text-align: left; }
.collections-matrix .collection-col input[type="text"], .collections-matrix .collection-col textarea { width: 100%; font-weight: 400; margin-bottom: .35rem; }
.collections-matrix .collection-col.is-new { opacity: .85; }
.collection-flag { display: block; font-weight: 400; font-size: .85rem; }
.collection-flag.is-danger { color: var(--danger); }
.collections-matrix th.collection-problem { white-space: normal; min-width: 14rem; font-weight: 400; }
.collections-matrix input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
.collections-regenerate { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 2rem; }
/* eticheta calendarului activitatii (assets/js/app.js, data-tip) */
.heatmap-tip { position: fixed; z-index: 50; padding: .3rem .55rem; border-radius: 6px; background: var(--header); color: #fff;
  font-size: .8rem; line-height: 1.3; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.heatmap-tip[hidden] { display: none; }
/* temele intunecate: eticheta deschisa la culoare (cea in culoarea antetului s-ar pierde pe fundalul paginii) */
:root.theme-dark .heatmap-tip { background: var(--text); color: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }

/* --- Teste cu timp limitat (pagina testului, rezultatele, formularul) --------------------------------------- */
.exam-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .6rem 1.5rem; margin: 0 0 1rem; }
.exam-facts dt { font-size: .8rem; color: var(--text-muted); }
.exam-facts dd { margin: 0; font-weight: 500; }
.exam-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.exam-actions form { margin: 0; }
.exam-rules { margin: 0 0 1.2rem; padding-left: 1.2rem; }
.exam-rules li { margin-bottom: .3rem; }
.exam-time-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 1rem; }
.exam-form fieldset { margin-bottom: 1rem; }
.exam-form .check { display: flex; gap: .45rem; align-items: baseline; margin: .25rem 0; }
.exam-items .points-input { width: 5.5rem; }
.narrow-input { max-width: 8rem; }
.field-label { display: block; font-weight: 600; margin-bottom: .3rem; }
.exam-draft-list { display: grid; gap: .2rem; max-height: 18rem; overflow-y: auto; padding: .3rem 0; }
/* bara de sus cu cronometrul: ramane vizibila la derulare */
.exam-bar {
  /* sub bara site-ului (si ea lipita sus), nu peste ea */
  position: sticky; top: calc(var(--header-h, 4rem) + .5rem); z-index: 9; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center;
  margin: 0 0 1rem; padding: .6rem 1rem; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.exam-bar form { margin: 0 0 0 auto; }
.exam-bar-title { font-weight: 700; color: var(--ink); }
.exam-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.15rem; padding: .1rem .6rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.exam-bar.is-warning .exam-timer { background: var(--warning-soft); color: var(--warning); }
.exam-bar.is-danger .exam-timer { background: var(--danger-soft); color: var(--danger); animation: exam-blink 1s step-end infinite; }
@keyframes exam-blink { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .exam-bar.is-danger .exam-timer { animation: none; } }
.exam-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.exam-nav-link {
  display: inline-flex; align-items: baseline; gap: .15rem; min-width: 2.6rem; justify-content: center; padding: .3rem .6rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-weight: 700; text-decoration: none;
}
.exam-nav-link small { font-weight: 500; color: var(--text-muted); font-size: .7rem; }
.exam-nav-link:hover { background: var(--surface-2); }
.exam-item { margin-bottom: 1.2rem; scroll-margin-top: 5rem; }
.exam-item-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .8rem; }
.exam-item-head h2 { margin: 0; font-size: 1.25rem; }
.exam-item-head .points { margin-left: auto; }
.exam-item-no { color: var(--text-muted); }
.exam-limits { margin-top: .5rem; }
.exam-form-msg { font-weight: 500; }
.exam-form-msg.is-ok { color: var(--success); }
.exam-form-msg.is-error { color: var(--danger); }
.exam-work { margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--border-strong); }
.exam-work-head { margin: 0 0 .5rem; }
.exam-submissions { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.exam-submissions > li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; padding: .4rem .7rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.exam-submissions details { flex-basis: 100%; }
.exam-submissions summary { cursor: pointer; font-size: .85rem; color: var(--link); }
.exam-verdict-list { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .85rem; }
.exam-verdict-list .is-ok { color: var(--success); }
.exam-verdict-list .is-bad { color: var(--danger); }
.exam-source pre { max-height: 24rem; overflow: auto; margin: .4rem 0 0; padding: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; }
.exam-options.is-readonly .quiz-option, .exam-options .quiz-option { display: flex; gap: .6rem; align-items: baseline; }
.exam-options .quiz-option label { display: flex; gap: .6rem; align-items: baseline; flex: 1; cursor: pointer; }
.exam-options .quiz-option.is-chosen { border-color: var(--primary); background: var(--primary-soft); }
.exam-options .quiz-option.is-correct { border-color: var(--success); background: var(--success-soft); }
.exam-options { list-style: none; margin: 0 0 1rem; }
.exam-answer { margin-top: .6rem; padding: .5rem .8rem; background: var(--success-soft); border-radius: var(--radius-sm); }
.exam-answer p { margin: 0 0 .3rem; }
.exam-grade { font-size: 1.1rem; }
.exam-grade-value { font-size: 1.4rem; color: var(--ink); }
.exam-statement > summary { cursor: pointer; color: var(--link); margin-bottom: .5rem; }
.exam-results .student-name { white-space: nowrap; }
.exam-table td, .exam-table th { vertical-align: middle; }
.exam-points-confirm { margin-top: .8rem; padding: .6rem .9rem; border-radius: var(--radius-sm); background: var(--warning-soft); }
.exam-points-confirm p { margin: 0 0 .4rem; }
.exam-points-confirm.has-error { outline: 2px solid var(--danger); }
/* radio-urile si bifele dintr-un .field nu se intind pe toata latimea (ca celelalte campuri) */
.field input[type="radio"], .field input[type="checkbox"] { width: auto; }
/* regulile testului: un rand per regula, textul in stanga, alegerea in dreapta */
.exam-rules-grid { display: grid; }
.exam-rule {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem 1.5rem; align-items: center;
  margin: 0; padding: .8rem 0; border: 0; border-top: 1px solid var(--border); min-width: 0;
}
.exam-rule:first-child { border-top: 0; padding-top: .2rem; }
.exam-rule-title { display: block; padding: 0; font-weight: 600; float: none; }
.exam-rule-text .hint { margin: .15rem 0 0; }
.exam-pills { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.exam-pill { position: relative; cursor: pointer; }
.exam-pill input { position: absolute; opacity: 0; pointer-events: none; }
.exam-pill span {
  display: inline-block; padding: .35rem .8rem; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); font-size: .9rem; white-space: nowrap; transition: background .12s, border-color .12s;
}
.exam-pill:hover span { background: var(--surface-2); }
.exam-pill input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.exam-pill input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.exam-switch { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-weight: 500; white-space: nowrap; }
.exam-switch input { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); }
@media (max-width: 700px) {
  .exam-rule { grid-template-columns: 1fr; }
  .exam-pills { justify-content: flex-start; }
}
/* supravegherea testelor */
.exam-subtitle { margin: 1.2rem 0 .4rem; font-size: 1.05rem; }
.exam-security-note { margin-top: .6rem; }
.exam-warning {
  position: sticky; top: calc(var(--header-h, 4rem) + 4.7rem); z-index: 8; margin: -.5rem 0 1rem; padding: .6rem 1rem; border-radius: var(--radius-sm);
  background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning); font-weight: 500;
}
.exam-locked { border-color: var(--danger); }
.exam-locked h2 { color: var(--danger); margin-top: 0; }
.exam-fullscreen-gate {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: var(--bg);   /* opac: fara ecran complet, exercitiile nu se vad */
}
.exam-fullscreen-gate[hidden] { display: none; }
.exam-fullscreen-gate .card { max-width: 32rem; text-align: center; }
.exam-monitor-cell .badge { margin: 0 .2rem .2rem 0; }
.exam-monitor-cell .inline-form { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
.exam-events { margin-top: .8rem; }
.exam-events summary { cursor: pointer; color: var(--link); }
.exam-events ol { margin: .5rem 0 0; padding-left: 1.3rem; font-size: .9rem; }
.exam-event--locked, .exam-event--finished, .exam-event--paste_blocked, .exam-event--other_device { color: var(--danger); }
.exam-replay { margin-top: .8rem; }
.exam-replay-controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.exam-replay-controls input[type="range"] { flex: 1; min-width: 12rem; }
.exam-replay-controls .is-jump { color: var(--danger); font-weight: 600; }
.exam-replay-code {
  max-height: 26rem; overflow: auto; margin: 0; padding: .7rem; font-size: .85rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); white-space: pre;
}
.header-exam { margin-left: auto; color: var(--on-header); opacity: .9; font-weight: 500; }
.exam-start { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.exam-start label { font-weight: 600; }
.exam-code-input { font-family: var(--mono, monospace); letter-spacing: .08em; text-transform: uppercase; }
.exam-time-form { display: inline-flex; gap: .25rem; align-items: center; margin: .2rem 0 0; }
.exam-time-form select { padding: .1rem .3rem; font-size: .8rem; width: auto; }
.exam-actions select { width: auto; }
.exam-sim-item { margin-bottom: 1rem; }
.exam-sim-pair { border-top: 1px solid var(--border); padding: .5rem 0; }
.exam-sim-pair summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.exam-sim-code { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .6rem; }
@media (max-width: 800px) { .exam-sim-code { grid-template-columns: 1fr; } }
/* trimiterea sursei elevilor (pagina solutiei) */
.share-menu { position: relative; margin-left: auto; }
.share-toggle {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem;
  border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
}
.share-toggle::-webkit-details-marker { display: none; }
.share-toggle svg { fill: none; stroke: currentColor; stroke-width: 2; }
.share-toggle:hover, .share-menu[open] .share-toggle { background: var(--primary-soft); color: var(--primary); }
.share-pop {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 40; width: min(22rem, 90vw); max-height: 70vh; overflow-y: auto;
  padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.share-pop-title { margin: 0 0 .5rem; font-weight: 700; color: var(--ink); }
.share-class { border-top: 1px solid var(--border); padding: .35rem 0; }
.share-class > summary { cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; }
.share-form { margin-top: .4rem; }
.share-all { margin: 0 0 .3rem; }
.share-students { display: grid; gap: .2rem; margin-bottom: .5rem; }
.share-students .check { display: flex; align-items: center; gap: .4rem; }
.share-students .check input { width: auto; }
.share-form .hint { margin: .4rem 0 0; }
/* sectiunile paginii clasei, care se pot inchide */
.class-section { margin: 0 0 1.2rem; border-bottom: 1px solid var(--border); padding-bottom: .6rem; }
.class-section-head { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .6rem; padding: .3rem 0; }
.class-section-head::-webkit-details-marker { display: none; }
.class-section-head::before {
  content: ''; flex: 0 0 auto; width: .55rem; height: .55rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: rotate(-45deg); transition: transform .15s; margin-right: .2rem;
}
.class-section[open] > .class-section-head::before { transform: rotate(45deg); }
.class-section-head h2 { margin: 0; display: flex; align-items: baseline; gap: .6rem; }
.class-section-meta { font-size: .9rem; font-weight: 500; color: var(--text-muted); }
.class-section-head:hover h2 { color: var(--link); }
.class-section-tools { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin: -.2rem 0 .6rem; }
@media (prefers-reduced-motion: reduce) { .class-section-head::before { transition: none; } }
/* „Clasele mele”: lista in stanga, clasa noua / clasele arhivate in dreapta */
.classes-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(18rem, 1fr); gap: 1.5rem; align-items: start; }
.classes-side > * { margin-top: 0; margin-bottom: 1rem; }
@media (max-width: 860px) { .classes-layout { grid-template-columns: 1fr; } }
.class-list--teacher li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.class-row-main { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }
.class-row-main a { font-weight: 600; }
/* controalele unei clase: lacatul, codul, creionul */
.class-controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.class-controls .inline-form { margin: 0; }
.lock-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; padding: 0; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface);
}
.lock-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lock-btn.is-open { color: var(--success); border-color: var(--success); background: var(--success-soft); }
.lock-btn.is-closed { color: var(--warning); border-color: var(--warning); background: var(--warning-soft); }
.lock-btn:hover { filter: brightness(.95); }
.class-code-btn { border: 0; background: none; padding: 0; cursor: zoom-in; }
.class-code-btn:hover .class-code { outline: 2px solid var(--primary); }
.class-closed-note { font-style: italic; }
.class-edit { position: relative; }
.class-edit > summary { list-style: none; cursor: pointer; }
.class-edit > summary::-webkit-details-marker { display: none; }
.class-edit-pop {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 40; width: min(22rem, 90vw); display: grid; gap: .5rem;
  padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.class-edit-pop form { margin: 0; }
.class-edit-pop .hint { margin: 0; }
.class-info { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.class-info .hint { margin: 0; }
/* codul pe tot ecranul (videoproiector) */
.code-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 2rem; background: var(--bg); cursor: zoom-out; text-align: center;
}
.code-overlay-label { margin: 0; font-size: clamp(1rem, 2.5vw, 1.8rem); color: var(--text-muted); }
.code-overlay-code {
  margin: 0; font-family: ui-monospace, Consolas, monospace; font-weight: 700; color: var(--ink);
  font-size: clamp(3rem, 14vw, 12rem); letter-spacing: .04em; line-height: 1.1; word-break: break-all;
}
.code-overlay-hint { margin: 0; color: var(--text-muted); font-size: clamp(.9rem, 1.6vw, 1.2rem); }
/* pagina clasei: lacatul, codul si creionul imediat dupa numele clasei */
.class-title { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }
.class-title h1 { margin: 0; }
.class-title .class-edit-pop { left: 0; right: auto; }
.class-code-btn .class-code { color: var(--ink); background: var(--surface-2); border: 1px solid var(--border-strong); }
/* antetele tabelelor sortabile (ex. elevii clasei) */
.sort-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.sort-btn::after { content: '⇅'; opacity: .45; font-size: 1.2em; line-height: 1; }
.sort-btn[data-dir="asc"]::after { content: '▲'; opacity: 1; font-size: 1em; color: var(--primary); }
.sort-btn[data-dir="desc"]::after { content: '▼'; opacity: 1; font-size: 1em; color: var(--primary); }
.sort-btn:hover { text-decoration: underline; }

/* Generatorul de date (/generator): optiunile in stanga, rezultatul in dreapta */
.gen-intro { margin-bottom: 1rem; max-width: 60rem; }
.gen-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.gen-options { display: grid; gap: 1rem; }
.gen-set { display: grid; gap: .9rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.gen-set[hidden], .gen-layout [hidden] { display: none; }
.gen-label { font-weight: 600; }
.gen-pills { justify-content: flex-start; }
.gen-checks { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.gen-check { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.gen-check input { accent-color: var(--primary); }
.gen-first input[type=text] { max-width: 20rem; }
.gen-seed input { flex: 0 1 9rem; min-width: 7rem; }
.gen-output { position: sticky; top: calc(var(--header-h, 4rem) + .75rem); display: grid; gap: .6rem; }
.gen-output-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.gen-output-head h2 { margin: 0; }
.gen-output textarea { width: 100%; min-height: 22rem; resize: vertical; font-family: var(--font-mono, ui-monospace, Consolas, monospace); font-size: .9rem; white-space: pre; overflow: auto; }
.gen-actions input { flex: 0 1 12rem; min-width: 8rem; }
.gen-drawing { overflow: auto; border-top: 1px solid var(--border); padding-top: .6rem; }
.gen-svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.gen-svg-edge { stroke: var(--text-muted); stroke-width: 1.5; fill: none; }
.gen-svg-arrow { fill: var(--text-muted); }
.gen-svg-node { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 1.5; }
.gen-svg-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.gen-svg-cost-bg { fill: #fff4e5; stroke: #e8890c; stroke-width: .8; }
.gen-svg-cost { fill: #8a4500; font-size: 11px; font-weight: 700; }
@media (max-width: 60rem) {
  .gen-layout { grid-template-columns: minmax(0, 1fr); }
  .gen-output { position: static; }
}
/* tema: punctajul unui elev e link spre solutiile lui la problema (randul lui e evidentiat) */
a.points { text-decoration: none; }
a.points:hover { text-decoration: underline; }
tr:target > * { background: var(--primary-soft); }
/* interpretorul de pseudocod */
.pseudo-editor { display: grid; gap: .75rem; min-width: 0; }
.pseudo-toolbar { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.pseudo-toolbar .btn { font-family: Consolas, "Courier New", ui-monospace, monospace; }
.pseudo-toolbar .pseudo-sym { font-family: inherit; font-size: 1.15rem; line-height: 1; min-width: 2.4rem; }
.pseudo-hint { font-weight: 400; opacity: .85; font-size: .85em; }
.pseudo-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 .25rem; }
/* „Refă liniile”: iconita, alta culoare decat simbolurile */
.pseudo-toolbar .pseudo-format { display: inline-flex; align-items: center; justify-content: center; min-width: 2.4rem; align-self: stretch;
  background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.pseudo-toolbar .pseudo-format:hover { background: var(--primary); color: #fff; }
.pseudo-code { width: 100%; min-height: 24rem; resize: vertical; font-family: Consolas, "Courier New", ui-monospace, monospace; font-size: 1rem; line-height: 1.35; white-space: pre; overflow: auto; tab-size: 4; }
.pseudo-examples { display: inline-flex; gap: .4rem; align-items: center; }
.pseudo-result { min-height: 6rem; margin: 0; padding: .75rem; background: var(--surface-2, var(--bg)); border: 1px solid var(--border); border-radius: 8px; white-space: pre-wrap; word-break: break-word; font-family: Consolas, "Courier New", ui-monospace, monospace; font-size: 1rem; }
.pseudo-error { margin: 0; padding: .6rem .75rem; border-radius: 8px; background: var(--danger-soft, #fdecec); color: var(--danger, #b42318); font-weight: 600; }
.pseudo-help summary { font-weight: 600; cursor: pointer; }
/* rezultatul sub editor; in dreapta explicatiile si sintaxa */
.pseudo-output { display: grid; gap: .6rem; border-top: 1px solid var(--border); padding-top: .75rem; }
.pseudo-intro { margin: 0; }
.pseudo-out-label { font-weight: 600; } /* ca eticheta „Date de intrare” */
.pseudo-toolbar-end { margin-left: auto; flex: 1 1 0; min-width: 9rem; display: flex; justify-content: flex-end; align-self: stretch; }
.pseudo-toolbar-end .pseudo-examples { display: flex; min-width: 0; max-width: 100%; }
.pseudo-toolbar-end select { min-width: 0; min-height: 0; max-width: 100%; align-self: stretch; padding: 0 1.8rem 0 .5rem; font-size: .9rem; text-overflow: ellipsis; }
.pseudo-input-row { display: flex; gap: .6rem; align-items: center; }
.pseudo-input-row input { flex: 1 1 auto; min-width: 0; }
.pseudo-input-row .btn { flex: none; }
/* sintaxa: cate o instructiune pe rand, pe doua coloane (instructiunea | ce face) */
.pseudo-syntax { margin: .6rem 0 0; display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; align-items: baseline; }
.pseudo-syntax dt { margin: 0; white-space: nowrap; }
.pseudo-syntax dd { margin: 0; font-size: .9rem; color: var(--text-muted); }
/* grila cu date de intrare (pseudocod): cate un camp pe set, cu ce a afisat algoritmul */
.quiz-sets { display: grid; gap: .9rem; }
.quiz-sets-intro { margin: 0; color: var(--text-muted); }
.quiz-set-msg { margin: 0; font-size: .92rem; }
.quiz-set.is-right .quiz-set-msg { color: var(--success); }
.quiz-set.is-wrong .quiz-set-msg { color: var(--danger, #b42318); }
.quiz-set input { font-family: Consolas, "Courier New", ui-monospace, monospace; letter-spacing: .02em; }
/* grila „algoritm echivalent” (pseudocod): editorul si verificarile */
.quiz-eq { display: grid; gap: .6rem; }
.quiz-eq > label, .quiz-eq-label { font-weight: 600; display: block; margin-bottom: .35rem; }
/* grila „algoritm echivalent”: algoritmul dat (stanga) si editorul elevului (dreapta); sub ele, explicatia limbajului */
.quiz-eq-sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.quiz-eq-sides > :only-child { grid-column: 1 / -1; }
.quiz-eq-mine, .quiz-eq-given { display: grid; gap: .5rem; }
.quiz-eq-mine .quiz-eq-label, .quiz-eq-given .quiz-eq-label { margin-bottom: 0; }
/* barele de deasupra celor doua chenare: aceeasi inaltime, ca sa fie aliniate */
.quiz-eq-sides .pseudo-toolbar { min-height: 2.5rem; }
.quiz-eq-bar .btn { font-family: inherit; align-self: stretch; }
.quiz-eq-given .pseudo-view { margin: 0; min-height: 16rem; }
@media (max-width: 900px) { .quiz-eq-sides { grid-template-columns: minmax(0, 1fr); } }
.pseudo-view { font-family: Consolas, "Courier New", ui-monospace, monospace; font-size: 1rem; line-height: 1.35; white-space: pre; overflow: auto;
  padding: .6rem; border-radius: 10px; border: 2px dashed var(--border); background: var(--surface-2, var(--surface)); color: var(--text); }
.pseudo-help-box { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .9rem; background: var(--surface); }
.pseudo-help-box[open] { padding-bottom: .9rem; }
.pseudo-help-box summary { cursor: pointer; font-weight: 600; }
.pseudo-help-box .pseudo-intro { margin: .6rem 0 0; font-size: .92rem; }
.quiz-eq textarea { width: 100%; min-height: 16rem; resize: vertical; font-family: Consolas, "Courier New", ui-monospace, monospace; font-size: 1rem; line-height: 1.35; white-space: pre; overflow: auto; padding: .6rem; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); }
.quiz-eq.is-right textarea { border-color: var(--success); }
.quiz-eq.is-wrong textarea { border-color: var(--danger, #b42318); }
.quiz-eq-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.quiz-eq-checks .is-right { color: var(--success); }
.quiz-eq-checks .is-wrong { color: var(--danger, #b42318); }
.pseudo-solution { font-family: Consolas, "Courier New", ui-monospace, monospace; }
/* simularea BAC: lista subiectelor */
.bac-subjects { display: grid; gap: .6rem; }
.bac-subject summary { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; cursor: pointer; }
.bac-subject summary .btn { margin-left: auto; }
.bac-items { margin-top: .75rem; }
/* pagina publica „Bacalaureat”: subiectele complete si simularile elevului */
.bac-limits { margin-bottom: 1rem; }
.bac-limits summary { cursor: pointer; font-weight: 600; }
.bac-limits ul { margin: .6rem 0 0; padding-left: 1.2rem; display: grid; gap: .35rem; font-size: .95rem; }
.bac-public-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; }
.bac-public-head h2 { margin: 0; font-size: 1.15rem; }
.bac-public-head form, .bac-public-head > .btn { margin-left: auto; }
.bac-attempts { margin: .6rem 0 0; padding-left: 1.2rem; display: grid; gap: .2rem; font-size: .95rem; }

/* Admin: campul cu linkul de Discord */
.admin-settings { display: grid; gap: .35rem; margin-top: .5rem; }
.admin-settings label { font-weight: 600; margin-top: .4rem; }
.admin-settings input { width: 100%; max-width: 36rem; }
.admin-settings p { font-size: .85rem; }
.admin-settings .discord-channel { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .9rem .8rem; margin: .4rem 0; display: grid; gap: .35rem; }
.admin-settings .discord-channel legend { font-weight: 700; padding: 0 .3rem; }
.admin-settings label.check { font-weight: 400; margin-top: 0; display: flex; gap: .45rem; align-items: baseline; }
.admin-settings label.check input { width: auto; }

/* Pagina „Despre InfoX”: echipa, cu pozele in cerc */
.about-intro p { margin: 0 0 .6rem; }
.about-intro p:last-child { margin-bottom: 0; }
.about-team { margin-top: 1.5rem; }
.team-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem; }
.team-member { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; padding: 1.25rem .75rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.team-photo { width: 8rem; height: 8rem; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary-soft); margin-bottom: .5rem; }
.team-initials { display: flex; align-items: center; justify-content: center; font-size: 2.25rem; font-weight: 700;
  color: var(--primary); background: var(--primary-soft); }
.team-name { font-weight: 700; color: var(--ink); }
.team-role { font-size: .9rem; color: var(--text-muted); }
#discord > div { flex: 1 1 auto; }
.page-head .about-motto { margin: -.8rem 0 0; font-size: 1.15rem; color: var(--text-muted); }
.about-x { font-weight: 700; color: var(--accent); }

/* editorul de pseudocod: textul colorat e un <pre> sub textarea (transparenta, cu cursorul vizibil); culorile ca la C++ */
.pseudo-hl-wrap { position: relative; }
.pseudo-hl { position: absolute; inset: 0; margin: 0; overflow: hidden; white-space: pre; pointer-events: none;
  border-style: solid; border-color: transparent; color: var(--text); box-sizing: border-box; }
.pseudo-hl-input { position: relative; z-index: 1; display: block; background: transparent !important; color: transparent !important;
  caret-color: var(--text); white-space: pre; overflow: auto; }
.pseudo-hl-input::selection { background: rgba(2, 132, 199, .25); }
.pseudo-hl .ph-kw, .pseudo-view .ph-kw, .pseudo-highlight .ph-kw { color: #0b4f9c; }  /* fara bold: latimea literelor trebuie sa ramana ca in textarea */
.pseudo-hl .ph-num, .pseudo-view .ph-num, .pseudo-highlight .ph-num { color: #164; }
.pseudo-hl .ph-str, .pseudo-view .ph-str, .pseudo-highlight .ph-str { color: #a11; }
.pseudo-hl .ph-line, .pseudo-view .ph-line, .pseudo-highlight .ph-line { color: var(--text-muted); }
:root.theme-dark .pseudo-hl .ph-kw, :root.theme-dark .pseudo-view .ph-kw, :root.theme-dark .pseudo-highlight .ph-kw { color: #7cc4ff; }
:root.theme-dark .pseudo-hl .ph-num, :root.theme-dark .pseudo-view .ph-num, :root.theme-dark .pseudo-highlight .ph-num { color: #f78c6c; }
:root.theme-dark .pseudo-hl .ph-str, :root.theme-dark .pseudo-view .ph-str, :root.theme-dark .pseudo-highlight .ph-str { color: #c3e88d; }
:root.theme-dark .pseudo-hl-input::selection { background: rgba(130, 170, 255, .3); }

/* paginile cu text lung (confidentialitate) */
.legal { max-width: 52rem; line-height: 1.6; }
.legal h2 { font-size: 1.15rem; margin: 1.5rem 0 .4rem; }
.legal h2:first-of-type { margin-top: 1rem; }
.legal ul { padding-left: 1.2rem; margin: .3rem 0; }
.legal li { margin: .25rem 0; }
.legal-cookies { margin-top: .5rem; font-size: .92rem; }
.auth-privacy { margin-top: .75rem; }
.settings-privacy { margin: .9rem 0 0; }

/* ---- /probleme-python: intrebarile frecvente ---- */
.py-faq-item { padding: 0; margin: 0 0 .6rem; }
.py-faq-item summary { padding: .85rem 1.1rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.py-faq-item p { margin: 0; padding: 0 1.1rem 1rem; line-height: 1.6; }
