/* =========================================================================
   Сторінки: головна, вхід, каталог, тема, презентація, тест, результати, профіль
   ========================================================================= */

@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}

/* Візерунок «зошит у клітинку» для градієнтних блоків */
.cta-banner::before,
.auth-aside::before,
.presentation-preview::before,
.slide-cover-deco {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

/* ================= ГОЛОВНА ================= */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(36px, 7vw, 88px) clamp(48px, 7vw, 96px);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 70% 35%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 70% 70% at 70% 35%, #000 10%, transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(40% 50% at 85% 25%, color-mix(in srgb, var(--violet) 14%, transparent), transparent 70%),
    radial-gradient(40% 50% at 5% 0%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 70%),
    radial-gradient(30% 40% at 55% 100%, color-mix(in srgb, #ec4899 7%, transparent), transparent 70%),
    radial-gradient(25% 35% at 100% 90%, color-mix(in srgb, #14b8a6 7%, transparent), transparent 70%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 700;
}

.eyebrow-pill .icon {
  color: var(--primary-ink);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.05rem, 4.8vw, 3.5rem);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

/* М'який вигнутий мазок під словами «крок за кроком»: синьо-фіолетовий градієнт, заокруглені кінці, легке сяйво.
   З'являється плавно, ніби його малюють. Лежить під літерами, не перекриваючи їх. */
.marker {
  --marker-stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 24' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%233a57f5'/%3E%3Cstop offset='1' stop-color='%238b5cf6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M6 15C70 8 170 6 294 11' fill='none' stroke='url(%23g)' stroke-opacity='.18' stroke-width='16' stroke-linecap='round'/%3E%3Cpath d='M6 15C70 8 170 6 294 11' fill='none' stroke='url(%23g)' stroke-width='6.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-image: var(--marker-stroke);
  background-repeat: no-repeat;
  background-size: 100% 0.36em;
  background-position: 0 100%;
  padding-bottom: 0.16em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  animation: marker-draw 0.9s 0.35s var(--ease) both;
}

[data-theme='dark'] .marker {
  --marker-stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 24' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%237b93ff'/%3E%3Cstop offset='1' stop-color='%23b49bff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M6 15C70 8 170 6 294 11' fill='none' stroke='url(%23g)' stroke-opacity='.18' stroke-width='16' stroke-linecap='round'/%3E%3Cpath d='M6 15C70 8 170 6 294 11' fill='none' stroke='url(%23g)' stroke-width='6.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

@keyframes marker-draw {
  from {
    background-size: 0% 0.36em;
  }
}

.hero-lead {
  max-width: 54ch;
  font-size: clamp(1.02rem, 1.5vw, 1.15rem);
  color: var(--text-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-perks {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.92rem;
}

.hero-perks li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-perks .icon {
  width: 18px;
  height: 18px;
  padding: 2px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success-ink);
  stroke-width: 3;
}

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 440px;
}

.hero-glow {
  position: absolute;
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--brand-gradient);
  filter: blur(80px);
  opacity: 0.22;
}

.mock-card {
  position: relative;
  width: min(100%, 420px);
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: rotate(-2deg);
}

.mock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mock-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.mock-label {
  margin-top: 18px;
  color: var(--text-3);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.mock-question {
  margin-top: 6px;
  font-size: 1.04rem;
  font-weight: 700;
}

.mock-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.mock-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-weight: 600;
}

.mock-option b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.85rem;
}

.mock-option.is-picked {
  border-color: var(--success);
  background: var(--success-soft);
}

.mock-option.is-picked b {
  background: var(--success);
  color: #fff;
}

.mock-check {
  margin-left: auto;
  color: var(--success-ink);
  stroke-width: 3;
}

.mock-progress {
  height: 6px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--primary-soft);
}

.mock-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.float-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  animation: float 6s ease-in-out infinite;
}

.float-a {
  top: 6%;
  left: 2%;
}

.float-b {
  bottom: 8%;
  left: 0;
  animation-delay: -2s;
}

.float-b .icon {
  color: var(--warning);
}

.float-c {
  right: 0;
  bottom: 22%;
  animation-delay: -4s;
}

.block {
  padding-block: clamp(48px, 7vw, 88px);
}

.block-tinted {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.block-head {
  max-width: 640px;
  margin-bottom: clamp(24px, 4vw, 36px);
}

.block-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  max-width: none;
}

.block-title {
  margin-top: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.feature-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

/* легке кольорове світло в куті картки */
.feature-card::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 140px;
  background: radial-gradient(110% 100% at 0% 0%, var(--tone-soft-2, transparent), transparent 70%);
  pointer-events: none;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--tone-line, var(--border-strong));
  box-shadow: 0 22px 40px -24px var(--tone-glow, rgba(0, 0, 0, 0.3));
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 6px;
  border-radius: 15px;
  background: var(--tone-grad, var(--primary-soft));
  box-shadow: 0 10px 20px -12px var(--tone-glow, transparent);
  color: #fff;
}

.feature-icon .icon {
  width: 24px;
  height: 24px;
}

.feature-card h3 {
  font-size: 1.08rem;
  font-weight: 800;
}

.feature-card p {
  color: var(--text-2);
  font-size: 0.95rem;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.step {
  padding: 26px;
  border: 1px solid var(--tone-line, var(--border));
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, var(--tone-soft, var(--bg)) 0%, var(--surface) 70%);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.step:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 36px -24px var(--tone-glow, rgba(0, 0, 0, 0.3));
}

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

.step-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--tone-grad, var(--brand-gradient));
  box-shadow: 0 10px 20px -12px var(--tone-glow, transparent);
  color: #fff;
}

.step-icon .icon {
  width: 22px;
  height: 22px;
}

.step-num {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  background: var(--tone-grad, var(--brand-gradient));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.step h3 {
  margin-top: 16px;
  font-size: 1.15rem;
  font-weight: 800;
}

.step p {
  margin-top: 6px;
  color: var(--text-2);
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.level-card {
  position: relative;
  overflow: hidden;
  padding: 26px 24px 24px;
  background: linear-gradient(165deg, var(--lvl-soft) 0%, var(--surface) 65%);
}

.level-card::before,
.test-card::before,
.quiz-intro::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--lvl);
}

.level-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--lvl-ink);
}

.level-card .level-dots i {
  width: 9px;
  height: 9px;
}

.level-card-rank {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.level-card h3 {
  margin-top: 14px;
  font-size: 1.2rem;
  font-weight: 800;
}

.level-card p {
  margin-top: 6px;
  color: var(--text-2);
}

.sections-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.section-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 16px 18px;
  border: 1px solid var(--tone-line, var(--border));
  border-radius: var(--r-lg);
  background: var(--tone-soft, var(--bg));
  color: var(--text);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.section-tile:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--tone, var(--border-strong));
  box-shadow: 0 16px 32px -20px var(--tone-glow, rgba(0, 0, 0, 0.3));
}

/* Значок теми/підтеми: яскравий градієнт кольору теми з білим символом */
.section-icon,
.topic-icon {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 48px;
  height: 48px;
  padding-inline: 8px;
  border-radius: 14px;
  background: var(--tone-grad, var(--brand-gradient));
  color: #fff;
  box-shadow: 0 10px 20px -12px var(--tone-glow, rgba(58, 87, 245, 0.6));
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.section-tile-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.section-tile-num {
  color: var(--tone-ink, var(--primary-ink));
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-tile-title {
  font-weight: 800;
  line-height: 1.3;
}

.section-tile-meta {
  color: var(--text-3);
  font-size: 0.86rem;
  font-weight: 600;
}

.section-tile-meta b {
  color: var(--success-ink);
}

.section-tile-arrow {
  margin-left: auto;
  color: var(--text-3);
  transition: transform 0.2s var(--ease);
}

.section-tile:hover .section-tile-arrow {
  transform: translateX(3px);
}

.cta-banner {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(28px, 5vw, 52px);
  border-radius: var(--r-xl);
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.cta-banner > * {
  position: relative;
}

.cta-banner h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.cta-banner p {
  margin-top: 8px;
  max-width: 52ch;
  opacity: 0.9;
}

/* ================= ВХІД / РЕЄСТРАЦІЯ ================= */

.auth-page {
  padding-block: clamp(24px, 5vw, 56px);
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: clamp(24px, 4vw, 40px);
}

.auth-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.auth-icon .icon {
  width: 24px;
  height: 24px;
}

.auth-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin-top: -8px;
  color: var(--text-2);
}

.auth-switch {
  text-align: center;
  color: var(--text-2);
  font-weight: 600;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 540px;
  padding: 40px;
  border-radius: var(--r-xl);
  background: var(--brand-gradient);
  color: #fff;
}

.auth-aside-formulas > span {
  position: absolute;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  font-size: 1.1rem;
  animation: float 7s ease-in-out infinite;
}

.auth-aside-formulas .fa { top: 9%; left: 8%; }
.auth-aside-formulas .fb { top: 20%; right: 9%; animation-delay: -2s; }
.auth-aside-formulas .fc { top: 36%; left: 18%; animation-delay: -4s; }
.auth-aside-formulas .fd { top: 50%; right: 14%; animation-delay: -1s; }

.auth-aside-content {
  position: relative;
}

.auth-aside-content h2 {
  max-width: 20ch;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  line-height: 1.2;
}

.auth-aside-content ul {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.auth-aside-content li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.auth-aside-content li .icon {
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  stroke-width: 3;
}

/* ================= КАТАЛОГ ================= */

.catalog-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  align-items: end;
  gap: 16px 32px;
}

.catalog-search .search-input {
  min-height: 52px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.search-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text-2);
  font-weight: 600;
}

/* --- Картки тем (Тема 1, Тема 2…) — по 3 в рядку --- */

.section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.section-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 340px;
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--tone-grad, var(--brand-gradient));
  color: #fff;
  box-shadow: 0 18px 36px -22px var(--tone-glow, rgba(58, 87, 245, 0.5));
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

/* Візерунок «зошит у клітинку», що згасає донизу */
.section-card::before,
.section-hero::before,
.topic-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(255, 255, 255, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.13) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(165deg, #000 0%, transparent 80%);
  mask-image: linear-gradient(165deg, #000 0%, transparent 80%);
  pointer-events: none;
}

/* М'яке світло в куті */
.section-card::after,
.section-hero::after {
  content: '';
  position: absolute;
  z-index: -1;
  top: -45%;
  right: -35%;
  width: 85%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.26), transparent 65%);
  pointer-events: none;
}

.section-card:hover {
  text-decoration: none;
  transform: translateY(-5px);
  box-shadow: 0 30px 50px -24px var(--tone-glow, rgba(58, 87, 245, 0.55));
}

/* Великий напівпрозорий символ теми на фоні */
.section-card-glyph {
  position: absolute;
  z-index: -1;
  right: -0.04em;
  bottom: -0.2em;
  color: rgba(255, 255, 255, 0.13);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 9rem;
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
  transform: rotate(-10deg);
  transform-origin: 100% 100%;
  transition: transform 0.45s var(--ease);
  pointer-events: none;
  user-select: none;
}

.section-card:hover .section-card-glyph {
  transform: rotate(-4deg) scale(1.07);
}

.section-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.section-card-icon {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 58px;
  height: 58px;
  padding-inline: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 18px -10px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* «Скляні» бейджі на кольоровому тлі */
.glass-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.glass-badge .icon {
  width: 14px;
  height: 14px;
}

.glass-badge-solid {
  border-color: #fff;
  background: #fff;
  color: oklch(0.42 0.15 var(--h, 268));
}

.section-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.28rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.section-card-num {
  color: rgba(255, 255, 255, 0.78);
}

.section-card-desc {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.93rem;
}

.section-card-list {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* довгі назви обрізаються «…», а не розпирають картку */
  gap: 5px;
}

.section-card-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
  font-weight: 600;
}

.section-card-list li.is-ready {
  background: rgba(255, 255, 255, 0.26);
  color: #fff;
  font-weight: 800;
}

.sub-num {
  flex: none;
  min-width: 2.6em;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sub-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-state {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.is-ready .sub-state {
  opacity: 1;
}

.section-card-list li.sub-more {
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.85rem;
}

.section-card-empty {
  padding: 14px;
  border: 1.5px dashed rgba(255, 255, 255, 0.45);
  border-radius: var(--r-md);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.section-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
}

.section-card-progress {
  display: grid;
  gap: 6px;
  flex-basis: 100%;
}

.section-card .progress-line-head,
.section-hero .progress-line-head {
  color: rgba(255, 255, 255, 0.9);
}

.section-card .progress-line-head b,
.section-hero .progress-line-head b {
  color: #fff;
}

.section-card .meter,
.section-hero .meter {
  --meter-track: rgba(255, 255, 255, 0.25);
  --meter-fill: #fff;
}

.section-card-meta {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.86rem;
  font-weight: 700;
}

.section-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.4);
  color: oklch(0.42 0.15 var(--h, 268));
  font-size: 0.9rem;
  font-weight: 800;
}

.section-card-cta .icon {
  transition: transform 0.2s var(--ease);
}

.section-card:hover .section-card-cta .icon {
  transform: translateX(3px);
}

/* --- Сторінка однієї теми: кольорова шапка --- */

.section-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: clamp(22px, 4vw, 38px);
  border-radius: var(--r-xl);
  background: var(--tone-grad, var(--brand-gradient));
  box-shadow: 0 26px 50px -30px var(--tone-glow, rgba(58, 87, 245, 0.55));
  color: #fff;
}

.section-hero .section-card-glyph {
  font-size: 14rem;
}

.section-hero-icon {
  min-width: 86px;
  height: 86px;
  border-radius: 26px;
  font-size: 1.7rem;
}

.section-hero-text {
  flex: 1;
  min-width: 0;
}

.section-hero .eyebrow {
  color: rgba(255, 255, 255, 0.85);
}

.section-hero .page-title {
  margin-top: 4px;
  color: #fff;
}

.section-hero .page-sub {
  color: rgba(255, 255, 255, 0.9);
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
}

.stat-chip .icon {
  width: 16px;
  height: 16px;
}

.section-hero-progress {
  align-self: center;
  display: grid;
  gap: 10px;
  width: min(100%, 300px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.88rem;
}

.section-hero-progress .btn {
  justify-self: start;
}

.section-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border: 1px solid var(--tone-line, var(--border));
  border-radius: var(--r-lg);
  background: var(--tone-soft, var(--surface));
  color: var(--text);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.pager-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--tone, var(--border-strong));
  box-shadow: 0 14px 28px -18px var(--tone-glow, rgba(0, 0, 0, 0.3));
}

.pager-next {
  align-items: flex-end;
  text-align: right;
}

.pager-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--tone-ink, var(--text-3));
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pager-label .icon {
  width: 15px;
  height: 15px;
}

.pager-title {
  font-weight: 800;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  align-items: start;
  gap: 16px;
}

.topic-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--tone-line, var(--border));
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

a.topic-card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: var(--tone, var(--border-strong));
  box-shadow: 0 24px 40px -24px var(--tone-glow, rgba(0, 0, 0, 0.3));
}

/* Кольорова «обкладинка» підтеми */
.topic-cover {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  height: 120px;
  padding: 14px 16px;
  background: var(--tone-grad, var(--brand-gradient));
  color: #fff;
}

.topic-cover::after {
  content: '';
  position: absolute;
  z-index: -1;
  top: -70%;
  right: -20%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 65%);
  pointer-events: none;
}

.topic-cover-num {
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.topic-cover-glyph {
  position: absolute;
  left: 16px;
  bottom: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.35s var(--ease);
}

a.topic-card:hover .topic-cover-glyph {
  transform: translateY(-3px) scale(1.06);
}

.topic-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 18px;
}

.topic-card-context {
  margin-bottom: -4px;
  color: var(--tone-ink, var(--primary-ink));
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topic-icon-lg {
  min-width: 80px;
  height: 80px;
  border-radius: 24px;
  font-size: 1.6rem;
}

.topic-icon-sm {
  min-width: 44px;
  height: 44px;
  padding-inline: 8px;
  border-radius: 13px;
  font-size: 0.92rem;
}

.topic-card-title {
  font-size: 1.12rem;
  font-weight: 800;
}

.topic-card-summary {
  flex: 1;
  color: var(--text-2);
  font-size: 0.93rem;
}

.topic-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--text-3);
  font-size: 0.86rem;
  font-weight: 700;
}

.topic-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topic-card-meta .icon {
  width: 16px;
  height: 16px;
  color: var(--tone, var(--text-3));
}

.topic-levels {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--tone-soft, var(--surface-2));
}

.topic-level {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.topic-level-label {
  color: var(--text-2);
}

.topic-level-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.topic-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--tone-ink, var(--primary-ink));
  font-size: 0.92rem;
  font-weight: 800;
}

.topic-card-cta .icon {
  transition: transform 0.2s var(--ease);
}

a.topic-card:hover .topic-card-cta .icon {
  transform: translateX(3px);
}

/* Підтема «Скоро»: та сама барва, але пастельна */
.topic-card.is-soon {
  box-shadow: none;
  cursor: default;
}

.topic-card.is-soon .topic-cover {
  background: linear-gradient(140deg, var(--tone-soft, var(--surface-2)) 0%, var(--tone-soft-2, var(--surface-3)) 100%);
  color: var(--tone-ink, var(--text-2));
}

.topic-card.is-soon .topic-cover-glyph {
  text-shadow: none;
  opacity: 0.75;
}

.topic-card.is-soon .topic-cover-num,
.topic-card.is-soon .glass-badge {
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.6);
  color: var(--tone-ink, var(--text-2));
}

[data-theme='dark'] .topic-card.is-soon .topic-cover {
  background: linear-gradient(140deg, oklch(0.34 0.08 var(--h)) 0%, oklch(0.26 0.06 calc(var(--h) + 12)) 100%);
}

[data-theme='dark'] .topic-card.is-soon .topic-cover::after {
  opacity: 0.35;
}

[data-theme='dark'] .topic-card.is-soon .topic-cover-num,
[data-theme='dark'] .topic-card.is-soon .glass-badge {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.topic-card.is-soon .topic-card-title {
  color: var(--text-2);
}

.topic-card-foot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 0.86rem;
  font-weight: 600;
}

.topic-card-foot .icon {
  width: 15px;
  height: 15px;
}

/* ================= ТЕМА ================= */

.topic-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 28px;
  padding: clamp(20px, 4vw, 32px);
}

.topic-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 90% at 0% 0%, var(--tone-soft-2, transparent), transparent 65%);
  pointer-events: none;
}

.topic-hero-main {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

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

.topic-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  letter-spacing: -0.03em;
}

.topic-desc {
  max-width: 62ch;
  color: var(--text-2);
}

.topic-path {
  position: relative;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.topic-path-head,
.progress-line-head,
.test-best-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 700;
}

.topic-path-head b,
.progress-line-head b,
.test-best-head b {
  color: var(--text);
}

.path-steps {
  list-style: none;
  display: grid;
  gap: 9px;
  margin-top: 4px;
}

.path-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 0.93rem;
  font-weight: 700;
}

.path-step-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
}

.path-step.is-started .path-step-mark {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 10px var(--primary);
}

.path-step.is-done {
  color: var(--text);
}

.path-step.is-done .path-step-mark {
  border-color: var(--success);
  background: var(--success);
  box-shadow: none;
  color: #fff;
}

.path-step-mark .icon {
  width: 13px;
  height: 13px;
  stroke-width: 3.2;
}

.topic-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 20px;
}

.presentation-card {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 22px;
  padding: 20px;
}

.presentation-preview {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 180px;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--tone-grad, var(--brand-gradient));
  box-shadow: 0 14px 28px -18px var(--tone-glow, rgba(58, 87, 245, 0.5));
  color: #fff;
}

.presentation-preview:hover {
  text-decoration: none;
}

.presentation-preview > * {
  position: relative;
}

.presentation-preview-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.92;
}

.presentation-preview-title {
  max-width: 12ch;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.2;
}

.presentation-preview-play {
  position: absolute !important;
  right: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  transition: transform 0.2s var(--ease);
}

.presentation-preview:hover .presentation-preview-play {
  transform: scale(1.08);
}

.presentation-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.progress-line {
  display: grid;
  gap: 6px;
  width: 100%;
  margin-block: 2px 6px;
}

.goals-card {
  padding: 22px;
}

.goals-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.goals-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-2);
  font-size: 0.95rem;
}

.goals-list .icon {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  color: var(--success);
  stroke-width: 3;
}

.tests-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.test-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 22px 22px;
}

.test-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.test-card-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.test-card-desc {
  color: var(--text-2);
  font-size: 0.93rem;
}

.test-meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 700;
}

.test-meta li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.test-meta .icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.test-best {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.test-best-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 8px;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 600;
}

.test-best-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 0.86rem;
  font-weight: 600;
}

.test-card.is-soon {
  box-shadow: none;
  opacity: 0.75;
}

/* ================= ПРЕЗЕНТАЦІЯ ================= */

.viewer {
  padding-block: 14px 32px;
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.viewer-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.3;
}

.viewer-topic {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.viewer-count {
  color: var(--text-3);
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.viewer-tools {
  display: flex;
  gap: 4px;
}

.viewer-tools .icon-min,
.is-fullscreen .viewer-tools .icon-max {
  display: none;
}

.is-fullscreen .viewer-tools .icon-min {
  display: block;
}

.viewer-frame {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.viewer-frame:fullscreen {
  padding: clamp(12px, 3vw, 28px);
  background: var(--bg);
}

.viewer-stage {
  position: relative;
  height: min(calc(100vh - var(--header-h) - 190px), 740px);
  min-height: 460px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.viewer-frame:fullscreen .viewer-stage {
  flex: 1;
  height: auto;
  max-height: none;
}

.viewer-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.viewer-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.viewer-seg {
  flex: 1;
  min-width: 6px;
  height: 26px;
  padding: 9px 0;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  background-clip: content-box;
  transition: background-color 0.2s var(--ease);
}

.viewer-seg:hover {
  background-color: var(--border-strong);
}

.viewer-seg.is-done {
  background-color: color-mix(in srgb, var(--primary) 55%, var(--surface));
}

.viewer-seg.is-current {
  background-color: var(--primary);
  padding-block: 7px;
}

.viewer-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-3);
  font-size: 0.84rem;
  font-weight: 600;
}

.outline {
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  z-index: 90;
  width: min(360px, 100vw);
  padding: 16px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: drawer-in 0.25s var(--ease);
}

@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
}

.outline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.outline-head h2 {
  font-size: 1.1rem;
  font-weight: 800;
}

.outline-list {
  list-style: none;
  display: grid;
  gap: 2px;
}

.outline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  text-align: left;
}

.outline-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.outline-item.is-current {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.outline-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.8rem;
  font-weight: 800;
}

.outline-item.is-current .outline-num {
  background: var(--primary);
  color: #fff;
}

/* ---------- Слайди ---------- */

.slide {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100%;
  padding: clamp(22px, 4vw, 48px) clamp(20px, 5vw, 56px);
}

.slide.enter-next {
  animation: slide-next 0.35s var(--ease);
}

.slide.enter-prev {
  animation: slide-prev 0.35s var(--ease);
}

@keyframes slide-next {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}

@keyframes slide-prev {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
}

.slide-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slide-num {
  flex: none;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.slide-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.slide-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 940px;
  font-size: clamp(1rem, 1.35vw, 1.1rem);
}

.slide-cover {
  position: relative;
  overflow: hidden;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;
  background: var(--brand-gradient);
  color: #fff;
}

.slide-cover > :not(.slide-cover-deco) {
  position: relative;
}

.slide-cover-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.86rem;
  font-weight: 700;
}

.slide-cover-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.slide-cover-sub {
  max-width: 58ch;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  opacity: 0.92;
}

.slide-cover-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.slide-chip {
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 1.05rem;
}

.slide-finish {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.slide-finish .slide-cover-title {
  color: var(--text);
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
}

.slide-finish .slide-cover-sub {
  color: var(--text-2);
  opacity: 1;
}

.finish-icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 26px;
  background: var(--accent-soft);
  color: var(--warning-ink);
}

.finish-icon .icon {
  width: 40px;
  height: 40px;
}

.finish-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

/* ---------- Блоки слайдів ---------- */

.b-lead {
  color: var(--text-2);
  font-size: 1.15em;
}

.b-formula {
  padding: 16px 20px;
  border: 1px solid var(--primary-soft-2);
  border-radius: var(--r-lg);
  background: var(--primary-soft);
  text-align: center;
}

.b-formula-tex {
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 1.35em;
}

.b-formula .katex-display {
  margin: 0.2em 0;
}

.b-caption {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 0.9em;
}

.b-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.b-list li {
  position: relative;
  padding-left: 28px;
}

.b-list li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--primary);
  transform: rotate(45deg);
}

.b-list-ordered {
  counter-reset: item;
}

.b-list-ordered li {
  counter-increment: item;
  padding-left: 34px;
}

.b-list-ordered li::before {
  content: counter(item);
  left: 0;
  top: 0.15em;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  transform: none;
  color: #fff;
  font-size: 0.75em;
  font-weight: 800;
}

.b-definition {
  padding: 16px 20px;
  border-left: 4px solid var(--primary);
  border-radius: 4px var(--r-md) var(--r-md) 4px;
  background: var(--surface-2);
}

.b-definition-term {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--primary-ink);
  font-size: 0.78em;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.b-note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--note-line);
  border-radius: var(--r-md);
  background: var(--note-bg);
  font-size: 0.95em;
}

.b-note[data-variant='info'] {
  --note-bg: var(--primary-soft);
  --note-line: var(--primary-soft-2);
  --note-ink: var(--primary-ink);
}

.b-note[data-variant='tip'] {
  --note-bg: var(--accent-soft);
  --note-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --note-ink: var(--warning-ink);
}

.b-note[data-variant='warning'] {
  --note-bg: var(--danger-soft);
  --note-line: var(--danger-line);
  --note-ink: var(--danger-ink);
}

.b-note[data-variant='success'] {
  --note-bg: var(--success-soft);
  --note-line: var(--success-line);
  --note-ink: var(--success-ink);
}

.b-note-icon {
  margin-top: 2px;
  color: var(--note-ink);
}

.b-note-title {
  display: block;
  margin-bottom: 2px;
  color: var(--note-ink);
  font-size: 0.9em;
}

.b-example {
  padding: 16px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
}

.b-example-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-ink);
  font-size: 0.9em;
  font-weight: 800;
}

.b-example-task {
  margin-top: 8px;
  font-size: 1.05em;
  font-weight: 700;
}

.b-steps {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-top: 12px;
  counter-reset: step;
}

.b-steps li {
  position: relative;
  padding-left: 36px;
  counter-increment: step;
}

.b-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1em;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.78em;
  font-weight: 800;
}

.b-answer {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: var(--success-soft);
  font-weight: 700;
}

.b-answer-label {
  color: var(--success-ink);
}

.b-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.b-table {
  width: 100%;
  min-width: 560px;
  font-size: 0.95em;
}

.b-table th {
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8em;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.b-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

/* формула в клітинці таблиці не розривається посередині — таблиця прокручується */
.b-table .katex,
.match-col .katex,
.pair .katex {
  white-space: nowrap;
}

.b-cards {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 12px;
}

.b-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.b-card-title {
  font-size: 1.05em;
  font-weight: 800;
}

.b-card-formula {
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 1.05em;
}

.b-card-formula .katex-display {
  margin: 0.2em 0;
  text-align: left;
}

.b-card-formula .katex-display > .katex {
  text-align: left;
}

.b-card-text {
  color: var(--text-2);
  font-size: 0.95em;
}

.b-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}

.b-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.b-image img {
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.b-image figcaption {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 0.9em;
  text-align: center;
}

.b-image {
  margin: 0;
}

/* ================= ТЕСТ ================= */

.quiz-intro {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(22px, 4vw, 36px);
}

.quiz-intro-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.quiz-intro-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.025em;
}

.quiz-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.fact-label {
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 700;
}

.fact-value {
  font-size: 1.25rem;
  font-weight: 800;
}

.quiz-intro-sub {
  font-size: 1rem;
  font-weight: 800;
}

.quiz-types {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-top: -8px;
}

.quiz-types li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-types li > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.quiz-types .muted {
  font-size: 0.88rem;
  font-weight: 600;
}

.quiz-type-count {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--lvl-soft);
  color: var(--lvl-ink);
  font-weight: 800;
}

.quiz-intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.quiz {
  padding-bottom: 48px;
}

.quiz-topbar {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.quiz-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}

.quiz-topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.quiz-topbar-topic {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 1.02rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.quiz-timer[data-state='warn'] {
  border-color: var(--warning-line);
  background: var(--warning-soft);
  color: var(--warning-ink);
}

.quiz-timer[data-state='danger'] {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger-ink);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 6px var(--danger-soft);
  }
}

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
  padding-top: 24px;
}

.quiz-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.question-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(20px, 4vw, 32px);
}

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

.q-index {
  color: var(--text-2);
  font-weight: 700;
}

.q-index b {
  color: var(--text);
  font-size: 1.1rem;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.q-flag {
  margin-left: auto;
}

.q-flag.is-on {
  background: var(--warning-soft);
  color: var(--warning-ink);
}

.q-instruction {
  color: var(--text-3);
  font-size: 0.88rem;
  font-weight: 700;
}

.q-text {
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  font-weight: 600;
  line-height: 1.65;
}

.q-image {
  margin: 0;
}

.q-image img {
  max-height: 360px;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.q-answer {
  margin-top: 6px;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.option:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.option-letter {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 800;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.option-text {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  font-weight: 600;
}

.option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.option:has(input:checked) .option-letter {
  background: var(--primary);
  color: #fff;
}

.option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.options-review .option {
  cursor: default;
}

.options-review .option:hover {
  border-color: var(--border);
  background: var(--surface);
}

.options-review .option.is-correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.options-review .option.is-correct .option-letter {
  background: var(--success);
  color: #fff;
}

.options-review .option.is-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.options-review .option.is-wrong .option-letter {
  background: var(--danger);
  color: #fff;
}

.option-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.option-tag .icon {
  width: 15px;
  height: 15px;
  stroke-width: 3;
}

.is-correct .option-tag {
  color: var(--success-ink);
}

.is-wrong .option-tag {
  color: var(--danger-ink);
}

.match,
.match-review {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.match-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.match-col {
  list-style: none;
  display: grid;
  align-content: start;
  gap: 8px;
}

.match-col li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-weight: 600;
}

.match-key {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 800;
}

.match-key-letter {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

.match-grid-wrap {
  position: relative;
  overflow-x: auto;
}

.match-grid {
  margin-inline: auto;
  border-spacing: 0;
}

.match-grid th {
  padding: 4px 6px;
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
}

.match-grid td {
  padding: 2px;
  text-align: center;
}

.match-cell {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  cursor: pointer;
}

.match-cell:hover {
  background: var(--surface-2);
}

.match-cell input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.match-cell span {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.match-cell input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.match-cell input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.pairs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid;
  border-radius: var(--r-sm);
  font-weight: 800;
}

.pair .icon {
  width: 16px;
  height: 16px;
  stroke-width: 3;
}

.pair.is-correct {
  border-color: var(--success-line);
  background: var(--success-soft);
  color: var(--success-ink);
}

.pair.is-wrong {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger-ink);
}

.pair-num,
.pair-user {
  color: var(--text);
}

.pair-arrow {
  color: var(--text-3);
}

.pair-correct {
  color: var(--text-2);
  font-weight: 600;
}

.pair-correct b {
  color: var(--success-ink);
}

.short-answer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 440px;
}

.short-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.short-unit {
  color: var(--text-2);
  font-weight: 700;
}

.short-review {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.short-box {
  display: flex;
  flex-direction: column;
  min-width: 170px;
  padding: 10px 16px;
  border: 1.5px solid;
  border-radius: var(--r-md);
}

.short-box span {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.short-box b {
  font-size: 1.2rem;
}

.short-box.is-correct {
  border-color: var(--success-line);
  background: var(--success-soft);
}

.short-box.is-correct span {
  color: var(--success-ink);
}

.short-box.is-wrong {
  border-color: var(--danger-line);
  background: var(--danger-soft);
}

.short-box.is-wrong span {
  color: var(--danger-ink);
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.quiz-side {
  position: sticky;
  top: calc(var(--header-h) + 60px + 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.quiz-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 700;
}

.quiz-side-title {
  font-size: 1rem;
  font-weight: 800;
}

.q-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.q-nav-btn {
  position: relative;
  min-height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.q-nav-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.q-nav-btn.is-done {
  border-color: var(--primary-soft-2);
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.q-nav-btn.is-partial {
  border-color: var(--primary-soft-2);
  background: linear-gradient(135deg, var(--primary-soft) 50%, var(--surface) 50%);
  color: var(--primary-ink);
}

.q-nav-btn.is-current {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  color: var(--text);
}

.q-nav-btn.is-flagged::after {
  content: '';
  position: absolute;
  top: -5px;
  right: -5px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--warning);
}

.q-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 600;
}

.q-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lg {
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
}

.lg-current {
  border: 2px solid var(--primary);
}

.lg-done {
  border-color: var(--primary-soft-2);
  background: var(--primary-soft);
}

.lg-flag {
  border-color: var(--warning);
  border-radius: 50%;
  background: var(--warning);
}

/* ================= РЕЗУЛЬТАТИ ================= */

.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 36px);
  padding: clamp(22px, 4vw, 36px);
}

.result-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.result-main .meter {
  width: 100%;
}

.result-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}

.result-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.025em;
}

.result-score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  margin-top: 6px;
}

.result-percent {
  font-family: var(--font-sans);
  font-size: clamp(3.2rem, 8vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.result-points {
  color: var(--text-2);
  font-size: 1.05rem;
  font-weight: 700;
}

.result-pass {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 700;
}

.result-hero[data-tone='success'] .result-pass .icon { color: var(--success); }
.result-hero[data-tone='primary'] .result-pass .icon { color: var(--primary-ink); }
.result-hero[data-tone='warning'] .result-pass .icon { color: var(--warning); }
.result-hero[data-tone='danger'] .result-pass .icon { color: var(--danger); }

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

.result-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-tile-sm {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.stat-tile-sm .stat-value {
  font-size: 1.5rem;
}

.stat-tile-wide {
  grid-column: 1 / -1;
}

.stat-tile[data-status='correct'] .stat-label .icon { color: var(--success); }
.stat-tile[data-status='partial'] .stat-label .icon { color: var(--warning); }
.stat-tile[data-status='wrong'] .stat-label .icon { color: var(--danger); }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-item {
  --status-color: var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 3vw, 26px) clamp(18px, 3vw, 26px) clamp(18px, 3vw, 26px) calc(clamp(18px, 3vw, 26px) + 4px);
  box-shadow: inset 4px 0 0 var(--status-color), var(--shadow-sm);
}

.review-item[data-status='correct'] { --status-color: var(--success); }
.review-item[data-status='partial'] { --status-color: var(--warning); }
.review-item[data-status='wrong'] { --status-color: var(--danger); }

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

.review-num {
  font-weight: 800;
}

.review-points {
  margin-left: auto;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.explanation {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--r-md);
  background: var(--accent-soft);
}

.explanation summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--warning-ink);
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

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

.explanation summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
}

.explanation[open] summary::after {
  transform: rotate(-135deg);
}

.explanation-body {
  padding: 0 16px 14px;
  line-height: 1.7;
}

/* ================= ПРОФІЛЬ ================= */

.profile-head {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: clamp(20px, 4vw, 28px);
}

.profile-head::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(50% 120% at 100% 0%, color-mix(in srgb, var(--violet) 12%, transparent), transparent 60%);
  pointer-events: none;
}

.profile-head > * {
  position: relative;
}

.profile-head-info {
  flex: 1;
  min-width: 220px;
}

.profile-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: -0.025em;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.progress-list {
  display: flex;
  flex-direction: column;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 1.5fr);
  align-items: center;
  gap: 14px 28px;
  padding-block: 16px;
  border-bottom: 1px solid var(--border);
}

.progress-row:first-child {
  padding-top: 0;
}

.progress-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.progress-topic {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: var(--text);
}

.progress-topic:hover {
  text-decoration: none;
}

.progress-topic:hover .progress-topic-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.progress-topic-title {
  display: block;
  font-weight: 800;
}

.progress-topic-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 0.84rem;
  font-weight: 600;
}

.progress-topic-sub .icon {
  width: 15px;
  height: 15px;
}

.progress-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.progress-level {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.progress-level:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.progress-level-label {
  grid-area: 1 / 1;
  color: var(--text-2);
}

.progress-level-value {
  grid-area: 1 / 2;
  font-variant-numeric: tabular-nums;
}

.progress-level .meter {
  grid-area: 2 / 1 / 3 / 3;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  margin-top: 16px;
}

.settings-appearance {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.settings-appearance [data-slot='theme'] {
  width: 100%;
}

.settings-sep {
  width: 100%;
  height: 1px;
  margin-block: 6px;
  background: var(--border);
}

/* ================= 404 ================= */

.not-found {
  align-items: center;
  text-align: center;
  padding-block: clamp(48px, 10vw, 110px);
}

.not-found .page-sub {
  margin-inline: auto;
}

.nf-code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(5rem, 16vw, 9rem);
  line-height: 1;
  letter-spacing: -0.05em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nf-code span {
  display: inline-block;
  animation: float 4s ease-in-out infinite;
}

/* ================= АДАПТИВНІСТЬ ================= */

@media (max-width: 1080px) {
  .features-grid,
  .kpi-row,
  .section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-appearance {
    grid-column: 1 / -1;
  }

  .tests-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  }

  .presentation-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hero-grid,
  .topic-hero,
  .topic-grid,
  .result-hero,
  .quiz-layout,
  .steps,
  .levels-grid,
  .progress-row,
  .auth-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-grid {
    justify-items: center;
  }

  .catalog-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-hero {
    flex-wrap: wrap;
  }

  .section-hero-progress {
    width: 100%;
  }

  .auth-card {
    width: 100%;
    max-width: 520px;
  }

  .auth-aside {
    display: none;
  }

  .sections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-visual {
    min-height: 400px;
  }

  .quiz-side {
    position: static;
    order: -1;
    padding: 14px;
    gap: 10px;
  }

  .q-nav {
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  }

  .q-legend {
    display: none;
  }

  .viewer-stage {
    height: auto;
    min-height: min(68vh, 560px);
  }

  .slide-cover,
  .slide-finish {
    min-height: min(68vh, 560px);
  }
}

@media (max-width: 640px) {
  .features-grid,
  .sections-grid,
  .settings-grid,
  .section-grid,
  .section-pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-hero {
    flex-direction: column;
  }

  .section-hero-icon {
    min-width: 68px;
    height: 68px;
    border-radius: 20px;
    font-size: 1.35rem;
  }

  .section-hero .section-card-glyph {
    font-size: 9rem;
  }

  .section-card {
    min-height: 0;
  }

  .kpi-row,
  .quiz-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .match-lists,
  .progress-levels {
    grid-template-columns: minmax(0, 1fr);
  }

  .b-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topic-hero-main {
    flex-direction: column;
  }

  .hero-visual {
    min-height: 360px;
  }

  .float-a,
  .float-c {
    display: none;
  }

  .float-b {
    bottom: 0;
  }

  .viewer-controls {
    gap: 8px;
  }

  .quiz-topbar-topic {
    display: none;
  }

  .stat-tile {
    padding: 14px 16px;
  }

  .profile-head-actions,
  .profile-head-actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .b-cards,
  .mock-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-actions .btn {
    width: 100%;
  }
}

/* Точна назва підтеми з програми НМТ (картка підтеми і сторінка підтеми) */
.topic-card-program,
.topic-program {
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.5;
}

.topic-card-program span,
.topic-program span {
  display: block;
  margin-bottom: 2px;
  color: var(--tone-ink, var(--primary-ink));
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.topic-program {
  max-width: 70ch;
  padding: 10px 14px;
  border-left: 3px solid var(--tone, var(--primary));
  border-radius: 4px var(--r-sm) var(--r-sm) 4px;
  background: var(--tone-soft, var(--surface-2));
}
