:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1f2433;
  --muted: #6b7280;
  --primary: #4f5bd5;
  --primary-dark: #3a44b0;
  --accent-algebra: #4f5bd5;
  --accent-geometriya: #16a394;
  --border: #e5e7f0;
  --shadow: 0 4px 16px rgba(31, 36, 51, 0.06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

/* yuqori menyu, chap panel — fayl oxirida «Yuqori menyu (header)» bo'limida */

.page-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(31, 36, 51, 0.1);
}

.grid {
  display: grid;
  gap: 20px;
}

/* ---------- Bosh sahifa: sinflar (guruhlarga ajratilgan) ---------- */
#grades-grid { max-width: 1080px; margin: 28px auto 0; display: flex; flex-direction: column; gap: 36px; }

.grade-group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.grade-group-title { font-weight: 800; font-size: 1.15rem; }
.grade-group-sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.grade-group-link { color: var(--primary); font-weight: 700; font-size: 0.9rem; }
.grade-group-link:hover { color: var(--primary-dark); }

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

.grade-tile {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.grade-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(31, 36, 51, 0.1); border-color: #c9cef5; }

.grade-tile-num {
  flex: 0 0 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.5rem; color: #fff;
  background: linear-gradient(135deg, #6872e0, var(--primary-dark));
}
.grade-tile--primary .grade-tile-num { background: linear-gradient(135deg, #2bbfa9, #12897c); }

.grade-tile-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.grade-tile-name { font-weight: 800; font-size: 1.02rem; }
.grade-tile-subj { font-size: 0.8rem; font-weight: 600; color: var(--primary-dark); line-height: 1.35; }
.grade-tile--primary .grade-tile-subj { color: #12897c; }
.grade-tile-meta { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.grade-tile-meta b { color: var(--accent-geometriya); font-weight: 700; }

@media (max-width: 960px) {
  .grade-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grade-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grade-tile { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .grade-tile-num { flex: none; width: 44px; height: 44px; font-size: 1.3rem; border-radius: 12px; }
  .grade-tile-body { width: 100%; }
}

.primary-promo-card {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, #eef0fd, #e6f7f4);
}

.primary-promo-text p {
  color: var(--muted);
  margin: 0;
  max-width: 560px;
}

.primary-promo-arrow {
  font-size: 1.6rem;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.primary-promo-card:hover .primary-promo-arrow { transform: translateX(4px); }

@media (max-width: 640px) {
  .primary-promo-card { flex-direction: column; align-items: flex-start; text-align: left; }
}

/* ---------- Bosh sahifa: hero, ko'rgazma, qadriyatlar, footer ---------- */

.hero-section {
  padding: 64px 24px 56px;
}

.hero-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.hero-text h1 {
  font-size: 2.6rem;
  line-height: 1.15;
  margin: 0 0 16px;
}

.hero-text p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 480px;
  margin: 0 0 28px;
}

.hero-cta {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.hero-cta:hover { background: var(--primary-dark); }

.hero-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-text p { margin-left: auto; margin-right: auto; }
  .hero-illustration { margin-top: 20px; }
}

.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.section-title {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 0 0 8px;
}

.section-sub {
  color: var(--muted);
  font-size: 1rem;
  margin: 0 0 32px;
  max-width: 560px;
}

.showcase-section, .grades-section, .values-section {
  padding: 24px 24px 64px;
}

.showcase-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 800px) {
  .showcase-grid { grid-template-columns: 1fr; }
}

.showcase-card { padding: 24px; }

.showcase-icon {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  background: #eef0fb;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.showcase-card h3 { font-size: 1.1rem; margin: 0 0 6px; }
.showcase-card p { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }

.showcase-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 10px;
}

/* ---------- Bosh sahifa: jonli mini-ko'rgazmalar ---------- */
.demo-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.demo-card:hover { transform: translateY(-3px); }
.demo-stage { position: relative; padding: 14px 14px 12px; border-bottom: 1px solid var(--border); }
.demo-stage--indigo { background: linear-gradient(160deg, #eef0fd, #f7f8ff); }
.demo-stage--teal { background: linear-gradient(160deg, #e3f6f2, #f5fbfa); }
.demo-stage--amber { background: linear-gradient(160deg, #fff4dc, #fffaf0); }
.demo-hint {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  padding: 3px 9px; border-radius: 999px; background: #fff; box-shadow: 0 2px 8px rgba(31,36,51,.1);
  font-size: 0.72rem; font-weight: 700; color: var(--primary); transition: opacity .3s ease;
}
.demo-hint::before { content: "👆 "; }
.is-touched .demo-hint { opacity: 0; }
.demo-svg { display: block; width: 100%; height: 150px; user-select: none; -webkit-user-select: none; }
.demo-svg--drag { cursor: grab; touch-action: none; }
.demo-svg--drag:active { cursor: grabbing; }
.demo-svg:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 10px; }
.demo-controls { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; min-height: 34px; }
.demo-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  font: inherit; font-size: 1.2rem; font-weight: 800; color: var(--primary); cursor: pointer;
  transition: border-color .12s ease, transform .08s ease;
}
.demo-btn:hover { border-color: var(--primary); }
.demo-btn:active { transform: scale(.94); }
.demo-readout { min-width: 120px; text-align: center; font-weight: 800; font-size: 0.92rem; color: var(--text); }
.demo-readout--big { min-width: 0; font-size: 1.5rem; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.demo-tag { padding: 3px 10px; border-radius: 999px; background: #fff; font-size: 0.78rem; font-weight: 700; color: #0f6f63; }
.is-solved .demo-readout { color: #1f9d55; }
.is-solved .demo-svg { filter: drop-shadow(0 0 10px rgba(31,157,85,.25)); }

.frac-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; height: 150px; }
.frac-bar { display: flex; gap: 4px; width: 62%; height: 54px; }
.frac-seg { flex: 1; border: 2px solid #e0a21e; border-radius: 8px; background: #fff; cursor: pointer; padding: 0; transition: background .15s ease, transform .1s ease; }
.frac-seg:hover { transform: translateY(-2px); }
.frac-seg.on { background: #f0b429; }
.frac-big { display: inline-flex; flex-direction: column; align-items: center; font-family: 'Cambria Math', 'Times New Roman', serif; font-size: 2rem; line-height: 1.1; color: #8a6100; }
.frac-big span:first-child { border-bottom: 3px solid currentColor; padding: 0 6px; }

.demo-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.demo-body h3 { font-size: 1.1rem; margin: 0 0 6px; }
.demo-body p { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.demo-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.demo-foot .showcase-meta { margin-top: 0; }
.demo-link { font-weight: 800; font-size: 0.88rem; color: var(--primary); }
.demo-link:hover { color: var(--primary-dark); }

.grades-header {
  max-width: 1080px;
  margin: 0 auto;
}

.values-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.values-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  text-align: center;
}

@media (max-width: 800px) {
  .values-grid { grid-template-columns: 1fr; }
}

.value-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: #e8ebfc;
  display: flex;
  align-items: center;
  justify-content: center;
}
.value-icon img { width: 60px; height: 60px; display: block; }
.value-icon .qd-tun { display: none; }

.value-item h4 { font-size: 1.2rem; font-weight: 800; margin: 0 0 8px; letter-spacing: -.01em; }
.value-item p { color: var(--muted); font-size: 0.95rem; line-height: 1.5; margin: 0 auto; max-width: 340px; }

.site-footer { position: relative; padding: 52px 24px 0; overflow: hidden; }
/* tepada ko'k-sariq chiziq, fonda juda xira matematik belgilar */
.site-footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, #3b4fd8, #7c8cff 45%, #f2c94c); }
.site-footer::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='160'%3E%3Cg fill='%233b4fd8' font-family='Arial' font-weight='700'%3E%3Ctext x='18' y='38' font-size='26'%3E%2B%3C/text%3E%3Ctext x='120' y='30' font-size='22'%3E%CF%80%3C/text%3E%3Ctext x='196' y='70' font-size='24'%3E%C3%97%3C/text%3E%3Ctext x='64' y='104' font-size='24'%3E%E2%88%9A%3C/text%3E%3Ctext x='160' y='138' font-size='22'%3E%C3%B7%3C/text%3E%3Ctext x='14' y='150' font-size='20'%3E%3D%3C/text%3E%3C/g%3E%3C/svg%3E") 0 0 / 240px 160px repeat; opacity: .05; pointer-events: none; }
.site-footer > * { position: relative; z-index: 1; }

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 36px;
  padding-bottom: 36px;
}
@media (max-width: 600px) { .footer-inner { grid-template-columns: 1fr; gap: 28px; } }

.footer-logo { display: inline-flex; align-items: center; margin-bottom: 18px; }
.footer-logo .site-logo-img { height: 34px; }
.footer-maqsad { margin: 0 0 8px; color: var(--muted); font-size: .95rem; line-height: 1.6; max-width: 420px; }
.footer-raqamlar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.footer-raqamlar span { padding: 6px 12px; border-radius: 10px; background: #eef1ff; color: var(--muted); font-size: .82rem; }
.footer-raqamlar b { color: #3b4fd8; font-weight: 800; }
.footer-social { display: flex; gap: 10px; margin-top: 18px; }
.footer-social a { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: #e8ebfc; color: #3b4fd8; transition: background .15s ease, color .15s ease, transform .15s ease; }
.footer-social a:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }
.footer-social svg { width: 20px; height: 20px; }

.footer-title { font-weight: 800; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text); margin-bottom: 16px; }
.footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.footer-col > a { color: var(--muted); font-size: .95rem; font-weight: 500; }
.footer-col > a:hover { color: var(--primary); }
.footer-news p { margin: 0 0 4px; color: var(--muted); font-size: .95rem; line-height: 1.6; }
.footer-tg { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 380px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: border-color .15s ease, transform .15s ease; }
.footer-tg:hover { border-color: var(--primary); transform: translateY(-2px); }
.footer-tg-ikon { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; display: block; object-fit: cover; box-shadow: 0 6px 14px rgba(59, 79, 216, .3); }
.footer-tg-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.footer-tg-text b { font-size: 1rem; }
.footer-tg-text span { color: var(--muted); font-size: .85rem; }
.footer-tg-strelka { margin-left: auto; color: var(--muted); }

.footer-bottom { max-width: 1180px; margin: 0 auto; padding: 18px 0 22px; border-top: 1px solid var(--border); text-align: right; }
.footer-copy { color: var(--muted); font-size: 0.85rem; }

.subject-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0 8px;
  border-bottom: 1px solid var(--border);
}

.subject-tab {
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
}

.subject-tab:hover { color: var(--primary); }

.subject-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.subject-heading {
  font-size: 1.4rem;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--primary);
  display: inline-block;
}

.topic-list { list-style: none; margin: 24px 0 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.topic-row { display: flex; align-items: baseline; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--border); transition: background 0.1s ease; }
.topic-row:first-child { border-top: 0; }
.topic-row:hover { background: #fafbff; }
.topic-row-num { flex: 0 0 34px; font-weight: 700; color: #9ca3af; font-variant-numeric: tabular-nums; }
.topic-row-title { flex: 1 1 auto; min-width: 0; font-weight: 600; line-height: 1.45; }
.topic-row-title:hover { color: var(--primary); }
.topic-row-page { margin-left: 10px; font-size: 0.78rem; font-weight: 500; color: #9ca3af; white-space: nowrap; }
.topic-row-actions { flex: 0 0 auto; display: flex; gap: 6px; align-self: center; }
.topic-btn { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); font-weight: 700; font-size: 0.78rem; white-space: nowrap; transition: border-color 0.1s ease, background 0.1s ease; }
.topic-btn:hover { border-color: var(--primary); }
.topic-btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.topic-btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.gallery-grade { margin-top: 30px; }
.gallery-grade-title { font-size: 1.35rem; margin: 0 0 4px; }
.gallery-grade-title a:hover { color: var(--primary); }
.gallery-subject { font-weight: 800; font-size: 0.95rem; color: var(--primary-dark); margin: 14px 0 0; }
.gallery-list { margin-top: 10px; }
.topic-list-foot { text-align: center; color: #9ca3af; font-size: 0.82rem; font-weight: 600; margin-top: 16px; }
@media (max-width: 640px) {
  .topic-row { flex-wrap: wrap; padding: 12px 14px; gap: 6px 8px; }
  .topic-row-num { flex-basis: 34px; }
  .topic-row-title { flex-basis: calc(100% - 42px); }
  .topic-row-actions { margin-left: 42px; }
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.topic-card {
  padding: 20px;
}

.topic-card-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-right: 6px;
}

.badge:last-child { margin-right: 0; }

.badge-interactive {
  background: #e6f7f4;
  color: var(--accent-geometriya);
}

.badge-lecture {
  background: #eef0fb;
  color: var(--primary-dark);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

/* bilinar-bilinmas to'rtburchak tugmalar */
.crumb {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
a.crumb:hover { border-color: var(--primary); color: var(--primary); background: #f5f6fe; }
.crumb--current { border-color: transparent; background: none; padding-left: 2px; color: var(--text); }
.crumb-sep { color: #c3c7d4; }

#topic-title {
  font-size: 2rem;
  margin: 0 0 6px;
}

.topic-page-tag {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 28px;
}

.content-block {
  margin-bottom: 40px;
  scroll-margin-top: calc(var(--site-header-h, 0px) + 76px); /* #interaktiv kabi havola bilan kelganda — yopishgan menyu va bosqichlar paneli ostida qolmasin */
}

/* mavzu bosqichlari: Nazariya → Interaktiv panel → Test — yopishgan yuqori menyu ostiga yopishib turadi */
.topic-steps {
  position: sticky;
  top: var(--site-header-h, 0px);
  z-index: 9;
  display: flex;
  gap: 8px;
  margin: 0 0 20px;
  padding: 10px 0;
  background: var(--bg);
  overflow-x: auto;
  scrollbar-width: none;
}
.topic-steps::-webkit-scrollbar { display: none; }
.topic-step {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 10px 18px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, color .15s, box-shadow .15s;
}
.topic-step b {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.topic-step:hover { border-color: var(--primary); color: var(--primary); }
.topic-step.active {
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(79, 91, 213, 0.18);
}
.topic-step.active b { background: var(--primary); color: #fff; }
.topic-pdf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.topic-pdf:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(79, 91, 213, 0.18); }
.topic-pdf[hidden] { display: none; }
@media (max-width: 520px) {
  .topic-pdf { padding: 8px 7px; }
  .topic-steps:has(.topic-pdf:not([hidden])) .topic-step { padding: 8px 4px; gap: 4px; }
  .topic-pdf span { display: none; }
}
@media (max-width: 520px) {
  /* telefonda uchala bosqich ekranga sig'adi: teng kenglik, kerak bo'lsa ikki qator */
  .topic-steps { gap: 6px; }
  .topic-step { flex: 1 1 0; min-width: 0; justify-content: center; padding: 8px 6px; gap: 6px; font-size: 0.85rem; line-height: 1.2; text-align: left; }
  .topic-step b { flex: 0 0 auto; width: 20px; height: 20px; font-size: 0.75rem; }
}

.step-next { display: flex; justify-content: center; margin-top: 24px; }
.step-next-btn {
  padding: 12px 22px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.step-next-btn:hover { background: var(--primary-dark); }

.content-block h3 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 14px;
}

.lecture-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

/* ma'ruza sahifasi (maruza/*.html) iframe ichida — tashqi quti va ichki chegarasiz, ortiqcha bo'sh joysiz */
.lecture-box:has(> iframe) { padding: 0; border: none; background: transparent; }
.lecture-box > iframe.embed-frame { display: block; border: 1px solid var(--border); }

.lecture-section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.lecture-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.lecture-section-title {
  font-size: 1rem;
  margin: 0 0 8px;
  color: var(--text);
}

.lecture-rule {
  background: #eef0fb;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
}

.lecture-rule strong {
  color: var(--primary-dark);
}

.lecture-example {
  background: #f6f7fb;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
}

.lecture-example strong {
  color: var(--accent-geometriya);
}

.lecture-figure {
  display: flex;
  justify-content: center;
  margin: 14px 0;
}

.lecture-figure svg { max-width: 100%; height: auto; }

.embed-frame {
  width: 100%;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.embed-frame-tall {
  height: 520px;
}

.placeholder {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: 16px;
}

.sim-plan {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
}
.sim-plan-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.sim-plan p { margin: 0; line-height: 1.6; }

.muted { color: var(--muted); }

#gallery-grid {
  margin-top: 24px;
}

.gallery-grade-section {
  margin-bottom: 40px;
}

.gallery-grade-section .upload-subject-heading {
  margin: 18px 0 12px;
}

.gallery-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.gallery-card {
  padding: 22px;
}

.gallery-card-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-geometriya);
  margin-bottom: 8px;
}

.gallery-card-title {
  font-weight: 700;
}

.page-title {
  font-size: 1.9rem;
  margin-bottom: 4px;
}

/* ---------- Interaktiv test (quiz) ---------- */

.quiz-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  min-height: 100vh;
}
/* mavzu sahifasi ichida (iframe): oyna balandligi testga moslashadi — 100vh bo'lsa faqat o'sib boradi */
.quiz-embedded .quiz-page { min-height: 0; padding: 12px 20px 20px; }

.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.quiz-back {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.quiz-back:hover { color: var(--primary); }

.quiz-progress {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

.dot.done { background: var(--accent-geometriya); }
.dot.active { background: var(--primary); transform: scale(1.3); }

.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px;
  box-shadow: var(--shadow);
}

.quiz-level {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin-bottom: 10px;
}

.quiz-question {
  font-size: 1.35rem;
  margin: 0 0 26px;
  line-height: 1.4;
}

.quiz-options {
  display: grid;
  gap: 12px;
}

.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.quiz-option:disabled { cursor: default; }

.quiz-option.correct {
  border-color: var(--accent-geometriya);
  background: #e6f7f4;
  color: var(--accent-geometriya);
}

.quiz-option.wrong {
  border-color: #e0546a;
  background: #fbe9ec;
  color: #c73754;
}

.quiz-feedback { margin-top: 22px; }

.feedback-text {
  font-weight: 700;
  margin-bottom: 16px;
}

.correct-text { color: var(--accent-geometriya); }
.feedback-explain {
  margin: -6px 0 16px;
  padding: 10px 14px;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: #eef0fb;
  color: var(--text);
  line-height: 1.5;
}
.wrong-text { color: #c73754; }

.quiz-next {
  display: inline-block;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
}

.quiz-next:hover { background: var(--primary-dark); }

.quiz-result { text-align: center; padding: 20px 0; }

.quiz-result-score {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
}

.quiz-result-message {
  color: var(--muted);
  margin: 8px 0 28px;
  font-size: 1.05rem;
}

.quiz-result-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.quiz-back-btn {
  display: inline-block;
  padding: 12px 24px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 12px;
}

.quiz-back-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Login / Admin / Sozlamalar / Ma'lumot ---------- */

.page-container.narrow {
  max-width: 480px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 24px;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-input {
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary);
}

.auth-error {
  color: #c73754;
  font-weight: 600;
  font-size: 0.9rem;
}

.admin-note {
  text-align: left;
  margin: 20px 0;
  padding: 18px 20px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.9rem;
}

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

.admin-table th {
  background: var(--bg);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

/* ---------- Admin dashboard ---------- */

.page-container.wide { max-width: 1200px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 32px 0 8px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card-soon { opacity: 0.6; }

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 4px;
}

.stat-soon-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--border);
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 4px;
}

.dashboard-section {
  margin-top: 44px;
}

.grade-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 24px;
}

.grade-chip {
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.grade-chip:hover { border-color: var(--primary); }

.grade-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.upload-subject-group { margin-bottom: 28px; }

.upload-subject-heading {
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.upload-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
}

.upload-topic-title { font-weight: 600; }

.upload-topic-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-upload-btn {
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--primary-dark);
  background: #eef0fb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.topic-upload-btn:hover { background: #e0e3f9; }

.upload-target-panel {
  position: sticky;
  bottom: 20px;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  margin-top: 12px;
}

.upload-target-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.upload-target-title { font-weight: 700; font-size: 1.05rem; }

.upload-btn {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  background: var(--primary);
  border-radius: 10px;
  cursor: pointer;
}

.upload-btn:hover { background: var(--primary-dark); }

.upload-result {
  margin-top: 18px;
  text-align: left;
  background: var(--bg);
  border-radius: 12px;
  padding: 14px;
}

.upload-filename {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.upload-instruction {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin: 0 0 10px;
}

.upload-copy-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--primary-dark);
  background: #eef0fb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.upload-copy-btn:hover { background: #e0e3f9; }

/* ===================== Admin panel ===================== */
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.adm-head-link { color: var(--primary); font-weight: 700; font-size: 0.9rem; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.adm-head-link:hover { border-color: var(--primary); }

.adm-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.adm-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; border-top: 3px solid var(--primary); }
.adm-stat--teal { border-top-color: var(--accent-geometriya); }
.adm-stat--green { border-top-color: #2bbfa9; }
.adm-stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.adm-stat-label { font-weight: 700; margin-top: 4px; }
.adm-stat-sub { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

.adm-work { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.adm-side { position: sticky; top: 84px; }
.adm-side-label { display: none; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #9ca3af; margin-bottom: 10px; }
.adm-grade-list { display: flex; flex-direction: column; gap: 8px; }
.adm-group-label { font-size: 0.72rem; font-weight: 800; color: #9ca3af; margin: 8px 0 0; }
.adm-group-label:first-child { margin-top: 0; }
.adm-grade--primary .adm-grade-num { background: linear-gradient(135deg, #2bbfa9, #12897c); }
.adm-current { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 0.85rem; }
.adm-current code { background: #e9ebf3; padding: 1px 5px; border-radius: 5px; }
.adm-current a { color: var(--primary); font-weight: 700; }
.adm-tab-sub { font-weight: 600; opacity: 0.75; font-size: 0.75rem; }
.adm-type-tabs { flex-wrap: wrap; }
.adm-grade { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.adm-grade:hover { border-color: #c9cef5; }
.adm-grade.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 91, 213, 0.12); }
.adm-grade-num { flex: 0 0 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, #6872e0, var(--primary-dark)); }
.adm-grade-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.adm-grade-name { font-weight: 700; }
.adm-grade-meta { color: var(--muted); font-size: 0.75rem; }
.adm-bar { height: 5px; border-radius: 999px; background: #eceef5; overflow: hidden; }
.adm-bar i { display: block; height: 100%; background: var(--accent-geometriya); border-radius: 999px; }
.adm-side-note { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #e6f7f4; color: #0f6f63; font-size: 0.8rem; line-height: 1.5; }
.adm-side-note a { display: inline-block; margin-top: 4px; font-weight: 700; color: #0f6f63; }
.adm-side-note code { font-size: 0.75rem; }

.adm-main { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px; }
.adm-main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.adm-main-title { margin: 0; font-size: 1.4rem; }
.adm-progress { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.adm-filter { display: flex; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.adm-filter-btn { font: inherit; font-size: 0.82rem; font-weight: 700; color: var(--muted); padding: 6px 12px; border: 0; border-radius: 7px; background: none; cursor: pointer; }
.adm-filter-btn.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(31, 36, 51, 0.1); }
.adm-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 0.78rem; color: var(--muted); margin: 14px 0 6px; }
.adm-legend span { display: inline-flex; align-items: center; gap: 5px; }

.adm-subject { margin-top: 14px; }
.adm-subject-name { font-weight: 800; font-size: 0.95rem; margin-bottom: 6px; color: var(--primary-dark); }
.adm-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.adm-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--border); }
.adm-row:first-child { border-top: 0; }
.adm-row:hover { background: #fafbff; }
.adm-row-num { flex: 0 0 34px; color: #9ca3af; font-weight: 700; font-variant-numeric: tabular-nums; }
.adm-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.adm-row-title { font-weight: 600; }
.adm-row-title:hover { color: var(--primary); }
.adm-row-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.adm-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: #f3f4f8; color: var(--muted); }
.adm-pill--ok { background: #e6f7f4; color: #0f6f63; }
.adm-pill--part { background: #fff6e0; color: #8a6100; }
.adm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #c3c7d4; }
.adm-dot--ok { background: var(--accent-geometriya); }
.adm-dot--part { background: #f0b429; }
.adm-upload-btn { flex: 0 0 auto; font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--primary); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 6px 12px; cursor: pointer; }
.adm-upload-btn:hover { border-color: var(--primary); background: #f5f6fe; }
.adm-empty { margin-top: 16px; padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 12px; }

.adm-soon { display: flex; gap: 14px; align-items: center; margin-top: 24px; padding: 16px 20px; border: 1px dashed var(--border); border-radius: 14px; background: var(--surface); }
.adm-soon-icon { font-size: 1.6rem; }

/* yuklash oynasi */
.adm-modal { position: fixed; inset: 0; z-index: 200; background: rgba(15, 18, 30, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.adm-modal-box { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(15, 18, 30, 0.25); padding: 22px 24px; }
.adm-modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.adm-modal-kicker { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.adm-modal-title { font-size: 1.15rem; font-weight: 800; margin-top: 2px; }
.adm-type-tabs { display: flex; gap: 6px; margin: 16px 0 14px; }
.adm-type-tab { font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--muted); padding: 7px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; }
.adm-type-tab.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.adm-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; text-align: center; border: 2px dashed #c9cef5; border-radius: 12px; background: #f8f9fe; cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease; }
.adm-drop:hover, .adm-drop.over { border-color: var(--primary); background: #eef0fd; }
.adm-drop-icon { font-size: 1.4rem; color: var(--primary); }
.adm-drop .muted { font-size: 0.8rem; }
.adm-file { margin-top: 16px; font-weight: 700; }
.adm-steps { margin: 10px 0 0; padding-left: 20px; line-height: 1.6; font-size: 0.92rem; }
.adm-steps li { margin-bottom: 6px; }
.adm-steps code, .adm-side-note code { background: #f1f2f8; padding: 1px 5px; border-radius: 5px; }
.adm-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: #1f2433; color: #e6e8f2; font-size: 0.85rem; overflow-x: auto; }
.adm-code code { white-space: nowrap; }
.adm-note { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }
.adm-note code { background: #f1f2f8; padding: 1px 5px; border-radius: 5px; }
.adm-copy { flex: 0 0 auto; font: inherit; font-size: 0.78rem; font-weight: 700; color: #1f2433; background: #fff; border: 0; border-radius: 7px; padding: 5px 10px; cursor: pointer; }

@media (max-width: 960px) {
  .adm-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .adm-work { grid-template-columns: 1fr; }
  .adm-side { position: static; }
  /* tor ekranda: ixcham tugmalar to'ri (faqat raqam va nom) */
  /* har qatorda 4 tadan: 1–4 | 5–8 | 9–11 */
  .adm-grade-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .adm-group-label { grid-column: 1 / -1; margin: 6px 0 0; font-size: 0.8rem; }
  .adm-grade { padding: 13px 15px; gap: 12px; border-radius: 14px; }
  .adm-grade-num { flex-basis: 46px; height: 46px; font-size: 1.25rem; border-radius: 12px; }
  .adm-grade-meta, .adm-grade .adm-bar { display: none; }
  .adm-grade-name { font-size: 1.12rem; white-space: nowrap; }
}
@media (max-width: 720px) {
  .adm-grade { padding: 11px 10px; gap: 9px; }
  .adm-grade-num { flex-basis: 40px; height: 40px; font-size: 1.1rem; }
  .adm-grade-name { font-size: 1.02rem; }
}
@media (max-width: 560px) {
  .adm-grade-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-stat:last-child { grid-column: 1 / -1; }
  .adm-main { padding: 16px 14px; }
  .adm-row { flex-wrap: wrap; }
  .adm-upload-btn { margin-left: 40px; }
}

/* Nishonlar to'plami (sinf sahifasi) */
.badge-board { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; margin-bottom: 18px; }
.badge-board-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.badge-board-head span { font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.badge-board-bar { height: 6px; border-radius: 3px; background: #eceef6; overflow: hidden; margin-bottom: 14px; }
.badge-board-bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; }
.badge-cell { display: flex; align-items: center; justify-content: center; height: 36px; border-radius: 8px; }
.badge-cell:hover { background: #f3f4fb; }
.badge-board-foot { margin: 12px 0 0; font-size: .8rem; color: var(--muted); }
.topic-row-badge { flex: 0 0 auto; align-self: center; line-height: 0; }

/* ---------- Mavzu qidirish (yuqoridagi lupa) ---------- */

.site-search {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(15, 18, 30, 0.35);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 72px 16px 16px;
}
.search-open-body { overflow: hidden; }
.site-search-box {
  width: 100%; max-width: 620px; background: var(--surface);
  border-radius: 16px; box-shadow: 0 20px 50px rgba(15, 18, 30, 0.25); overflow: hidden;
}
.site-search-field {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted);
}
.site-search-field input {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  font: inherit; font-size: 1.05rem; color: var(--text);
}
.site-search-field input::-webkit-search-cancel-button { display: none; }
.site-search-close {
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  border-radius: 6px; padding: 2px 8px; font: inherit; font-size: .75rem; cursor: pointer;
}
.site-search-list { list-style: none; margin: 0; padding: 6px; max-height: min(60vh, 460px); overflow-y: auto; }
.site-search-item { display: block; padding: 10px 12px; border-radius: 10px; }
.site-search-item.active, .site-search-item:hover { background: #f1f2fc; }
.site-search-title { display: block; font-weight: 600; line-height: 1.4; }
.site-search-title mark { background: none; color: var(--primary); font-weight: 800; }
.site-search-meta { display: block; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.site-search-meta b { color: var(--accent-geometriya); font-weight: 700; }
.site-search-empty { padding: 14px 12px; color: var(--muted); font-size: .92rem; }
.site-search-group {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 12px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--primary);
}
.site-search-group span { color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; }
.site-search-group--similar { color: var(--muted); border-top: 1px solid var(--border); margin-top: 6px; }

/* qidiruv: "Barcha natijalar" tugmasi va katta oyna */
.site-search-more {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px;
  margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px;
  color: var(--primary); font-weight: 600;
}
.site-search-more span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.site-search-box { transition: max-width .2s ease; }
.site-search-box--wide { max-width: 980px; }
.site-search-box--wide .site-search-list {
  max-height: calc(100vh - 230px);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; align-content: start;
}
.site-search-box--wide .site-search-group,
.site-search-box--wide .site-search-empty { grid-column: 1 / -1; }
.site-search-chips {
  display: flex; gap: 6px; padding: 10px 14px; overflow-x: auto;
  border-bottom: 1px solid var(--border); scrollbar-width: thin;
}
.site-search-chip {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font: inherit; font-size: .85rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.site-search-chip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.site-search-chip:hover { border-color: var(--primary); }
.site-search-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.site-search-chip.active span { color: rgba(255, 255, 255, .8); }
@media (max-width: 720px) {
  .site-search { padding-top: 16px; }
  .site-search-box--wide .site-search-list { grid-template-columns: 1fr; max-height: calc(100vh - 150px); }
}
.site-search-more em { font-style: normal; }

/* Yangi simulyatorli interaktiv darslar — yashil (eskilari ko'k qoladi) */
.topic-btn--new { color: #12805C; border-color: #BFE5D3; }
.topic-btn--new:hover { border-color: #12805C; }
.topic-btn--primary.topic-btn--new { background: #12805C; border-color: #12805C; color: #fff; }
.topic-btn--primary.topic-btn--new:hover { background: #0E6B4C; border-color: #0E6B4C; }
.site-search-meta b.is-old { color: var(--primary); }
.site-search-meta b.is-new { color: #12805C; }

/* logotip — logo.png (belgi + "Mathlearn" yozuvi) */

/* qizil nuqta — hali tekshirilmagan yangi simulyator */
.review-dot { display: inline-block; width: 10px; height: 10px; margin-left: 8px; border-radius: 50%; background: #E11D48; box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18); vertical-align: middle; }
.review-dot.yellow { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22); }
.review-dot.green { background: #16A34A; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2); }
.review-dot.blue { background: #2563EB; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }
.dot-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.85rem; color: var(--muted); margin: 0 0 12px; }
.dot-legend span { display: inline-flex; align-items: center; gap: 8px; }
.dot-legend .review-dot { margin-left: 3px; }
/* ichki ish belgilari (holat nuqtalari va izohi, kitob betlari, simulyatsiya rejasi, tahrirlash izohlari) — faqat adminga:
   js/auth.js admin kirganda <html> ga is-admin klassini qo'yadi; odatda (o'quvchi) yashirin */
html:not(.is-admin) .review-dot,
html:not(.is-admin) .dot-legend,
html:not(.is-admin) .admin-only { display: none !important; }
/* belgilari yashirilgan bo'sh qator kartochkada joy egallamasin (1–4-sinf «N-chorak» qoladi) */
html:not(.is-admin) .tc-meta:not(:has(.tc-page:not(.admin-only))) { display: none; }

/* mavzular kartochkalari (sinf sahifasi) */
.topic-cards { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.topic-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.topic-card:hover { border-color: #c7cdf6; box-shadow: 0 8px 22px rgba(30, 42, 120, .10); transform: translateY(-1px); }
.tc-main { display: flex; align-items: flex-start; gap: 12px; color: inherit; }
.tc-icon { flex: 0 0 72px; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 14px; background: #f3f5ff; overflow: hidden; }
.tc-icon img { width: 72px; height: 72px; object-fit: contain; display: block; }
.tc-num { font-weight: 800; font-size: 1.6rem; line-height: 1; color: #5b6cf0; letter-spacing: -.02em; }
.tc-title { font-weight: 650; line-height: 1.38; font-size: .95rem; padding-top: 2px; }
.tc-title b { color: #9ca3af; font-weight: 700; margin-right: 2px; }
.tc-main:hover .tc-title { color: var(--primary); }
.tc-meta { display: flex; align-items: center; gap: 2px; margin-left: 84px; min-height: 14px; }
.tc-meta .review-dot { margin-left: 0; margin-right: 6px; }
.tc-page { font-size: .78rem; font-weight: 600; color: #9ca3af; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.tc-actions:empty { display: none; }
/* hali hech narsa yuklanmagan mavzu — xira va rangsiz */
.topic-card--bosh { filter: grayscale(1); opacity: .5; box-shadow: none; }
.topic-card--bosh:hover { opacity: .7; transform: none; box-shadow: none; }
@media (max-width: 560px) {
  .topic-cards { grid-template-columns: 1fr; gap: 10px; }
  .tc-icon, .tc-icon img { width: 60px; height: 60px; flex-basis: 60px; }
  .tc-meta { margin-left: 72px; }
}

/* bosh sahifa: sinf afishalari — katta tik rasm, ostida shu fonda sinf nomi (mavzu kartochkalaridan ajralib turadi) */
#grades-grid { max-width: 1180px; }
.grade-tiles { gap: 22px; }
.grade-poster { position: relative; display: flex; flex-direction: column; border-radius: 24px; overflow: hidden; background: #e8ecfc; border: 1px solid rgba(30, 42, 120, .07); color: #1e2a78; box-shadow: 0 6px 18px rgba(30, 42, 120, .08); transition: transform .25s ease, box-shadow .25s ease; }
.grade-poster:hover { transform: translateY(-6px); box-shadow: 0 22px 44px rgba(30, 42, 120, .18); }
.gp-art { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; }
.gp-art img { position: absolute; left: 0; top: 0; width: 100%; height: auto; display: block; transition: transform .5s ease; transform-origin: center 40%; }
.grade-poster:hover .gp-art img { transform: scale(1.05); }
.gp-num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: clamp(5rem, 11vw, 8rem); line-height: 1; color: #3b4fd8; letter-spacing: -.05em; }
.gp-badge { display: none; }
.gp-body { display: flex; flex-direction: column; gap: 4px; padding: 4px 20px 20px; }
.gp-name { font-weight: 800; font-size: 1.85rem; line-height: 1.05; letter-spacing: -.02em; color: #1e2a78; }
.gp-subj { font-size: .9rem; font-weight: 700; color: #3b4fd8; line-height: 1.35; }
.grade-poster--primary .gp-subj { color: #12805c; }
.gp-meta { color: #4b5578; font-size: .84rem; font-weight: 600; }
.gp-meta b { color: #12805c; font-weight: 800; }
@media (max-width: 860px) { .grade-tiles { gap: 16px; } .gp-name { font-size: 1.55rem; } }
/* kartochkalar 75% kattalikda (foydalanuvchi, 2026-10-26): kenglik --gt-w da; telefonda (≤ 560 px) avvalgidek */
@media (min-width: 561px) {
  .grade-tiles { --gt-w: calc((100% - 3 * 22px) / 4 * .75); grid-template-columns: repeat(4, var(--gt-w)); }
  .grade-poster { border-radius: 18px; }
  .gp-body { padding: 2px 14px 14px; gap: 3px; }
  .gp-name { font-size: 1.4rem; }
  .gp-subj { font-size: .8rem; }
  .gp-meta { font-size: .76rem; }
}
@media (min-width: 861px) and (max-width: 960px) { .grade-tiles { --gt-w: calc((100% - 2 * 22px) / 3 * .75); grid-template-columns: repeat(3, var(--gt-w)); } }
@media (min-width: 721px) and (max-width: 860px) { .grade-tiles { --gt-w: calc((100% - 2 * 16px) / 3 * .75); grid-template-columns: repeat(3, var(--gt-w)); } }
@media (min-width: 561px) and (max-width: 720px) { .grade-tiles { --gt-w: calc((100% - 16px) / 2 * .75); grid-template-columns: repeat(2, var(--gt-w)); } }

/* 5–11 sinflar — bitta qator, yonga suriladi (tugma, sichqoncha bilan sudrash, sensor paneli/barmoq) */
.grade-rail { position: relative; }
.grade-tiles--rail { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: var(--gt-w, calc((100% - 12px) / 2.25)); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 10px 2px 28px; margin: -10px -2px -28px; }
.grade-tiles--rail::-webkit-scrollbar { display: none; }
.grade-tiles--rail > * { scroll-snap-align: start; }
.grade-tiles--rail.gr-surish { scroll-snap-type: none; scroll-behavior: auto; }
@media (hover: hover) { .grade-tiles--rail { cursor: grab; } .grade-tiles--rail.gr-surish { cursor: grabbing; } }
.grade-tiles--rail.gr-surish > * { pointer-events: none; }
/* ramka ichida: 1–4 qatorni to'ldiradi, 5–11 da beshinchisining cheti ko'rinib turadi */
.grade-panel { width: 100%; }
@media (min-width: 561px) {
  .grade-tiles.grade-tiles--rail { gap: 18px; }
  /* ikkala ramkada kartochkalar bir xil o'lchamda: qatorda 4 ta */
  .grade-tiles.gr-boshlang, .grade-tiles.gr-yuqori { --gt-w: clamp(170px, calc((100% - 3 * 18px) / 4), 330px); }
  .grade-panel .gp-body { min-height: 7.4rem; }
}
@media (min-width: 961px) {
  .grade-panel .gp-body { padding: 4px 18px 18px; gap: 4px; }
  .grade-panel .gp-name { font-size: 1.7rem; }
  .grade-panel .gp-subj { font-size: .9rem; }
  .grade-panel .gp-meta { font-size: .84rem; }
  .grade-panel .gp-body { min-height: 7.4rem; }
}
@media (max-width: 560px) { .grade-panel .grade-tiles--rail { --gt-w: calc((100% - 12px) / 1.75); } .grade-panel .gp-body { min-height: 7.2rem; } }
@media (max-width: 380px) { .grade-panel .gp-body { min-height: 7.9rem; } }
@media (max-width: 560px) { .grade-tiles--rail { --gt-w: calc((100% - 12px) / 2.25); } }
.gr-btn { position: absolute; top: 34%; transform: translateY(-50%); z-index: 2; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; transition: opacity .2s ease, transform .2s ease, background .2s ease; }
.gr-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.gr-btn svg { width: 22px; height: 22px; }
.gr-prev { left: -14px; }
.gr-next { right: -14px; }
.gr-btn[hidden] { display: grid; opacity: 0; pointer-events: none; }
@media (hover: none) { .gr-btn { display: none !important; } }
@media (max-width: 560px) {
  .grade-tiles { gap: 12px; }
  .grade-poster { border-radius: 18px; }
  .gp-body { padding: 2px 12px 12px; gap: 2px; }
  .gp-name { font-size: 1.25rem; }
  .gp-subj { font-size: .78rem; }
  .gp-meta { font-size: .74rem; }
}

/* bosh sahifa: kirish qismi (maket bo'yicha) va o'ng tomondagi slayd-shou */
.hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 40px; align-items: center; }
.hero-text h1 { font-size: clamp(2.3rem, 4.6vw, 3.6rem); line-height: 1.05; letter-spacing: -.03em; color: #1e2a78; font-weight: 800; }
.hero-text h1 span { color: #3b4fd8; display: block; }
.hero-text p { font-size: 1.1rem; color: #4b5578; max-width: 30ch; }
.hero-cta { display: inline-flex; align-items: center; gap: 10px; padding: 15px 26px; border-radius: 14px; background: #3b4fd8; font-size: 1.02rem; box-shadow: 0 8px 20px rgba(59, 79, 216, .25); }
.hero-feats { list-style: none; display: flex; flex-wrap: wrap; gap: 12px 16px; margin: 26px 0 0; padding: 0; }
.hero-feats li { flex: 0 0 auto; }
.hero-feats a { max-width: 10.5em; font-size: .8rem !important; padding: 6px 14px 6px 6px; border-radius: 999px; background: #fff; border: 1px solid #e3e7f7; box-shadow: 0 4px 14px rgba(30, 42, 120, .06); transition: border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .15s ease; }
.hero-feats a:hover { border-color: #c7cdf6; box-shadow: 0 8px 20px rgba(59, 79, 216, .14); transform: translateY(-1px); }
.hero-feats a i { background: #eef1ff !important; box-shadow: none !important; }
.hero-feats i { flex-basis: 36px !important; width: 36px !important; height: 36px !important; }
.hero-feats a { display: flex; align-items: center; gap: 10px; font-size: .85rem; font-weight: 600; color: #4b5578; line-height: 1.25; border-radius: 999px; transition: color .15s ease; }
.hero-feats a:hover { color: #3b4fd8; }
.hero-feats a:hover i { transform: none; }
.hero-feats i { transition: box-shadow .15s ease, transform .15s ease; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(30, 42, 120, .08); display: grid; place-items: center; color: #3b4fd8; }
.hero-feats svg { width: 20px; height: 20px; }

.hero-slider { position: relative; aspect-ratio: 3 / 2; perspective: 1400px; touch-action: pan-y; user-select: none; }
.hs-track { position: absolute; inset: 0; }
.hs-slide { position: absolute; top: 4%; bottom: 10%; left: 13%; right: 13%; border-radius: 26px; background: #e9edfd; overflow: hidden; box-shadow: 0 16px 40px rgba(30, 42, 120, .14); padding: 26px 28px; display: flex; flex-direction: column; justify-content: center; color: #1e2a78;
  opacity: 0; visibility: hidden; transform: translateX(0) scale(.7); filter: blur(4px); z-index: 0; cursor: pointer;
  transition: transform .7s cubic-bezier(.2, .7, .2, 1), opacity .7s ease, filter .7s ease, visibility .7s; }
.hs-slide.on { opacity: 1; visibility: visible; transform: none; filter: none; z-index: 3; cursor: default; }
.hs-slide.prev, .hs-slide.next { visibility: visible; opacity: .55; filter: blur(2px) saturate(.8); z-index: 1; }
.hs-slide.prev { transform: translateX(-40%) rotateY(32deg) scale(.82); }
.hs-slide.next { transform: translateX(40%) rotateY(-32deg) scale(.82); }
.hs-slide.prev:hover, .hs-slide.next:hover { opacity: .75; }
.hs-art { padding: 0; }
/* rasmli slayd («Yuqori sinflar» bo'limi): rasm butun slaydni egallaydi */
.hs-rasm { padding: 0; background: #f5f7fd; }
.hs-rasm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hs-rasm .gp-tun { display: none; }
.hs-ico-son { font-size: 1.3rem; font-weight: 800; color: #3b4fd8; }
.hs-modul { flex-direction: column; gap: 4px; background: linear-gradient(140deg, #3b4fd8, #6d7cf5) !important; color: #fff; }
.hs-modul b { font: 600 clamp(1.5rem, 3.2vw, 2.4rem)/1 "Times New Roman", Georgia, serif; font-style: italic; }
.hs-modul small { font: 600 clamp(1.1rem, 2.2vw, 1.6rem)/1 "Times New Roman", Georgia, serif; font-style: italic; color: #f2c94c; }
:root[data-theme="dark"] .hs-ico-son { color: var(--primary); }
:root[data-theme="dark"] .hs-rasm { background: #0f1529; }
:root[data-theme="dark"] .hs-rasm .gp-kun { display: none; }
:root[data-theme="dark"] .hs-rasm .gp-tun { display: block; }
.hs-art { background: #e4e9fd; container-type: inline-size; }
.hs-art img { position: absolute; right: 0; bottom: 0; width: 88%; height: auto; display: block; -webkit-mask-image: linear-gradient(to right, transparent, #000 14%), linear-gradient(to bottom, transparent, #000 16%); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 14%), linear-gradient(to bottom, transparent, #000 16%); mask-composite: intersect; }
.hs-shior { position: absolute; left: 7%; top: 50%; transform: translateY(-50%); max-width: 40%; display: flex; flex-direction: column; gap: 8px; z-index: 1; }
.hs-shior b span { display: block; white-space: nowrap; }
.hs-shior b { font-size: clamp(1.1rem, 6cqw, 2.1rem); line-height: 1.18; letter-spacing: -.02em; font-weight: 800; color: #1e2a78; }
.hs-label { font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #3b4fd8; }
.hs-slide h3 { margin: 6px 0 14px; font-size: clamp(1.35rem, 2.3vw, 1.9rem); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; }
.hs-row { display: flex; align-items: center; gap: 14px; padding: 7px 12px; margin-bottom: 7px; border-radius: 16px; background: #fff; font-weight: 700; font-size: .95rem; color: #1e2a78; box-shadow: 0 3px 10px rgba(30, 42, 120, .06); transition: transform .15s ease; }
.hs-row:hover { transform: translateX(3px); color: #3b4fd8; }
.hs-row b { margin-left: auto; color: #3b4fd8; }
.hs-ico { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px; background: #eef1ff; display: grid; place-items: center; overflow: hidden; }
.hs-ico img { width: 48px; height: 48px; }
.hs-more { margin-top: 6px; font-weight: 700; font-size: .9rem; color: #3b4fd8; }
.hs-feature { flex-direction: row; align-items: center; gap: 28px; }
.hs-big { flex: 0 0 auto; width: 42%; aspect-ratio: 1; border-radius: 24px; background: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(30, 42, 120, .08); }
.hs-big img { width: 78%; height: auto; }
.hs-text { display: flex; flex-direction: column; min-width: 0; }
.hs-text p { margin: 0 0 18px; color: #4b5578; font-size: .98rem; }
.hs-btn { align-self: flex-start; padding: 12px 20px; border-radius: 12px; background: #3b4fd8; color: #fff; font-weight: 700; font-size: .95rem; }
.hs-btn:hover { background: #1e2a78; }
.hs-poster { flex: 0 0 auto; width: 36%; aspect-ratio: 3 / 4; border-radius: 20px; overflow: hidden; background: #e8ecfc; box-shadow: 0 6px 18px rgba(30, 42, 120, .1); }
.hs-poster img { width: 100%; height: auto; display: block; }
.hs-stats { display: flex; gap: 22px; margin: 0 0 18px; }
.hs-stats span { display: flex; flex-direction: column; font-size: .82rem; font-weight: 600; color: #4b5578; }
.hs-stats b { font-size: 1.9rem; line-height: 1.05; color: #1e2a78; font-weight: 800; }
.hs-arrow { position: absolute; top: 47%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255, 255, 255, .9); color: #1e2a78; font-size: 1.5rem; line-height: 1; cursor: pointer; box-shadow: 0 4px 12px rgba(30, 42, 120, .12); opacity: 0; transition: opacity .2s ease; z-index: 2; }
.hs-prev { left: 4px; } .hs-next { right: 4px; }
.hero-slider:hover .hs-arrow, .hs-arrow:focus-visible { opacity: 1; }
.hs-dots { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px; z-index: 2; }
.hs-dots button { width: 9px; height: 9px; padding: 0; border: none; border-radius: 999px; background: #aeb8f7; cursor: pointer; transition: width .25s ease, background .25s ease; }
.hs-dots button.on { width: 26px; background: #3b4fd8; }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: left; }
  .hero-feats { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .hero-slider { aspect-ratio: 1 / 1.08; }
  .hs-slide { padding: 20px 18px; left: 9%; right: 9%; border-radius: 20px; }
  .hs-art { padding: 0; }
  .hs-art img { width: 128%; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%); -webkit-mask-composite: source-over; mask-image: linear-gradient(to bottom, transparent, #000 14%); mask-composite: add; }
  .hs-shior { top: 8%; transform: none; max-width: 86%; gap: 4px; }
  .hs-shior b { text-wrap: balance; }
  .hs-shior b span { display: inline; white-space: normal; }
  .hs-slide.prev { transform: translateX(-30%) rotateY(30deg) scale(.8); }
  .hs-slide.next { transform: translateX(30%) rotateY(-30deg) scale(.8); }
  .hs-feature { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hs-big { width: 34%; border-radius: 18px; }
  .hs-poster { width: 30%; border-radius: 14px; }
  .hs-slide h3 { margin: 4px 0 10px; }
  .hs-text p { font-size: .9rem; margin-bottom: 12px; }
  .hs-stats { gap: 16px; margin-bottom: 12px; }
  .hs-stats b { font-size: 1.5rem; }
  .hs-btn { padding: 10px 16px; font-size: .9rem; }
  .hs-row { padding: 6px 10px; gap: 10px; font-size: .88rem; }
  .hs-ico, .hs-ico img { width: 40px; height: 40px; flex-basis: 40px; }
  .hs-row:nth-of-type(3) { display: none; }
  .hs-arrow { display: none; }
}

.site-login-tip { position: fixed; left: 50%; top: calc(var(--site-header-h, 64px) + 14px); transform: translate(-50%, -8px); padding: 10px 18px; border-radius: 12px; background: #1e2a78; color: #fff; font-weight: 600; font-size: .9rem; box-shadow: 0 10px 24px rgba(30, 42, 120, .25); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 60; }
.site-login-tip.on { opacity: 1; transform: translate(-50%, 0); }

/* bosh sahifa: interaktiv darslar (maket bo'yicha, harakatsiz kartochkalar) */
.lessons-panel { max-width: 1180px; margin: 0 auto; background: #fff; border-radius: 28px; padding: 32px 32px 28px; box-shadow: 0 10px 30px rgba(30, 42, 120, .06); }
.lessons-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.lessons-title { margin: 6px 0 6px; font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.12; letter-spacing: -.025em; font-weight: 800; color: #1e2a78; }
.lessons-sub { margin: 0; color: #4b5578; font-size: 1.02rem; }
.lessons-all { flex: 0 0 auto; padding: 12px 20px; border: 1.5px solid #c7cdf6; border-radius: 14px; color: #3b4fd8; font-weight: 700; background: #fff; transition: border-color .15s ease, background .15s ease; }
.lessons-all:hover { border-color: #3b4fd8; background: #f3f5ff; }
.lessons-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.lesson-card { position: relative; display: flex; align-items: stretch; min-height: 210px; padding: 20px; border-radius: 22px; background: #fff; border: 1px solid #e6e9f6; box-shadow: 0 6px 18px rgba(30, 42, 120, .06); color: #1e2a78; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.lesson-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(30, 42, 120, .12); }
.lesson-text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; max-width: 54%; }
.lesson-chip { align-self: flex-start; padding: 4px 12px; border-radius: 10px; background: #eef1ff; color: #3b4fd8; font-weight: 700; font-size: .82rem; }
.lesson-name { font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }
.lesson-desc { color: #4b5578; font-size: .88rem; line-height: 1.45; }
.lesson-link { margin-top: auto; color: #3b4fd8; font-weight: 700; font-size: .95rem; }
.lesson-art { position: absolute; right: 8px; bottom: 50%; transform: translateY(50%); width: 40%; height: auto; pointer-events: none; transition: transform .3s ease; }
.lesson-card:hover .lesson-art { transform: translateY(50%) scale(1.05); }
@media (max-width: 960px) { .lessons-grid { grid-template-columns: 1fr; } .lesson-art { width: 34%; } }
@media (max-width: 560px) { .lessons-panel { padding: 22px 16px; border-radius: 22px; } .lesson-text { max-width: 62%; } .lesson-art { width: 38%; } }
.hero-section { overflow-x: clip; }

/* bosh sahifa sarlavhasi: uch qatorli hikmat, oxirgi qator ko'k */
.hero-text h1.h1-hikmat { font-size: clamp(1.9rem, 3.7vw, 3rem); line-height: 1.12; }
.hero-text h1.h1-hikmat span { display: block; color: #1e2a78; }
.hero-text h1.h1-hikmat span:nth-child(2) { color: #4b5578; }
.hero-text h1.h1-hikmat span:last-child { color: #3b4fd8; }

/* ---------- O'quvchi kirishi (Google) ---------- */

.site-login-modal { position: fixed; inset: 0; z-index: 220; background: rgba(15, 18, 30, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.site-login-box { position: relative; width: min(400px, 100%); background: var(--surface); border-radius: 18px; box-shadow: 0 20px 60px rgba(15, 18, 30, .25); padding: 28px 24px 20px; text-align: center; }
.site-login-close { position: absolute; top: 10px; right: 12px; font-size: 1.6rem; line-height: 1; color: var(--muted); background: none; border: 0; cursor: pointer; }
.site-login-emoji { font-size: 2.2rem; }
.site-login-box h2 { margin: 6px 0 12px; font-size: 1.35rem; }
.site-login-why { list-style: none; margin: 0 0 18px; padding: 0; text-align: left; display: inline-block; font-size: .92rem; color: #3d4356; }
.site-login-why li { padding: 3px 0 3px 24px; position: relative; }
.site-login-why li::before { content: "✓"; position: absolute; left: 2px; color: var(--accent-geometriya); font-weight: 800; }
.site-google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px 16px; border: 1px solid #d5d9e6; border-radius: 12px; background: #fff; font: inherit; font-weight: 700; font-size: .98rem; color: #1f2433; cursor: pointer; }
.site-google-btn:hover { background: #f6f7fb; border-color: #b8bdd0; }
.site-google-btn:disabled { opacity: .6; cursor: default; }
.site-login-err { margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: #fdecec; color: #9b1c1f; font-size: .85rem; text-align: left; }
.site-login-hint { margin: 14px 0 0; color: var(--muted); font-size: .78rem; }

/* ---------- Mening natijalarim ---------- */
.my-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.my-ava { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #6872e0, var(--primary-dark)); color: #fff; font-weight: 800; font-size: 1.3rem; }
.my-user-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.my-user-body span { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.my-user-body .my-sync { color: #0f8a7c; font-weight: 600; font-size: .8rem; margin-top: 2px; }
.my-logout { font: inherit; font-weight: 700; font-size: .85rem; color: #c73754; background: none; border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px; cursor: pointer; }
.my-login > div { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.my-login > div span { color: var(--muted); font-size: .88rem; }
.my-login .site-google-btn { flex: 0 1 260px; }
.my-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.my-stats > div { padding: 14px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.my-stats b { display: block; font-size: 1.6rem; line-height: 1.2; }
.my-stats span { color: var(--muted); font-size: .8rem; }
.my-rate--low { color: #c2373b; }
.my-rate--mid { color: #a06b00; }
.my-rate--high { color: #0f8a7c; }
.my-h { font-size: 1.1rem; margin: 18px 0 10px; }
.my-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.my-list li + li { border-top: 1px solid var(--border); }
.my-list a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: inherit; }
.my-list a:hover { background: #fafbff; }
/* chap ustun (mavzu) qolgan joyni egallaydi, uzun nom qatorga bo'linadi; o'ng ustun (foiz) — faqat kichik raqam */
.my-topic { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow-wrap: anywhere; }
.my-title { font-weight: 600; line-height: 1.35; }
.my-topic small, .my-score small { color: var(--muted); font-weight: 500; font-size: .76rem; }
.my-topic .my-meta { margin-top: 3px; }
.my-score { flex: 0 0 auto; min-width: 56px; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.my-score b { font-size: 1.2rem; line-height: 1.2; }
/* saqlangan savollar: mavzu, savol (formula, chizma), to'g'ri javob — ustma-ust */
.my-list a.my-saved { display: block; padding: 14px 16px; }
.my-saved-meta { display: block; color: var(--muted); font-weight: 500; font-size: .76rem; overflow-wrap: anywhere; }
.my-saved-q { margin-top: 4px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.my-saved-a { margin-top: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.my-saved-a small { color: var(--muted); font-size: .8rem; }
.my-saved-a b { color: #0f8a7c; font-size: 1.02rem; }
.my-fig { max-width: 260px; margin: 8px 0 2px; }
.my-fig svg { display: block; width: 100%; height: auto; }
.my-list .qz-m { display: inline-block; margin: 2px 0; vertical-align: middle; }
.my-list .qz-m .katex, .my-list [data-mw] .katex { font-size: 1.06em; }
.my-list .q-text, .my-list .q-formula { display: inline; }
.page-container.my-page { max-width: 720px; }
@media (max-width: 560px) { .my-stats { gap: 8px; } .my-stats > div { padding: 12px 6px; } .my-stats b { font-size: 1.3rem; } .my-stats span { font-size: .72rem; line-height: 1.3; display: block; } .my-list a { padding: 11px 12px; } .my-list a.my-saved { padding: 12px; } .my-fig { max-width: 220px; } }

/* ---------- Tungi rejim (html[data-theme="dark"]) ----------
   Mavzu <head> dagi bir qatorli skript va js/layout.js (oy tugmasi) orqali qo'yiladi.
   Ma'ruza (maruza/*), simulyatorlar (lessons/), 1–4-sinf (mathrunner-web/) va admin — doim kunduzgi. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1320;
  --surface: #181d2e;
  --surface-2: #21283d;
  --text: #e7eaf3;
  --muted: #a4acc4;
  --primary: #97a2ff;
  --primary-dark: #bcc3ff;
  --accent-algebra: #97a2ff;
  --accent-geometriya: #40d0bd;
  --border: #2d3451;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --btn: #5361e4;
  --btn-hover: #6470f0;
  --tint: rgba(151, 162, 255, 0.14);
  --ok: #4fd18b;
  --bad: #ff8f97;
  --warn: #f5c451;
}

/* yuqori menyu va chap panelning tungi ranglari — fayl oxirida */
:root[data-theme="dark"] .site-logo-img { filter: brightness(1.75) saturate(0.9); }
:root[data-theme="dark"] .card:hover,
:root[data-theme="dark"] .grade-tile:hover { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45); }

/* asosiy tugmalar: oq yozuv o'qiladigan to'qroq ko'k fon */
:root[data-theme="dark"] .hero-cta,
:root[data-theme="dark"] .hs-btn,
:root[data-theme="dark"] .topic-btn--primary:not(.topic-btn--new),
:root[data-theme="dark"] .step-next-btn,
:root[data-theme="dark"] .quiz-next,
:root[data-theme="dark"] .site-search-chip.active { background: var(--btn); border-color: var(--btn); color: #fff; box-shadow: none; }
:root[data-theme="dark"] .hero-cta:hover,
:root[data-theme="dark"] .hs-btn:hover,
:root[data-theme="dark"] .topic-btn--primary:not(.topic-btn--new):hover,
:root[data-theme="dark"] .step-next-btn:hover,
:root[data-theme="dark"] .quiz-next:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
:root[data-theme="dark"] .topic-step.active b { background: var(--btn); color: #fff; }
:root[data-theme="dark"] .topic-step.active { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
:root[data-theme="dark"] .site-login-tip { background: var(--btn); }

/* bosh sahifa */
:root[data-theme="dark"] .primary-promo-card { background: linear-gradient(135deg, #1d2340, #15302e); }
:root[data-theme="dark"] .showcase-icon,
:root[data-theme="dark"] .value-icon { background: #1b2238; }
:root[data-theme="dark"] .hs-big { background: var(--surface-2); box-shadow: none; }
:root[data-theme="dark"] .value-icon .qd-kun { display: none; }
:root[data-theme="dark"] .value-icon .qd-tun { display: block; }
:root[data-theme="dark"] .footer-social a { background: var(--surface-2); color: var(--muted); }
:root[data-theme="dark"] .site-footer::after { filter: invert(1) brightness(1.6); opacity: .045; }
:root[data-theme="dark"] .footer-raqamlar span { background: var(--surface-2); }
:root[data-theme="dark"] .footer-raqamlar b { color: var(--primary); }
:root[data-theme="dark"] :root[data-theme="dark"] :root[data-theme="dark"] .footer-social a:hover { background: var(--primary); color: #fff; }
:root[data-theme="dark"] .hero-text h1,
:root[data-theme="dark"] .hero-text h1.h1-hikmat span { color: var(--text); }
:root[data-theme="dark"] .hero-text h1 span,
:root[data-theme="dark"] .hero-text h1.h1-hikmat span:last-child { color: var(--primary); }
:root[data-theme="dark"] .hero-text h1.h1-hikmat span:nth-child(2),
:root[data-theme="dark"] .hero-text p { color: var(--muted); }
:root[data-theme="dark"] .hero-feats a { background: var(--surface); border-color: var(--border); color: var(--muted); box-shadow: none; }
:root[data-theme="dark"] .hero-feats a:hover { color: var(--primary); border-color: #4a5390; }
:root[data-theme="dark"] .hero-feats a i { background: var(--tint) !important; color: var(--primary); }
:root[data-theme="dark"] .hero-feats svg [stroke="#fff"] { stroke: var(--surface); }
:root[data-theme="dark"] .hero-feats svg [fill="#fff"] { fill: var(--surface); }
:root[data-theme="dark"] .hs-slide { background: #1e2440; color: var(--text); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
:root[data-theme="dark"] .hs-art { background: #171d30; color: var(--text); }
.hs-art .gp-tun { display: none; }
:root[data-theme="dark"] .hs-art .gp-kun { display: none; }
:root[data-theme="dark"] .hs-art .gp-tun { display: block; }
:root[data-theme="dark"] .hs-art .hs-shior b { color: #eef0fb; }
:root[data-theme="dark"] .hs-label,
:root[data-theme="dark"] .hs-more,
:root[data-theme="dark"] .hs-row b { color: var(--primary); }
:root[data-theme="dark"] .hs-art .hs-label { color: #7f8cff; }
:root[data-theme="dark"] .hs-row { background: var(--surface-2); color: var(--text); box-shadow: none; }
:root[data-theme="dark"] .hs-row:hover { color: var(--primary); }
:root[data-theme="dark"] .hs-text p,
:root[data-theme="dark"] .hs-stats span { color: var(--muted); }
:root[data-theme="dark"] .hs-stats b { color: var(--text); }
:root[data-theme="dark"] .hs-arrow { background: rgba(24, 29, 46, 0.92); color: var(--text); }
:root[data-theme="dark"] .hs-dots button { background: #3a4370; }
:root[data-theme="dark"] .hs-dots button.on { background: var(--primary); }
:root[data-theme="dark"] .lessons-panel { background: var(--surface); box-shadow: none; border: 1px solid var(--border); }
:root[data-theme="dark"] .lessons-title,
:root[data-theme="dark"] .lesson-card { color: var(--text); }
:root[data-theme="dark"] .lessons-sub,
:root[data-theme="dark"] .lesson-desc { color: var(--muted); }
:root[data-theme="dark"] .lessons-all { background: var(--surface); border-color: #4a5390; color: var(--primary); }
:root[data-theme="dark"] .lessons-all:hover { background: var(--surface-2); border-color: var(--primary); }
:root[data-theme="dark"] .lesson-card { background: var(--surface-2); border-color: var(--border); box-shadow: none; }
:root[data-theme="dark"] .lesson-card:hover { box-shadow: 0 16px 34px rgba(0, 0, 0, 0.4); }
:root[data-theme="dark"] .lesson-chip { background: var(--tint); color: var(--primary); }
:root[data-theme="dark"] .lesson-link { color: var(--primary); }

/* sinf, mavzular ro'yxati, mavzu sahifasi */
:root[data-theme="dark"] .topic-row:hover,
:root[data-theme="dark"] .my-list a:hover,
:root[data-theme="dark"] a.crumb:hover,
:root[data-theme="dark"] .site-search-item.active,
:root[data-theme="dark"] .site-search-item:hover { background: var(--surface-2); }
:root[data-theme="dark"] .crumb-sep { color: #4b536e; }
:root[data-theme="dark"] .badge-interactive { background: rgba(64, 208, 189, 0.14); }
:root[data-theme="dark"] .badge-lecture { background: var(--tint); }
:root[data-theme="dark"] .topic-btn--new:not(.topic-btn--primary) { color: #4fd8a0; border-color: #24624a; }
:root[data-theme="dark"] .topic-btn--new:not(.topic-btn--primary):hover { border-color: #4fd8a0; }
/* sinf afishalari rasmli och kartochka bo'lib qoladi (rasm foni bilan bir xil) */
:root[data-theme="dark"] .site-search-meta b.is-new { color: #4fd8a0; }
:root[data-theme="dark"] .topic-card:hover { border-color: #4a5390; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4); }
:root[data-theme="dark"] .tc-icon { background: #e9ecfb; }
:root[data-theme="dark"] .grade-poster { border-color: var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
:root[data-theme="dark"] .grade-poster:hover { box-shadow: 0 22px 44px rgba(0, 0, 0, 0.5); }
/* tungi afisha (img/sinf/<sinf>-tun.webp): kartochka foni rasm foni bilan bir xil */
.gp-art .gp-tun, .hs-poster .gp-tun { display: none; }
:root[data-theme="dark"] .hs-poster { background: #171c2d; }
:root[data-theme="dark"] .hs-poster .gp-kun { display: none; }
:root[data-theme="dark"] .hs-poster .gp-tun { display: block; }
:root[data-theme="dark"] .grade-poster--tun { background: #171c2d; }
:root[data-theme="dark"] .grade-poster--tun .gp-kun { display: none; }
:root[data-theme="dark"] .grade-poster--tun .gp-tun { display: block; }
:root[data-theme="dark"] .grade-poster--tun .gp-name { color: #eef0fb; }
:root[data-theme="dark"] .grade-poster--tun .gp-subj { color: #9aa6ff; }
:root[data-theme="dark"] .grade-poster--tun.grade-poster--primary .gp-subj,
:root[data-theme="dark"] .grade-poster--tun .gp-meta b { color: #4fd1a1; }
:root[data-theme="dark"] .grade-poster--tun .gp-meta { color: #a4acc4; }
:root[data-theme="dark"] .lecture-rule,
:root[data-theme="dark"] .lecture-example,
:root[data-theme="dark"] .feedback-explain { background: var(--surface-2); }
/* ma'ruza va simulyator oynasi — qorong'i sahifada oq qog'oz varag'idek (chizmalar o'z ranglarida qoladi) */
:root[data-theme="dark"] .embed-frame:not(.embed-frame-test) { background: #fff; border-color: #3a4263; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
:root[data-theme="dark"] .embed-frame-test { background: transparent; border-color: transparent; }
:root[data-theme="dark"] .quiz-option.correct { background: rgba(64, 208, 189, 0.14); }
:root[data-theme="dark"] .quiz-option.wrong { background: rgba(255, 143, 151, 0.12); color: var(--bad); border-color: #b9475a; }
:root[data-theme="dark"] .wrong-text { color: var(--bad); }

/* kirish, qidiruv */
:root[data-theme="dark"] .site-search { background: rgba(0, 0, 0, 0.55); }
:root[data-theme="dark"] .site-search-box { border: 1px solid var(--border); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
:root[data-theme="dark"] .auth-error,
:root[data-theme="dark"] .my-logout { color: var(--bad); }
:root[data-theme="dark"] .auth-input { background: var(--bg); }
:root[data-theme="dark"] .site-login-modal { background: rgba(0, 0, 0, 0.6); }
:root[data-theme="dark"] .site-login-box { border: 1px solid var(--border); }
:root[data-theme="dark"] .site-login-why { color: var(--text); }
:root[data-theme="dark"] .site-login-err { background: rgba(229, 72, 77, 0.16); color: #ffb3b6; }
:root[data-theme="dark"] #site-role-modal [data-role] { background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border) !important; }
:root[data-theme="dark"] #site-role-modal [data-role]:hover { border-color: var(--primary) !important; }

/* Mening natijalarim */
:root[data-theme="dark"] .my-user-body .my-sync,
:root[data-theme="dark"] .my-rate--high,
:root[data-theme="dark"] .my-saved-a b { color: var(--accent-geometriya); }
:root[data-theme="dark"] .my-rate--low { color: var(--bad); }
:root[data-theme="dark"] .my-rate--mid { color: var(--warn); }
/* savol chizmalari o'z ranglarida — oq quti ichida */
:root[data-theme="dark"] .my-fig { background: #fff; border-radius: 12px; padding: 8px; }

/* ======================================================================
   Yuqori menyu (header) va chap panel (☰) — js/layout.js renderSiteHeader
   Keng ekranda (≥ 900px) yuqori menyu ko'rinadi, ☰ yashirin; torida — ☰ va chap panel.
   Qidiruv maydoni ≥ 1000px da, torida — lupa tugmasi (ikkalasi bitta qidiruv oynasini ochadi).
   ====================================================================== */
:root {
  --site-header-h: 68px;
  --hdr-bg: rgba(255, 255, 255, 0.92);
  --hdr-hover: #f3f4fd;
  --hdr-active: #eef0fd;
  --hdr-btn: #3b4fd8;
  --hdr-btn-hover: #1e2a78;
  --hdr-danger: #c73754;
}
:root[data-theme="dark"] {
  --hdr-bg: rgba(24, 29, 46, 0.9);
  --hdr-hover: #21283d;
  --hdr-active: rgba(151, 162, 255, 0.14);
  --hdr-btn: #5361e4;
  --hdr-btn-hover: #6470f0;
  --hdr-danger: #ff8f97;
}
@media (max-width: 899px) { :root { --site-header-h: 60px; } }

#site-header-root { display: contents; }
/* tepa qator JS bilan chiziladi — chizilguncha joyi band turadi, sahifa pastga sakramaydi */
#site-header-root:empty { display: block; height: var(--site-header-h); border-bottom: 1px solid var(--border); background: var(--surface); }
/* sahifalar orasida silliq o'tish (Chrome, Edge, Safari 18+): tepa qator joyida qoladi, mazmun yumshoq almashadi */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
.site-header {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--site-header-h);
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .2s ease, background-color .2s ease;
}
.site-header--sticky { position: sticky; top: 0; }
.site-header--sticky.is-scrolled {
  background: var(--hdr-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
  box-shadow: 0 6px 22px rgba(30, 42, 120, 0.08);
}
.site-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.site-logo { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; }
.site-logo-img { display: block; height: 34px; width: auto; max-width: 100%; }

.menu-toggle {
  display: flex;   /* ☰ har doim ko'rinadi (kompyuterda ham — foydalanuvchi talabi, 2026-10-26) */
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin-left: -8px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
.menu-toggle:hover { background: var(--hdr-hover); }

.site-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.site-nav a {
  position: relative;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--primary); background: var(--hdr-hover); }
.site-nav a.active { color: var(--primary); background: var(--hdr-active); }

.site-header-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: 14px; }

/* yuqoridagi qidiruv maydoni — bosilganda (yoki harf yozilganda) umumiy qidiruv oynasi ochiladi */
.site-search-trigger {
  display: none;
  align-items: center;
  gap: 8px;
  width: clamp(170px, 17vw, 240px);
  height: 40px;
  padding: 0 7px 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: text;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.site-search-trigger svg { flex: 0 0 18px; width: 18px; height: 18px; }
.site-search-trigger span { flex: 1 1 auto; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-search-trigger kbd {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}
.site-search-trigger:hover { border-color: var(--primary); background: var(--surface); }
.site-search-trigger:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--hdr-active); }

.theme-toggle,
.search-open {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover,
.search-open:hover { color: var(--primary); border-color: var(--primary); background: var(--hdr-hover); }
:root[data-theme="dark"] .theme-toggle { color: #f5c451; }

/* Kirish tugmasi va kirgan o'quvchi belgisi (bosilsa — kichik menyu) */
.site-login-btn {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  background: var(--hdr-btn);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 79, 216, 0.22);
  transition: background .15s;
}
.site-login-btn:hover { background: var(--hdr-btn-hover); }
:root[data-theme="dark"] .site-login-btn:not(.is-user) { box-shadow: none; }
.site-login-btn.is-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 200px;
  padding: 0 8px 0 4px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: none;
}
.site-login-btn.is-user:hover,
.site-login-btn.is-user[aria-expanded="true"] { background: var(--hdr-hover); border-color: var(--primary); }
.site-user-ava {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6872e0, #3a44b0);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}
.site-user-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-user-chev { display: inline-flex; color: var(--muted); transition: transform .15s; }
.site-user-chev svg { width: 16px; height: 16px; }
.site-login-btn[aria-expanded="true"] .site-user-chev { transform: rotate(180deg); }

.site-user-menu {
  position: absolute;
  z-index: 130;
  width: 260px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 18, 30, 0.16);
  animation: hdr-pop .14s ease-out;
}
:root[data-theme="dark"] .site-user-menu { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
@keyframes hdr-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.site-user-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.site-user-menu-head .site-user-ava { flex-basis: 36px; width: 36px; height: 36px; }
.site-user-menu-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.site-user-menu-who b, .site-user-menu-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-user-menu-who span { color: var(--muted); font-size: 0.8rem; }
.site-user-menu a,
.site-user-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  cursor: pointer;
}
.site-user-menu svg { flex: 0 0 20px; color: var(--muted); }
.site-user-menu a:hover,
.site-user-menu button:hover { background: var(--hdr-hover); }
.site-user-menu .site-user-logout { color: var(--hdr-danger); }
.site-user-menu .site-user-logout svg { color: currentColor; }
.site-login-author { display: inline-block; margin-top: 10px; font-size: 0.78rem; color: #9ca3af; }
.site-login-author:hover { color: var(--primary); }

/* ---------- chap panel ---------- */
.side-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(300px, 86vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .24s, box-shadow .24s;
  z-index: 100;
}
.side-drawer.open {
  transform: none;
  visibility: visible;
  transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s, box-shadow .24s;
  box-shadow: 10px 0 36px rgba(15, 18, 30, 0.16);
}
:root[data-theme="dark"] .side-drawer.open { box-shadow: 10px 0 36px rgba(0, 0, 0, 0.5); }
.side-drawer-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  padding: 12px 14px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0 12px 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.drawer-head .site-logo-img { height: 28px; }
.drawer-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.side-drawer .drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  transition: background .15s, color .15s;
}
.side-drawer .drawer-close:hover { background: var(--hdr-hover); color: var(--text); }
.drawer-label {
  padding: 10px 12px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
}
:root[data-theme="dark"] .drawer-label { color: #7a83a3; }
.drawer-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.drawer-link svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--muted); transition: color .15s; }
.drawer-link span { min-width: 0; }
.drawer-link:hover { background: var(--hdr-hover); }
.drawer-link:hover svg { color: var(--primary); }
.drawer-link.active { background: var(--hdr-active); color: var(--primary); }
.drawer-link.active svg { color: var(--primary); }
.drawer-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.drawer-divider { height: 1px; margin: 8px 12px; background: var(--border); }
.drawer-bottom { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 14px; }

/* tungi rejim almashtirgichi */
.drawer-theme { padding-right: 10px; }
.drawer-switch {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 24px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--border);
  transition: background .2s;
}
.drawer-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 18, 30, 0.25);
  transition: transform .2s;
}
.drawer-theme[aria-checked="true"] .drawer-switch { background: var(--primary); }
.drawer-theme[aria-checked="true"] .drawer-switch::after { transform: translateX(16px); }
.drawer-theme[aria-checked="true"] svg { color: #f5c451; }

/* hisob: kirgan o'quvchi */
.drawer-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}
.drawer-user-card { display: flex; align-items: center; gap: 10px; padding: 6px 6px 8px; }
.drawer-user-card .site-user-ava { flex-basis: 36px; width: 36px; height: 36px; }
.drawer-user-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.drawer-user-txt b, .drawer-user-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-user-txt small { color: var(--muted); font-size: 0.78rem; }
.drawer-link--sm { padding: 8px 10px; font-size: 0.92rem; }
.drawer-user .drawer-link:hover { background: var(--surface); }
.drawer-admin, .drawer-admin svg { color: var(--primary); }
.drawer-logout, .drawer-logout svg, .drawer-logout:hover svg { color: var(--hdr-danger); }

/* hisob: kirmagan — Google bilan kirish (yuqoridagi «Kirish» bilan bir xil) */
.drawer-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--hdr-btn);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background .15s;
}
.drawer-signin:hover { background: var(--hdr-btn-hover); }
.drawer-login-small { align-self: center; padding: 4px 12px; font-size: 0.78rem; color: #9ca3af; }
.drawer-login-small:hover { color: var(--primary); }

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 18, 30, 0.38);
  animation: hdr-fade .2s ease-out;
}
:root[data-theme="dark"] .drawer-overlay { background: rgba(0, 0, 0, 0.55); }
@keyframes hdr-fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-open-body { overflow: hidden; }

/* ---------- moslashuv ---------- */
@media (min-width: 1000px) {
  .site-search-trigger { display: flex; }
  .search-open { display: none; }
}
@media (max-width: 1099px) and (min-width: 900px) {
  .site-header { padding: 0 20px; }
  .site-nav a { padding: 8px 11px; }
  .site-header-right { margin-left: 10px; }
  .site-login-btn.is-user { max-width: 150px; }
}
@media (max-width: 899px) {
  .site-nav { display: none; }
  .menu-toggle { display: flex; }
  .site-header { padding: 0 20px; }
  .site-header-right { margin-left: auto; }
}
@media (max-width: 640px) {
  .site-header { gap: 8px; padding: 0 12px 0 14px; }
  .site-header-left { gap: 6px; }
  .site-logo-img { height: 28px; }
  .site-header-right { gap: 6px; }
  .theme-toggle, .search-open { width: 38px; height: 38px; border-radius: 11px; }
  .site-login-btn { height: 38px; padding: 0 14px; font-size: 0.86rem; }
  .site-login-btn.is-user { padding: 0 3px; max-width: none; }
  .site-user-name, .site-user-chev { display: none; }
}
@media (max-width: 370px) {
  .site-header { padding: 0 8px 0 12px; }
  .site-logo-img { height: 24px; }
  .site-header-right { gap: 4px; }
  .theme-toggle, .search-open { width: 34px; height: 34px; border-radius: 10px; }
  .site-login-btn { height: 34px; padding: 0 11px; }
  .site-login-btn.is-user { padding: 0 1px; }
}

/* mavzu kartochkalari — hammasi bir xil: ramka hamma tomondan bir xil ingichka, tepada alohida rangli chiziq yo'q (foydalanuvchi qarori, 2026-10-29). Ma'ruza sahifalari o'z rang to'plamida qoladi */
.topic-card[data-tema] { --tc: var(--primary); --tc-l: color-mix(in srgb, var(--primary) 45%, transparent); }
.topic-card[data-tema] .tc-num { color: var(--tc); }
.topic-card[data-tema] .tc-main:hover .tc-title { color: var(--tc); }
