﻿:root {
  --bg: #f5f7fb;
  --paper: #ffffff;
  --text: #1f2933;
  --muted: #5b6372;
  --accent: #0b8f87;
  --accent-2: #f2a33a;
  --border: #e2e8f0;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --shadow: 0 18px 36px rgba(20, 29, 53, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top, #eef3ff 0%, #f7f9ff 42%, #ffffff 100%);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.75;
}

html {
  scroll-behavior: smooth;
}

body.dark {
  --bg: #0e131b;
  --paper: #1a2029;
  --text: #e3e8ef;
  --muted: #a4adbb;
  --accent: #27b5a8;
  --accent-2: #f4c06a;
  --border: #2a313d;
  --code-bg: #111824;
  --code-text: #e6ecf5;
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle at top, #151b25 0%, #0f141c 60%, #0e131b 100%);
  color: var(--text);
}

body {
  transition: opacity 0.18s ease, filter 0.18s ease;
}

body.page-fade {
  opacity: 0.6;
  filter: blur(1px);
}

body.dark.page-fade {
  background: radial-gradient(circle at top, #151b25 0%, #0f141c 60%, #0e131b 100%);
  opacity: 0.85;
  filter: blur(1px);
}

/* Scrollbar styling */
body {
  scrollbar-width: thin;
  scrollbar-color: rgba(14, 143, 135, 0.5) transparent;
}

body.dark {
  scrollbar-color: rgba(39, 181, 168, 0.7) transparent;
}

body::-webkit-scrollbar,
nav.toc::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-track,
nav.toc::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb,
nav.toc::-webkit-scrollbar-thumb {
  background: rgba(14, 143, 135, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

body::-webkit-scrollbar-thumb:hover,
nav.toc::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 143, 135, 0.7);
  background-clip: content-box;
}

body.dark::-webkit-scrollbar-thumb,
body.dark nav.toc::-webkit-scrollbar-thumb {
  background: rgba(39, 181, 168, 0.55);
  background-clip: content-box;
}

body.dark::-webkit-scrollbar-thumb:hover,
body.dark nav.toc::-webkit-scrollbar-thumb:hover {
  background: rgba(39, 181, 168, 0.85);
  background-clip: content-box;
}

main {
  max-width: 1120px;
  margin: 36px auto 80px;
  padding: 38px 46px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  position: relative;
}

.hero {
  padding: 20px 24px 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0b8f87 0%, #1aa39b 60%, #34c6bb 100%);
  color: #ffffff;
  margin-bottom: 24px;
}

body.dark .hero {
  background: linear-gradient(135deg, #0f5f5a 0%, #0c756f 60%, #14968c 100%);
}

.hero h1 {
  margin: 0 0 8px;
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", "Fira Code", "Courier New", monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero p { margin: 0; color: #e6ecff; }

.toc {
  margin: 18px 0 18px;
  padding: 12px 16px;
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  background: #f5f7ff;
}

.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toc-fav-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #dbe4ff;
  background: #ffffff;
  color: #93a3c6;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s ease, color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.toc-fav-toggle:hover {
  transform: scale(1.06);
  border-color: #b7c6ee;
  color: #7c93c7;
}

.toc-fav-toggle[aria-pressed="true"] {
  color: #f2a33a;
  border-color: #f6c27d;
  background: #fff5e6;
}

.toc-empty {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed #dbe4ff;
  background: #ffffff;
  color: var(--muted);
  font-weight: 600;
}

.toc-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

@keyframes cuvant-fade {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.toc-grid > .toc-card:first-child {
  grid-column: 1 / -1;
  padding: 20px 24px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460, #533483, #0f3460, #16213e, #1a1a2e);
  background-size: 300% 300%;
  animation: cuvant-fade 10s ease infinite;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 52, 96, 0.25);
}

body.dark .toc-grid > .toc-card:first-child {
  background: linear-gradient(135deg, #0d0d1a, #111828, #0c2a4d, #3b1f6e, #0c2a4d, #111828, #0d0d1a);
  background-size: 300% 300%;
  animation: cuvant-fade 10s ease infinite;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.toc-grid > .toc-card:first-child .toc-nr {
  display: none;
}

.toc-grid > .toc-card:first-child .toc-title {
  font-family: "Georgia", serif;
  font-size: 1.25rem;
  color: #ffffff;
}

.toc-grid > .toc-card:first-child .toc-sub {
  color: rgba(255, 255, 255, 0.7);
}

.toc-grid > .toc-card:first-child:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(15, 52, 96, 0.35);
  animation-duration: 4s;
}

body.dark .toc-grid > .toc-card:first-child:hover {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
}

.toc-grid > .toc-card:first-child .toc-bookmark {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
}

.toc-grid > .toc-card:first-child.is-bookmarked .toc-bookmark {
  color: #ffd966;
  border-color: rgba(255, 217, 102, 0.5);
  background: rgba(255, 217, 102, 0.15);
}

/* ── Special treatment for Cuvânt înainte (00.html) ── */
.toc-grid > .toc-card[href="Chapter/00.html"] {
  grid-column: 1 / -1;
  padding: 22px 26px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #0a4f4a, #0e6e64, #14a89f, #27b5a8, #14a89f, #0e6e64, #0a4f4a);
  background-size: 300% 300%;
  animation: cuvant-fade 12s ease infinite;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(20, 168, 159, 0.22);
  position: relative;
  overflow: hidden;
}

body.dark .toc-grid > .toc-card[href="Chapter/00.html"] {
  background: linear-gradient(135deg, #042f2c, #0a4a44, #0f7870, #14a89f, #0f7870, #0a4a44, #042f2c);
  background-size: 300% 300%;
  animation: cuvant-fade 12s ease infinite;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.toc-grid > .toc-card[href="Chapter/00.html"]::after {
  content: "\201E Trebuie să învățăm să învățăm. \201C";
  position: absolute;
  right: 26px;
  bottom: 14px;
  font-family: "Georgia", serif;
  font-style: italic;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.02em;
  pointer-events: none;
}

.toc-grid > .toc-card[href="Chapter/00.html"] .toc-nr {
  display: none;
}

.toc-grid > .toc-card[href="Chapter/00.html"] .toc-title {
  font-family: "Georgia", serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.toc-grid > .toc-card[href="Chapter/00.html"] .toc-sub {
  color: rgba(255, 255, 255, 0.7);
}

.toc-grid > .toc-card[href="Chapter/00.html"]:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(20, 168, 159, 0.32);
  animation-duration: 5s;
}

body.dark .toc-grid > .toc-card[href="Chapter/00.html"]:hover {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
}

.toc-grid > .toc-card[href="Chapter/00.html"] .toc-bookmark {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

.toc-grid > .toc-card[href="Chapter/00.html"].is-bookmarked .toc-bookmark {
  color: #ffd966;
  border-color: rgba(255, 217, 102, 0.5);
  background: rgba(255, 217, 102, 0.15);
}

@media (max-width: 600px) {
  .toc-grid > .toc-card[href="Chapter/00.html"]::after {
    display: none;
  }
}


/* ── Folder groups on index ── */
.toc-folder {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(11, 143, 135, 0.04) 0%, rgba(255, 255, 255, 0.6) 100%);
  padding: 0;
  margin-top: 4px;
  overflow: visible;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.toc-folder-head {
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.toc-folder.is-collapsed .toc-folder-head {
  border-radius: 16px;
}

.toc-folder:hover {
  border-color: rgba(11, 143, 135, 0.3);
  box-shadow: 0 8px 24px rgba(11, 143, 135, 0.08);
}

body.dark .toc-folder {
  border-color: #2a313d;
  background: linear-gradient(135deg, rgba(39, 181, 168, 0.05) 0%, rgba(26, 33, 45, 0.7) 100%);
}

body.dark .toc-folder:hover {
  border-color: rgba(39, 181, 168, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.toc-folder-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(90deg, rgba(11, 143, 135, 0.08) 0%, transparent 60%);
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.toc-folder:not(.is-collapsed) .toc-folder-head {
  border-bottom-color: var(--border);
}

.toc-folder-head:hover {
  background: linear-gradient(90deg, rgba(11, 143, 135, 0.12) 0%, transparent 60%);
}

body.dark .toc-folder-head {
  background: linear-gradient(90deg, rgba(39, 181, 168, 0.08) 0%, transparent 60%);
}

body.dark .toc-folder-head:hover {
  background: linear-gradient(90deg, rgba(39, 181, 168, 0.14) 0%, transparent 60%);
}

.toc-folder-icon {
  font-size: 0.85rem;
  color: var(--accent);
  transition: transform 0.25s ease;
}

.toc-folder.is-collapsed .toc-folder-icon {
  transform: rotate(-90deg);
}

.toc-folder-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.toc-folder-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: auto;
  background: rgba(11, 143, 135, 0.08);
  border: 1px solid rgba(11, 143, 135, 0.15);
  padding: 2px 10px;
  border-radius: 999px;
}

body.dark .toc-folder-count {
  background: rgba(39, 181, 168, 0.1);
  border-color: rgba(39, 181, 168, 0.2);
}

.toc-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
  max-height: 2000px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
}

.toc-folder.is-collapsed .toc-folder-grid {
  max-height: 0;
  opacity: 0;
  padding: 0 14px;
}

.toc-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--toc-border, #dbe4ff);
  background: #ffffff;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 6px 16px rgba(31, 77, 184, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  position: relative;
}

.toc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(31, 77, 184, 0.16), 0 0 0 2px var(--accent);
}

.toc-nr {
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}

.toc-title {
  font-weight: 700;
}

.toc-bookmark {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #dbe4ff;
  background: #f7f9ff;
  color: #c6d1ea;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s ease, color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.toc-bookmark:hover {
  transform: scale(1.06);
  border-color: #b7c6ee;
  color: #7c93c7;
}

.toc-card.is-bookmarked .toc-bookmark {
  color: #f2a33a;
  border-color: #f6c27d;
  background: #fff5e6;
}

.toc-sub {
  color: var(--muted);
  font-size: 0.95rem;
}

#TOC ul {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

#TOC li { margin: 0; }

#TOC a {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #dbe4ff;
  background: #ffffff;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 6px 16px rgba(31, 77, 184, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#TOC a:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(31, 77, 184, 0.16);
}

.content h1, .content h2, .content h3, .content h4 {
  color: var(--accent);
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.content h2,
.content h3,
.content h4 {
  margin-top: 32px;
}

.content h2 + p,
.content h3 + p,
.content h4 + p {
  margin-top: 8px;
}

.content p {
  margin: 14px 0;
}

.content h3, .content h4 {
  color: #0f172a;
  border-left: 4px solid var(--accent-2);
  padding-left: 10px;
}

body.dark .content h3,
body.dark .content h4 {
  color: #cbd5e1;
}

hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

body.dark hr {
  border-top-color: #2a313d;
}

blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  background: #f7f8ff;
  border-left: 6px solid var(--accent);
  border-radius: 10px;
  color: var(--muted);
  font-style: italic;
  position: relative;
}

blockquote.quote {
  padding: 18px 20px 18px 44px;
}

blockquote.quote::before {
  content: "\201C";
  position: absolute;
  top: -4px;
  left: 14px;
  font-size: 2.8rem;
  color: var(--accent);
  opacity: 0.3;
  font-family: Georgia, serif;
  line-height: 1;
}

body.dark blockquote {
  background: #151c28;
}

.hint {
  margin: 16px 0;
  padding: 10px 14px 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(11, 143, 135, 0.25);
  background: linear-gradient(90deg, rgba(10, 177, 166, 0.363) 0%, rgba(255, 255, 255, 0.9) 55%);
  box-shadow: 0 8px 16px rgba(11, 143, 135, 0.1);
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.hint::before {
  content: "💡";
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  background: rgba(11, 143, 135, 0.15);
  color: #0b6f68;
  border: 1px solid rgba(11, 143, 135, 0.35);
  margin-top: 2px;
}

.hint > :first-child { margin-top: 0; }
.hint > :last-child { margin-bottom: 0; }

/* Toate elementele-copil (in afara de iconita ::before) stau in coloana 2 */
.hint > * {
  grid-column: 2;
}

body.dark .hint {
  border-color: rgba(39, 181, 168, 0.4);
  background: linear-gradient(90deg, rgba(39, 181, 168, 0.18) 0%, rgba(24, 35, 44, 0.95) 70%);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

body.dark .hint::before {
  color: #9ae6df;
  background: rgba(39, 181, 168, 0.2);
  border-color: rgba(39, 181, 168, 0.45);
}

/* ── Autor: notă personală a autorului (autor![ ... ]autor!) ── */
.autor {
  margin: 18px 0;
  padding: 14px 18px 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(242, 163, 58, 0.3);
  border-left: 3px solid var(--accent-2);
  background:
    radial-gradient(circle at top left, rgba(242, 163, 58, 0.18) 0%, transparent 40%),
    linear-gradient(135deg, rgba(242, 163, 58, 0.06) 0%, rgba(255, 255, 255, 0.92) 70%);
  box-shadow: 0 6px 16px rgba(242, 163, 58, 0.1);
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  line-height: 1.6;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.autor:hover {
  box-shadow: 0 10px 22px rgba(242, 163, 58, 0.16);
  transform: translateY(-1px);
}

/* Quote mark decorativ în colțul dreapta-jos */
.autor::after {
  content: "\201D";
  position: absolute;
  right: 10px;
  bottom: -34px;
  font-family: "Georgia", serif;
  font-size: 8rem;
  line-height: 1;
  color: rgba(242, 163, 58, 0.15);
  pointer-events: none;
  user-select: none;
}

.autor::before {
  content: "✍️";
  font-size: 1rem;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(242, 163, 58, 0.25), rgba(242, 163, 58, 0.08));
  border: 1px solid rgba(242, 163, 58, 0.45);
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 2px 6px rgba(242, 163, 58, 0.15);
  position: relative;
  z-index: 1;
}

.autor > * {
  grid-column: 2;
  margin: 0;
  position: relative;
  z-index: 1;
}

.autor > p {
  margin: 0;
}

.autor > p:first-of-type {
  font-weight: 700;
  color: #9a6614;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: "Inter", "Segoe UI", sans-serif;
  display: inline-block;
  padding-bottom: 4px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, var(--accent-2), transparent);
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
}

.autor > p:first-of-type strong:first-child {
  font-weight: 700;
}

/* Varianta fără titlu (autornotme!): primul paragraf arată ca orice paragraf normal. */
.autor.no-title > p:first-of-type {
  font-weight: 400;
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: normal;
  text-transform: none;
  font-family: inherit;
  display: block;
  padding-bottom: 0;
  margin-bottom: 0;
  background: none;
}

body.dark .autor.no-title > p:first-of-type {
  color: var(--text);
}

.autor > p + p,
.autor > p + ol,
.autor > p + ul,
.autor > ol,
.autor > ul {
  font-weight: 400;
  color: var(--text);
  font-size: 0.95rem;
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-style: normal;
  line-height: 1.6;
  margin: 6px 0;
}

.autor ol,
.autor ul {
  padding-left: 22px;
}

.autor li {
  margin: 3px 0;
  line-height: 1.55;
}

.autor li > ol,
.autor li > ul {
  margin: 3px 0 6px 0;
}

.autor strong {
  font-style: normal;
  font-weight: 700;
}

.autor code {
  font-style: normal;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.85em;
  padding: 1px 5px;
  background: rgba(242, 163, 58, 0.12);
  border-radius: 3px;
}

body.dark .autor {
  border-color: rgba(244, 192, 106, 0.35);
  border-left-color: var(--accent-2);
  background: linear-gradient(90deg, rgba(244, 192, 106, 0.14) 0%, rgba(24, 35, 44, 0.92) 70%);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

body.dark .autor::before {
  background: rgba(244, 192, 106, 0.18);
  border-color: rgba(244, 192, 106, 0.4);
}

body.dark .autor > p:first-of-type {
  color: var(--accent-2);
}

body.dark .autor > p + p {
  color: var(--text);
}

details.advanced {
  margin: 16px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--paper);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

details.advanced > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, rgba(11, 143, 135, 0.12) 0%, rgba(11, 143, 135, 0.02) 60%);
  border-bottom: 1px solid rgba(11, 143, 135, 0.15);
}

details.advanced > summary::-webkit-details-marker { display: none; }

details.advanced > summary::before {
  content: "▸";
  font-size: 0.95rem;
  transition: transform 0.15s ease;
  color: var(--accent);
}

details.advanced[open] > summary::before {
  transform: rotate(90deg);
}

details.advanced > summary::after {
  content: "Optional";
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(11, 143, 135, 0.12);
  border: 1px solid rgba(11, 143, 135, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
}

details.advanced .advanced-body {
  height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 16px;
  transition: height 0.32s ease, opacity 0.2s ease;
}

details.advanced[open] .advanced-body {
  height: auto;
  padding: 10px 16px 14px;
}

details.advanced .advanced-body > :first-child { margin-top: 0; }
details.advanced .advanced-body > :last-child { margin-bottom: 0; }

details.advanced[open] blockquote,
details.advanced[open] pre,
details.advanced[open] ul,
details.advanced[open] ol {
  margin-left: 0;
  margin-right: 0;
}

details.advanced[open] blockquote {
  margin: 8px 10px 12px 10px;
  padding-left: 14px;
  padding-right: 14px;
}

body.dark details.advanced {
  border-color: #2a313d;
  background: #171e28;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

body.dark details.advanced > summary {
  background: linear-gradient(90deg, rgba(39, 181, 168, 0.18) 0%, rgba(23, 30, 40, 0.96) 60%);
  border-bottom-color: rgba(39, 181, 168, 0.2);
}

body.dark details.advanced > summary::after {
  color: #9ae6df;
  border-color: rgba(39, 181, 168, 0.35);
  background: rgba(39, 181, 168, 0.16);
}

code {
  background: #eef2ff;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", "Fira Code", "Courier New", monospace;
}

body.dark code {
  background: rgba(90, 160, 255, 0.18);
}

pre, pre.sourceCode {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 14px 16px;
  border-radius: 12px;
  overflow-x: auto;
  border: 1px solid #111827;
}

pre code { background: none; padding: 0; color: inherit; }

pre.sourceCode > code > span,
pre.sourceCode > code > span > a {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

pre.sourceCode code span,
pre.sourceCode code span a {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

body.dark pre code {
  background: none !important;
}

body.dark pre.sourceCode code span,
body.dark pre.sourceCode code span a {
  background: transparent !important;
  background-color: transparent !important;
}

.codespace {
  margin: 18px 0;
  border: 1px solid #3a3d41;
  border-radius: 14px;
  background: #2f3134;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(20, 24, 28, 0.35);
  min-height: 140px;
}

body.dark .codespace {
  border-color: #32363c;
  background: #2b2f33;
}

.codespace-top {
  display: flex;
  align-items: center;
  background: #6a6a6a;
  padding: 0;
}

.codespace-tab {
  background: #2c72b1;
  color: #ffffff;
  padding: 8px 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-top-left-radius: 12px;
}

.codespace-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 12px;
  background: #2b2b2b;
  border-top: 1px solid #3a3d41;
}

.codespace-check {
  appearance: none;
  border: 1px solid #2c72b1;
  background: #2c72b1;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.codespace-check:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(44, 114, 177, 0.35);
  background: #2f7fcc;
}

.codespace-check:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.codespace-status {
  color: #d1d5db;
  font-weight: 600;
}

.codespace-status.good { color: #36c27c; }
.codespace-status.bad { color: #f28b82; }

.codespace-hint-btn {
  appearance: none;
  border: 1px solid rgba(244, 192, 106, 0.4);
  background: rgba(244, 192, 106, 0.1);
  color: #f4c06a;
  padding: 6px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
  display: none;
}

.codespace-hint-btn.visible {
  display: inline-block;
}

.codespace-hint-btn:hover {
  background: rgba(244, 192, 106, 0.2);
  transform: translateY(-1px);
}

.codespace-body {
  display: flex;
  border-top: 1px solid #3a3d41;
  align-items: stretch;
  height: 360px;
}

.codespace-body,
.codespace-layer,
.codespace-preview,
.codespace-input,
.codespace-gutter {
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", "Fira Code", "Courier New", monospace;
  font-size: 0.98rem;
  line-height: 1.6;
}

.codespace-gutter {
  width: 52px;
  background: #2b2b2b;
  border-right: 1px solid #3a3d41;
  color: #8a8f98;
  margin: 0;
  padding: 12px 10px;
  text-align: right;
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", "Fira Code", "Courier New", monospace;
  font-size: 0.96rem;
  line-height: 1.6;
  user-select: none;
  white-space: pre;
  overflow: hidden;
  height: 100%;
}

body.dark .codespace-gutter {
  background: #262a2e;
}

.codespace-input {
  width: 100%;
  height: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: #e6e6e6;
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", "Fira Code", "Courier New", monospace;
  font-size: 0.98rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  position: relative;
  z-index: 2;
  overflow: auto;
  display: block;
}

body.dark .codespace-input {
  background: transparent;
  color: transparent;
  caret-color: #e5e7eb;
}

.codespace-input::placeholder {
  color: #a3aab6;
}

.codespace-layer {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.codespace-preview {
  position: absolute;
  inset: 0;
  margin: 0;
  border-radius: 0;
  border: 0;
  background: #2f3134;
  color: #e6e6e6;
  padding: 12px 16px;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  height: 100%;
  width: 100%;
}

.codespace-preview code {
  background: none;
  padding: 0;
  color: inherit;
  display: block;
  white-space: pre;
}

.codespace-preview code span {
  font-weight: 400;
  font-style: normal;
}

.codespace-input,
.codespace-preview,
.codespace-preview code {
  tab-size: 4;
}

.tok-kw { color: #f6b26b; font-weight: 700; }
.tok-type { color: #6fa8dc; }
.tok-lit { color: #93c47d; }
.tok-num { color: #c27ba0; }
.tok-str { color: #ffd966; }
.tok-com { color: #9aa4b2; font-style: italic; }
.tok-pre { color: #76a5af; }
.tok-ns { color: #a4c2f4; }

/* Pandoc code highlighting */
code span.kw { color: #fbbf24; font-weight: 600; }
code span.dt { color: #a5b4fc; }
code span.cf { color: #fbbf24; font-weight: 600; }
code span.st { color: #fca5a5; }
code span.co { color: #94a3b8; font-style: italic; }
code span.dv { color: #c4b5fd; }
code span.im { color: #93c5fd; }
code span.op { color: #e2e8f0; }
code span.an { color: #7dd3fc; }

.table, table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.table th, .table td, table th, table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.table th, table th {
  background: #f3f6ff;
  color: #243b7a;
}

ul, ol { padding-left: 22px; }

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.site-footer {
  margin: 18px auto 28px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  text-align: center;
  gap: 10px 18px;
  font-size: 0.95rem;
  color: var(--muted);
  width: 100%;
}

body.dark .site-footer {
  border-top-color: #2a313d;
  color: #a4adbb;
}

.footer-contact {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  padding: 4px;
}

.discord-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.instagram-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.gmail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.footer-contact::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.footer-contact:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

body.dark .footer-contact::after {
  background: #1b2230;
  color: #e3e8ef;
  border-color: #2a313d;
}

.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid #dbe4ff;
  background: #eef2ff;
  color: var(--accent);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

body.dark .btn {
  border-color: #2a313d;
  background: #1b2230;
}

.btn:hover {
  background: #e0e7ff;
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn.primary:hover { background: #1b43a5; }

.btn.icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn.icon .icon {
  font-size: 1.1rem;
  line-height: 1;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #dbe4ff;
  background: #eef2ff;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  z-index: 1000;
}

.theme-toggle:hover {
  background: #e0e7ff;
  transform: translateY(-1px);
}

body.dark .theme-toggle {
  border-color: #2a313d;
  background: #1b2230;
}

/* Chapter layout with left TOC */
body.chapter .page {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  max-width: 1440px;
  margin: 36px auto 80px;
  padding: 0 16px;
}

body.chapter main {
  max-width: none;
  margin: 0;
}

body.chapter main img {
  display: block;
  max-width: 500px;
  width: 100%;
  height: auto;
  margin: 20px auto;
  border-radius: 8px;
}

body.chapter main figure {
  margin: 20px auto;
  text-align: center;
}

body.chapter main figcaption,
body.chapter main figure > p {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted, #9aa5b8);
  font-style: italic;
  margin-top: 8px;
}

body.chapter .toc {
  grid-column: 1;
  align-self: start;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  border: 1px solid #dbe4ff;
  background: #f6f8ff;
  box-shadow: 0 10px 28px rgba(31, 77, 184, 0.08);
}

body.dark .toc {
  border-color: #2a313d;
  background: #1a212d;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

body.dark .toc-fav-toggle {
  border-color: #2c3547;
  background: #161d28;
  color: #53627a;
}

body.dark .toc-fav-toggle:hover {
  border-color: #3b465d;
  color: #8aa0c6;
}

body.dark .toc-fav-toggle[aria-pressed="true"] {
  color: #f4c06a;
  border-color: #6b4d1e;
  background: #2a2317;
}

body.dark .toc-empty {
  border-color: #2c3547;
  background: #1b2230;
  color: #b7c0cf;
}

body.chapter .toc strong {
  display: block;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

body.dark .toc strong {
  color: #b7c0cf;
}

body.chapter .toc ul {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

body.chapter .toc > ul > li > a {
  font-size: 1rem;
  font-weight: 700;
}

body.chapter .toc a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0e7ff;
  background: #ffffff;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

body.dark .toc a {
  border-color: #2c3547;
  background: #1b2230;
  color: #e3e8ef;
  box-shadow: none;
}

body.dark .toc .toc-card {
  border-color: var(--toc-border, #2c3547);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

body.dark .toc-bookmark {
  border-color: #2c3547;
  background: #161d28;
  color: #53627a;
}

body.dark .toc-bookmark:hover {
  border-color: #3b465d;
  color: #8aa0c6;
}

body.dark .toc-card.is-bookmarked .toc-bookmark {
  color: #f4c06a;
  border-color: #6b4d1e;
  background: #2a2317;
}

body.dark .toc .toc-card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.34), 0 0 0 2px var(--toc-border, #2c3547);
}

body.chapter .toc a:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31, 77, 184, 0.12);
  border-color: #c7d2fe;
}

body.chapter .toc a.toc-active {
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(31, 77, 184, 0.18);
  background: linear-gradient(90deg, #eef2ff 0%, #ffffff 70%);
}

body.dark .toc a.toc-active {
  background: linear-gradient(90deg, rgba(90, 160, 255, 0.28) 0%, rgba(27, 34, 48, 0.95) 70%);
  border-color: #7db1ff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

body.chapter .toc ul ul {
  margin-top: 6px;
  margin-left: 12px;
  gap: 6px;
}

body.chapter .toc ul ul ul {
  display: none;
}

body.chapter .toc ul ul a {
  padding: 8px 10px;
  font-size: 0.95rem;
  border-style: dashed;
  background: #fafbff;
}

body.dark .toc ul ul a {
  border-style: solid;
  background: #171e2a;
  color: #d6dbe6;
}

body.chapter .toc ul ul ul {
  margin-left: 16px;
}

body.chapter .toc ul ul ul a {
  font-size: 0.9rem;
  opacity: 0.9;
}

body.chapter .content {
  grid-column: 2;
  min-width: 0;
}

.toc-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.toc-actions .icon-only {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid #dbe4ff;
  background: #eef2ff;
  color: var(--accent);
  text-decoration: none;
  font-size: 1.1rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

body.dark .toc-actions .icon-only {
  border-color: #2a313d;
  background: #1b2230;
}

.toc-actions .icon-only:hover {
  background: #e0e7ff;
  transform: translateY(-1px);
}

.toc-actions .icon-only.is-disabled {
  opacity: 0.5;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}
 
body.chapter .content h1,
body.chapter .content h2,
body.chapter .content h3,
body.chapter .content h4 {
  scroll-margin-top: 20px;
}

@media (max-width: 700px) {
  body.chapter .page {
    grid-template-columns: 1fr;
  }

  body.chapter .toc,
  body.chapter .content {
    grid-column: 1;
  }

  body.chapter .toc {
    position: static;
    max-height: none;
  }

  body.chapter main {
    margin-top: 0;
  }
}

/* ── Scroll progress bar ── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 9999;
  transition: width 0.05s linear;
  border-radius: 0 2px 2px 0;
}

/* ── Reading time badge ── */
.reading-time {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 2px 10px;
  border-radius: 999px;
  margin-top: 6px;
}

/* ── Chapter difficulty badge (in hero) ── */
.chapter-level-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.chapter-level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 5px 14px;
  border-radius: 10px;
}

.chapter-level::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chapter-level-incepator {
  background: rgba(54, 194, 124, 0.18);
  color: #86efac;
  border: 1px solid rgba(54, 194, 124, 0.35);
}

.chapter-level-incepator::before {
  background: #36c27c;
  box-shadow: 0 0 6px rgba(54, 194, 124, 0.5);
}

.chapter-level-intermediar {
  background: rgba(244, 192, 106, 0.18);
  color: #fde68a;
  border: 1px solid rgba(244, 192, 106, 0.35);
}

.chapter-level-intermediar::before {
  background: #f4c06a;
  box-shadow: 0 0 6px rgba(244, 192, 106, 0.5);
}

.chapter-level-avansat {
  background: rgba(242, 139, 130, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(242, 139, 130, 0.35);
}

.chapter-level-avansat::before {
  background: #f28b82;
  box-shadow: 0 0 6px rgba(242, 139, 130, 0.5);
}

/* ── Back to top button ── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--accent);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

body.dark .back-to-top {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ── Search bar on index ── */
.toc-search {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6372' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.toc-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 143, 135, 0.1);
}

.toc-search::placeholder {
  color: var(--muted);
}

body.dark .toc-search {
  background-color: #1b2230;
  border-color: #2a313d;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a4adbb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

body.dark .toc-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 181, 168, 0.12);
}

/* ── pbinfo link (problema de pe pbinfo.ro) ── */
.pbinfo-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 10px 16px;
  margin: 14px 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(11, 143, 135, 0.06) 0%, rgba(39, 181, 168, 0.12) 100%);
  border: 1px solid rgba(11, 143, 135, 0.25);
  color: var(--text);
  font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  max-width: fit-content;
  position: relative;
}

.pbinfo-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(11, 143, 135, 0.2);
  border-color: rgba(11, 143, 135, 0.5);
  background: linear-gradient(135deg, rgba(11, 143, 135, 0.12) 0%, rgba(39, 181, 168, 0.2) 100%);
  text-decoration: none;
}

.pbinfo-link:active {
  transform: translateY(0);
}

.pbinfo-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #0b6f68;
  color: #fff;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: lowercase;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
}

.pbinfo-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.pbinfo-arrow {
  font-size: 1.1rem;
  color: #0b6f68;
  transition: transform 0.2s ease;
  margin-left: 4px;
}

.pbinfo-link:hover .pbinfo-arrow {
  transform: translateX(4px);
}

body.dark .pbinfo-link {
  background: linear-gradient(135deg, rgba(39, 181, 168, 0.08) 0%, rgba(39, 181, 168, 0.15) 100%);
  border-color: rgba(39, 181, 168, 0.3);
}

body.dark .pbinfo-link:hover {
  background: linear-gradient(135deg, rgba(39, 181, 168, 0.15) 0%, rgba(39, 181, 168, 0.25) 100%);
  border-color: rgba(39, 181, 168, 0.55);
  box-shadow: 0 8px 20px rgba(39, 181, 168, 0.25);
}

body.dark .pbinfo-badge {
  background: #27b5a8;
  color: #0e131b;
}

body.dark .pbinfo-arrow {
  color: #27b5a8;
}

/* ── Info icon on folders ── */
.toc-info-icon {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(39, 181, 168, 0.12);
  border: 1px solid rgba(39, 181, 168, 0.35);
  color: var(--accent);
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  transition: transform 0.12s, background 0.12s;
  flex-shrink: 0;
}

.toc-info-icon:hover {
  transform: scale(1.15);
  background: rgba(39, 181, 168, 0.2);
}

.toc-info-icon::after {
  content: attr(data-info);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  max-width: 320px;
  width: max-content;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-style: normal;
  font-weight: normal;
  font-size: 0.85rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: pre-wrap;
  text-align: left;
  z-index: 10;
}

.toc-info-icon:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Difficulty level badges on cards ── */
.toc-level {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
}

.toc-level-incepator {
  background: rgba(54, 194, 124, 0.15);
  color: #36c27c;
  border: 1px solid rgba(54, 194, 124, 0.3);
}

.toc-level-intermediar {
  background: rgba(244, 192, 106, 0.15);
  color: #f4c06a;
  border: 1px solid rgba(244, 192, 106, 0.3);
}

.toc-level-avansat {
  background: rgba(242, 139, 130, 0.15);
  color: #f28b82;
  border: 1px solid rgba(242, 139, 130, 0.3);
}

body:not(.dark) .toc-level-incepator {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
  border-color: rgba(22, 163, 74, 0.25);
}

body:not(.dark) .toc-level-intermediar {
  background: rgba(202, 138, 4, 0.1);
  color: #ca8a04;
  border-color: rgba(202, 138, 4, 0.25);
}

body:not(.dark) .toc-level-avansat {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.25);
}

/* ── Visited indicator on cards ── */
.toc-card.is-visited .toc-nr::after {
  content: " \2713";
  color: var(--accent);
  font-size: 0.75em;
}

/* ── Copy button on code blocks ── */
.code-copy-wrap {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.12s ease, color 0.12s ease;
  z-index: 5;
}

.code-copy-wrap:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.25);
}

.code-copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Bold visibility ── */
.content strong {
  color: #ffffff;
  font-weight: 700;
}

/* ── PS note ── */
.ps-note {
  margin: 20px 0;
  padding: 14px 18px;
  border-radius: 12px;
  border-left: 3px solid var(--muted);
  background: rgba(164, 173, 187, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.7;
}

.ps-note strong {
  color: var(--text);
  font-style: normal;
}

body.dark .ps-note {
  background: rgba(164, 173, 187, 0.04);
}

/* ── Author card ── */
.author-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 32px 0 8px;
  padding: 24px 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.author-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  opacity: 0.6;
}

.author-name {
  font-family: "Georgia", serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

/* ── AKA signature ── */
.aka {
  display: inline;
  font-family: "Georgia", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 0.92em;
  color: var(--muted);
}

.aka::before {
  content: "aka ";
  font-size: 0.85em;
  font-style: normal;
  opacity: 0.5;
}
body:not(.dark) .content strong {
  color: #0f172a;
}
.content li strong {
  color: #ffffff;
}
body:not(.dark) .content li strong {
  color: #0f172a;
}

/* ═══════════════════════════════════════════
   COLOR PALETTES  (body.palette-*)
   ═══════════════════════════════════════════ */

/* ── Ocean ── */
body.palette-ocean { --accent: #3b82f6; --accent-2: #f59e0b; scrollbar-color: rgba(59,130,246,0.5) transparent; }
body.palette-ocean.dark { --accent: #60a5fa; --accent-2: #fbbf24; scrollbar-color: rgba(96,165,250,0.7) transparent; }
body.palette-ocean .hero { background: linear-gradient(135deg, #1e40af 0%, #3b82f6 60%, #60a5fa 100%); }
body.palette-ocean.dark .hero { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%); }
body.palette-ocean .hint { border-color: rgba(59,130,246,0.25); background: linear-gradient(90deg, rgba(59,130,246,0.15) 0%, rgba(255,255,255,0.9) 55%); }
body.palette-ocean.dark .hint { border-color: rgba(96,165,250,0.4); background: linear-gradient(90deg, rgba(96,165,250,0.18) 0%, rgba(24,35,44,0.95) 70%); }
body.palette-ocean .hint::before { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.35); color: #2563eb; }
body.palette-ocean.dark .hint::before { background: rgba(96,165,250,0.2); border-color: rgba(96,165,250,0.45); color: #93bbfd; }
body.palette-ocean .toc a.toc-active { border-color: var(--accent); background: linear-gradient(90deg, #eff6ff 0%, #fff 70%); }
body.palette-ocean.dark .toc a.toc-active { background: linear-gradient(90deg, rgba(96,165,250,0.28) 0%, rgba(27,34,48,0.95) 70%); border-color: #60a5fa; }
body.palette-ocean.layout-magazine .hero { background: linear-gradient(160deg, #1e3a8a 0%, #2563eb 40%, #3b82f6 80%, #60a5fa 100%); }

/* ── Sunset ── */
body.palette-sunset { --accent: #e11d48; --accent-2: #f59e0b; scrollbar-color: rgba(225,29,72,0.5) transparent; }
body.palette-sunset.dark { --accent: #fb7185; --accent-2: #fbbf24; --bg: #130d14; --paper: #1e1525; --border: #352439; --code-bg: #1a1020; scrollbar-color: rgba(251,113,133,0.7) transparent; background: radial-gradient(circle at top, #1c1520 0%, #170f18 60%, #130d14 100%); }
body.palette-sunset .hero { background: linear-gradient(135deg, #9f1239 0%, #e11d48 50%, #fb7185 100%); }
body.palette-sunset.dark .hero { background: linear-gradient(135deg, #881337 0%, #be123c 50%, #e11d48 100%); }
body.palette-sunset .hint { border-color: rgba(225,29,72,0.25); background: linear-gradient(90deg, rgba(225,29,72,0.12) 0%, rgba(255,255,255,0.9) 55%); }
body.palette-sunset.dark .hint { border-color: rgba(251,113,133,0.4); background: linear-gradient(90deg, rgba(251,113,133,0.15) 0%, rgba(30,21,37,0.95) 70%); }
body.palette-sunset .hint::before { background: rgba(225,29,72,0.15); border-color: rgba(225,29,72,0.35); color: #be123c; }
body.palette-sunset.dark .hint::before { background: rgba(251,113,133,0.2); border-color: rgba(251,113,133,0.45); color: #fda4af; }
body.palette-sunset .toc a.toc-active { border-color: var(--accent); background: linear-gradient(90deg, #fff1f2 0%, #fff 70%); }
body.palette-sunset.dark .toc a.toc-active { background: linear-gradient(90deg, rgba(251,113,133,0.25) 0%, rgba(30,21,37,0.95) 70%); border-color: #fb7185; }
body.palette-sunset.layout-magazine .hero { background: linear-gradient(160deg, #881337 0%, #be123c 40%, #e11d48 80%, #fb7185 100%); }

/* ── Forest ── */
body.palette-forest { --accent: #16a34a; --accent-2: #ca8a04; scrollbar-color: rgba(22,163,74,0.5) transparent; }
body.palette-forest.dark { --accent: #4ade80; --accent-2: #facc15; --bg: #0b120d; --paper: #151e18; --border: #243329; --code-bg: #101a13; scrollbar-color: rgba(74,222,128,0.7) transparent; background: radial-gradient(circle at top, #111c15 0%, #0d150f 60%, #0b120d 100%); }
body.palette-forest .hero { background: linear-gradient(135deg, #15803d 0%, #16a34a 50%, #4ade80 100%); }
body.palette-forest.dark .hero { background: linear-gradient(135deg, #14532d 0%, #15803d 50%, #16a34a 100%); }
body.palette-forest .hint { border-color: rgba(22,163,74,0.25); background: linear-gradient(90deg, rgba(22,163,74,0.12) 0%, rgba(255,255,255,0.9) 55%); }
body.palette-forest.dark .hint { border-color: rgba(74,222,128,0.4); background: linear-gradient(90deg, rgba(74,222,128,0.15) 0%, rgba(21,30,24,0.95) 70%); }
body.palette-forest .hint::before { background: rgba(22,163,74,0.15); border-color: rgba(22,163,74,0.35); color: #15803d; }
body.palette-forest.dark .hint::before { background: rgba(74,222,128,0.2); border-color: rgba(74,222,128,0.45); color: #86efac; }
body.palette-forest .toc a.toc-active { border-color: var(--accent); background: linear-gradient(90deg, #f0fdf4 0%, #fff 70%); }
body.palette-forest.dark .toc a.toc-active { background: linear-gradient(90deg, rgba(74,222,128,0.25) 0%, rgba(21,30,24,0.95) 70%); border-color: #4ade80; }
body.palette-forest.layout-magazine .hero { background: linear-gradient(160deg, #14532d 0%, #15803d 40%, #16a34a 80%, #4ade80 100%); }

/* ── Lavender ── */
body.palette-lavender { --accent: #7c3aed; --accent-2: #ec4899; scrollbar-color: rgba(124,58,237,0.5) transparent; }
body.palette-lavender.dark { --accent: #a78bfa; --accent-2: #f472b6; --bg: #0f0b1a; --paper: #1a1528; --border: #2e2545; --code-bg: #140f20; scrollbar-color: rgba(167,139,250,0.7) transparent; background: radial-gradient(circle at top, #18122b 0%, #130e22 60%, #0f0b1a 100%); }
body.palette-lavender .hero { background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 50%, #a78bfa 100%); }
body.palette-lavender.dark .hero { background: linear-gradient(135deg, #3b0764 0%, #5b21b6 50%, #7c3aed 100%); }
body.palette-lavender .hint { border-color: rgba(124,58,237,0.25); background: linear-gradient(90deg, rgba(124,58,237,0.1) 0%, rgba(255,255,255,0.9) 55%); }
body.palette-lavender.dark .hint { border-color: rgba(167,139,250,0.4); background: linear-gradient(90deg, rgba(167,139,250,0.15) 0%, rgba(26,21,40,0.95) 70%); }
body.palette-lavender .hint::before { background: rgba(124,58,237,0.15); border-color: rgba(124,58,237,0.35); color: #6d28d9; }
body.palette-lavender.dark .hint::before { background: rgba(167,139,250,0.2); border-color: rgba(167,139,250,0.45); color: #c4b5fd; }
body.palette-lavender .toc a.toc-active { border-color: var(--accent); background: linear-gradient(90deg, #f5f3ff 0%, #fff 70%); }
body.palette-lavender.dark .toc a.toc-active { background: linear-gradient(90deg, rgba(167,139,250,0.25) 0%, rgba(26,21,40,0.95) 70%); border-color: #a78bfa; }
body.palette-lavender.layout-magazine .hero { background: linear-gradient(160deg, #3b0764 0%, #5b21b6 40%, #7c3aed 80%, #a78bfa 100%); }

/* ═══════════════════════════════════════════
   LAYOUT: Focus  (body.layout-focus)
   ═══════════════════════════════════════════ */

body.layout-focus.chapter .page {
  display: block;
  max-width: 820px;
  margin: 0 auto 80px;
  padding: 0 24px;
}
body.layout-focus.chapter main {
  max-width: none;
  margin: 36px 0 0;
  padding: 32px 38px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
body.layout-focus .hero { padding: 16px 20px 14px; border-radius: 14px; margin-bottom: 20px; }
body.layout-focus .hero h1 { font-size: 1.7rem; margin-bottom: 4px; }
body.layout-focus .hero p { font-size: 0.88rem; }
body.layout-focus .content { font-size: 1.05rem; line-height: 1.85; }
body.layout-focus .content h1 { font-size: 1.8rem; }
body.layout-focus .content h2 { font-size: 1.4rem; }
body.layout-focus .content h3 { font-size: 1.15rem; }
body.layout-focus .content p { margin: 18px 0; }
body.layout-focus .content blockquote { margin: 20px 0; padding: 14px 20px; border-radius: 14px; font-size: 1.02rem; }
body.layout-focus .content pre,
body.layout-focus .content pre.sourceCode { border-radius: 14px; padding: 16px 20px; font-size: 0.95rem; }

body.layout-focus.chapter .toc {
  position: fixed; bottom: 24px; right: 24px; top: auto; left: auto;
  width: 340px; max-height: 60vh; overflow-y: auto; z-index: 900;
  border-radius: 16px; padding: 14px 16px;
  border: 1px solid var(--border); background: var(--paper);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  transform: translateY(12px); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
body.layout-focus.chapter .toc.toc-open { opacity: 1; transform: translateY(0); pointer-events: auto; }

body.layout-focus .toc-fab {
  display: flex; position: fixed; bottom: 24px; right: 24px;
  width: 52px; height: 52px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--paper); color: var(--accent);
  font-size: 1.3rem; align-items: center; justify-content: center;
  cursor: pointer; z-index: 901;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
body.layout-focus .toc-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 36px rgba(0,0,0,0.4); }
body.layout-focus .toc-fab.toc-fab-active { background: var(--accent); color: #fff; border-color: var(--accent); }
body:not(.layout-focus):not(.layout-magazine) .toc-fab { display: none !important; }
body.layout-focus .toc-actions { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }

@media (max-width: 700px) {
  body.layout-focus.chapter .page { padding: 0 12px; }
  body.layout-focus.chapter main { padding: 20px 18px; margin-top: 20px; }
  body.layout-focus.chapter .toc { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
  body.layout-focus .toc-fab { right: 16px; bottom: 16px; width: 46px; height: 46px; }
}

/* ═══════════════════════════════════════════
   LAYOUT: Magazine  (body.layout-magazine)
   ═══════════════════════════════════════════ */

body.layout-magazine.chapter .page {
  display: block; max-width: 960px; margin: 0 auto 80px; padding: 0 20px;
}
body.layout-magazine.chapter main {
  max-width: none; margin: 36px 0 0; padding: 0;
  background: none; border: none; box-shadow: none; border-radius: 0;
}
body.layout-magazine .hero {
  padding: 40px 36px 32px; border-radius: 24px; margin-bottom: 28px;
  background: linear-gradient(160deg, #0f5f5a 0%, #0c756f 40%, #14968c 80%, #1dbfb0 100%);
  position: relative; overflow: hidden;
}
body.layout-magazine .hero::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(-45deg, transparent, transparent 20px, rgba(255,255,255,0.03) 20px, rgba(255,255,255,0.03) 40px);
  pointer-events: none;
}
body.layout-magazine .hero h1 { font-size: 2.4rem; letter-spacing: -0.5px; margin-bottom: 8px; position: relative; }
body.layout-magazine .hero p { font-size: 1rem; opacity: 0.85; position: relative; }
body:not(.dark).layout-magazine .hero { background: linear-gradient(160deg, #0b8f87 0%, #14b5aa 40%, #28d4c6 80%, #5ae6da 100%); }

body.layout-magazine .content {
  background: var(--paper); border: 1px solid var(--border); border-radius: 20px;
  padding: 36px 40px; box-shadow: var(--shadow); font-size: 1.02rem; line-height: 1.8;
}
body.layout-magazine .content h2 { margin-top: 40px; padding-bottom: 10px; border-bottom: 2px solid var(--accent); font-size: 1.45rem; }
body.layout-magazine .content h3 { border-left: none; padding-left: 0; position: relative; padding-bottom: 6px; }
body.layout-magazine .content h3::after { content: ""; display: block; width: 40px; height: 3px; background: var(--accent-2); border-radius: 2px; margin-top: 6px; }
body.layout-magazine .content h4 { border-left: none; padding-left: 0; }
body.layout-magazine .content blockquote {
  border-left: none; border-radius: 16px; padding: 18px 24px; position: relative;
  background: linear-gradient(135deg, rgba(39,181,168,0.08) 0%, rgba(244,192,106,0.06) 100%);
  border: 1px solid rgba(39,181,168,0.2);
}
body:not(.dark).layout-magazine .content blockquote {
  background: linear-gradient(135deg, rgba(11,143,135,0.06) 0%, rgba(242,163,58,0.04) 100%);
  border-color: rgba(11,143,135,0.2);
}
body.layout-magazine .content blockquote::before {
  content: "\201C"; position: absolute; top: -8px; left: 16px;
  font-size: 3rem; color: var(--accent); opacity: 0.3; font-family: Georgia, serif; line-height: 1;
}
body.layout-magazine .content pre,
body.layout-magazine .content pre.sourceCode { border-radius: 16px; padding: 18px 22px; border: none; box-shadow: inset 0 2px 8px rgba(0,0,0,0.3); }
body.layout-magazine .content .table th,
body.layout-magazine .content table th { background: rgba(39,181,168,0.12); color: var(--accent); border: none; border-bottom: 2px solid var(--accent); }
body.layout-magazine .content .table td,
body.layout-magazine .content table td { border: none; border-bottom: 1px solid var(--border); }

body.layout-magazine.chapter .toc {
  position: fixed; bottom: 24px; right: 24px; top: auto; left: auto;
  width: 360px; max-height: 60vh; overflow-y: auto; z-index: 900;
  border-radius: 16px; padding: 14px 16px;
  border: 1px solid var(--border); background: var(--paper);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  transform: translateY(12px); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
body.layout-magazine.chapter .toc.toc-open { opacity: 1; transform: translateY(0); pointer-events: auto; }

body.layout-magazine .toc-fab {
  display: flex; position: fixed; bottom: 24px; right: 24px;
  width: 52px; height: 52px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--paper); color: var(--accent);
  font-size: 1.3rem; align-items: center; justify-content: center;
  cursor: pointer; z-index: 901;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
body.layout-magazine .toc-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 36px rgba(0,0,0,0.4); }
body.layout-magazine .toc-fab.toc-fab-active { background: var(--accent); color: #fff; border-color: var(--accent); }
body.layout-magazine .toc-actions { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }

@media (max-width: 700px) {
  body.layout-magazine.chapter .page { padding: 0 12px; }
  body.layout-magazine .hero { padding: 28px 22px 22px; }
  body.layout-magazine .hero h1 { font-size: 1.7rem; }
  body.layout-magazine .content { padding: 22px 18px; }
  body.layout-magazine.chapter .toc { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
  body.layout-magazine .toc-fab { right: 16px; bottom: 16px; width: 46px; height: 46px; }
}

/* ============================================================
   Task lists (markdown checkboxes: - [ ] item / - [x] item)
   Pandoc renders these as: <ul class="task-list"><li><label><input type="checkbox"/>text</label></li></ul>
   ============================================================ */

.content ul.task-list {
  list-style: none;
  padding-left: 0.25em;
  margin: 1em 0;
}

.content ul.task-list li {
  position: relative;
  padding: 0.35em 0.5em 0.35em 2em;
  margin: 0.25em 0;
  border-radius: 8px;
  transition: background 0.18s ease, color 0.18s ease;
}

.content ul.task-list li::before { content: none; }

.content ul.task-list li > label {
  display: block;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.content ul.task-list li input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  left: 0.4em;
  top: 0.55em;
  width: 1.15em;
  height: 1.15em;
  margin: 0;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--paper);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  outline: none;
}

.content ul.task-list li input[type="checkbox"]:hover {
  border-color: var(--accent);
}

.content ul.task-list li:hover {
  background: rgba(39, 181, 168, 0.06);
}

body:not(.dark) .content ul.task-list li:hover {
  background: rgba(11, 143, 135, 0.05);
}

.content ul.task-list li input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(39, 181, 168, 0.25);
}

.content ul.task-list li input[type="checkbox"]:active {
  transform: scale(0.9);
}

.content ul.task-list li input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.content ul.task-list li input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: 0.45em;
  height: 0.22em;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: translate(-50%, -65%) rotate(-45deg);
  border-bottom-left-radius: 1px;
}

.content ul.task-list li:has(input[type="checkbox"]:checked) > label {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1.5px;
}

.content ul.task-list li:has(input[type="checkbox"]:checked) {
  background: rgba(39, 181, 168, 0.04);
}

body:not(.dark) .content ul.task-list li:has(input[type="checkbox"]:checked) {
  background: rgba(11, 143, 135, 0.04);
}

/* ============================================================
   User notes block (localStorage-backed at end of 101.md)
   ============================================================ */

.content .user-notes {
  margin: 2.5em 0 1.5em;
  padding: 1.4em 1.6em 1.2em;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.content .user-notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.4em;
  flex-wrap: wrap;
}

.content .user-notes-head h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.content .user-notes-status {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.content .user-notes-status.ok {
  background: rgba(39, 181, 168, 0.18);
  color: var(--accent);
}

body:not(.dark) .content .user-notes-status.ok {
  background: rgba(11, 143, 135, 0.15);
  color: var(--accent);
}

.content .user-notes-status.pending {
  background: rgba(244, 192, 106, 0.2);
  color: #b6841f;
}

body.dark .content .user-notes-status.pending {
  color: var(--accent-2);
}

.content .user-notes-status.err {
  background: rgba(220, 70, 70, 0.18);
  color: #d04545;
}

.content .user-notes-hint {
  margin: 0 0 0.9em;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.content .user-notes textarea[data-notes-textarea] {
  display: block;
  width: 100%;
  min-height: 220px;
  padding: 12px 14px;
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", "Fira Code", "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.content .user-notes textarea[data-notes-textarea]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 181, 168, 0.18);
}

body:not(.dark) .content .user-notes textarea[data-notes-textarea]:focus {
  box-shadow: 0 0 0 3px rgba(11, 143, 135, 0.15);
}

.content .user-notes-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 0.9em;
  flex-wrap: wrap;
}

.content .user-notes-actions button {
  padding: 7px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.content .user-notes-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.content .user-notes-actions button:active {
  transform: scale(0.97);
}

.content .user-notes-actions button.danger:hover {
  border-color: #d04545;
  color: #d04545;
}

@media (max-width: 600px) {
  .content .user-notes {
    padding: 1.1em 1.1em 1em;
  }
  .content .user-notes textarea[data-notes-textarea] {
    min-height: 180px;
    font-size: 0.9rem;
  }
  .content .user-notes-actions {
    justify-content: stretch;
  }
  .content .user-notes-actions button {
    flex: 1;
  }
}

/* ============================================================
   Programa Olimpiadei (pagina interactivă programa.md)
   ============================================================ */

.content .programa-loading,
.content .programa-error {
  padding: 2em;
  text-align: center;
  color: var(--muted);
}
.content .programa-error { color: #d04545; }

.content .programa-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.content .programa-nav-cat {
  margin-top: 1.2em;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.content .programa-nav-clasa {
  padding-bottom: 12px;
}

.content .programa-nav-etapa {
  gap: 0;
  border-bottom: 2px solid var(--border);
  padding: 0;
  margin-bottom: 1.5em;
}

.content .programa-pill {
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.content .programa-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.content .programa-pill:active { transform: scale(0.97); }

.content .programa-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.content .programa-pill-sm {
  padding: 7px 14px;
  font-size: 0.88rem;
}

.content .programa-tab {
  padding: 10px 18px 12px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.content .programa-tab:hover { color: var(--text); }

.content .programa-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.content .programa-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.8em;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}

.content .programa-progress-bar {
  flex: 1;
  min-width: 180px;
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.content .programa-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}

.content .programa-progress-text {
  font-size: 0.92rem;
  color: var(--muted);
  white-space: nowrap;
}

.content .programa-progress-text strong {
  color: var(--accent);
  font-size: 1.05rem;
}

.content .programa-reset {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.content .programa-reset:hover {
  color: #d04545;
  border-color: #d04545;
}

.content .programa-sectiune {
  margin-bottom: 1.8em;
  padding: 1em 1.2em 0.6em;
  background: var(--paper);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
}

.content .programa-sectiune-titlu {
  margin: 0 0 0.7em;
  font-size: 1.08rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.content ul.programa-puncte {
  list-style: none;
  padding: 0;
  margin: 0;
}

.content ul.programa-puncte li.programa-punct {
  position: relative;
  padding: 0.6em 0.5em 0.6em 2.2em;
  margin: 0.15em 0;
  border-radius: 8px;
  transition: background 0.18s ease;
}

.content ul.programa-puncte li.programa-punct::before { content: none; }

.content ul.programa-puncte li.programa-punct:hover {
  background: rgba(39, 181, 168, 0.05);
}

body:not(.dark) .content ul.programa-puncte li.programa-punct:hover {
  background: rgba(11, 143, 135, 0.04);
}

.content ul.programa-puncte li.programa-punct > label {
  display: block;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-weight: 500;
}

.content ul.programa-puncte li.programa-punct input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  left: 0.5em;
  top: 0.85em;
  width: 1.2em;
  height: 1.2em;
  margin: 0;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  outline: none;
}

.content ul.programa-puncte li.programa-punct input[type="checkbox"]:hover {
  border-color: var(--accent);
}

.content ul.programa-puncte li.programa-punct input[type="checkbox"]:active {
  transform: scale(0.9);
}

.content ul.programa-puncte li.programa-punct input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.content ul.programa-puncte li.programa-punct input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: 0.45em;
  height: 0.22em;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: translate(-50%, -65%) rotate(-45deg);
}

.content ul.programa-puncte li.programa-punct.is-done > label {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1.5px;
}

.content ul.programa-puncte li.programa-punct.is-done {
  background: rgba(39, 181, 168, 0.05);
}

.content .programa-lectii {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.4em;
  padding-left: 0;
}

.content a.programa-lectie {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
  color: var(--accent);
  background: rgba(39, 181, 168, 0.1);
  border: 1px solid rgba(39, 181, 168, 0.3);
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

body:not(.dark) .content a.programa-lectie {
  background: rgba(11, 143, 135, 0.08);
  border-color: rgba(11, 143, 135, 0.25);
}

.content a.programa-lectie:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.content .programa-nota {
  margin-top: 0.4em;
  padding: 4px 10px;
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(244, 192, 106, 0.08);
  border-left: 2px solid var(--accent-2);
  border-radius: 3px;
  font-style: italic;
}

.content li.programa-punct.programa-punct-gap > label .programa-punct-text::after {
  content: " •";
  color: var(--accent-2);
  font-weight: 700;
}

@media (max-width: 600px) {
  .content .programa-nav { gap: 6px; }
  .content .programa-pill { padding: 8px 14px; font-size: 0.88rem; }
  .content .programa-pill-sm { padding: 6px 10px; font-size: 0.82rem; }
  .content .programa-progress { padding: 12px 14px; gap: 10px; }
  .content .programa-sectiune { padding: 0.8em 0.9em 0.5em; }
  .content ul.programa-puncte li.programa-punct { padding-left: 2em; }
}
