:root {
  --bg: #f8f2e6;
  --bg-2: #fbf8ef;
  --surface: #fffdf8;
  --surface-soft: #f5f1e6;
  --ink: #102016;
  --ink-2: #183a2b;
  --muted: #687064;
  --line: #e2dac9;
  --line-strong: #cfc4ad;
  --brand: #17482f;
  --brand-dark: #0e3322;
  --brand-soft: #eaf1e5;
  --olive: #64704c;
  --accent: #c8831a;
  --accent-soft: #fbefd6;
  --danger: #b3262f;
  --danger-soft: #fff1f0;
  --shadow: 0 24px 55px rgba(27, 42, 24, .12);
  --shadow-soft: 0 14px 36px rgba(27, 42, 24, .08);
  --radius: 24px;
  --display: "Nunito Sans", "Nunito", "Segoe UI Rounded", "Aptos Display", "Aptos", Calibri, "Segoe UI", Arial, sans-serif;
  --serif: var(--display);
  --sans: "Nunito Sans", "Nunito", "Segoe UI Rounded", "Aptos", Calibri, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 14% 0%, rgba(245, 219, 154, .28) 0, rgba(245, 219, 154, 0) 34%),
    radial-gradient(circle at 100% 16%, rgba(23, 72, 47, .08) 0, rgba(23, 72, 47, 0) 32%),
    linear-gradient(180deg, #fffdf7 0%, var(--bg) 100%);
  color: var(--ink);
  line-height: 1.5;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(16, 32, 22, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(16, 32, 22, .02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.6), rgba(0,0,0,0));
  z-index: -1;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: none; color: var(--brand); }
img { max-width: 100%; display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(14px, 3vw, 36px);
  min-height: 78px;
  padding: 12px clamp(18px, 4vw, 58px);
  background: rgba(255, 252, 245, .88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(207, 196, 173, .62);
  box-shadow: 0 8px 30px rgba(28, 41, 24, .04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -.018em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(20, 61, 40, .10);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { font-size: clamp(22px, 2vw, 31px); }

.main-nav,
.auth-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.main-nav { justify-content: center; }
.main-nav a {
  position: relative;
  padding: 10px 13px;
  border-radius: 999px;
  color: #1c2b1f;
  font-weight: 600;
  font-size: 15px;
}
.main-nav a:hover { background: rgba(23, 72, 47, .07); }
.main-nav a.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 34px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, #1a5638, #3a8b5c);
}
.auth-nav { justify-content: flex-end; }
.hello { color: var(--muted); font-size: 14px; }
.hello-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--muted);
}
.hello-link:hover { background: rgba(23, 72, 47, .07); color: var(--brand-dark); }

.site-main {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 34px clamp(18px, 4vw, 56px) 56px;
}
.site-footer {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 26px clamp(18px, 4vw, 56px) 46px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand strong { display: block; color: var(--ink); font-family: var(--sans); font-weight: 700; font-size: 20px; }
.footer-brand span:not(.footer-logo) { display: block; }
.footer-logo {
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.footer-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-weight: 600; }
.footer-links a:hover { color: var(--brand-dark); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 15px;
  border: 1px solid var(--line);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(20, 35, 25, .05);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(20, 35, 25, .10); color: inherit; }
.btn-primary {
  background: linear-gradient(180deg, #1f5f3f, var(--brand-dark));
  border-color: rgba(14, 51, 34, .88);
  color: #fff;
}
.btn-primary:hover { color: #fff; }
.btn-light { background: rgba(255, 253, 248, .94); color: var(--ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-big { min-height: 58px; padding: 15px 24px; border-radius: 17px; font-size: 16px; }
.btn-small { min-height: 34px; padding: 7px 10px; border-radius: 11px; font-size: 13px; }
.btn-glass {
  color: #fff;
  background: rgba(255, 255, 255, .13);
  border-color: rgba(255,255,255,.28);
  backdrop-filter: blur(10px);
  box-shadow: none;
}
.btn-glass:hover { color: #fff; background: rgba(255,255,255,.19); }

h1, h2, h3 { color: var(--ink); margin-top: 0; }
h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(44px, 7vw, 92px);
  line-height: .98;
  letter-spacing: -.028em;
  margin: 0 0 18px;
}
h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1.05;
  letter-spacing: -.025em;
  margin: 0 0 12px;
}
h3 { margin: 0 0 8px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
p { margin-top: 0; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid #d8e3cf;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 16px;
}
.slim-eyebrow { margin-bottom: 10px; padding: 6px 10px; }
.link-arrow { font-weight: 700; color: var(--brand-dark); }
.link-arrow:hover { color: var(--accent); }

/* Home */
.home-page .site-main { width: min(100%, 1600px); }
.home-hero {
  position: relative;
  min-height: clamp(480px, 62vh, 660px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  border-radius: 38px;
  padding: clamp(32px, 6vw, 74px);
  color: #fff;
  background-image: linear-gradient(90deg, rgba(9, 28, 19, .92) 0%, rgba(9, 28, 19, .72) 44%, rgba(9, 28, 19, .22) 100%), url('../img/hero-gorilla.jpg');
  background-size: cover;
  background-position: center right;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 32px 80px rgba(20, 35, 25, .22);
}
.home-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 8% 16%, rgba(245, 221, 169, .24), transparent 32%);
  pointer-events: none;
}
.home-hero-content, .home-hero-stats { position: relative; z-index: 1; }
.home-hero-content { max-width: 760px; }
.home-hero .eyebrow {
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.25);
  color: #f8e8c6;
}
.home-hero h1 { color: #fff; text-shadow: 0 2px 32px rgba(0,0,0,.25); }
.home-hero p { color: rgba(255,255,255,.84); font-size: clamp(18px, 2vw, 22px); max-width: 720px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.home-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 12px;
  align-self: flex-end;
}
.home-hero-stats span {
  min-width: 150px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.24);
  backdrop-filter: blur(12px);
  color: rgba(255,255,255,.82);
}
.home-hero-stats b { display: block; color: #fff; font-size: 34px; line-height: 1; }

.home-example {
  display: grid;
  grid-template-columns: minmax(300px, .48fr) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
  margin: 34px 0 28px;
}
.home-example-copy,
.home-frame-shell,
.panel,
.sidebar-card,
.empty-state,
.quiz-card,
.timer-card,
.test-sidebar,
.test-frame-wrap,
.features-grid article,
.stats-grid article {
  background: rgba(255, 253, 248, .94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.home-example-copy { padding: clamp(24px, 4vw, 40px); }
.home-example-copy p { color: var(--muted); font-size: 17px; }
.home-frame-shell { overflow: hidden; min-height: 410px; }
.home-frame-topbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf8, #f6f0e4);
}
.home-frame-topbar span { color: var(--accent); font-weight: 700; font-size: 13px; }
.home-frame-topbar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-test-frame { width: 100%; height: 360px; border: 0; display: block; background: #fff; }
.home-frame-empty { display: grid; place-items: center; min-height: 360px; color: var(--muted); font-weight: 700; }
.home-latest-head { margin-top: 36px; }

/* Shared sections */
.section-head,
.page-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 20px;
}
.section-head p,
.page-title-row p { color: var(--muted); margin: 0; }

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.quiz-list { display: grid; gap: 16px; }
.quiz-list.compact .quiz-card { padding: 18px; }

.quiz-card {
  position: relative;
  padding: 26px 28px;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.quiz-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.quiz-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--brand), rgba(200, 131, 26, .64));
  opacity: .72;
}
.quiz-card-flag {
  position: absolute;
  top: -1px;
  right: 22px;
  width: 28px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #efe4ca;
  color: #8e7446;
  clip-path: polygon(0 0,100% 0,100% 100%,50% 78%,0 100%);
  font-size: 13px;
}
.quiz-card-meta {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  padding-right: 42px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.quiz-code { color: var(--accent); font-weight: 700; letter-spacing: .01em; }
.meta-separator { width: 1px; height: 18px; background: var(--line-strong); }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.quiz-card-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-top: 14px;
}
.quiz-card h3 {
  font-family: var(--serif);
  font-size: clamp(23px, 2.2vw, 31px);
  line-height: 1.08;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.quiz-card h3 a { color: var(--ink); }
.quiz-card h3 a:hover { color: var(--brand); }
.quiz-card p { color: #3d493f; margin: 0 0 12px; }
.quiz-tags { margin-top: 10px; }
.category-chip-list { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.category-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #d9e2d3;
  background: #eef3e9;
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 13px;
}
.category-chip:nth-child(3n) { background: #f5ead2; border-color: #eadbbd; color: #5c4724; }
.category-chip:hover { transform: translateY(-1px); border-color: var(--brand); background: #e4efdc; }
.keywords {
  display: inline-flex;
  margin-top: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.score-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #7c4b03;
  border: 1px solid #edd49f;
  font-weight: 700;
  font-size: 13px;
}
.quiz-grid .quiz-card { min-height: 300px; }
.quiz-grid .quiz-card-content { grid-template-columns: 1fr; align-items: start; }
.quiz-grid .card-actions { justify-content: flex-start; margin-top: 4px; }
.quiz-grid .btn { min-height: 42px; padding: 10px 13px; font-size: 14px; }

.features-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.features-grid article,
.stats-grid article { padding: 22px; }
.features-grid p { color: var(--muted); margin-bottom: 0; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-grid span { color: var(--muted); }
.stats-grid b { display: block; font-size: 34px; }

/* Tests page */
.tests-page .site-main { width: min(100%, 1600px); }
.tests-hero-row {
  display: grid;
  grid-template-columns: minmax(330px, .75fr) minmax(460px, 1fr);
  align-items: end;
  gap: clamp(22px, 5vw, 62px);
  margin: 8px 0 30px;
}
.tests-title-block h1 {
  position: relative;
  margin-bottom: 22px;
}
.tests-title-block h1::after {
  content: '';
  display: block;
  width: 118px;
  height: 5px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--accent);
}
.tests-title-block p { max-width: 650px; color: #4c5a4e; font-size: 17px; margin: 0; }
.tests-actions-block {
  display: grid;
  justify-items: end;
  gap: 16px;
}
.search-bar {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  margin: 0;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  background: rgba(255,253,248,.96);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 10px 26px rgba(24, 34, 23, .04);
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #99b79d;
  box-shadow: 0 0 0 4px rgba(23, 72, 47, .09);
}
textarea { resize: vertical; }
label { display: grid; gap: 7px; font-weight: 600; }
legend { font-weight: 700; }
.two-column {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.content-list { min-width: 0; }
.sidebar-card,
.panel { padding: 26px; }
.sidebar-card { position: sticky; top: 96px; }
.sidebar-card h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 20px;
  font-family: var(--sans);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: .18em;
}
.sidebar-card h2::after {
  content: '▥';
  letter-spacing: 0;
  color: var(--brand-dark);
  font-size: 20px;
}
.sidebar-card h3 {
  margin: 28px 0 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.sidebar-help { margin: -8px 0 14px; font-size: 13px; }
.category-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: 0;
  background: transparent;
  margin-bottom: 0;
  color: var(--ink);
  font-weight: 600;
}
.category-pill.active {
  min-height: 54px;
  margin-bottom: 10px;
  border: 1px solid rgba(14, 51, 34, .2);
  border-radius: 15px;
  background: linear-gradient(180deg, #245d3f, var(--brand-dark));
  color: #fff;
  box-shadow: 0 12px 24px rgba(19, 67, 43, .16);
}
.category-pill:hover:not(.active) {
  text-decoration: none;
  background: rgba(23, 72, 47, .07);
  border-radius: 14px;
  border-color: #d4dec9;
}
.category-pill .category-name { min-width: 0; overflow-wrap: anywhere; }
.category-pill.has-children { color: var(--brand-dark); font-weight: 700; }
.category-pill.depth-1 { margin-left: 14px; }
.category-pill.depth-2 { margin-left: 26px; font-size: 14px; }
.category-pill.depth-3,
.category-pill.depth-4,
.category-pill.depth-5 { margin-left: 34px; font-size: 13px; }
.category-pill.depth-1::before,
.category-pill.depth-2::before,
.category-pill.depth-3::before,
.category-pill.depth-4::before,
.category-pill.depth-5::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  width: 8px;
  height: 1px;
  background: #b8b197;
}
.result-summary {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
}
.result-summary strong { color: var(--brand-dark); }

.empty-state { padding: 34px; text-align: center; }
.empty-state p,
.muted { color: var(--muted); }
.flash {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.flash-success { background: var(--brand-soft); border-color: #c4d7b9; color: var(--brand-dark); }
.flash-warning { background: #fff8dd; border-color: #efd68a; color: #6d4a00; }
.flash-error { background: var(--danger-soft); border-color: #f0a0a7; color: var(--danger); }

/* Forms / admin */
.narrow { max-width: 560px; margin: 0 auto; }
.wide { max-width: 980px; }
.form-stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.checkbox-grid {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  background: var(--surface);
}
.checkbox-grid legend { padding: 0 8px; }
.checkbox-grid label,
.inline-check { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.checkbox-grid input,
.inline-check input { width: auto; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.tabs a,
.tabs button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 15px;
  padding: 11px 15px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.tabs a.active,
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.simple-list { display: grid; gap: 10px; }
.simple-list article,
.small-list article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.small-list article { padding: 12px; }
.inline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-actions form { margin: 0; }
.category-admin-list article { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Test page */
body.test-page { overflow-x: hidden; }
.test-page .site-main {
  max-width: none;
  width: 100%;
  padding: clamp(14px, 2vw, 28px) clamp(12px, 2vw, 28px) 30px;
}
.test-page .site-footer { max-width: none; padding-left: clamp(12px, 2vw, 28px); padding-right: clamp(12px, 2vw, 28px); }
.test-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  width: 100%;
  transition: grid-template-columns .2s ease;
}
.test-sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 22px;
  min-width: 0;
  transition: width .2s ease, padding .2s ease;
}
.test-sidebar h1 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: -.025em;
}
.back-link { font-weight: 700; display: inline-block; margin-bottom: 14px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.tag {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #c8d7bc;
  font-weight: 600;
  font-size: 13px;
}
.timer-card { box-shadow: none; padding: 16px; margin: 18px 0; }
.label { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .05em; }
.timer-display { font-variant-numeric: tabular-nums; font-size: 38px; font-weight: 700; letter-spacing: -.02em; margin: 8px 0 12px; }
.timer-actions,
.side-actions { display: grid; gap: 8px; }
.status-box { min-height: 0; margin-top: 14px; border-radius: 14px; font-weight: 600; }
.status-box:not(:empty) { padding: 12px; border: 1px solid var(--line); background: var(--surface-soft); }
.status-box.success { background: var(--brand-soft); color: var(--brand-dark); border-color: #c4d7b9; }
.status-box.error { background: var(--danger-soft); color: var(--danger); border-color: #f0a0a7; }
.status-box.info { background: #eef6ff; color: #1f4d7a; border-color: #c6ddf6; }
.test-frame-wrap { position: relative; overflow: hidden; min-width: 0; }
.test-frame { width: 100%; min-height: calc(100vh - 118px); border: 0; display: block; background: #fff; }
.sidebar-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37,64,27,.10);
}
.sidebar-toggle:hover { background: var(--brand-soft); }
.test-sidebar-content { transition: opacity .16s ease; }
.test-layout.sidebar-collapsed { grid-template-columns: 58px minmax(0, 1fr); }
.test-layout.sidebar-collapsed .test-sidebar { padding: 10px; overflow: hidden; }
.test-layout.sidebar-collapsed .test-sidebar-content { opacity: 0; visibility: hidden; pointer-events: none; width: 0; height: 0; overflow: hidden; }
.test-layout.sidebar-collapsed .sidebar-toggle { left: 11px; right: auto; top: 12px; }
.share-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}
.share-panel[hidden] { display: none; }
.share-panel a,
.share-panel button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.share-panel a:hover,
.share-panel button:hover { background: var(--brand-soft); }
.test-expand-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(17,34,17,.14);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.test-expand-btn:hover { background: var(--brand-soft); color: var(--brand-dark); transform: translateY(-1px); }
body.frame-expanded-mode { overflow: hidden; }
body.frame-expanded-mode .site-header,
body.frame-expanded-mode .site-footer { visibility: hidden; }
.test-frame-wrap.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #edf4fb;
}
.test-frame-wrap.is-expanded .test-frame { width: 100%; height: 100vh; min-height: 100vh; }
.test-frame-wrap.is-expanded .test-expand-btn { position: fixed; top: 14px; right: 18px; border-radius: 999px; background: #fff; font-size: 34px; }

/* Account / cabinet */
.cabinet-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(135deg, rgba(234,241,229,.92), rgba(255,253,248,.96));
  box-shadow: var(--shadow-soft);
  margin-bottom: 18px;
}
.cabinet-hero h1 { font-size: clamp(36px, 5vw, 60px); }
.cabinet-hero p { color: var(--muted); max-width: 820px; }
.cabinet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0 22px;
}
.cabinet-widget {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,253,248,.96);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.cabinet-widget:hover { transform: translateY(-2px); border-color: var(--line-strong); color: var(--ink); }
.widget-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 17px;
  background: linear-gradient(180deg, var(--brand-soft), #fff8ec);
  border: 1px solid #d8e0d0;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-dark);
}
.widget-body { display: grid; gap: 5px; min-width: 0; }
.widget-body strong { font-size: 20px; letter-spacing: -.02em; }
.widget-body small { color: var(--muted); line-height: 1.35; }
.widget-arrow { margin-left: auto; font-weight: 700; color: var(--brand-dark); }
.cabinet-panel { margin-top: 20px; }
.compact-head { margin-top: 0; }
.cabinet-grid-main { margin-top: 18px; }
.compact-page-title {
  font-size: clamp(32px, 4vw, 50px);
  line-height: 1.02;
  letter-spacing: -.028em;
  margin-bottom: 8px;
}
.cabinet-list { display: grid; gap: 12px; }
.cabinet-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.cabinet-list h3 { margin-bottom: 4px; }
.cabinet-list p { margin: 0; }
.account-panel { margin-top: 6px; }
.account-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.account-info-card {
  display: grid;
  gap: 7px;
  min-height: 120px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}
.account-info-card strong { font-size: 19px; overflow-wrap: anywhere; }
.compact-account-widgets { margin-top: 18px; }

/* Category builders */
.category-picker,
.category-builder {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 14px;
  background: var(--surface-soft);
}
.category-picker legend,
.category-builder legend { padding: 0 8px; }
.category-picker-help,
.category-builder-help { margin: -4px 0 0; font-weight: 600; }
.category-picker-group,
.category-axis-card,
.quick-axis-box,
.single-category-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.category-picker-group h3,
.quick-axis-box h3,
.single-category-box h3 { margin-bottom: 10px; }
.category-picker-options,
.category-builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.category-picker-options-compact { grid-template-columns: 1fr; max-height: 240px; overflow: auto; padding-right: 4px; }
.category-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-weight: 600;
}
.category-check:hover { border-color: #c7d6bd; background: var(--brand-soft); }
.category-check input { width: auto; }
.category-check span { overflow-wrap: anywhere; }
.category-check small { color: var(--muted); font-weight: 600; white-space: nowrap; }
.category-check.depth-1 { margin-left: 12px; }
.category-check.depth-2,
.category-check.depth-3,
.category-check.depth-4 { margin-left: 22px; }
.category-admin-item.depth-1 { margin-left: 14px; }
.category-admin-item.depth-2,
.category-admin-item.depth-3,
.category-admin-item.depth-4 { margin-left: 24px; }
.mini-note {
  display: inline-flex;
  margin-left: 6px;
  padding: 3px 7px;
  border: 1px solid #c8d7bc;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}
.category-admin-layout { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); }
.category-create-panel { display: grid; gap: 18px; }
.quick-axis-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.category-axis-card { display: grid; gap: 12px; }
.category-axis-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.category-axis-head h3 { margin: 0; }
.category-axis-head span {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #c8d7bc;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}
.inline-create-category {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed #c7d6bd;
  border-radius: 16px;
  background: #fbfff8;
}
.inline-create-category small { display: block; }
.empty-inline {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 600;
}

@media (max-width: 1180px) {
  .tests-hero-row { grid-template-columns: 1fr; }
  .tests-actions-block { justify-items: stretch; }
  .two-column { grid-template-columns: 290px minmax(0, 1fr); }
  .quiz-card-content { grid-template-columns: 1fr; }
  .card-actions { justify-content: flex-start; }
  .home-example { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .site-header { grid-template-columns: 1fr; align-items: start; }
  .main-nav { justify-content: flex-start; }
  .auth-nav { justify-content: flex-start; }
  .home-hero { min-height: auto; align-items: flex-start; flex-direction: column; background-position: 65% center; }
  .home-hero-stats { align-self: stretch; }
  .two-column,
  .test-layout,
  .test-layout.sidebar-collapsed,
  .category-admin-layout,
  .category-builder-grid { grid-template-columns: 1fr; }
  .sidebar-card,
  .test-sidebar { position: static; max-height: none; }
  .quiz-grid,
  .features-grid,
  .stats-grid,
  .cabinet-grid,
  .account-info-grid { grid-template-columns: 1fr; }
  .search-bar,
  .form-grid,
  .checkbox-grid,
  .category-picker-options { grid-template-columns: 1fr; }
  .test-page .site-main { padding: 12px; }
  .test-layout.sidebar-collapsed .test-sidebar { padding: 20px; }
  .test-layout.sidebar-collapsed .test-sidebar-content { opacity: 1; visibility: visible; pointer-events: auto; width: auto; height: auto; overflow: visible; }
  .sidebar-toggle { display: none; }
  .test-frame { min-height: 72vh; }
  .cabinet-hero { display: grid; align-items: start; }
  .category-admin-list article,
  .cabinet-list article { align-items: flex-start; flex-direction: column; }
  .category-check small { white-space: normal; }
}

@media (max-width: 640px) {
  .site-main { padding-left: 14px; padding-right: 14px; }
  .site-header { padding-left: 14px; padding-right: 14px; }
  h1 { font-size: clamp(42px, 16vw, 64px); }
  .home-hero { border-radius: 26px; padding: 28px 20px; }
  .home-hero-stats { grid-template-columns: 1fr; }
  .home-example-copy,
  .sidebar-card,
  .panel,
  .quiz-card { padding: 20px; }
  .search-bar .btn { width: 100%; }
  .card-actions .btn { width: 100%; }
}
.category-pill.active,
.category-pill.active .category-name { color: #fff; }

/* Softer typography pass: removes the heavy editorial serif feeling everywhere. */
:root {
  --display: "Nunito Sans", "Nunito", "Segoe UI Rounded", "Aptos Display", "Aptos", Calibri, "Segoe UI", Arial, sans-serif;
  --serif: var(--display);
  --sans: "Nunito Sans", "Nunito", "Segoe UI Rounded", "Aptos", Calibri, "Segoe UI", Arial, sans-serif;
}

html,
body,
button,
input,
select,
textarea,
.btn,
.main-nav a,
.auth-nav,
.brand,
.brand-text,
.site-main,
.site-footer,
.panel,
.sidebar-card,
.quiz-card,
.home-example-copy,
.home-frame-shell,
.cabinet-widget {
  font-family: var(--sans) !important;
}

h1,
h2,
h3,
h4,
h5,
h6,
.home-hero h1,
.tests-title-block h1,
.compact-page-title,
.quiz-card h3,
.quiz-card h3 a,
.brand-text,
.footer-brand strong,
.widget-body strong {
  font-family: var(--display) !important;
  font-weight: 700 !important;
  letter-spacing: -0.014em !important;
}

h1 {
  font-size: clamp(42px, 6vw, 78px);
  line-height: 1.045;
}

h2 {
  font-size: clamp(27px, 3.2vw, 42px);
  line-height: 1.11;
}

h3 {
  font-weight: 700 !important;
  line-height: 1.16;
}

.home-hero h1 {
  max-width: 920px;
  line-height: 1.055 !important;
  text-shadow: 0 2px 26px rgba(0,0,0,.22);
}

.home-hero p,
.home-example-copy p,
.tests-title-block p,
.quiz-card p,
.widget-body small,
.footer-brand span:not(.footer-logo) {
  font-weight: 400;
  letter-spacing: 0;
}

.quiz-card h3 {
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.14 !important;
  letter-spacing: -0.012em !important;
}

.brand-text {
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
}

.eyebrow,
.quiz-code,
.category-chip,
.category-pill,
.btn,
.main-nav a,
.footer-links a,
.label,
.tabs a,
.tabs button {
  font-weight: 650;
}

.home-example-copy h2 {
  max-width: 560px;
}

@supports not (font-variation-settings: normal) {
  .eyebrow,
  .quiz-code,
  .category-chip,
  .category-pill,
  .btn,
  .main-nav a,
  .footer-links a,
  .label,
  .tabs a,
  .tabs button {
    font-weight: 600;
  }
}


/* Patch 8.3: snippet-friendly intro before the interactive test area */
.test-index-lead {
  width: 100%;
  margin: 0 0 14px;
  padding: 13px 18px;
  border: 1px solid rgba(23, 72, 47, .14);
  border-radius: 18px;
  background: rgba(255,253,248,.86);
  box-shadow: 0 10px 28px rgba(37,64,27,.05);
}
.test-index-lead p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 650;
}
.test-index-lead strong { color: var(--ink); }

/* Patch 8/8.1: SEO content blocks for quiz pages */
.test-seo-content {
  max-width: 1180px;
  margin: 28px auto 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.test-seo-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.test-seo-summary::after {
  content: '+';
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid rgba(23, 72, 47, .18);
  color: var(--brand-dark);
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.test-seo-content[open] .test-seo-summary {
  border-bottom: 1px solid var(--line);
}

.test-seo-content[open] .test-seo-summary::after {
  content: '−';
}

.test-seo-summary-main {
  display: grid;
  gap: 6px;
}

.test-seo-summary-title {
  font-size: clamp(21px, 2.5vw, 30px);
  line-height: 1.05;
  letter-spacing: -.025em;
  font-weight: 950;
  color: var(--ink);
}

.test-seo-summary-meta {
  color: var(--muted);
  font-weight: 650;
}

.test-seo-inner {
  padding: 24px 28px 28px;
}

.test-seo-head h2 {
  margin: 8px 0 10px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.test-seo-head p {
  max-width: 920px;
  color: var(--muted);
  font-size: 17px;
}

.seo-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.seo-meta-grid > div,
.seo-block,
.seo-questions {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
}

.seo-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.seo-chip-row span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid rgba(23, 72, 47, .16);
  font-weight: 800;
  font-size: 13px;
}

.seo-chip-row-soft span {
  background: var(--accent-soft);
  color: #745015;
  border-color: rgba(200, 131, 26, .25);
}

.seo-topic-list {
  columns: 2;
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--ink-2);
}

.seo-topic-list li {
  break-inside: avoid;
  margin-bottom: 8px;
}

.seo-questions {
  margin-top: 18px;
}

.seo-questions summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--brand-dark);
}

.seo-question-list {
  display: grid;
  gap: 16px;
  margin: 18px 0 0;
  padding-left: 24px;
}

.seo-question-list > li {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.seo-question-list h3 {
  margin: 0 0 8px;
  font-size: 19px;
  letter-spacing: -.015em;
}

.seo-question-chapter {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.seo-option-list {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--ink-2);
}

.seo-option-list li {
  margin: 4px 0;
}

.seo-explanation {
  margin: 10px 0 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .test-seo-content {
    border-radius: 22px;
  }

  .test-seo-summary,
  .test-seo-inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  .test-seo-summary::after {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  .seo-meta-grid {
    grid-template-columns: 1fr;
  }

  .seo-topic-list {
    columns: 1;
  }
}

/* Patch 2: JSON schema/admin helpers */
.flash-info { background: #eef6ff; border-color: #c6ddf6; color: #1f4d7a; }
.flash ul { margin: 8px 0 0 18px; padding: 0; }
.code-block {
  max-height: 620px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #0b1628;
  color: #e6edf8;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}
.schema-panel h2 { margin-top: 0; }
.schema-rules-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.schema-rules-grid article {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}
.schema-rules-grid strong { color: var(--brand-dark); font-size: 17px; }
.schema-rules-grid span { font-weight: 800; }
.schema-rules-grid p { margin: 0; color: var(--muted); line-height: 1.45; }
@media (max-width: 980px) { .schema-rules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .schema-rules-grid { grid-template-columns: 1fr; } }
