/* ГеоКомпас — стилове
   Идеята: страницата е като физическа карта. Цветовете на класовете идват от
   хипсометричната скала (вода → низина → възвишение), а навигацията е „легенда“. */

/* Шрифтове — качени в сайта (без Google Fonts), лиценз OFL в /fonts */
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-cyrillic-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-cyrillic-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper: #F4F7F6;
  --surface: #FFFFFF;
  --sunken: #E9EFEE;
  --ink: #15283B;
  --ink-soft: #4B5E6E;
  --ink-faint: #7B8C99;
  --line: #D3DEDC;
  --line-strong: #B4C4C2;
  --focus: #2E6DB4;
  --danger: #B3261E;
  --ok: #2D8657;

  /* Класовете — цветове от легендата на физическа карта */
  --g5: #2E6DB4;      /* вода */
  --g6: #2D8657;      /* низина */
  --g7: #B26B12;      /* възвишение */
  --gx: #6B4FA0;      /* специален слой: школи и състезания */
  --g5-tint: #E3EEF8;
  --g6-tint: #E2F1E8;
  --g7-tint: #F7EAD6;
  --gx-tint: #EEE8F6;

  /* Хипсометрични пояси за картата в началото */
  --h-deep: #A9CFE8;
  --h-shallow: #CFE3F2;
  --h-low: #CDE5C5;
  --h-plain: #A9D19A;
  --h-hill: #E8DDA0;
  --h-up: #D9B57A;
  --h-mount: #B98A5B;
  --h-peak: #F4EFE6;
  --h-line: #6E8A86;

  --radius: 10px;
  --radius-lg: 16px;
  --font-display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --font-body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 1px 2px rgba(21, 40, 59, .06), 0 8px 24px -12px rgba(21, 40, 59, .18);
  --wrap: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1A22;
    --surface: #14242E;
    --sunken: #0B151C;
    --ink: #E6EEF0;
    --ink-soft: #A9BAC2;
    --ink-faint: #7F929C;
    --line: #22384A;
    --line-strong: #31495B;
    --focus: #7FB2EA;
    --danger: #F2928A;
    --ok: #7BCB9C;
    --g5: #6FA6E4;
    --g6: #6CC193;
    --g7: #E2A54F;
    --gx: #B39AE0;
    --g5-tint: #15283A;
    --g6-tint: #132B21;
    --g7-tint: #2D2213;
    --gx-tint: #241E33;
    --h-deep: #18344A;
    --h-shallow: #1E4560;
    --h-low: #24463A;
    --h-plain: #2D5A3F;
    --h-hill: #5A5530;
    --h-up: #6A5232;
    --h-mount: #7A5638;
    --h-peak: #C9BFAE;
    --h-line: #8FA9A5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; }
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.noscript { padding: 2rem; text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.6rem); }
h2 { font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); }
h3 { font-size: 1.05rem; font-weight: 500; }
p { margin: 0; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }

/* ---------- Горна лента ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; gap: .25rem; margin-left: .5rem; }
.nav a {
  text-decoration: none; padding: .4rem .7rem; border-radius: 8px; color: var(--ink-soft); font-weight: 500; font-size: .95rem;
  display: inline-flex; align-items: center; gap: .45rem;
}
.nav a:hover { color: var(--ink); background: var(--sunken); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--sunken); }
.nav .dot { width: 9px; height: 9px; border-radius: 2px; background: var(--c, var(--ink-faint)); }
.topbar .spacer { flex: 1; }
.searchbox { position: relative; }
.searchbox input {
  width: 220px; padding: .45rem .8rem .45rem 2.1rem; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; font-size: .92rem;
}
.searchbox svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-faint); pointer-events: none; }
.usermenu { position: relative; }
.userbtn {
  display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); background: var(--surface);
  padding: .3rem .4rem .3rem .3rem; border-radius: 999px; cursor: pointer;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: .8rem;
}
.userbtn .uname { font-size: .9rem; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-count {
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 999px;
  min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center;
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .4rem; display: none;
}
.dropdown.open { display: block; }
.dropdown .who { padding: .5rem .7rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.dropdown .who strong { display: block; }
.dropdown .who span { color: var(--ink-soft); font-size: .85rem; }
.dropdown a, .dropdown button {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  padding: .55rem .7rem; border-radius: 8px; border: 0; background: none; text-decoration: none; cursor: pointer; font-size: .95rem;
}
.dropdown a:hover, .dropdown button:hover { background: var(--sunken); }
.nav .mobile-only { display: none; }
.nav.open .mobile-only { display: inline-flex; }
.page-search { display: flex; gap: .5rem; max-width: 560px; margin-top: 1rem; }
.menu-toggle { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: .4rem .6rem; cursor: pointer; }

@media (max-width: 900px) {
  .nav { display: none; }
  .nav.open {
    display: flex; flex-direction: column; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem 1rem 1rem; margin: 0;
  }
  .nav.open a { padding: .7rem .6rem; }
  .menu-toggle { display: inline-flex; }
  .searchbox input { width: 150px; }
  .userbtn .uname { display: none; }
}
@media (max-width: 520px) {
  .searchbox { display: none; }
  .brand span { font-size: .95rem; }
}

/* ---------- Бутони и форми ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.1rem; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--ink); color: var(--paper); font-weight: 600; text-decoration: none; cursor: pointer;
  font-size: .95rem; line-height: 1.2; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--sunken); filter: none; }
.btn.small { padding: .4rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); filter: none; }

.field { display: grid; gap: .35rem; }
.field label, .field .label { font-weight: 600; font-size: .92rem; }
.field .hint { color: var(--ink-soft); font-size: .85rem; }
.input, select.input {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); font-size: 1rem;
}
.input:focus { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 0; border-color: var(--focus); }
.form { display: grid; gap: 1.1rem; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.error-box { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); padding: .7rem .9rem; border-radius: var(--radius); font-size: .93rem; }
.error-box:empty { display: none; }

.segmented { display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); gap: .4rem; background: var(--sunken); padding: .3rem; border-radius: 12px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  text-align: center; padding: .6rem .5rem; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .95rem; color: var(--ink-soft);
  border: 1px solid transparent;
}
.segmented input:checked + label { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.segmented input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
.segmented.grades label { display: grid; gap: .1rem; }
.segmented.grades label small { font-weight: 500; font-size: .75rem; color: var(--ink-faint); }
.segmented.grades input:checked + label { border-color: var(--c); box-shadow: inset 0 -3px 0 var(--c); }

/* ---------- Начало (без вход) ---------- */
.hero { padding: clamp(2rem, 5vw, 4.5rem) 0 2rem; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.hero h1 { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.6rem); font-weight: 700; letter-spacing: -0.02em; }
.hero .lead { font-size: 1.15rem; color: var(--ink-soft); margin-top: 1.1rem; max-width: 34ch; }
.hero .actions { display: flex; gap: .7rem; margin-top: 1.8rem; flex-wrap: wrap; }
.relief { aspect-ratio: 1.15; width: 100%; }
.relief path { vector-effect: non-scaling-stroke; }
@media (max-width: 820px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .relief { max-width: 460px; justify-self: center; order: -1; }
}

/* Легендата — основният навигационен елемент */
.legend {
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface);
  overflow: hidden;
}
.legend-title { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.legend-title h2 { font-size: 1.05rem; font-weight: 600; }
.legend-title p { color: var(--ink-soft); font-size: .9rem; }
.legend-item {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 1.1rem; align-items: center;
  padding: 1rem 1.25rem; text-decoration: none; border-top: 1px solid var(--line);
}
.legend-title + .legend-item { border-top: 0; }
a.legend-item:hover { background: var(--tint, var(--sunken)); }
.swatch {
  width: 64px; height: 44px; border-radius: 6px; background: var(--c); position: relative; overflow: hidden;
  display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
}
@media (prefers-color-scheme: dark) { .swatch { color: var(--paper); } }
.swatch::after { /* хоризонтали върху мострата */
  content: ''; position: absolute; inset: 0; opacity: .28;
  background: repeating-radial-gradient(circle at 80% 120%, transparent 0 7px, rgba(255,255,255,.9) 7px 8px);
}
.swatch span { position: relative; z-index: 1; }
.legend-item h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.legend-item p { color: var(--ink-soft); font-size: .93rem; margin-top: .15rem; }
.legend-item .meta { color: var(--ink-faint); font-size: .85rem; text-align: right; white-space: nowrap; }
@media (max-width: 560px) {
  .legend-item { grid-template-columns: 48px 1fr; }
  .swatch { width: 48px; height: 40px; font-size: 1.05rem; }
  .legend-item .meta { grid-column: 2; text-align: left; }
}

.section-block { padding: 1.5rem 0 3rem; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem 2.5rem; margin-top: 1.5rem; }
.features div { border-top: 2px solid var(--ink); padding-top: .8rem; }
.features h3 { font-family: var(--font-body); font-weight: 700; font-size: 1rem; }
.features p { color: var(--ink-soft); font-size: .95rem; margin-top: .3rem; }
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }

/* ---------- Табло (след вход) ---------- */
.dash { padding: 2rem 0 3rem; display: grid; gap: 2rem; }
.greet { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.greet p { color: var(--ink-soft); margin-top: .35rem; }
.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .9rem 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-strong);
  border-left: 5px solid var(--danger);
}
.notice.info { border-left-color: var(--focus); }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.2rem 1.25rem; }
.panel h2 { font-size: 1.05rem; margin-bottom: .8rem; }
.linklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .15rem; }
.linklist a { display: block; padding: .5rem .2rem; text-decoration: none; border-bottom: 1px dashed var(--line); }
.linklist a:hover { color: var(--focus); }
.linklist small { display: block; color: var(--ink-faint); }

/* ---------- Страница на клас ---------- */
.grade-head {
  background: var(--tint); border-bottom: 1px solid var(--line); padding: 2rem 0 1.6rem; position: relative; overflow: hidden;
}
.grade-head::after { /* хоризонтали в ъгъла */
  content: ''; position: absolute; right: -120px; top: -160px; width: 460px; height: 460px; pointer-events: none;
  background: repeating-radial-gradient(circle, transparent 0 17px, color-mix(in srgb, var(--c) 30%, transparent) 17px 18px);
  border-radius: 50%; opacity: .7;
  mask-image: radial-gradient(circle, #000 55%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 72%);
}
.grade-head .wrap { position: relative; z-index: 1; }
.grade-head p { color: var(--ink-soft); margin-top: .5rem; max-width: 60ch; }
.grade-head .stats { display: flex; gap: 1.5rem; margin-top: 1rem; color: var(--ink-soft); font-size: .92rem; flex-wrap: wrap; }
.grade-head .stats b { color: var(--ink); font-size: 1.1rem; font-family: var(--font-display); font-weight: 600; margin-right: .25rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: .35rem; font-size: .88rem; color: var(--ink-soft); margin-bottom: .8rem; list-style: none; padding: 0; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs li + li::before { content: '/'; margin-right: .35rem; color: var(--ink-faint); }

.grade-body { display: grid; grid-template-columns: 240px 1fr; gap: 2.5rem; padding: 2rem 0 3rem; align-items: start; }
.toc { position: sticky; top: 80px; }
.toc h2 { font-family: var(--font-body); font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .5rem; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: .35rem .8rem; text-decoration: none; color: var(--ink-soft); font-size: .92rem; margin-left: -2px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--ink); border-left-color: var(--c); }
@media (max-width: 860px) { .grade-body { grid-template-columns: 1fr; } .toc { display: none; } }

.theme { scroll-margin-top: 80px; }
.theme + .theme { margin-top: 2.2rem; }
.theme-head { display: flex; gap: .8rem; align-items: baseline; border-bottom: 2px solid var(--c); padding-bottom: .6rem; }
.theme-head .num { font-family: var(--font-display); font-weight: 700; color: var(--c); font-size: 1.1rem; min-width: 1.6rem; }
.theme-head p { color: var(--ink-soft); font-size: .93rem; margin-top: .2rem; }
.topics { list-style: none; margin: 0; padding: 0; }
.topics a {
  display: grid; grid-template-columns: 3.4rem 1fr auto; gap: .6rem; align-items: baseline;
  padding: .75rem .4rem; border-bottom: 1px solid var(--line); text-decoration: none;
}
.topics a:hover { background: var(--tint); }
.topics .code { font-variant-numeric: tabular-nums; color: var(--c); font-weight: 700; font-size: .9rem; }
.topics .state { font-size: .8rem; color: var(--ink-faint); }
.topics .state.has { color: var(--ok); }

/* ---------- Урок ---------- */
.topic-head { background: var(--tint); border-bottom: 1px solid var(--line); padding: 1.8rem 0 0; }
.topic-head .title-row { display: flex; gap: 1.2rem; align-items: flex-start; }
.topic-head .bigcode {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.6rem, 1rem + 2.4vw, 2.6rem);
  color: var(--c); line-height: 1; padding-top: .1em; font-variant-numeric: tabular-nums;
}
.tabs { display: flex; gap: .2rem; margin-top: 1.6rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; padding: .7rem 1rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; white-space: nowrap;
  border-bottom: 3px solid transparent; font-size: .95rem;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--c); }
.topic-body { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; padding: 2rem 0 3rem; align-items: start; }
@media (max-width: 900px) { .topic-body { grid-template-columns: 1fr; } }
.goals { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem 1.2rem; }
.goals h2 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; margin-bottom: .6rem; }
.goals ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .55rem; }
.goals li { display: grid; grid-template-columns: 14px 1fr; gap: .6rem; font-size: .95rem; }
.goals li::before { content: ''; width: 10px; height: 10px; margin-top: .45em; border: 2px solid var(--c); border-radius: 50%; }
.prose { max-width: 70ch; font-size: 1.05rem; }
.prose > * + * { margin-top: 1em; }
.empty {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 2rem 1.5rem; text-align: center; color: var(--ink-soft);
  display: grid; gap: .6rem; justify-items: center;
}
.empty strong { color: var(--ink); font-size: 1.05rem; }
.empty svg { width: 64px; height: 64px; color: var(--c, var(--ink-faint)); opacity: .8; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.pager a { display: grid; gap: .1rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; background: var(--surface); }
.pager a:hover { border-color: var(--c); }
.pager small { color: var(--ink-faint); }
.pager .next { text-align: right; grid-column: 2; }

/* ---------- Вход и регистрация ---------- */
.auth { display: grid; place-items: start center; padding: clamp(1.5rem, 5vw, 4rem) 1rem 3rem; }
.auth-card { width: min(100%, 460px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.25rem, 4vw, 2rem); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.6rem; }
.auth-card .sub { color: var(--ink-soft); margin: .4rem 0 1.4rem; }
.auth-card .alt { margin-top: 1.2rem; text-align: center; color: var(--ink-soft); font-size: .95rem; }
.pending-map { width: 160px; margin: 0 auto 1rem; }

/* ---------- Връзки ---------- */
.page-head { padding: 2rem 0 1rem; }
.page-head p { color: var(--ink-soft); margin-top: .4rem; max-width: 60ch; }
.links-grid { display: grid; gap: 2rem; padding-bottom: 3rem; }
.links-grid h2 { font-size: 1.05rem; margin-bottom: .6rem; }
.link-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.link-card { display: grid; gap: .25rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.link-card:hover { border-color: var(--ink-soft); }
.link-card .host { color: var(--ink-faint); font-size: .82rem; }
.link-card p { color: var(--ink-soft); font-size: .9rem; }

/* ---------- Потребители ---------- */
.subtabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; }
.subtabs button { border: 1px solid var(--line); background: var(--surface); padding: .45rem .9rem; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-soft); }
.subtabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters .input { width: auto; padding: .45rem .7rem; font-size: .92rem; }
.utable { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.utable th { text-align: left; font-size: .82rem; color: var(--ink-soft); font-weight: 600; padding: .7rem .9rem; background: var(--sunken); }
.utable td { padding: .75rem .9rem; border-top: 1px solid var(--line); vertical-align: middle; font-size: .94rem; }
.utable .email { color: var(--ink-soft); font-size: .85rem; }
.utable .actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.role-tag { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 600; }
.role-tag::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--ink-faint)); }
.class-tag { display: inline-block; font-weight: 700; font-size: .85rem; padding: .1rem .5rem; border-radius: 6px; background: var(--tint); color: var(--c); }
@media (max-width: 760px) {
  .utable, .utable tbody, .utable tr, .utable td { display: block; width: 100%; }
  .utable thead { display: none; }
  .utable tr { border-top: 1px solid var(--line); padding: .6rem .3rem; }
  .utable tr:first-child { border-top: 0; }
  .utable td { border: 0; padding: .2rem .6rem; }
  .utable .actions { justify-content: flex-start; padding-top: .5rem; }
}
.temp-pass { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.3rem; letter-spacing: .08em; background: var(--sunken); padding: .6rem .9rem; border-radius: 8px; text-align: center; user-select: all; }

/* ---------- Диалог ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); padding: 1.4rem; width: min(100% - 2rem, 440px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(14, 26, 34, .45); }
dialog h2 { font-size: 1.15rem; margin-bottom: .6rem; }
dialog .buttons { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }

/* ---------- Търсене ---------- */
.results { list-style: none; padding: 0; margin: 0 0 3rem; display: grid; gap: .5rem; }
.results a { display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: center; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.results a:hover { border-color: var(--c); }

/* ---------- Известие ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%); background: var(--ink); color: var(--paper);
  padding: .7rem 1.1rem; border-radius: 10px; font-weight: 500; z-index: 60; max-width: calc(100% - 2rem);
  visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .25s ease; }

.footer { border-top: 1px solid var(--line); padding: 1.4rem 0; color: var(--ink-faint); font-size: .85rem; }
.footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.loading { padding: 4rem 0; text-align: center; color: var(--ink-faint); }

/* Цветове по клас — задават се с data-c */
[data-c="5"] { --c: var(--g5); --tint: var(--g5-tint); }
[data-c="6"] { --c: var(--g6); --tint: var(--g6-tint); }
[data-c="7"] { --c: var(--g7); --tint: var(--g7-tint); }
[data-c="x"] { --c: var(--gx); --tint: var(--gx-tint); }

/* Еднократната анимация в началото: хоризонталите се „изчертават“ */
.relief .ring { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.4s cubic-bezier(.4,0,.2,1) forwards; animation-delay: calc(var(--i) * 110ms); }
.relief .fill { opacity: 0; animation: fade .8s ease forwards; animation-delay: calc(var(--i) * 110ms + 300ms); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .relief .ring, .relief .fill { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .toast { transition: none; }
}

@media print {
  .topbar, .tabs, .pager, .footer, .toc { display: none !important; }
  body { background: #fff; color: #000; }
}

/* Unbounded е широк — ползваме го само за големите заглавия; малките са с Onest */
.legend-item h3, .legend-title h2, .panel h2, dialog h2, .links-grid h2, .theme-head h2 {
  font-family: var(--font-body); font-weight: 700; letter-spacing: 0;
}
.theme-head h2 { font-size: 1.25rem; }
@media (max-width: 900px) { .topic-body .goals { order: -1; } }
.topic-head h1 { font-size: clamp(1.3rem, 1rem + 1.8vw, 2.2rem); }

/* ---------- Материали ---------- */
.side { display: grid; gap: 1.5rem; align-content: start; }
.muted { color: var(--ink-soft); font-size: .93rem; }
.opt { font-weight: 400; color: var(--ink-faint); }
textarea.input { resize: vertical; min-height: 3.2rem; line-height: 1.45; }

.mats { border-radius: var(--radius-lg); transition: background-color .15s ease, outline-color .15s ease; outline: 2px dashed transparent; outline-offset: 6px; }
.mats.dragging { outline-color: var(--c, var(--focus)); background: var(--tint, var(--sunken)); }
.mats-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.drop-hint { color: var(--ink-faint); font-size: .88rem; }
@media (hover: none) { .drop-hint { display: none; } }

.mat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.mat {
  display: grid; grid-template-columns: 3.4rem 1fr auto; gap: .9rem; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem;
}
.mat-body { min-width: 0; display: grid; gap: .2rem; }
.mat-title { font-weight: 600; overflow-wrap: anywhere; }
.mat-desc { color: var(--ink-soft); font-size: .93rem; }
.mat-meta { color: var(--ink-faint); font-size: .84rem; display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; }
.mat-where { font-size: .86rem; color: var(--c); font-weight: 600; text-decoration: none; }
.mat-where:hover { text-decoration: underline; }
.mat-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.mat-actions .btn { min-width: 4.6rem; }
.only-staff { font-size: .76rem; font-weight: 700; color: var(--gx); border: 1px solid color-mix(in srgb, var(--gx) 45%, transparent); border-radius: 6px; padding: 0 .4rem; }

/* Етикет за вида файл — цвят по категория, без иконки */
.ftag {
  display: grid; place-items: center; height: 2.6rem; border-radius: 8px; font-weight: 800; font-size: .74rem; letter-spacing: .02em;
  color: var(--ft); background: color-mix(in srgb, var(--ft) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ft) 35%, transparent);
  --ft: var(--ink-soft);
}
.ftag[data-t="pdf"] { --ft: var(--danger); }
.ftag[data-t="pres"] { --ft: var(--g7); }
.ftag[data-t="doc"] { --ft: var(--g5); }
.ftag[data-t="sheet"], .ftag[data-t="img"] { --ft: var(--g6); }
.ftag[data-t="media"], .ftag[data-t="link"] { --ft: var(--gx); }
.ftag[data-t="map"] { --ft: var(--h-line); }

.mat-list.compact .mat { grid-template-columns: 2.8rem 1fr; padding: .7rem .8rem; gap: .7rem; }
.mat-list.compact .ftag { height: 2.2rem; font-size: .68rem; }
.mat-list.compact .mat-actions { grid-column: 2; justify-content: flex-start; }
.mat-list.compact .mat-desc { display: none; }

@media (max-width: 640px) {
  .mat { grid-template-columns: 2.8rem 1fr; }
  .ftag { height: 2.2rem; font-size: .68rem; }
  .mat-actions { grid-column: 2; justify-content: flex-start; }
}

.progress { position: relative; height: 2.2rem; border-radius: 8px; background: var(--sunken); overflow: hidden; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--c, var(--focus)) 35%, transparent); transition: width .2s ease; }
.progress .ptext { position: relative; display: grid; place-items: center; height: 100%; font-size: .9rem; font-weight: 600; }
.progress[hidden] { display: none; }
input[type="file"].input { padding: .55rem; }
