/* Motorul de conținut (cititor, termeni, figuri), preluat din aplicația Fiziologia plantelor */
/* Paleta și tipografia din prototipul Figma */
:root {
  --bg: #f8f6f1;
  --fg: #1a2b18;
  --card: #ffffff;
  --primary: #2d6a4f;
  --primary-fg: #f8f6f1;
  --secondary: #d4e8cf;
  --muted: #ede9e0;
  --muted-fg: #637060;
  --accent: #52b788;
  --accent-2: #40916c;
  --border: #c8d9c3;
  --border-soft: #e4dfd5;
  --masthead: #f0ede6;
  --text-2: #3d5239;
  --text-3: #2c3e2a;
  --faint: #b0c5ab;
  --danger: #b23a3a;
  --danger-bg: #f8e3e3;
  --ok-bg: #d8f3dc;
  --radius: 0.5rem;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --serif: 'Lora', Georgia, serif;
}

html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans);
  line-height: 1.6; -webkit-font-smoothing: antialiased; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, .serif { font-family: var(--serif); color: var(--fg); }
h1 { font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
mark { background: #fff3b0; padding: 0 2px; border-radius: 2px; }
.container { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 56rem; }
.inline { display: inline; }
.muted { color: var(--muted-fg); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.right { text-align: right; }
.hidden { display: none !important; }
.mt { margin-top: 1.5rem; }
.mb { margin-bottom: 1.5rem; }

/* ---------- masthead (home) */
.masthead { background: var(--masthead); border-bottom: 1px solid var(--border); padding: 2.5rem 0 3rem; }
.masthead .kicker { font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-fg); margin-bottom: .75rem; }
.masthead h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); margin: 0 0 1rem; }
.masthead .lead { max-width: 42rem; color: var(--text-2); font-size: 1.05rem; line-height: 1.75; margin-bottom: 1.75rem; }
.howto { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; font-size: .9rem; color: var(--accent-2); }
.stats-row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: 1.5rem; font-size: .8rem; color: var(--muted-fg); font-family: var(--serif); font-style: italic; }

/* ---------- cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: .75rem; padding: 1.25rem; }
.card h3 { margin: 0 0 .75rem; font-size: 1rem; }
.card-link { display: block; color: inherit; transition: box-shadow .15s; }
.card-link:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(26,43,24,.08); }
.tod { display: flex; gap: 1.25rem; align-items: flex-start; margin: 2rem 0; }
.tod .star { font-size: 1.5rem; }
.tod .kicker { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-fg); margin-bottom: .25rem; }
.tod .title { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; margin-bottom: .25rem; }
.tod .go { align-self: center; color: var(--primary); font-size: .9rem; font-weight: 500; white-space: nowrap; }

.divider { display: flex; align-items: center; gap: 1rem; margin: 0 0 2.5rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { font-family: var(--serif); font-style: italic; font-size: .9rem; color: var(--muted-fg); }

/* ---------- chapter sections (home) */
.chapter-block { margin-bottom: 2.5rem; }
.chapter-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.chapter-num { flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: .85rem; margin-top: .2rem; }
.chapter-head h2 { margin: 0; font-size: 1.3rem; }
.chapter-head .all { font-size: .8rem; font-weight: 500; margin-left: .75rem; white-space: nowrap; }
.chapter-head p { margin: .25rem 0 0; font-size: .9rem; color: var(--muted-fg); max-width: 56ch; }
.index-list { margin-left: 3rem; border-top: 1px solid var(--border-soft); }
.index-row { display: flex; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--border-soft); color: inherit; align-items: flex-start; }
.index-row:hover { text-decoration: none; }
.index-row:hover .idx-title { text-decoration: underline; text-decoration-color: var(--accent); }
.index-row .n { flex-shrink: 0; width: 1.25rem; text-align: right; font-size: .75rem; font-family: ui-monospace, monospace; color: var(--faint); margin-top: .2rem; }
.idx-title { font-family: var(--serif); font-weight: 600; font-size: 1rem; }
.idx-meta { font-size: .75rem; color: var(--faint); margin-left: .5rem; }
.idx-def { font-size: .9rem; color: var(--muted-fg); margin: .1rem 0 0; }
.index-row .arrow { opacity: 0; color: var(--accent); margin-top: .2rem; }
.index-row:hover .arrow { opacity: 1; }
@media (max-width: 600px) { .index-list { margin-left: 0; } }

.section-end { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 0; border-top: 1px solid var(--border); margin: 1rem 0 2rem; }
.section-end .serif { font-style: italic; font-size: .9rem; color: var(--muted-fg); }

/* ---------- badges */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 500; background: var(--secondary); color: var(--primary); }
.badge-outline { background: var(--bg); border: 1px solid var(--border); }
.badge-kind { background: var(--muted); color: var(--muted-fg); }
.badge-l1 { background: #2d6a4f; color: #fff; }
.badge-l2 { background: #95d5b2; color: #1a2b18; }
.badge-l3 { background: var(--muted); color: var(--muted-fg); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 500; border: 1px solid var(--border); background: var(--bg); color: var(--primary); }
.chip:hover { background: var(--secondary); text-decoration: none; }

/* ---------- breadcrumb */
.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .8rem; color: var(--muted-fg); margin: 1.5rem 0 1.25rem; }
.breadcrumb a { color: var(--muted-fg); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--faint); }
.breadcrumb .current { color: var(--fg); font-weight: 500; }

/* ---------- term page */
.term-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; margin-bottom: 3rem; }
@media (max-width: 860px) { .term-grid { grid-template-columns: 1fr; } }
.term-title { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: .5rem 0 1rem; }
.def-origin { color: #8a6414; background: var(--warn-bg); border-radius: .4rem; padding: .2rem .6rem; display: inline-block; margin: -.8rem 0 1.2rem; }
.cpanel .def-origin { margin: -.3rem 0 .6rem; }
.term-def { font-family: var(--serif); font-size: 1.15rem; line-height: 1.7; font-style: italic; color: var(--accent-2); border-left: 3px solid var(--accent); padding-left: 1rem; margin: 0 0 1.5rem; }
.term-body p { line-height: 1.85; color: var(--text-3); }
.source-box { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .5rem 1rem; border: 1px solid var(--border); border-radius: .5rem; font-size: .85rem; color: var(--muted-fg); background: var(--bg); }
.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-list li { padding: .45rem 0; border-bottom: 1px solid var(--border-soft); font-size: .9rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.rel-list li:last-child { border-bottom: 0; }
.rel-list .rel { color: var(--muted-fg); font-style: italic; font-family: var(--serif); }
.rel-list .pg { margin-left: auto; font-size: .75rem; color: var(--faint); white-space: nowrap; }
.aside > * + * { margin-top: 1.25rem; }
.quiz-box { background: linear-gradient(135deg, #d4e8cf, #b7e4c7); border-color: var(--border); }
.quiz-box .cta { display: inline-block; margin-top: .5rem; padding: .35rem .9rem; border-radius: .5rem; background: rgba(255,255,255,.6); color: var(--primary); font-size: .8rem; font-weight: 500; }
h2.sub { font-size: 1.15rem; margin: 2rem 0 .75rem; }
.term-link { color: var(--primary); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; cursor: pointer; }
.term-link:hover { text-decoration-style: solid; background: rgba(82,183,136,.12); }

/* ---------- tooltip */
.tooltip-card {
  position: fixed; z-index: 100; width: 18rem; background: #fff; border: 1px solid var(--border); border-radius: .6rem;
  padding: .75rem .9rem; box-shadow: 0 8px 24px rgba(26,43,24,.14); pointer-events: none; font-size: .8rem;
}
.tooltip-card .t-title { font-family: var(--serif); font-weight: 600; font-size: .95rem; margin: .3rem 0 .2rem; }
.tooltip-card .t-def { color: var(--muted-fg); line-height: 1.45; }

/* ---------- explore */
.tabs { display: inline-flex; gap: .25rem; padding: .25rem; background: var(--muted); border-radius: .5rem; margin-bottom: 1.75rem; }
.tabs a { padding: .45rem 1rem; border-radius: .4rem; font-size: .9rem; font-weight: 500; color: var(--muted-fg); }
.tabs a:hover { text-decoration: none; color: var(--primary); }
.tabs a.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(26,43,24,.08); }
.az-layout { display: grid; grid-template-columns: 3rem 1fr; gap: 1.5rem; }
.az-rail { position: sticky; top: 4.5rem; align-self: start; display: flex; flex-direction: column; gap: .1rem; max-height: calc(100vh - 6rem); overflow: auto; }
.az-rail a { font-size: .75rem; font-weight: 600; text-align: center; padding: .2rem 0; border-radius: .3rem; color: var(--muted-fg); }
.az-rail a:hover { background: var(--secondary); color: var(--primary); text-decoration: none; }
.az-rail .dis { color: var(--border); pointer-events: none; }
.letter-block { margin-bottom: 1.5rem; scroll-margin-top: 4.5rem; }
.letter-block h2 { font-size: 1.6rem; color: var(--accent); border-bottom: 1px solid var(--border); margin: 0 0 .5rem; }
.term-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .25rem 1.5rem; }
.term-list a { display: flex; gap: .5rem; align-items: baseline; padding: .35rem 0; color: inherit; border-bottom: 1px solid var(--border-soft); }
.term-list a:hover { text-decoration: none; color: var(--primary); }
.term-list .k { font-size: .7rem; color: var(--faint); margin-left: auto; white-space: nowrap; }
@media (max-width: 600px) { .az-layout { grid-template-columns: 1fr; } .az-rail { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; } }

.chapter-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.chapter-card { display: block; color: inherit; background: #fff; border: 1px solid var(--border); border-radius: .75rem; padding: 1.25rem; border-top: 4px solid var(--primary); }
.chapter-card:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(26,43,24,.08); }
.chapter-card .icon { font-size: 1.6rem; }
.chapter-card h3 { margin: .5rem 0 .25rem; font-size: 1.05rem; }
.chapter-card p { font-size: .85rem; color: var(--muted-fg); margin: 0 0 .5rem; }
.chapter-card .meta { font-size: .78rem; color: var(--primary); font-weight: 500; }

.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 1.25rem; border-left: 1px solid var(--border); padding-left: .75rem; }
.tree li { padding: .2rem 0; }
.tree a { color: inherit; }
.tree a:hover { color: var(--primary); }
.tree .more { font-size: .75rem; color: var(--faint); }

/* ---------- chapter page */
.chapter-hero { background: var(--masthead); border-bottom: 1px solid var(--border); padding: 2rem 0; }
.chapter-hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: .25rem 0 .5rem; }
.chapter-hero p { color: var(--text-2); max-width: 60ch; }
.two-col { display: grid; grid-template-columns: 1fr 2fr; gap: 2rem; margin: 2rem 0 3rem; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.toc { font-size: .9rem; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc ul ul { margin-left: 1rem; }
.toc li { padding: .2rem 0; }
.toc .num { color: var(--faint); font-family: ui-monospace, monospace; font-size: .75rem; margin-right: .4rem; }
.toc a { color: var(--text-3); }
.toc a:hover { color: var(--primary); }
.level-head { display: flex; align-items: center; gap: .6rem; margin: 1.5rem 0 .5rem; }
.level-head h2 { margin: 0; font-size: 1.1rem; }

/* ---------- book page */
.book-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1rem 0; font-size: .9rem; }
.book-nav .pg { font-family: var(--serif); font-style: italic; color: var(--muted-fg); }
.book-text { background: #fff; border: 1px solid var(--border); border-radius: .75rem; padding: 2rem 2.25rem; font-family: var(--serif); font-size: 1.02rem; line-height: 1.85; color: var(--text-3); }
.book-text p { margin: 0 0 1em; }
@media (max-width: 600px) { .book-text { padding: 1.25rem 1rem; } }
.jump { display: flex; gap: .5rem; align-items: center; font-size: .85rem; }
.jump input { width: 4.5rem; padding: .3rem .5rem; border: 1px solid var(--border); border-radius: .4rem; font: inherit; }

/* ---------- search */
.result-block { margin-bottom: 2.5rem; }
.result-block h2 { font-size: 1.1rem; border-bottom: 1px solid var(--border); padding-bottom: .4rem; margin-bottom: .75rem; }
.page-hit { padding: .75rem 0; border-bottom: 1px solid var(--border-soft); font-size: .9rem; }
.page-hit .where { font-size: .78rem; color: var(--muted-fg); margin-bottom: .2rem; }
.page-hit .ctx { color: var(--text-3); font-family: var(--serif); }

/* ---------- forms */
/* (formularele iau lățimea containerului) */
.form-wide { max-width: 44rem; }
label.field { display: block; margin-bottom: 1rem; font-size: .9rem; font-weight: 500; }
label.field input[type=text], label.field input[type=password], label.field input[type=number], label.field select, .input {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: .5rem; font: inherit; background: #fff; color: var(--fg);
}
label.field input:focus, .input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(82,183,136,.15); }
.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; padding: .3rem 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .1rem .75rem; }
.btn { display: inline-block; padding: .55rem 1.1rem; border-radius: .5rem; border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { background: #245740; text-decoration: none; }
.btn-secondary { background: #fff; color: var(--primary); }
.btn-secondary:hover { background: var(--secondary); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
fieldset { border: 1px solid var(--border); border-radius: .75rem; padding: 1rem 1.25rem; margin: 0 0 1.25rem; background: #fff; }
legend { font-family: var(--serif); font-weight: 600; padding: 0 .4rem; }
.help { font-size: .8rem; color: var(--muted-fg); margin: .25rem 0 0; }
.errorlist { color: var(--danger); font-size: .85rem; margin: .25rem 0 .5rem; padding-left: 1.2rem; }

/* ---------- quiz */
.question { background: #fff; border: 1px solid var(--border); border-radius: .75rem; padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.question .qhead { display: flex; justify-content: space-between; gap: 1rem; font-size: .75rem; color: var(--muted-fg); margin-bottom: .5rem; }
.question .prompt { font-family: var(--serif); font-size: 1.05rem; line-height: 1.6; margin-bottom: .9rem; }
.options { display: grid; gap: .4rem; }
.option { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: .5rem; cursor: pointer; font-size: .92rem; background: var(--bg); }
.option:hover { border-color: var(--accent); }
.option input { margin-top: .25rem; }
.option.correct { background: var(--ok-bg); border-color: #74c69d; }
.option.wrong { background: var(--danger-bg); border-color: #e7b3b3; }
.explain { margin-top: .75rem; padding: .6rem .8rem; border-left: 3px solid var(--accent); background: var(--bg); font-size: .88rem; color: var(--text-3); }
.score-hero { text-align: center; padding: 2rem 1rem; }
.score-hero .big { font-family: var(--serif); font-size: 3rem; font-weight: 700; color: var(--primary); line-height: 1; }
.quiz-progress { position: sticky; top: 3.6rem; z-index: 5; background: var(--bg); padding: .5rem 0; font-size: .85rem; color: var(--muted-fg); }
.bar { height: 6px; background: var(--muted); border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); transition: width .2s; }

/* ---------- progress / admin */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; border: 1px solid var(--border); border-radius: .75rem; overflow: hidden; }
.table th, .table td { padding: .55rem .8rem; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table th { background: var(--masthead); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-fg); }
.table tr:last-child td { border-bottom: 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.tile { background: #fff; border: 1px solid var(--border); border-radius: .75rem; padding: 1rem 1.25rem; }
.tile .v { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.tile .l { font-size: .78rem; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .05em; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem; padding: 1.5rem 0; font-size: .8rem; color: var(--muted-fg); }
.footer-links a { margin-left: 1rem; }
.site-footer { border-top: 1px solid var(--border); margin-top: 2rem; }

.page-enter { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.empty { text-align: center; padding: 4rem 1rem; }
.empty .ico { font-size: 3rem; }

/* ---------- layout lat: capitol (cuprins | concepte | panou) și cititor */
.wide { max-width: 94rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
kbd { font-family: ui-monospace, monospace; font-size: .75rem; padding: .05rem .35rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: .3rem; background: #fff; }
.chip-strong { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-strong:hover { background: #245740; }
.chip-up { background: var(--muted); }

.explore-3, .reader-grid { display: grid; gap: 1.75rem; margin: 1.75rem auto 3rem; align-items: start; }
.explore-3 { grid-template-columns: 16rem minmax(0, 1fr) 24rem; }
.reader-grid { grid-template-columns: 15rem minmax(0, 44rem) 22rem; justify-content: center; }
.col-toc { position: sticky; top: 4.5rem; max-height: calc(100vh - 5.5rem); overflow: auto; }
.reader-grid .col-toc { top: 7.5rem; max-height: calc(100vh - 8.5rem); }
.col-panel { position: sticky; top: 4.5rem; }
.reader-grid .col-panel { top: 7.5rem; }

.toc { font-size: .85rem; }
.toc .toc-a { display: block; padding: .2rem .4rem; border-radius: .35rem; color: var(--text-3); line-height: 1.35; }
.toc .toc-a:hover { background: var(--bg); text-decoration: none; color: var(--primary); }
.toc .toc-a.active { background: var(--secondary); color: var(--primary); font-weight: 500; }
.toc .toc-a .p { font-size: .7rem; color: var(--faint); white-space: nowrap; }
.toc li { padding: 0; }
.reader-toc { max-height: inherit; overflow: auto; }

.list-tools { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-bottom: .5rem; }
.list-tools .filter { flex: 1 1 14rem; margin: 0; max-width: 22rem; padding: .45rem .7rem; }
.lvl-toggle { display: flex; flex-wrap: wrap; gap: .25rem .8rem; font-size: .8rem; color: var(--muted-fg); }
.lvl-toggle .lvl { display: inline-flex; gap: .3rem; align-items: center; cursor: pointer; }
.col-list .index-list { margin-left: 0; }
.col-list .index-row { padding: .7rem .6rem; margin: 0 -.6rem; border-radius: .5rem; border-bottom-color: transparent; box-shadow: 0 1px 0 var(--border-soft); scroll-margin: 6rem; }
.col-list .index-row:hover { background: #fff; }
.col-list .index-row.active { background: #fff; box-shadow: inset 3px 0 0 var(--accent), 0 1px 4px rgba(26,43,24,.08); }
.col-list .index-row.active .idx-title { color: var(--primary); }

/* panoul de concept */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: .75rem; display: flex; flex-direction: column; max-height: calc(100vh - 5.5rem); position: relative; }
.reader-grid .panel { max-height: calc(100vh - 8.5rem); }
.panel-nav { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border-soft); }
.panel-pos { flex: 1; text-align: center; font-size: .78rem; color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.panel-body { padding: 1rem 1.15rem 1.25rem; overflow: auto; transition: opacity .12s; }
.panel-body.loading { opacity: .45; }
.panel-empty { text-align: center; padding: 1.5rem .5rem; color: var(--text-2); font-size: .9rem; }
.panel-close { display: none; position: absolute; top: .45rem; right: .55rem; border: 0; background: transparent; font-size: 1.4rem; line-height: 1; color: var(--muted-fg); cursor: pointer; z-index: 2; }
.panel [data-panel-back] { display: none; }
.panel.has-concept [data-panel-back] { display: inline-block; }
.cpanel .cp-title { font-size: 1.45rem; margin: .5rem 0 .25rem; line-height: 1.2; }
.cpanel .cp-aliases { font-size: .78rem; color: var(--muted-fg); margin: 0 0 .5rem; }
.cpanel .cp-def { font-family: var(--serif); font-style: italic; font-size: 1rem; line-height: 1.6; color: var(--accent-2); border-left: 3px solid var(--accent); padding-left: .8rem; margin: .5rem 0 1rem; }
.cp-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-fg); font-family: var(--sans); font-weight: 600; margin: 1.1rem 0 .45rem; }
.cp-rels { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.cp-rels li { padding: .3rem 0; border-bottom: 1px solid var(--border-soft); display: flex; gap: .35rem; flex-wrap: wrap; align-items: baseline; }
.cp-rels li:last-child { border-bottom: 0; }
.cp-rels .rel { color: var(--muted-fg); font-style: italic; font-family: var(--serif); }
.cp-rels .pg { margin-left: auto; font-size: .72rem; color: var(--faint); }
.cp-more { font-size: .78rem; color: var(--muted-fg); margin: .6rem 0 0; }
.cp-full { display: inline-block; margin-top: 1.1rem; font-size: .85rem; font-weight: 500; }

/* ---------- cititorul */
.reader-bar { position: sticky; top: 3.5rem; z-index: 40; background: rgba(248,246,241,.97); border-bottom: 1px solid var(--border); backdrop-filter: blur(6px); }
.reader-bar-inner { display: flex; align-items: center; gap: .6rem; height: 3rem; }
.rb-home { font-size: 1.25rem; text-decoration: none !important; }
.rb-select select { font: inherit; font-size: .88rem; font-family: var(--serif); font-weight: 600; color: var(--fg); background: transparent; border: 1px solid transparent; border-radius: .4rem; padding: .25rem .4rem; max-width: 26rem; cursor: pointer; }
.rb-select select:hover { border-color: var(--border); background: #fff; }
.rb-page { font-size: .78rem; color: var(--muted-fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rb-spacer { flex: 1; }
.rb-toggle { font-size: .78rem; color: var(--muted-fg); display: inline-flex; gap: .3rem; align-items: center; cursor: pointer; white-space: nowrap; }
.rb-progress { height: 2px; background: transparent; }
.rb-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

.reader { position: relative; font-family: var(--serif); font-size: 1.06rem; line-height: 1.8; color: var(--text-3); }
.reader-head { margin: .5rem 0 1.75rem; scroll-margin-top: 8rem; }
.reader-head .kicker { font-family: var(--sans); font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-fg); }
.reader-head h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin: .35rem 0 0; }
.reader p { margin: 0 0 .9em; text-align: left; hyphens: manual; }
.reader p.li { padding-left: 1.4rem; text-indent: -1.1rem; margin-bottom: .45em; }
.reader p.cap { font-family: var(--sans); font-size: .85rem; color: var(--muted-fg); }
.reader .sec-h { font-family: var(--serif); color: var(--fg); line-height: 1.3; scroll-margin-top: 8rem; margin: 2.2rem 0 .9rem; }
.reader h2.sec-h { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: .35rem; }
.reader h3.sec-h { font-size: 1.22rem; }
.reader h4.sec-h { font-size: 1.05rem; }
.reader .sec-num { color: var(--accent-2); font-variant-numeric: tabular-nums; margin-right: .2rem; }
.reader .sub-h { font-family: var(--serif); font-size: 1rem; font-weight: 700; color: var(--fg); margin: 1.4rem 0 .5rem; }
.reader sub, .reader sup { font-size: .68em; line-height: 0; }
.reader strong { color: var(--fg); }

.pg-mark { position: absolute; left: -3.4rem; width: 2.8rem; text-align: right; font-family: var(--sans); font-size: .7rem; color: var(--faint); margin-top: .35rem; scroll-margin-top: 8rem; text-decoration: none; }
.pg-mark:hover { color: var(--primary); text-decoration: none; }
.pg-mark::after { content: ''; position: absolute; right: -.6rem; top: .55rem; width: .35rem; height: 1px; background: var(--border); }
.pg-mark.inline { position: static; display: inline-block; width: auto; margin: 0 .15rem; padding: 0 .35rem; border-radius: 999px; background: var(--muted); font-size: .65rem; line-height: 1.5; vertical-align: .1em; }
.pg-mark.inline::after { display: none; }

.term-link.rep { color: inherit; text-decoration: none; background: none; }
body.all-terms .term-link.rep { color: var(--primary); text-decoration: underline dotted; text-underline-offset: 3px; }
.term-link.hl, body .term-link.rep.hl { background: #fff3b0; border-radius: 2px; color: var(--fg); text-decoration: none; box-shadow: 0 0 0 2px #fff3b0; }

.book-fig { margin: 1.4rem auto 1.6rem; width: var(--w, 100%); max-width: 100%; text-align: center; }
.book-fig .fig-zoom { display: block; width: 100%; padding: .5rem; border: 1px solid var(--border-soft); border-radius: .5rem; background: #fff; cursor: zoom-in; }
.book-fig .fig-zoom:hover { border-color: var(--accent); }
.book-fig img { display: block; width: 100%; height: auto; }
.book-fig figcaption { font-family: var(--sans); font-size: .8rem; line-height: 1.5; color: var(--muted-fg); margin-top: .45rem; text-align: center; }

.reader-foot { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); font-family: var(--sans); }
.next-ch { display: flex; flex-direction: column; gap: .2rem; margin-bottom: 1.25rem; }
.next-t { font-size: 1.1rem; font-weight: 600; color: var(--primary); }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(20,30,18,.82); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1rem 1rem; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(96vw, 70rem); max-height: calc(100vh - 7rem); background: #fff; border-radius: .4rem; box-shadow: 0 10px 40px rgba(0,0,0,.35); object-fit: contain; }
.lb-cap { color: #eef3ec; font-size: .85rem; margin-top: .75rem; max-width: 50rem; text-align: center; }
.lb-close { position: absolute; top: .6rem; right: 1rem; border: 0; background: transparent; color: #fff; font-size: 2rem; cursor: pointer; }
body.lb-open { overflow: hidden; }

/* ecrane medii: panoul devine foaie de jos */
@media (max-width: 1280px) {
  .explore-3 { grid-template-columns: 15rem minmax(0, 1fr) 21rem; }
  .reader-grid { grid-template-columns: 13rem minmax(0, 42rem) 19rem; }
}
@media (max-width: 1080px) {
  .explore-3 { grid-template-columns: minmax(0, 1fr); }
  .reader-grid { grid-template-columns: minmax(0, 44rem); }
  .explore-3 .col-toc, .reader-grid .col-toc { position: static; max-height: none; }
  .reader-grid .col-toc { display: none; }
  .col-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 90; padding: 0 .75rem .75rem; transform: translateY(110%); transition: transform .2s ease; }
  .col-panel.open { transform: none; }
  .col-panel .panel, .reader-grid .col-panel .panel { max-height: 62vh; box-shadow: 0 -8px 30px rgba(26,43,24,.18); max-width: 44rem; margin: 0 auto; }
  .panel-close { display: block; }
  .panel-nav { padding-right: 2.4rem; }
  .pg-mark { position: static; display: block; width: auto; text-align: left; margin: 1rem 0 .4rem; }
  .pg-mark::after { display: none; }
  .rb-toggle { display: none; }
}
@media (max-width: 760px) {
  .reader-bar { position: static; }
  .reader-bar-inner { flex-wrap: wrap; height: auto; padding: .4rem 0; }
}
@media (max-width: 600px) {
  .rb-select select { max-width: 11rem; }
  .reader { font-size: 1rem; }
}

.col-list .index-row:focus { outline: none; }
.col-list .index-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- niveluri colorate (1 bază · 2 aprofundare · 3 detaliu) */
:root { --l1: #2d6a4f; --l1-bg: #2d6a4f; --l2: #2f7a57; --l2-bg: #cdebd9; --l3: #6b7568; --l3-bg: #f1eee7; }
.lvl-link.lv-1 { color: var(--l1); font-weight: 700; }
.lvl-link.lv-2 { color: var(--l2); font-weight: 500; }
.lvl-link.lv-3 { color: var(--l3); }
.lvl-chip.lv-1 { background: var(--l1-bg); border-color: var(--l1-bg); color: #fff; font-weight: 600; }
.lvl-chip.lv-2 { background: var(--l2-bg); border-color: #a7d8bb; color: #1d4d36; }
.lvl-chip.lv-3 { background: var(--l3-bg); border-color: var(--border-soft); color: var(--l3); font-weight: 400; }
.lvl-chip.lv-1:hover { background: #245740; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin: 0 .15rem 0 .5rem; vertical-align: -.02rem; }
.dot.lv-1 { background: var(--l1-bg); } .dot.lv-2 { background: #95d5b2; } .dot.lv-3 { background: #d9d3c6; }
.rel-list li.lv-1 { box-shadow: inset 3px 0 0 var(--l1-bg); padding-left: .6rem; }
.rel-list li.lv-2 { box-shadow: inset 3px 0 0 #95d5b2; padding-left: .6rem; }
.rel-list li.lv-3 { box-shadow: inset 3px 0 0 #e4dfd5; padding-left: .6rem; }
.lvl-scope[data-max="1"] .lv-2, .lvl-scope[data-max="1"] .lv-3, .lvl-scope[data-max="2"] .lv-3 { display: none; }
.lvl-scope .lvl-legend .lvl-filter, .lvl-scope .level-set .lvl-btn { display: inline-block !important; }
.lvl-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 1.75rem 0 -.5rem; }
.lvl-filter { font: inherit; font-size: .75rem; padding: .2rem .65rem; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--muted-fg); cursor: pointer; }
.lvl-filter.on.lv-1, .lvl-filter.on.lv-2, .lvl-filter.on.lv-3 { color: #fff; border-color: transparent; }
.lvl-filter.on.lv-1 { background: var(--l1-bg); } .lvl-filter.on.lv-2 { background: #40916c; } .lvl-filter.on.lv-3 { background: #6b7568; }

.structure ul { list-style: none; margin: 0; padding: 0; }
.structure > ul > li { padding: .35rem 0; border-bottom: 1px solid var(--border-soft); }
.structure ul ul { margin: .25rem 0 .1rem 1.1rem; padding-left: .8rem; border-left: 2px solid var(--border-soft); }
.structure ul ul li { padding: .12rem 0; font-size: .92rem; }
.structure .st-rel { font-family: var(--serif); font-style: italic; font-size: .78rem; color: var(--faint); margin-right: .15rem; }

/* ---------- definiția din carte */
.book-def { border: 1px solid var(--border); background: #fff; border-radius: .75rem; padding: 1rem 1.2rem; margin: 0 0 1rem; }
.bd-head { display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: space-between; align-items: baseline; }
.bd-kicker { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-fg); }
.bd-where { font-size: .8rem; color: var(--muted-fg); }
.book-def blockquote { margin: .6rem 0 .5rem; font-family: var(--serif); font-size: 1.02rem; line-height: 1.65; color: var(--text-3); }
.book-def blockquote mark { background: #fff3b0; font-weight: 600; }
.bd-go { font-size: .85rem; font-weight: 500; }
.bd-more { font-size: .85rem; color: var(--muted-fg); margin-top: .45rem; }
.bd-others { margin-top: .6rem; font-size: .85rem; }
.bd-others summary { cursor: pointer; color: var(--primary); }
.bd-others ul { margin: .4rem 0 0; padding-left: 1.1rem; color: var(--text-3); }
.bd-others li { margin-bottom: .3rem; }

/* ---------- editare */
.term-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; }
.edit-tools { display: flex; gap: .5rem; align-items: center; }
.level-set { display: inline-flex; border: 1px solid var(--border); border-radius: .5rem; overflow: hidden; }
.lvl-btn { font: inherit; font-size: .72rem; padding: .3rem .6rem; border: 0; border-right: 1px solid var(--border); background: #fff; color: var(--muted-fg); cursor: pointer; }
.lvl-btn:last-child { border-right: 0; }
.lvl-btn:hover { background: var(--bg); }
.lvl-btn.on.lv-1 { background: var(--l1-bg); color: #fff; } .lvl-btn.on.lv-2 { background: #95d5b2; color: #1a2b18; } .lvl-btn.on.lv-3 { background: #d9d3c6; color: #1a2b18; }
.badge-edited { background: #fff3d6; color: #8a6414; border-radius: 999px; padding: .1rem .5rem; }
.editor .edit-card { margin-bottom: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.editor textarea.input { font: inherit; resize: vertical; }
.level-pick { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .35rem; }
.lvl-radio { display: inline-flex; gap: .35rem; align-items: center; padding: .35rem .7rem; border-radius: .5rem; border: 1px solid var(--border); font-weight: 400; cursor: pointer; }
.lvl-radio.lv-1 { border-left: 4px solid var(--l1-bg); } .lvl-radio.lv-2 { border-left: 4px solid #95d5b2; } .lvl-radio.lv-3 { border-left: 4px solid #d9d3c6; }
.def-choices { display: grid; gap: .4rem; }
.def-opt { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .7rem; border: 1px solid var(--border-soft); border-radius: .5rem; font-size: .88rem; cursor: pointer; background: var(--bg); }
.def-opt:hover { border-color: var(--accent); }
.def-opt input[type=radio] { margin-top: .3rem; }
.def-opt mark { background: #fff3b0; }
.page-in { width: 5.5rem !important; display: inline-block !important; margin: 0 !important; padding: .3rem .5rem !important; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.25rem; }
.rel-table td { font-size: .88rem; }
.rel-table .rel { color: var(--muted-fg); font-style: italic; font-family: var(--serif); }
.rel-table .hidden-rel td { color: var(--muted-fg); }
.add-rel { margin-top: 1.25rem; }
.add-rel-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.add-rel-row .input { width: auto; margin: 0; flex: 1 1 10rem; }
.add-rel-row select.input { flex: 0 1 14rem; }
.add-rel-self { font-weight: 600; font-family: var(--serif); }
.danger-zone { margin: 0 0 3rem; }

/* paragraful țintă din cititor */
.reader .flash { animation: flash 2.6s ease-out 1; border-radius: .3rem; }
@keyframes flash { 0%, 35% { background: #fff3b0; box-shadow: 0 0 0 .4rem #fff3b0; } 100% { background: transparent; box-shadow: 0 0 0 .4rem transparent; } }

/* ---------- figuri */
.fig-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.25rem; }
.fig-filters .input { width: auto; margin: 0; }
.fig-filters input.input { flex: 1 1 16rem; max-width: 26rem; }
.fig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin-bottom: 3rem; }
.fig-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: .75rem; overflow: hidden; color: inherit; }
.fig-card:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(26,43,24,.1); border-color: var(--accent); }
.fig-thumb { display: flex; align-items: center; justify-content: center; background: #fff; border-bottom: 1px solid var(--border-soft); aspect-ratio: 4 / 3; overflow: hidden; }
.fig-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; padding: .4rem; }
.fig-card-body { display: flex; flex-direction: column; gap: .3rem; padding: .7rem .85rem .85rem; }
.fig-title { font-family: var(--serif); font-weight: 700; }
.fig-cap { font-size: .82rem; color: var(--text-3); line-height: 1.4; }
.fig-chips .chip { font-size: .7rem; padding: .1rem .5rem; }

.fig-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .75rem; }
.fig-mini { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: .6rem; overflow: hidden; background: #fff; color: inherit; font-size: .78rem; }
.fig-mini:hover { text-decoration: none; border-color: var(--accent); }
.fig-mini-t { font-weight: 600; padding: .4rem .55rem 0; }
.fig-mini-c { color: var(--muted-fg); padding: .1rem .55rem .5rem; line-height: 1.35; }
.cp-figs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.cp-figs a { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border: 1px solid var(--border-soft); border-radius: .4rem; background: #fff; overflow: hidden; }
.cp-figs a:hover { border-color: var(--accent); }
.cp-figs img { max-width: 100%; max-height: 100%; object-fit: contain; }

.fig-detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(16rem, 2fr); gap: 2rem; margin-bottom: 3rem; align-items: start; }
@media (max-width: 860px) { .fig-detail { grid-template-columns: 1fr; } }
.fig-big { display: block; width: 100%; padding: .75rem; background: #fff; border: 1px solid var(--border); border-radius: .75rem; cursor: zoom-in; }
.fig-big img { display: block; max-width: 100%; margin: 0 auto; max-height: 75vh; object-fit: contain; }
.fig-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: .75rem; }
.kicker-sm { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-fg); }
.fig-h1 { font-size: 1.7rem; margin: .3rem 0 .5rem; }
.fig-caption { font-family: var(--serif); font-size: 1.05rem; color: var(--text-3); }
.fig-concepts { list-style: none; margin: 0 0 .5rem; padding: 0; }
.fig-concepts li { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; padding: .35rem 0 .35rem .6rem; border-bottom: 1px solid var(--border-soft); }
.fig-concepts li.lv-1 { box-shadow: inset 3px 0 0 var(--l1-bg); } .fig-concepts li.lv-2 { box-shadow: inset 3px 0 0 #95d5b2; } .fig-concepts li.lv-3 { box-shadow: inset 3px 0 0 #e4dfd5; }
.fig-concepts form { margin-left: auto; }
.linklike { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 1rem; padding: 0 .3rem; }
.linklike:hover { color: var(--danger); }
.fig-refs { margin: 0; padding-left: 1.1rem; font-size: .85rem; color: var(--text-3); }
.fig-refs li { margin-bottom: .4rem; }
.book-fig .fig-more { font-size: .72rem; margin-left: .3rem; white-space: nowrap; }
.lb-cap a { color: #b7e4c7; }

/* ---------- termeni adăugați de utilizatori („Explică”, generat de Claude) */
:root { --ua: #6d4bb8; --ua-bg: #f3effb; --ua-border: #d9ccf2; }
.is-user-added .term-title { color: var(--ua); }
.is-user-added .term-def { color: var(--ua); border-left-color: var(--ua); }
.ua-banner { display: flex; gap: .75rem; align-items: flex-start; background: var(--ua-bg); border: 1px dashed var(--ua); border-radius: .75rem; padding: .8rem 1rem; margin: 0 0 1rem; font-size: .88rem; color: #3b2a66; }
.ua-banner-sm { padding: .5rem .7rem; font-size: .78rem; margin-bottom: .6rem; }
.ua-icon { font-size: 1.3rem; line-height: 1; }
.ua-note { display: block; color: #6b5b8f; font-size: .8rem; margin-top: .15rem; }
.ua-context { border-color: var(--ua-border); }
.ua-context blockquote { font-size: .95rem; }
.ua-text { font-family: var(--serif); line-height: 1.75; color: var(--text-3); }
.ua-tag { display: inline-block; margin-left: .4rem; font-size: .68rem; font-weight: 600; color: var(--ua); background: var(--ua-bg); border: 1px solid var(--ua-border); border-radius: 999px; padding: 0 .45rem; vertical-align: .1em; }
.index-row.is-user-added .idx-title { color: var(--ua); }
.term-list a.is-user-added { color: var(--ua); }
.cpanel.is-user-added .cp-title { color: var(--ua); }
.term-link.ua, body .term-link.ua.rep { color: var(--ua); text-decoration: underline dashed; text-underline-offset: 3px; }

/* butonul „Explică” de lângă selecție */
.explain-pop { position: absolute; z-index: 120; display: flex; flex-direction: column; gap: .35rem; max-width: 22rem; }
.explain-btn { font: inherit; font-size: .8rem; font-weight: 600; padding: .35rem .7rem; border-radius: 999px; border: 0; background: var(--ua); color: #fff; box-shadow: 0 4px 14px rgba(60,30,120,.3); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22rem; }
.explain-btn:hover { background: #5a3aa0; }
.explain-btn[disabled] { opacity: .7; cursor: progress; }
.explain-status { background: #fff; border: 1px solid var(--ua-border); border-radius: .6rem; padding: .55rem .75rem; font-size: .8rem; color: #3b2a66; box-shadow: 0 6px 20px rgba(60,30,120,.15); }
.explain-status a { color: var(--ua); font-weight: 600; }
.explain-spin { display: inline-block; width: .8rem; height: .8rem; border: 2px solid var(--ua-border); border-top-color: var(--ua); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -.1rem; margin-right: .35rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.term-def p, .cpanel .cp-def p { margin: 0; }
.term-def p + p, .cpanel .cp-def p + p { margin-top: .5rem; }

/* cod (manuale de programare): blocuri și cod în text */
#reader pre.code-block, .prose pre { background: #f4f6f3; border: 1px solid var(--border); border-radius: .4rem; padding: .7rem .9rem; overflow-x: auto; font-size: .86rem; line-height: 1.45; margin: .6rem 0 1rem; }
#reader pre.code-block code, .prose pre code { background: none; padding: 0; white-space: pre; }
#reader code, .prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: #f1f3ef; padding: .05em .3em; border-radius: .25em; }
