/* =========================================================
   Digital Logic Design — Question Bank
   Stylesheet
   ========================================================= */

:root {
  --bg: #f4f6fc;
  --bg-soft: #eef2fa;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --surface-3: #f1f4fb;
  --ink: #111a2e;
  --ink-2: #33405a;
  --muted: #6d7892;
  --line: #dfe5f1;
  --line-strong: #cfd7e7;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-ink: #ffffff;
  --cyan: #0891b2;
  --good: #0b8f64;
  --good-bg: #e7f8f1;
  --good-line: #b7ead8;
  --bad: #d33b3b;
  --bad-bg: #fdeeee;
  --bad-line: #f3caca;
  --warn: #a65a06;
  --warn-bg: #fff7e6;
  --warn-line: #f2dfb3;
  --shadow-sm: 0 2px 8px rgba(18, 31, 57, .04);
  --shadow: 0 12px 32px rgba(18, 31, 57, .07);
  --shadow-lg: 0 28px 70px rgba(8, 15, 35, .22);
  --radius: 18px;
  --radius-sm: 12px;
  --font-ar: "Segoe UI", Tahoma, Arial, sans-serif;
  --font-en: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", "Courier New", monospace;
  --content: 1080px;
  --hero-ink: #f5f8ff;
}

html[data-theme="dark"] {
  --bg: #070d1b;
  --bg-soft: #0a1222;
  --surface: #101a2c;
  --surface-2: #0c1525;
  --surface-3: #16223a;
  --ink: #e9effa;
  --ink-2: #c3cee1;
  --muted: #93a2bb;
  --line: #22314b;
  --line-strong: #2e405f;
  --primary: #818cf8;
  --primary-2: #a5b4fc;
  --primary-ink: #10142b;
  --cyan: #22d3ee;
  --good: #35d9a4;
  --good-bg: rgba(16, 185, 129, .12);
  --good-line: rgba(16, 185, 129, .28);
  --bad: #ff7b7b;
  --bad-bg: rgba(239, 68, 68, .12);
  --bad-line: rgba(239, 68, 68, .28);
  --warn: #f3bd64;
  --warn-bg: rgba(245, 158, 11, .10);
  --warn-line: rgba(245, 158, 11, .25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .18);
  --shadow: 0 14px 36px rgba(0, 0, 0, .30);
}

* { box-sizing: border-box; }

html {
  --toolbar-h: 148px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--toolbar-h) + 12px);
}

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 100% -40px, rgba(99, 102, 241, .09), transparent 65%),
    radial-gradient(700px 400px at 0% 15%, rgba(8, 145, 178, .06), transparent 65%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ar);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

::selection { background: rgba(99, 102, 241, .25); }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
img, svg { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  transform: translateY(-160%);
  transition: transform .2s ease;
}
.skip-link:focus { transform: translateY(0); }

/* =========================================================
   HERO
   ========================================================= */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1000px 560px at 88% -15%, rgba(99, 102, 241, .38), transparent 60%),
    radial-gradient(780px 420px at 4% 105%, rgba(8, 145, 178, .24), transparent 62%),
    linear-gradient(145deg, #0a1022 0%, #0d1730 55%, #0a1327 100%);
  color: var(--hero-ink);
  isolation: isolate;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .85), transparent 92%);
}

.hero-glow {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}
.hero-glow-a {
  width: 430px; height: 430px;
  background: rgba(99, 102, 241, .22);
  inset-block-start: -160px;
  inset-inline-start: -100px;
}
.hero-glow-b {
  width: 360px; height: 360px;
  background: rgba(6, 182, 212, .13);
  inset-block-end: -190px;
  inset-inline-end: 18%;
}

.nav {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-badge {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #c7d2fe;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(99, 102, 241, .34), rgba(8, 145, 178, .16));
  border: 1px solid rgba(199, 210, 254, .25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.brand-badge svg { width: 25px; height: 25px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong {
  font-family: var(--font-en);
  font-size: 16px;
  letter-spacing: -.01em;
}
.brand-text small { color: rgba(226, 232, 240, .66); font-size: 11.5px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-links a {
  color: rgba(238, 243, 255, .78);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 9px;
  transition: background-color .18s ease, color .18s ease;
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, .07); }

.icon-btn {
  width: 38px;
  height: 38px;
  margin-inline-start: 4px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  color: #eef2ff;
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

.hero-body {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 28px 78px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 54px;
  align-items: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .055);
  color: rgba(238, 243, 255, .82);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  margin-bottom: 22px;
}
.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .14);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(52, 211, 153, .12); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, .04); }
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(2.25rem, 4.4vw, 3.6rem);
  line-height: 1.28;
  font-weight: 800;
  letter-spacing: -.015em;
  color: #f7f9ff;
  text-wrap: balance;
}
.grad-text {
  background: linear-gradient(100deg, #c7d2fe 0%, #a5b4fc 35%, #67e8f9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lede {
  margin: 0 0 26px;
  max-width: 55ch;
  color: rgba(224, 232, 247, .74);
  font-size: 16px;
  line-height: 1.85;
  text-wrap: pretty;
}
.hero-lede em { color: rgba(238, 243, 255, .95); font-style: normal; font-weight: 600; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 20px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 12px 26px rgba(79, 70, 229, .32);
}
.btn-primary:hover { box-shadow: 0 16px 32px rgba(79, 70, 229, .42); }

.btn-ghost {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .17);
  color: #eef3ff;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .11); }

.btn-soft {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--primary);
}
.btn-soft:hover { background: rgba(99, 102, 241, .07); border-color: rgba(99, 102, 241, .40); }

.btn-sm { padding: 9px 15px; font-size: 13.5px; }

.hero-footnote {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 20px 0 0;
  color: rgba(205, 216, 238, .58);
  font-size: 12.5px;
}
.hero-footnote .tick { color: #34d399; font-weight: 800; }
.hero-footnote .sep { opacity: .45; }

/* Progress panel */

.progress-panel {
  position: relative;
  padding: 22px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .095), rgba(255, 255, 255, .035));
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(238, 243, 255, .7);
}
.panel-pct {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.progress-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .11);
  overflow: hidden;
  margin: 13px 0 22px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #818cf8, #22d3ee);
  box-shadow: 0 0 14px rgba(34, 211, 238, .45);
  transition: width .5s cubic-bezier(.2, .8, .2, 1);
}
.panel-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.pstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
}
.pstat strong {
  font-family: var(--font-mono);
  font-size: 26px;
  line-height: 1.1;
  color: #fff;
  font-weight: 700;
}
.pstat span { font-size: 11.5px; color: rgba(218, 227, 244, .55); }

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 11.5px;
  color: rgba(205, 216, 238, .56);
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: rgba(238, 243, 255, .7);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: #fff; }

.panel-deco {
  display: flex;
  gap: 5px;
  margin-top: 16px;
  opacity: .6;
}
.panel-deco span {
  height: 4px;
  flex: 1;
  border-radius: 999px;
  background: rgba(129, 140, 248, .35);
}
.panel-deco span:nth-child(2n) { background: rgba(34, 211, 238, .3); }

/* =========================================================
   TOOLBAR
   ========================================================= */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .toolbar { background: var(--bg); }
}
.toolbar-inner {
  max-width: var(--content);
  margin: 0 auto;
  padding: 14px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 980px) {
  .toolbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 540px) minmax(0, 1fr);
    grid-template-areas:
      "search status"
      "sections sections";
    align-items: center;
    gap: 10px 10px;
  }
  .searchbox { grid-area: search; }
  .status-row { grid-area: status; }
  .section-chips { grid-area: sections; }
}

.searchbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, box-shadow .18s ease;
  max-width: 560px;
  width: 100%;
}
.searchbox:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}
.searchbox svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.searchbox input::placeholder { color: var(--muted); opacity: .85; }
.searchbox kbd {
  flex: 0 0 auto;
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.chip:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-sm);
}
.chip .chip-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-family: var(--font-mono);
}
.chip.active .chip-count { background: rgba(255, 255, 255, .16); color: inherit; }

.section-chips .chip { padding: 8px 13px; }
@media (min-width: 980px) {
  .section-chips {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
  .section-chips .chip {
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
  }
}
@media (min-width: 721px) and (max-width: 979.98px) {
  .section-chips {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 5px;
  }
  .section-chips .chip {
    padding: 7px 10px;
    font-size: 11.5px;
  }
}
@media (min-width: 721px) {
  .section-chips .chip-count {
    min-width: 18px;
    height: 17px;
    font-size: 10px;
  }
}
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.status-chips .chip {
  padding: 5px 10px;
  font-size: 11.5px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.status-chips .chip:hover { background: var(--surface); border-color: var(--line); }
.status-chips .chip.active {
  background: rgba(79, 70, 229, .10);
  border-color: rgba(79, 70, 229, .22);
  color: var(--primary);
  box-shadow: none;
}
.status-chips .chip svg { width: 12px; height: 12px; }
.result-count {
  margin: 0;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

/* =========================================================
   CONTENT / QUESTION LIST
   ========================================================= */

.content {
  max-width: var(--content);
  margin: 0 auto;
  padding: 48px 24px 20px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.section-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.kicker {
  margin: 0 0 5px;
  color: var(--primary);
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  line-height: 1.3;
  letter-spacing: -.01em;
}
.section-sub {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  text-align: end;
}

.qlist { display: grid; gap: 16px; }

.qcard {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
  overflow: hidden;
}
.qcard:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.qcard.is-correct { border-color: var(--good-line); }
.qcard.is-wrong { border-color: var(--bad-line); }
.qcard::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 4px;
  background: transparent;
  transition: background-color .2s ease;
}
.qcard.is-correct::before { background: var(--good); }
.qcard.is-wrong::before { background: var(--bad); }

.qcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 0;
}
.qmeta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.qnum {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
.qtag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 700;
}
.qtag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: var(--primary);
}
.diff {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
}
.diff.easy { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.diff.medium { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.diff.hard { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }

.qcard-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.retry-btn:hover { color: var(--primary); border-color: var(--primary); background: rgba(99, 102, 241, .07); }
.retry-btn svg { width: 13px; height: 13px; }

.bookmark-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.bookmark-btn svg { width: 14px; height: 14px; fill: none; }
.bookmark-btn:hover { color: var(--primary); border-color: var(--primary); }
.bookmark-btn.active { color: var(--primary); border-color: rgba(99, 102, 241, .35); background: rgba(99, 102, 241, .10); }
.bookmark-btn.active svg { fill: currentColor; }

.qcard-body { padding: 12px 20px 18px; }

.qtext {
  margin: 0 0 14px;
  font-family: var(--font-en);
  font-size: 17.5px;
  line-height: 1.55;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  letter-spacing: -.005em;
  text-wrap: pretty;
}
.qtext::before {
  content: "Q";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-inline-end: 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  vertical-align: 2px;
}

.q-visual {
  margin: 4px 0 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(500px 200px at 50% 0%, rgba(99, 102, 241, .055), transparent 70%),
    var(--surface-2);
  border-radius: 13px;
  padding: 14px;
  overflow-x: auto;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.choices.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices.one { grid-template-columns: 1fr; }

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  text-align: start;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.choice:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--surface);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, .09);
}
.choice-letter {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.choice-text {
  flex: 1;
  min-width: 0;
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: left;
  font-family: var(--font-en);
  font-size: 13.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.choice .choice-mark {
  display: none;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-inline-start: auto;
  color: currentColor;
}
.choice.correct {
  border-color: var(--good);
  background: var(--good-bg);
  color: var(--good);
}
.choice.correct .choice-letter { background: var(--good); border-color: var(--good); color: #fff; }
.choice.correct .choice-mark { display: block; }
.choice.wrong {
  border-color: var(--bad);
  background: var(--bad-bg);
  color: var(--bad);
}
.choice.wrong .choice-letter { background: var(--bad); border-color: var(--bad); color: #fff; }
.choice.wrong .choice-mark { display: block; }
.choice:disabled { cursor: default; opacity: 1; }
.choice.not-picked:disabled { opacity: .62; }

.feedback {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
  animation: fadeUp .25s ease both;
}
.feedback svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 3px; }
.feedback.ok { color: var(--good); background: var(--good-bg); border: 1px solid var(--good-line); }
.feedback.no { color: var(--bad); background: var(--bad-bg); border: 1px solid var(--bad-line); }
.feedback b { font-weight: 800; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .17s ease, border-color .17s ease, transform .17s ease;
}
.reveal-btn:hover { background: rgba(99, 102, 241, .07); border-color: rgba(99, 102, 241, .35); transform: translateY(-1px); }
.reveal-btn svg { width: 14px; height: 14px; transition: transform .2s ease; }
.reveal-btn.is-open svg { transform: rotate(180deg); }

/* =========================================================
   SOLUTION
   ========================================================= */

.solution {
  margin-top: 15px;
  padding: 18px;
  border: 1px solid rgba(99, 102, 241, .20);
  border-radius: 15px;
  background:
    linear-gradient(155deg, rgba(99, 102, 241, .07), rgba(8, 145, 178, .035) 55%, transparent),
    var(--surface);
  animation: solutionIn .28s ease both;
}
.solution[hidden] { display: none; }
@keyframes solutionIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sol-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(99, 102, 241, .25);
}
.sol-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--primary);
}
.sol-title svg { width: 17px; height: 17px; }

.answer-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 11px;
  border-radius: 8px;
  background: var(--good-bg);
  border: 1px solid var(--good-line);
  color: var(--good);
  font-size: 12.5px;
  font-weight: 700;
}
.answer-chip small {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  opacity: .72;
}
.answer-chip .answer-value {
  direction: ltr;
  unicode-bidi: plaintext;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.idea {
  position: relative;
  margin: 0 0 15px;
  padding: 11px 14px;
  border-inline-start: 3px solid var(--primary);
  border-radius: 0 9px 9px 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.85;
}
.idea strong { color: var(--primary); }

.steps-title,
.extra-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .02em;
}
.steps-title::after,
.extra-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 11px;
}
.steps li {
  position: relative;
  padding-inline-start: 38px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.9;
  min-height: 26px;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 1px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(99, 102, 241, .12);
  border: 1px solid rgba(99, 102, 241, .22);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
}
.steps li b { color: var(--ink); }

.final {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--good-bg);
  border: 1px solid var(--good-line);
  color: var(--good);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.8;
  margin-bottom: 12px;
}
.final svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 3px; }
.final .final-label {
  display: block;
  font-size: 9.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .72;
  margin-bottom: 2px;
}

.warn {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  font-size: 12.5px;
  line-height: 1.8;
}
.warn svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 3px; }
.warn b { font-weight: 800; }

.law-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 13px;
}
.law-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-en);
}
.law-chip::before { content: "ƒ"; color: var(--primary); font-family: Georgia, serif; font-style: italic; }

.math {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-mono);
  font-size: .94em;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  padding: 0 2px;
}
.idea .math, .steps .math, .final .math, .warn .math { color: inherit; }
.qtext .math { font-size: 1em; }

/* =========================================================
   K-MAP
   ========================================================= */

.kmap-card {
  margin: 0 auto;
  width: max-content;
  max-width: 100%;
  direction: ltr;
}
.kmap-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 700;
}
.kmap-badge {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 9px;
  letter-spacing: .06em;
  background: rgba(99, 102, 241, .10);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, .18);
}
.kmap {
  border-collapse: separate;
  border-spacing: 4px;
  margin: 0 auto;
}
.kmap th {
  width: 44px;
  height: 26px;
  padding: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
}
.kmap th.km-corner {
  width: 54px;
  font-family: var(--font-en);
  font-size: 9.5px;
  color: var(--muted);
}
.kmap td {
  width: 50px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  position: relative;
  transition: background-color .2s ease, box-shadow .2s ease;
}
.kmap td.one { color: var(--primary); background: rgba(99, 102, 241, .065); }
.kmap td.zero { color: var(--muted); }
.kmap td.in-group {
  background: var(--tint);
  box-shadow: inset 0 0 0 1.5px var(--ring);
}
.km-dots {
  position: absolute;
  inset-block-end: 3px;
  inset-inline-end: 4px;
  display: flex;
  gap: 2px;
  direction: ltr;
}
.km-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.kmap-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  direction: rtl;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
}
.legend-dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }
.legend-item small { color: var(--muted); font-family: var(--font-mono); font-size: 9px; }

/* =========================================================
   QUESTION TABLES & CIRCUITS
   ========================================================= */

.table-scroll { overflow-x: auto; }

table.qtable {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  border-collapse: collapse;
  direction: ltr;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
}
.qtable caption {
  caption-side: top;
  padding: 0 0 8px;
  color: var(--muted);
  font-family: var(--font-en);
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
}
.qtable th, .qtable td {
  border: 1px solid var(--line);
  padding: 6px 9px;
  text-align: center;
}
.qtable th {
  background: var(--surface-3);
  color: var(--ink-2);
  font-weight: 700;
}
.qtable tr:nth-child(even) td { background: var(--surface-2); }
.qtable .hl td { background: rgba(99, 102, 241, .08); color: var(--primary); font-weight: 700; }
.qtable .hl-zero td { background: rgba(211, 59, 59, .07); color: var(--bad); font-weight: 700; }

.circuit-card { direction: ltr; }
.circuit-card svg {
  display: block;
  width: 100%;
  min-width: 480px;
  height: auto;
  color: var(--ink);
}
.circuit-card .circuit-cap {
  margin-top: 8px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-en);
  font-size: 10.5px;
  font-weight: 600;
}
.truth-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  direction: ltr;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.truth-inline span {
  padding: 4px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.truth-inline span b { color: var(--primary); }

/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
  padding: 50px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: 8px;
}
.empty-art { color: var(--line-strong); margin-bottom: 10px; }
.empty-art svg { width: 90px; height: 70px; }
.empty-state h3 { margin: 0 0 6px; font-size: 18px; }
.empty-state p { margin: 0 auto 18px; max-width: 40ch; color: var(--muted); font-size: 13px; }

/* =========================================================
   REFERENCE
   ========================================================= */

.reference { padding-top: 40px; padding-bottom: 56px; }
.ref-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.ref-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.ref-card summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 17px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.ref-card summary::-webkit-details-marker { display: none; }
.ref-card summary::after {
  content: "+";
  margin-inline-start: auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: transform .22s ease, background-color .22s ease;
}
.ref-card[open] summary::after { content: "−"; background: rgba(99, 102, 241, .10); color: var(--primary); }
.ref-card summary:hover { background: var(--surface-2); }
.ref-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(99, 102, 241, .09);
  border: 1px solid rgba(99, 102, 241, .15);
  color: var(--primary);
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 700;
}
.ref-card summary span:not(.ref-icon) { display: flex; flex-direction: column; line-height: 1.4; }
.ref-card summary strong { font-size: 13px; }
.ref-card summary small { color: var(--muted); font-family: var(--font-en); font-size: 10px; font-weight: 500; }
.ref-body {
  padding: 0 17px 17px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.ref-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ref-list li {
  position: relative;
  padding-inline-start: 17px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.85;
}
.ref-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--primary-2);
  opacity: .55;
}
.ref-list b { color: var(--ink); }
.check-list li::before { background: var(--warn); }

.ref-tip {
  margin: 13px 0 0;
  padding: 9px 11px;
  border-inline-start: 2px solid var(--primary);
  background: var(--surface-2);
  border-radius: 0 7px 7px 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}
.ref-tip b { color: var(--ink-2); }

.table-scroll { margin-bottom: 12px; }
.mini-table {
  width: 100%;
  border-collapse: collapse;
  direction: ltr;
  font-family: var(--font-mono);
  font-size: 11px;
}
.mini-table th, .mini-table td {
  padding: 6px 7px;
  border: 1px solid var(--line);
  text-align: center;
}
.mini-table th {
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 9.5px;
  font-weight: 700;
}
.mini-table td { color: var(--ink-2); background: var(--surface); }
.mini-table tr:nth-child(even) td { background: var(--surface-2); }
.laws-table td:first-child, .laws-table th:first-child {
  font-family: var(--font-ar);
  text-align: right;
  color: var(--ink-2);
  font-size: 10.5px;
}
.laws-table .math { font-size: 10.5px; }
.mini-table .math { white-space: nowrap; }

.weight-row {
  display: flex;
  direction: ltr;
  gap: 5px;
  justify-content: center;
}
.weight-row span {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}
.weight-row b { color: var(--primary); font-size: 9px; font-weight: 700; }

.split-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.note-box {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
.note-box h4 {
  margin: 0 0 5px;
  color: var(--primary);
  font-family: var(--font-en);
  font-size: 10.5px;
}
.note-box .ref-list li { font-size: 11px; line-height: 1.75; padding-inline-start: 13px; }
.note-box .ref-list li::before { width: 4px; height: 4px; top: 8px; }

.law-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  direction: ltr;
}
.law-callout p {
  margin: 0;
  padding: 7px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.kmap-mini {
  display: grid;
  grid-template-columns: 44px repeat(4, 1fr);
  gap: 3px;
  max-width: 250px;
  margin: 0 auto 12px;
  direction: ltr;
  font-family: var(--font-mono);
  font-size: 9px;
}
.kmap-mini > div {
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
}
.kmap-mini .km-head { background: var(--surface-3); color: var(--primary); font-weight: 700; }
.kmap-mini .km-corner { font-size: 8px; background: transparent; border-color: transparent; }
.kmap-mini .km-row { font-weight: 700; color: var(--ink-2); }

/* =========================================================
   FOOTER / TO TOP / TOAST
   ========================================================= */

.footer {
  background: linear-gradient(160deg, #0a1022, #0d1730);
  color: #dfe7f8;
  padding: 38px 24px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.footer-inner {
  max-width: var(--content);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 26px;
}
.footer strong { font-family: var(--font-en); font-size: 15px; color: #fff; }
.footer p { margin: 6px 0 0; max-width: 52ch; color: rgba(218, 227, 244, .55); font-size: 12px; line-height: 1.8; }
.footer-links { display: flex; gap: 16px; flex: 0 0 auto; }
.footer-links a {
  color: rgba(218, 227, 244, .68);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.footer-links a:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }

.to-top {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-start: 22px;
  z-index: 60;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease, background-color .2s ease;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--surface-2); color: var(--primary); }
.to-top svg { width: 17px; height: 17px; }

.toast {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-end: 22px;
  z-index: 70;
  padding: 10px 15px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.toast.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {
  .hero-body {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 18px;
  }
  .progress-panel { max-width: 520px; }
  .ref-grid { grid-template-columns: 1fr; }
  .nav { padding-inline: 22px; }
  .hero-body { padding-inline: 22px; }
  .toolbar-inner, .content { padding-inline: 22px; }
}

@media (max-width: 720px) {
  html { --toolbar-h: 178px; }
  .nav-links a { display: none; }
  .brand-text strong { font-size: 15px; }
  .hero h1 { font-size: clamp(2rem, 8.5vw, 2.7rem); }
  .hero-lede { font-size: 14.5px; }
  .hero-body { padding-bottom: 52px; }
  .toolbar-inner { padding-top: 10px; gap: 8px; }
  .searchbox { height: 43px; max-width: none; }
  .section-chips { margin-inline: -22px; padding-inline: 22px; }
  .status-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .status-chips { margin-inline: -5px; }
  .result-count { text-align: end; padding-inline-end: 4px; }
  .content { padding-top: 34px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 18px; }
  .section-side { align-items: flex-start; }
  .section-sub { text-align: start; }
  .choices,
  .choices.two,
  .choices.one { grid-template-columns: 1fr; }
  .qtext { font-size: 16px; }
  .qcard-top { padding-inline: 16px; }
  .qcard-body { padding-inline: 16px; }
  .solution { padding: 14px; }
  .steps li { font-size: 12.5px; }
  .idea, .final { font-size: 12.5px; }
  .qnum { min-width: 40px; }
  .ref-card summary { padding: 13px 14px; }
  .ref-body { padding-inline: 14px; }
  .footer-inner { flex-direction: column; gap: 16px; }
  .footer-links { order: -1; }
  .to-top { inset-block-end: 14px; inset-inline-start: 14px; }
  .toast { inset-block-end: 14px; inset-inline-end: 14px; left: 64px; }
  .split-notes { grid-template-columns: 1fr; }
  .circuit-card svg { min-width: 420px; }
}

@media (max-width: 460px) {
  .hero-pill { font-size: 10.5px; padding: 6px 10px; }
  .hero-actions .btn { flex: 1; }
  .panel-stats { gap: 6px; }
  .pstat strong { font-size: 21px; }
  .qtag { font-size: 9.5px; }
  .diff { font-size: 9px; }
  .choice-text { font-size: 12.5px; }
  .kmap td { width: 40px; height: 38px; font-size: 12px; }
  .kmap th { width: 36px; font-size: 9px; }
  .kmap th.km-corner { width: 44px; font-size: 8px; }
  .kmap { border-spacing: 3px; }
  .ref-card summary strong { font-size: 12px; }
  .ref-list li { font-size: 11.5px; }
}

/* =========================================================
   MOTION / PRINT
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  body { background: #fff; color: #000; }
  .hero, .toolbar, .footer, .to-top, .toast, .reveal-btn, .bookmark-btn, .retry-btn, #retryAllBtn { display: none !important; }
  .content { max-width: none; padding: 0; }
  .qcard { break-inside: avoid; box-shadow: none; border-color: #bbb; }
  .solution[hidden] { display: block !important; }
  .solution { background: #fff; }
  a { text-decoration: none; }
}
