/* ==========================================================
   ელექტრული ინჟინერია — სტილები
   ფონტები: aa (სათაურები, ნავიგაცია, ღილაკები), rr (ტექსტი)
   ========================================================== */

@font-face {
  font-family: "aa";
  src: url("../assets/fonts/aa.woff2") format("woff2"),
       url("../assets/fonts/aa.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* rr-ის Ω სიმბოლო ფონტში არასწორადაა დახატული, ამიტომ მას გამოვრიცხავთ
   (unicode-range) და Ω სისტემური ფონტიდან ჩანს. */
@font-face {
  font-family: "rr";
  src: url("../assets/fonts/rr.woff2") format("woff2"),
       url("../assets/fonts/rr.otf") format("opentype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-03A8, U+03AA-2125, U+2127-FFFF;
}
@font-face {
  font-family: "rr";
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Roboto Bold"), local("Roboto-Bold"),
       local("Helvetica Bold"), local("Helvetica-Bold"), local("Segoe UI Bold"), local("SegoeUI-Bold");
  font-weight: 100 900;
  unicode-range: U+03A9, U+2126;
}

/* ---------- ფერები და ცვლადები ---------- */
:root {
  --font-head: "aa", "Noto Sans Georgian", sans-serif;
  --font-body: "rr", "Noto Serif Georgian", serif;
  --font-code: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #1c2230;
  --text-soft: #2f3747;
  --muted: #576074;
  --border: #d9dee8;
  --border-strong: #b8c0cf;
  --shadow: 0 1px 2px rgba(20, 28, 45, .06), 0 6px 20px rgba(20, 28, 45, .07);
  --shadow-lift: 0 2px 4px rgba(20, 28, 45, .08), 0 14px 32px rgba(20, 28, 45, .12);

  --amber: #f59e0b;
  --amber-strong: #d97706;
  --amber-ink: #92400e;
  --amber-soft: #fff4dc;
  --glow: #fbbf24;

  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --bad: #b91c1c;
  --bad-soft: #fdecec;

  --code-bg: #f0f2f5;
  --code-bar: #2f3747;
  --code-text: #1c2230;

  --g8: #1d4ed8;  --g8-soft: #e8efff;
  --g9: #15803d;  --g9-soft: #e6f5ea;
  --g10: #7c3aed; --g10-soft: #f1eaff;

  --accent: #334155;
  --accent-soft: #eef1f6;
  --on-accent: #ffffff;

  --radius: 14px;
  --radius-sm: 10px;
  --tap: 44px;
  --maxw: 1080px;
  --prose: 70ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --surface: #171e2d;
    --surface-2: #1f2839;
    --text: #e9edf5;
    --text-soft: #d5dbe7;
    --muted: #a5afc3;
    --border: #2c3650;
    --border-strong: #42506e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 36px rgba(0, 0, 0, .35);

    --amber: #fbbf24;
    --amber-strong: #f59e0b;
    --amber-ink: #fcd34d;
    --amber-soft: #2e2512;

    --ok: #4ade80;
    --ok-soft: #12291c;
    --bad: #fb7185;
    --bad-soft: #321820;

    --code-bg: #0b101a;
    --code-bar: #8b98b3;
    --code-text: #e5e9f2;

    --g8: #8fb1ff;  --g8-soft: #1a2442;
    --g9: #5ee08a;  --g9-soft: #142a1d;
    --g10: #c4a8ff; --g10-soft: #261c40;

    --accent: #cbd5e1;
    --accent-soft: #1f2839;
    --on-accent: #0f1420;
    color-scheme: dark;
  }
}

body[data-grade="8"]  { --accent: var(--g8);  --accent-soft: var(--g8-soft); }
body[data-grade="9"]  { --accent: var(--g9);  --accent-soft: var(--g9-soft); }
body[data-grade="10"] { --accent: var(--g10); --accent-soft: var(--g10-soft); }

/* ---------- საფუძველი ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-synthesis: none;
  overflow-wrap: break-word;
}
@media (min-width: 768px) { body { font-size: 18px; } }

main { flex: 1 0 auto; outline: none; }
img, svg { max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 .5em;
  letter-spacing: .01em;
}
h1 { font-size: clamp(1.9rem, 5.5vw, 2.8rem); }
h2 { font-size: clamp(1.45rem, 3.6vw, 1.9rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 3px; }
/* rr ფონტი თავისთავად მსხვილია, ამიტომ გამოყოფას ფერით ვაკეთებთ */
strong, b { font-weight: inherit; color: var(--accent); }
.btn b, .btn strong, .chip b { color: inherit; }
.lat { font-family: var(--font-body); font-size: .88em; letter-spacing: 0; }
.feedback strong, .remember strong, .notice strong { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li + li { margin-top: .35em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, p[tabindex="-1"]:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--amber-strong);
  outline-offset: 2px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--text); color: var(--bg);
  font-family: var(--font-head);
  border-radius: 10px;
  text-decoration: none;
}
.skip-link:focus { top: 10px; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 768px) { .container { padding: 0 28px; } }

.prose { max-width: var(--prose); }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }

code, kbd, pre { font-family: var(--font-code); }
code.inline, .inline-code {
  font-family: var(--font-code);
  font-size: .9em;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .05em .35em;
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------- ზედა ზოლი ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--surface); }
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
  font-family: var(--font-head);
  font-size: 1.15rem;
  min-height: var(--tap);
  min-width: 0;
}
.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  border-radius: 10px;
  background: #1b2233; color: var(--glow);
}
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.grade-pill {
  font-family: var(--font-head);
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  white-space: nowrap;
}
@media (max-width: 520px) {
  .brand-text { display: none; }
}

/* ---------- ღილაკები ---------- */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 1.05rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg { flex: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { border-color: transparent; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-amber { background: var(--amber); color: #1c1407; }
.btn-amber:hover { border-color: transparent; box-shadow: 0 4px 14px rgba(245, 158, 11, .35); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #1a0b0e; } }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: .98rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.spread { justify-content: space-between; }

/* ---------- ზოგადი ბარათები ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
@media (min-width: 768px) { .card { padding: 26px; } }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-head);
  font-size: .88rem;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.q-meta .badge, .mistake-item .badge { white-space: normal; max-width: 100%; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-amber { background: var(--amber-soft); color: var(--amber-ink); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }

.notice {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--text);
  border-left: 4px solid var(--amber);
}

.page { padding-top: 28px; padding-bottom: 56px; }
@media (min-width: 768px) { .page { padding-top: 40px; padding-bottom: 72px; } }

.crumbs {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-family: var(--font-head);
  font-size: 1rem;
  margin-bottom: 14px;
  color: var(--muted);
}
.crumbs a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 36px; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- მთავარი გვერდი ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 40px 0 32px;
  background:
    radial-gradient(900px 400px at 85% -10%, color-mix(in srgb, var(--amber) 16%, transparent), transparent 70%),
    radial-gradient(700px 360px at 0% 110%, color-mix(in srgb, var(--g8) 10%, transparent), transparent 70%);
}
@media (min-width: 768px) { .hero { padding: 64px 0 48px; } }
.hero-circuit {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  color: var(--border-strong);
  opacity: .55;
  pointer-events: none;
}
.hero-circuit .pulse { stroke: var(--amber); stroke-dasharray: 10 190; animation: pulse-run 6s linear infinite; }
.hero-circuit .pulse.p2 { animation-duration: 8s; animation-delay: -3s; }
.hero-circuit .pulse.p3 { animation-duration: 7s; animation-delay: -5s; }
@keyframes pulse-run { to { stroke-dashoffset: -400; } }
.hero .container { position: relative; }
.hero h1 { margin-bottom: .35em; font-size: clamp(2rem, 6vw, 3.4rem); }
.hero h1 .h1-line { display: inline-block; }
.hero h1 .dash { color: var(--amber-strong); }
.hero-lead { font-size: 1.1rem; max-width: 52ch; color: var(--text-soft); }
.continue-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 18px;
}

.grade-cards {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  margin: 8px 0 8px;
}
@media (min-width: 760px) { .grade-cards { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.grade-card {
  --c: var(--g8); --c-soft: var(--g8-soft);
  position: relative;
  display: flex; flex-direction: column;
  padding: 22px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.grade-card::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 6px;
  background: var(--c);
}
.grade-card[data-g="9"] { --c: var(--g9); --c-soft: var(--g9-soft); }
.grade-card[data-g="10"] { --c: var(--g10); --c-soft: var(--g10-soft); }
.grade-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--c) 45%, var(--border)); }
.grade-card .roman {
  font-family: var(--font-head);
  font-size: 4.2rem;
  line-height: 1;
  color: var(--c);
  margin: 6px 0 4px;
}
.grade-card .gc-title { font-family: var(--font-head); font-size: 1.35rem; margin-bottom: 10px; }
.grade-card .gc-topics { list-style: none; padding: 0; margin: 0 0 16px; color: var(--text-soft); font-size: .98rem; }
.grade-card .gc-topics li { position: relative; padding-left: 18px; }
.grade-card .gc-topics li + li { margin-top: 4px; }
.grade-card .gc-topics li::before {
  content: ""; position: absolute; left: 2px; top: .62em;
  width: 8px; height: 8px; border-radius: 2px; background: var(--c); opacity: .75;
}
.grade-card .gc-foot { margin-top: auto; }
.grade-card .gc-go {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-head);
  color: var(--c);
  margin-top: 12px;
}
.grade-card .roman-wrap { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.grade-card .gc-badge { margin-bottom: 10px; }

.mini-progress { font-size: .92rem; color: var(--muted); }
.mini-progress .bar { margin-top: 6px; }

.bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar > span {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: inherit;
  background: var(--c, var(--accent));
  transition: width .4s ease;
}
.bar.amber > span { background: var(--amber); }

.how-it-works {
  display: grid; gap: 14px;
  grid-template-columns: 1fr;
  margin-top: 28px;
}
@media (min-width: 760px) { .how-it-works { grid-template-columns: repeat(3, 1fr); } }
.how-item { display: flex; gap: 12px; align-items: flex-start; }
.how-item .how-icon {
  flex: none; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--amber-soft); color: var(--amber-ink);
}
.how-item h3 { font-size: 1.15rem; margin-bottom: .2em; }
.how-item p { margin: 0; color: var(--muted); font-size: .98rem; }

/* ---------- კლასის გვერდი ---------- */
.grade-head {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 18px;
}
.grade-head .roman-big {
  flex: none;
  display: grid; place-items: center;
  min-width: 76px; height: 76px; padding: 0 10px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-head);
  font-size: 2.4rem; line-height: 1;
}
.grade-head h1 { margin: 0; }
.grade-head p { margin: 4px 0 0; color: var(--muted); }

.stats {
  display: grid; gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
}
.stat .stat-label { font-size: .85rem; color: var(--muted); line-height: 1.3; }
.stat .stat-value { font-family: var(--font-head); font-size: 1.6rem; line-height: 1.15; margin: 4px 0 6px; }
.stat .stat-value small { font-size: .95rem; color: var(--muted); }
@media (max-width: 480px) {
  .stats { gap: 8px; }
  .stat { padding: 10px; }
  .stat .stat-value { font-size: 1.3rem; }
  .stat .stat-label { font-size: .78rem; }
}

.tabs {
  display: flex; gap: 6px;
  padding: 5px;
  margin-bottom: 26px;
  background: var(--surface-2);
  border-radius: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap);
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 1.05rem;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.tab .count {
  font-size: .8rem; min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--bad-soft); color: var(--bad);
}
@media (max-width: 560px) {
  .tabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .tab { padding: 8px 6px; font-size: 1rem; }
}

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.lesson-list {
  list-style: none; padding: 0; margin: 0 0 18px;
  display: grid; gap: 10px;
}
.lesson-list li + li { margin: 0; }
.lesson-link {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  min-height: 64px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.lesson-link:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.lesson-num {
  flex: none;
  display: grid; place-items: center;
  min-width: 52px; height: 40px; padding: 0 8px;
  border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-head);
  font-size: 1.1rem;
}
.lesson-link .lt { flex: 1; min-width: 0; line-height: 1.4; }
.lesson-link .lt small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.read-mark {
  flex: none;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-head); font-size: .9rem;
  color: var(--ok);
}
.read-mark.no { color: var(--muted); opacity: .7; }

.review-card {
  margin-top: 30px;
  border-left: 6px solid var(--g9);
  background: linear-gradient(0deg, var(--surface), var(--surface)), var(--g9-soft);
}
.review-card h2 { color: var(--g9); }
.review-card .lesson-num { background: var(--g9-soft); color: var(--g9); }
.review-card .lesson-link:hover { border-color: var(--g9); }

/* ---------- გაკვეთილი ---------- */
.lesson-head { margin-bottom: 22px; }
.lesson-head .kicker {
  display: inline-block;
  font-family: var(--font-head);
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 1.05rem;
}
.lesson-body { max-width: 760px; }
.lesson-body > p, .lesson-body > ul, .lesson-body > ol { max-width: var(--prose); }
.lesson-body h2 { margin-top: 1.6em; font-size: 1.45rem; }
.lead {
  font-size: 1.1em;
  color: var(--text-soft);
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--accent-soft);
  border-left: 5px solid var(--accent);
  max-width: var(--prose);
}
.lead::before { content: "💡 "; }
.example {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  max-width: var(--prose);
}
.example .ex-label { font-family: var(--font-head); color: var(--amber-ink); display: block; margin-bottom: 2px; }
.formula {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 1.5rem;
  padding: 8px 18px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  margin: 4px 0 14px;
  letter-spacing: .03em;
}

.remember {
  margin: 28px 0;
  padding: 18px 20px 8px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  border: 2px solid color-mix(in srgb, var(--amber) 55%, transparent);
  max-width: var(--prose);
}
.remember h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px; font-size: 1.35rem;
  color: var(--amber-ink);
}
.remember ul { list-style: none; padding: 0; }
.remember li { position: relative; padding-left: 28px; }
.remember li::before {
  content: "⚡"; position: absolute; left: 0; top: 0;
}

.selfcheck { margin-top: 32px; }
.selfcheck > h2 { display: flex; align-items: center; gap: 10px; }
.selfcheck .q-card + .q-card { margin-top: 16px; }

.lesson-actions {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: grid; gap: 12px;
}
@media (min-width: 640px) {
  .lesson-actions { grid-template-columns: auto 1fr auto; align-items: center; }
}
.read-toggle[aria-pressed="true"] { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }

/* ---------- ინტერაქტიული ბლოკი ---------- */
.widget {
  margin: 24px 0;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.widget-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(90deg, var(--amber-soft), transparent);
  border-bottom: 1px solid var(--border);
}
.widget-head .w-icon {
  flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--amber); color: #1c1407;
}
.widget-head h3 { margin: 0; font-size: 1.15rem; }
.widget-body { padding: 18px; }
@media (min-width: 768px) { .widget-body { padding: 22px; } }
.widget-hint { color: var(--muted); font-size: .95rem; margin: 0 0 12px; }
.w-stage {
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  padding: 12px;
  margin-bottom: 14px;
  overflow: hidden;
}
.w-stage svg { display: block; width: 100%; height: auto; }
.w-stage.tall svg { max-height: 360px; }
.w-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.w-row + .w-row { margin-top: 10px; }
.w-grid2 { display: grid; gap: 16px; }
.w-grid2 > *, .fields > *, .lesson-actions > *, .counter-box > * { min-width: 0; }
@media (min-width: 700px) { .w-grid2 { grid-template-columns: 1fr 1fr; align-items: start; } }
.readout {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 1rem;
}
.readout .big { font-family: var(--font-body); font-size: 1.55rem; line-height: 1.15; }
.readout .big.amber { color: var(--amber-ink); }
.status-line {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 1rem;
  background: var(--surface-2);
  margin-top: 12px;
}
.status-line.on { background: var(--amber-soft); }
.status-line.ok { background: var(--ok-soft); color: var(--ok); }
.status-line.bad { background: var(--bad-soft); color: var(--bad); }
.status-line .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.status-line.on .dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-family: var(--font-head); font-size: 1rem; display: flex; justify-content: space-between; gap: 10px; }
.field output, .field .val { font-family: var(--font-code); font-size: .95rem; color: var(--amber-ink); font-weight: 700; }
.fields { display: grid; gap: 14px; }
@media (min-width: 640px) { .fields.two { grid-template-columns: 1fr 1fr; } }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: var(--tap);
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--amber) 0 var(--fill, 50%), var(--border) var(--fill, 50%) 100%);
}
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: var(--border); }
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--amber); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -9px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--amber-strong);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--amber-strong);
}
input[type="range"]:focus-visible { outline: 3px solid var(--amber-strong); outline-offset: 2px; }

.text-input {
  font: inherit;
  font-family: var(--font-code);
  min-height: var(--tap);
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  width: 9em;
  max-width: 100%;
}
.text-input:focus { border-color: var(--amber-strong); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 35%, transparent); }

.seg {
  display: inline-flex; flex-wrap: wrap;
  padding: 4px; gap: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}
.seg button {
  -webkit-appearance: none; appearance: none;
  min-height: 40px; padding: 6px 14px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-code);
  font-size: .95rem; font-weight: 700;
  cursor: pointer;
}
.seg button.txt { font-family: var(--font-head); font-weight: 400; font-size: 1rem; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.seg button:focus-visible { outline: 3px solid var(--amber-strong); }

.switch {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: var(--tap); padding: 6px 14px 6px 8px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-head); font-size: 1rem;
  cursor: pointer;
}
.switch .knob {
  position: relative; width: 46px; height: 26px; flex: none;
  border-radius: 999px; background: var(--border-strong);
  transition: background-color .2s ease;
}
.switch .knob::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .2s ease;
}
.switch[aria-checked="true"] .knob { background: var(--amber-strong); }
.switch[aria-checked="true"] .knob::after { transform: translateX(20px); }
.switch .sw-state { font-family: var(--font-code); font-weight: 700; font-size: .9rem; color: var(--muted); }
.switch[aria-checked="true"] .sw-state { color: var(--amber-ink); }

/* კოდის ხაზები ინტერაქტივებში */
.code-lines {
  margin: 0;
  padding: 10px 0;
  border-radius: 10px;
  background: var(--code-bg);
  border-left: 5px solid var(--code-bar);
  font-family: var(--font-code);
  font-size: .92rem;
  line-height: 1.55;
  overflow-x: auto;
  color: var(--code-text);
}
.code-lines .ln {
  display: block;
  padding: 1px 14px 1px 12px;
  white-space: pre;
  border-left: 4px solid transparent;
  min-width: max-content;
}
.code-lines .ln.active { background: color-mix(in srgb, var(--amber) 28%, transparent); border-left-color: var(--amber-strong); }
.code-lines .ln.dim { opacity: .45; }
.code-lines .ln.hit { background: color-mix(in srgb, var(--ok) 18%, transparent); border-left-color: var(--ok); }
.code-lines button.ln {
  -webkit-appearance: none; appearance: none;
  width: 100%; text-align: left;
  border-top: 0; border-right: 0; border-bottom: 0;
  background: transparent; color: inherit;
  font: inherit; cursor: pointer;
}
.code-lines button.ln:hover, .code-lines button.ln[aria-pressed="true"] { background: color-mix(in srgb, var(--amber) 20%, transparent); border-left-color: var(--amber-strong); }
.tok-k { color: #7c3aed; }
.tok-f { color: #0e6ea8; }
.tok-n { color: #b45309; }
.tok-c { color: #637087; font-style: italic; }
@media (prefers-color-scheme: dark) {
  .tok-k { color: #c4a8ff; }
  .tok-f { color: #7dd3fc; }
  .tok-n { color: #fcd34d; }
  .tok-c { color: #8b98b3; }
}

.counter-box { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.counter {
  padding: 12px; border-radius: 12px; background: var(--surface-2); text-align: center;
}
.counter .c-name { font-family: var(--font-code); font-weight: 700; }
.counter .c-val { font-family: var(--font-head); font-size: 2.4rem; line-height: 1.1; color: var(--amber-ink); }
.counter.flash { animation: flash .5s ease; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--amber) 40%, transparent); } 100% { background: var(--surface-2); } }

/* ფლიპ-ბარათები (სენსორები) */
.flip-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 640px) { .flip-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.flip {
  -webkit-appearance: none; appearance: none;
  position: relative; display: block; width: 100%;
  min-height: 230px; padding: 0; border: 0;
  background: transparent; cursor: pointer;
  perspective: 900px;
  font: inherit; color: inherit; text-align: center;
}
.flip-inner {
  position: absolute; inset: 0;
  transition: transform .5s ease;
  transform-style: preserve-3d;
}
.flip[aria-pressed="true"] .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.flip-face img { max-height: 130px; width: auto; max-width: 100%; }
.flip-front .tap-hint { font-size: .85rem; color: var(--muted); font-family: var(--font-head); }
.flip-back { transform: rotateY(180deg); background: var(--amber-soft); }
.flip-back .fb-name { font-family: var(--font-head); font-size: 1.15rem; line-height: 1.25; }
.flip-back .fb-what { font-size: .95rem; line-height: 1.45; }
.flip-back .fb-model { font-family: var(--font-code); font-size: .85rem; font-weight: 700; color: var(--amber-ink); }
.light-img { background: #fff; border-radius: 10px; padding: 6px; }

/* ---------- კითხვები ---------- */
.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
@media (min-width: 768px) { .q-card { padding: 26px; } }
.q-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.q-stem { font-size: 1.08em; margin-bottom: .8em; max-width: var(--prose); }
.q-stem:last-child { margin-bottom: 0; }
pre.code-block {
  margin: 0 0 1em;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-text);
  border-left: 5px solid var(--code-bar);
  border-radius: 6px 10px 10px 6px;
  font-family: var(--font-code);
  font-size: .95rem;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  tab-size: 4;
}
pre.code-block code { font-family: inherit; }
.q-figure {
  margin: 0 0 1em;
  padding: 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  display: grid; place-items: center;
}
.q-figure img { max-height: 260px; width: auto; max-width: 100%; }
.q-figure.wide img { width: 100%; max-height: 280px; object-fit: contain; }

.options { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.options li + li { margin: 0; }
.opt {
  -webkit-appearance: none; appearance: none;
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
  touch-action: manipulation;
}
.opt:hover:not([disabled]) { border-color: var(--accent); background: var(--accent-soft); }
.opt .letter {
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  font-family: var(--font-head);
  font-size: 1rem;
  margin-top: -1px;
}
.opt .opt-text { flex: 1; min-width: 0; padding-top: 1px; }
.opt .mark { flex: none; font-family: var(--font-head); font-size: .92rem; padding-top: 3px; white-space: nowrap; }
.opt[disabled] { cursor: default; }
.opt.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.is-selected .letter { background: var(--accent); color: var(--on-accent); }
.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-correct .letter { background: var(--ok); color: #fff; }
.opt.is-correct .mark { color: var(--ok); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .letter { background: var(--bad); color: #fff; }
.opt.is-wrong .mark { color: var(--bad); }
@media (prefers-color-scheme: dark) {
  .opt.is-correct .letter, .opt.is-wrong .letter { color: #0f1420; }
}
.opt.is-faded { opacity: .6; }

.num-answer { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.num-answer .unit { font-family: var(--font-head); }

.feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border-left: 5px solid;
}
.feedback.ok { background: var(--ok-soft); border-color: var(--ok); }
.feedback.bad { background: var(--bad-soft); border-color: var(--bad); }
.feedback .fb-title { font-family: var(--font-head); font-size: 1.2rem; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.bad .fb-title { color: var(--bad); }
.feedback p { margin: 0; }
.feedback p + p { margin-top: 6px; }
.explain { color: var(--text-soft); }

.q-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 16px; }

.progress-line { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.progress-line .bar { flex: 1; }
.progress-line .pl-text { font-family: var(--font-head); white-space: nowrap; }

/* ვარჯიშის მენიუ */
.pick-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 26px; }
@media (min-width: 700px) { .pick-grid { grid-template-columns: 1fr 1fr; } }
.pick {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  min-height: 72px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
}
.pick:hover { border-color: var(--accent); }
.pick .p-icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.pick.amber .p-icon { background: var(--amber-soft); color: var(--amber-ink); }
.pick .p-text { flex: 1; min-width: 0; }
.pick .p-title { font-family: var(--font-head); font-size: 1.2rem; line-height: 1.25; }
.pick .p-sub { color: var(--muted); font-size: .92rem; }
.pick[aria-disabled="true"] { opacity: .55; pointer-events: none; }

.group-title { font-size: 1.25rem; margin: 22px 0 12px; color: var(--muted); }

/* შეჯამება */
.summary { text-align: center; }
.score-big {
  font-family: var(--font-head);
  font-size: clamp(3.4rem, 14vw, 5.5rem);
  line-height: 1;
  color: var(--accent);
  margin: 6px 0;
}
.score-big small { font-size: .45em; color: var(--muted); }
.score-pct { font-family: var(--font-head); font-size: 1.4rem; }
.summary .btn-row { justify-content: center; margin-top: 18px; }
.score-note {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber-ink);
  font-family: var(--font-head);
}

.result-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 14px; }
.result-list > li + li { margin: 0; }
.result-item { border-left: 6px solid var(--ok); }
.result-item.wrong { border-left-color: var(--bad); }
.result-item.skipped { border-left-color: var(--border-strong); }
.r-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.r-num { font-family: var(--font-head); font-size: 1.1rem; }
.r-verdict { font-family: var(--font-head); display: inline-flex; align-items: center; gap: 6px; }
.r-verdict.ok { color: var(--ok); }
.r-verdict.bad { color: var(--bad); }
.r-verdict.skip { color: var(--muted); }
.r-answers { display: grid; gap: 6px; margin: 10px 0; }
.r-answers .ra { padding: 8px 12px; border-radius: 10px; background: var(--surface-2); }
.r-answers .ra .ra-label { font-family: var(--font-head); color: var(--muted); font-size: .9rem; display: block; }
.r-answers .ra.ok { background: var(--ok-soft); }
.r-answers .ra.bad { background: var(--bad-soft); }

/* ---------- ტესტი ---------- */
.testbar {
  position: sticky; top: 61px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.testbar .tb-left { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); }
.timer {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  min-width: 96px;
  justify-content: center;
}
.timer.low { background: var(--bad-soft); color: var(--bad); }
.timer.off { font-size: 1rem; color: var(--muted); }
.testbar .tb-right { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .testbar { padding: 8px 10px; gap: 6px 8px; }
  .testbar .tb-label, .testbar .tb-answered { display: none; }
  .testbar .timer-toggle { min-width: 44px; padding: 6px 10px; }
  .timer { font-size: 1.2rem; min-width: 84px; }
  .timer.off { font-size: .85rem; min-width: 0; }
}

.qmap-wrap { margin-top: 22px; }
.qmap-wrap h2 { font-size: 1.2rem; }
.qmap { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 420px; }
@media (min-width: 700px) { .qmap { grid-template-columns: repeat(10, 1fr); max-width: 640px; } }
.qmap button {
  -webkit-appearance: none; appearance: none;
  position: relative;
  min-height: var(--tap);
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 1.05rem;
  cursor: pointer;
}
.qmap button.answered { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.qmap button.answered::after {
  content: "✓"; position: absolute; top: 0; right: 4px; font-size: .7rem; font-family: var(--font-body);
}
.qmap button.current { outline: 3px solid var(--amber-strong); outline-offset: 2px; }
.qmap-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: .9rem; color: var(--muted); }
.qmap-legend span { display: inline-flex; align-items: center; gap: 6px; }
.qmap-legend i { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--border); }
.qmap-legend i.a { background: var(--accent); border-color: var(--accent); }
.qmap-legend i.c { outline: 2px solid var(--amber-strong); outline-offset: 1px; }

.test-intro .rules { margin: 14px 0; }
.test-cards { display: grid; gap: 16px; }
@media (min-width: 800px) { .test-cards.two { grid-template-columns: 1fr 1fr; } }
.test-card h2 { font-size: 1.4rem; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }

/* ---------- შეცდომები ---------- */
.mistake-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.mistake-list li + li { margin: 0; }
.mistake-item { padding: 14px 16px; }
.mistake-item .mi-stem { margin: 4px 0 0; }
.empty-state { text-align: center; padding: 30px 20px; }
.empty-state .es-icon { width: 64px; height: 64px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 18px; background: var(--ok-soft); color: var(--ok); }
.danger-zone { margin-top: 36px; padding: 18px; border-radius: var(--radius); border: 2px dashed var(--border-strong); }
.danger-zone h2 { font-size: 1.2rem; }

/* ---------- დიალოგი ---------- */
dialog.ee-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
dialog.ee-dialog::backdrop { background: rgba(12, 16, 26, .55); }
.ee-dialog .dlg-body { padding: 22px 22px 8px; }
.ee-dialog h2 { font-size: 1.4rem; }
.ee-dialog .dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 12px 22px 22px; }
.dlg-fallback {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(12, 16, 26, .55);
  padding: 16px;
}
.dlg-fallback > .ee-dialog { position: static; display: block; }

/* ---------- ძირი ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .92rem;
}
.footer-inner { padding: 18px 16px 22px; }
.footer-inner p { margin: 0; }
.footer-inner p + p { margin-top: 4px; }

/* ---------- SVG ინტერაქტივების დეტალები ---------- */
.svg-text { font-family: var(--font-head); fill: var(--text); }
.svg-muted { fill: var(--muted); }
.svg-code { font-family: var(--font-code); font-weight: 700; }
.wire { stroke: var(--text-soft); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wire.live { stroke: var(--amber-strong); }
.hot { cursor: pointer; }
.hot:focus { outline: none; }
.hot:focus-visible .hot-ring, .hot:hover .hot-ring { stroke: var(--amber-strong); stroke-width: 3; }
.board-wrap { position: relative; background: #fff; border-radius: 12px; padding: 8px; }
.board-wrap svg { display: block; width: 100%; height: auto; }
.zone { fill: transparent; stroke: transparent; stroke-width: .5; cursor: pointer; }
.zone:hover, .zone.sel { fill: rgba(245, 158, 11, .28); stroke: #d97706; }
.zone:focus { outline: none; }
.zone:focus-visible { fill: rgba(245, 158, 11, .35); stroke: #b45309; stroke-width: .7; }
.zone.good { fill: rgba(21, 128, 61, .35); stroke: #15803d; }
.zone.badz { fill: rgba(185, 28, 28, .3); stroke: #b91c1c; }
.board-label { font-family: var(--font-head); font-size: 2.3px; fill: #1c2230; paint-order: stroke; stroke: #fff; stroke-width: .5px; pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip {
  -webkit-appearance: none; appearance: none;
  min-height: 40px; padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-head);
  font-size: .98rem;
  cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--amber-strong); background: var(--amber-soft); }
.info-panel {
  min-height: 92px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 5px solid var(--amber);
}
.info-panel h4 { margin: 0 0 4px; font-size: 1.15rem; }
.info-panel p { margin: 0; }

.bb-hole { cursor: pointer; }
.bb-cell rect.hole { fill: #4b5563; }
.bb-cell.lit rect.hole { fill: #f59e0b; }
.bb-cell.focus rect.hole { fill: #b45309; }
.bb-cell .halo { fill: transparent; }
.bb-cell.lit .halo { fill: rgba(245, 158, 11, .25); }

.game-box { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.game-box .g-q { font-family: var(--font-head); font-size: 1.2rem; margin-bottom: 8px; }
.score-chip { font-family: var(--font-head); color: var(--amber-ink); }

.timeline { display: block; width: 100%; height: auto; }
.truth { border-collapse: collapse; width: 100%; max-width: 520px; font-family: var(--font-code); font-size: .95rem; }
.truth th, .truth td { border: 1px solid var(--border); padding: 8px 10px; text-align: center; }
.truth th { background: var(--surface-2); font-weight: 700; }
.truth tr.cur td { background: var(--amber-soft); font-weight: 700; }
.table-wrap { overflow-x: auto; }

.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }


/* ---------- გაკვეთილის სურათი ---------- */
.lesson-fig { margin: 8px 0 20px; max-width: 520px; }
.lesson-fig img { display: block; margin: 0 auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; max-height: 240px; width: auto; max-width: 100%; }
.lesson-fig figcaption { font-size: .9rem; color: var(--muted); margin-top: 6px; text-align: center; }

/* ---------- სიმულაციის LED ---------- */
.sim-led .lens { fill: #d4d9e2; stroke: #8a94a6; stroke-width: 2; transition: fill .15s ease; }
.sim-led .rim { fill: #b6bdc9; }
.sim-led .glow { opacity: 0; transition: opacity .15s ease; pointer-events: none; }
@media (prefers-color-scheme: dark) {
  .sim-led .lens { fill: #4b5567; stroke: #7b869b; }
  .sim-led .rim { fill: #5b667a; }
}
.wire.sigw { stroke-width: 3; }
.svg-code { font-family: var(--font-code); font-weight: 700; }
.steps li { margin-top: .4em; }
.pushbtn:focus-visible { outline: 4px solid var(--amber-strong); outline-offset: 4px; }
.flip:focus-visible { outline: 3px solid var(--amber-strong); outline-offset: 4px; border-radius: 16px; }

/* ---------- მოძრაობის შემცირება ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .hero-circuit .pulse { display: none; }
}

@media print {
  .topbar, .site-footer, .tabs, .btn, .testbar { display: none !important; }
}
