/* =========================================================
   数据库原理学习站 — design system
   ========================================================= */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg: #f7f5f0;
  --bg-elev: #fffdfa;
  --bg-soft: #efece4;
  --bg-tint: #f2f8f6;
  --ink: #1b2430;
  --ink-2: #4d5968;
  --ink-3: #7d8796;
  --line: #e6e0d5;
  --line-strong: #d5cec0;
  --accent: #0f766e;
  --accent-2: #0b5d57;
  --accent-soft: #d9efeb;
  --accent-ink: #0b5751;
  --amber: #b45309;
  --amber-soft: #fbefd8;
  --red: #b42318;
  --red-soft: #fbe9e7;
  --blue: #1d4ed8;
  --blue-soft: #e8eefc;
  --green: #15803d;
  --green-soft: #e4f5e9;
  --violet: #6d28d9;
  --violet-soft: #efe9fd;
  --code-bg: #0e1722;
  --code-ink: #dbe7f3;
  --shadow-sm: 0 1px 2px rgba(27, 36, 48, .05);
  --shadow: 0 2px 4px rgba(27, 36, 48, .04), 0 16px 40px -24px rgba(27, 36, 48, .28);
  --shadow-lg: 0 30px 70px -35px rgba(15, 61, 56, .45);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 264px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Courier New", monospace;
}

[data-theme="dark"] {
  --bg: #0c1117;
  --bg-elev: #141b24;
  --bg-soft: #1a2330;
  --bg-tint: #10201e;
  --ink: #e7edf5;
  --ink-2: #aab5c5;
  --ink-3: #7e8a9d;
  --line: #232d3a;
  --line-strong: #334155;
  --accent: #2dd4bf;
  --accent-2: #5eead4;
  --accent-soft: #12332f;
  --accent-ink: #5eead4;
  --amber: #fbbf24;
  --amber-soft: #33280f;
  --red: #f87171;
  --red-soft: #3a1a1a;
  --blue: #93b4ff;
  --blue-soft: #17233f;
  --green: #4ade80;
  --green-soft: #102a1a;
  --violet: #c4b5fd;
  --violet-soft: #241a3d;
  --code-bg: #080d14;
  --code-ink: #dbe7f3;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 16px 40px -24px rgba(0, 0, 0, .8);
  --shadow-lg: 0 30px 70px -35px rgba(0, 0, 0, .9);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 78% -10%, rgba(15, 118, 110, .10), transparent 62%),
    radial-gradient(700px 420px at 8% 0%, rgba(180, 83, 9, .06), transparent 60%);
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(900px 480px at 78% -10%, rgba(45, 212, 191, .10), transparent 62%),
    radial-gradient(700px 420px at 8% 0%, rgba(251, 191, 36, .05), transparent 60%);
}

::selection { background: var(--accent); color: #fff; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  transition: top .2s;
}
.skip-link:focus { top: 12px; color: #fff; }

/* ---------- layout ---------- */

.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 18px;
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand { padding: 4px 8px 20px; }
.brand-link { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand-link:hover { color: var(--ink); }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  flex: none;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #0f766e, #115e59);
  box-shadow: 0 8px 20px -8px rgba(15, 118, 110, .8);
}
.brand-mark svg { width: 25px; height: 25px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: .01em; }
.brand-text small { color: var(--ink-3); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s, transform .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--bg-soft); color: var(--ink); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 650;
}
.nav-item.active svg { opacity: 1; }

.side-progress {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.side-progress-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--ink-3);
}
.side-progress-head b { color: var(--accent); font-family: var(--mono); font-size: 13px; }
.side-progress p { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

.bar {
  height: 6px;
  margin-top: 9px;
  border-radius: 99px;
  background: var(--bg-soft);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #22a699);
  transition: width .45s cubic-bezier(.22, .8, .28, 1);
}

.side-foot { padding: 12px 8px 0; font-size: 10.5px; color: var(--ink-3); letter-spacing: .02em; }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px);
}

.icon-btn.menu-btn { display: none; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-elev);
  color: var(--ink-2);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 19px; height: 19px; }

#theme-btn .ico-moon { display: none; }
[data-theme="dark"] #theme-btn .ico-sun { display: none; }
[data-theme="dark"] #theme-btn .ico-moon { display: block; }

.search { position: relative; flex: 1; max-width: 580px; }
.search-icon {
  position: absolute; left: 13px; top: 50%;
  width: 17px; height: 17px;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 40px;
  padding: 0 46px 0 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.search kbd {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  min-width: 20px; height: 21px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  z-index: 60;
  max-height: 380px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
}
.search-item {
  display: block;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--ink);
}
.search-item:hover, .search-item.active { background: var(--bg-soft); color: var(--ink); }
.search-item strong { display: block; font-size: 13.5px; font-weight: 650; }
.search-item span { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.search-empty { padding: 18px; text-align: center; color: var(--ink-3); font-size: 13px; }

.view {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 32px 72px;
  animation: pageIn .35s cubic-bezier(.22, .8, .28, 1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 32px 30px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(8, 12, 18, .48);
  backdrop-filter: blur(2px);
}

/* ---------- shared headings / buttons ---------- */

.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 18px; height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.page-head { margin-bottom: 26px; }
.page-title {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 34px);
  line-height: 1.22;
  letter-spacing: -.02em;
  font-weight: 750;
}
.page-sub {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 38px 0 16px;
}
.section-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.01em;
}
.section-head p { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.section-head a { font-size: 13px; white-space: nowrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 17px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--bg-soft); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  border-color: transparent;
  background: linear-gradient(150deg, #0f766e, #0e635c);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(15, 118, 110, .75);
}
.btn-primary:hover { background: linear-gradient(150deg, #0d6b64, #0b5751); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-sm { min-height: 33px; padding: 5px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 9px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }

/* ---------- home ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, .88fr);
  align-items: center;
  gap: 34px;
  padding: 18px 0 10px;
}
.hero-title {
  margin: 0;
  font-size: clamp(31px, 4.4vw, 48px);
  line-height: 1.14;
  letter-spacing: -.035em;
  font-weight: 800;
}
.hero-title .grad {
  background: linear-gradient(105deg, var(--accent) 5%, #1d9a8f 48%, #b45309 115%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  max-width: 540px;
  margin: 16px 0 0;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.75;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.hero-visual {
  position: relative;
  height: 310px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink-3) 28%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(160deg, var(--accent-soft), transparent 65%);
  border: 1px solid var(--line);
  overflow: hidden;
}
.hero-visual::after {
  content: "";
  position: absolute;
  inset: auto -30% -55% -10%;
  height: 70%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 20%, transparent), transparent);
  filter: blur(20px);
}
.db-card {
  position: absolute;
  width: 200px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 10.5px;
}
.db-card-head {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink-2);
  font-weight: 600;
  letter-spacing: .03em;
}
.db-card-head i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.db-grid { width: 100%; border-collapse: collapse; }
.db-grid th, .db-grid td {
  padding: 4px 9px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  text-align: left;
  white-space: nowrap;
}
.db-grid th {
  color: var(--ink-3);
  font-weight: 500;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.db-grid td { color: var(--ink-2); }
.db-grid td:first-child { color: var(--ink); }
.db-grid tr:last-child td { border-bottom: 0; }
.db-card.c1 { top: 20px; left: 16px; transform: rotate(-3deg); z-index: 1; }
.db-card.c2 { top: 84px; right: 12px; transform: rotate(2.5deg); z-index: 2; }
.db-card.c3 { bottom: 18px; left: 46px; transform: rotate(1.2deg); z-index: 3; }
.db-card .pk { color: var(--amber); }
.fk-line {
  position: absolute;
  z-index: 0;
  width: 90px; height: 1px;
  border-top: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  transform-origin: left center;
}
.fk-line.l1 { top: 88px; left: 150px; transform: rotate(28deg); }
.fk-line.l2 { top: 190px; left: 120px; transform: rotate(-18deg); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 30px;
}
.stat {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
}
.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 23px;
  line-height: 1.2;
  color: var(--accent);
  letter-spacing: -.03em;
}
.stat span { font-size: 11.5px; color: var(--ink-3); }

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

.card {
  position: relative;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
a.card { display: block; color: var(--ink); }
a.card:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  margin-bottom: 13px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.card-icon svg { width: 19px; height: 19px; }
.card h3 { margin: 0 0 6px; font-size: 16px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.65; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--accent); font-weight: 600; }
.card-foot::after { content: "→"; transition: transform .18s; }
a.card:hover .card-foot::after { transform: translateX(3px); }

/* module cards */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 15px;
}
.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
a.module-card:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.module-card.learned { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.module-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.module-no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .06em;
}
.module-card h3 { margin: 9px 0 7px; font-size: 16.5px; letter-spacing: -.01em; line-height: 1.4; }
.module-essence {
  margin: 0;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.68;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.module-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 13px; }
.module-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.learned-dot {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--green); font-size: 11px; font-weight: 650;
}

/* ---------- learn ---------- */

.learn-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}
.module-nav {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 6px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  scrollbar-width: thin;
}
.module-nav-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 12.8px;
  line-height: 1.45;
}
.module-nav-item b {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  padding-top: 1px;
}
.module-nav-item:hover { background: var(--bg-soft); color: var(--ink); }
.module-nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.module-nav-item.active b { color: var(--accent); }

.learn-main { min-width: 0; max-width: 800px; }
.learn-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.learn-head h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 31px);
  line-height: 1.25;
  letter-spacing: -.025em;
}
.learn-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.prose { font-size: 14.5px; line-height: 1.78; color: var(--ink-2); }
.prose > :first-child { margin-top: 0; }
.prose h2 {
  margin: 32px 0 12px;
  padding-top: 8px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: -.015em;
}
.prose h2:first-child { margin-top: 0; padding-top: 0; }
.prose h3 { margin: 22px 0 8px; color: var(--ink); font-size: 15.5px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: .88em;
  white-space: nowrap;
}
.prose .formula {
  margin: 4px 0 16px;
  padding: 13px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-x: auto;
}
.table-wrap { margin: 6px 0 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev); }
.prose table, .cheat-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.55;
}
.prose table th, .prose table td,
.cheat-card table th, .cheat-card table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.prose table th, .cheat-card table th {
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 650;
  font-size: 12px;
  white-space: nowrap;
}
.prose table tr:last-child td, .cheat-card table tr:last-child td { border-bottom: 0; }
.prose table td { color: var(--ink-2); }
.prose table code { white-space: nowrap; }

.callout {
  position: relative;
  margin: 18px 0;
  padding: 14px 16px 14px 17px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.7;
}
.callout-title {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px;
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .09em;
}
.callout.exam { border-left-color: var(--amber); background: var(--amber-soft); }
.callout.exam .callout-title { color: var(--amber); }
.callout.trap { border-left-color: var(--red); background: var(--red-soft); }
.callout.trap .callout-title { color: var(--red); }
.callout.mnemonic { border-left-color: var(--violet); background: var(--violet-soft); }
.callout.mnemonic .callout-title { color: var(--violet); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout ul { margin: 4px 0 0; padding-left: 19px; }
.callout li { margin: 3px 0; }

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

/* ---------- forms & tools ---------- */

.field { margin-bottom: 16px; }
.field > label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
}
.field small { display: block; margin-top: 6px; color: var(--ink-3); font-size: 11.5px; line-height: 1.6; }
.input, .textarea, .select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 118px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.7; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.input.mono { font-family: var(--mono); }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; }

.tool-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.tool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.tool-head h2 { margin: 0; font-size: 18px; }
.tool-head p { margin: 5px 0 0; color: var(--ink-3); font-size: 12.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-btn {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 550;
  transition: background .15s, border-color .15s, color .15s;
}
.chip-btn:hover { background: var(--bg-soft); border-color: var(--line-strong); color: var(--ink); }
.chip-btn.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent-ink); }
.path-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.path-arrow { color: var(--ink-3); font-family: var(--mono); font-size: 12px; }

.attr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
}
.attr.plain { background: var(--bg-soft); border-color: var(--line); color: var(--ink-2); }
.attr.prime { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--amber); }
.attr.nonprime { background: var(--bg-soft); border-color: var(--line); color: var(--ink-3); }
.mono { font-family: var(--mono); }
.attr-group { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.fd-output { margin-top: 22px; }
.fd-step {
  position: relative;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-elev);
}
.fd-step h4 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
}
.step-no {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  flex: none;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}
.fd-step p { margin: 6px 0; color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.fd-step ul { margin: 6px 0; padding-left: 20px; color: var(--ink-2); font-size: 13px; }
.fd-step li { margin: 4px 0; }
.fd-line {
  margin: 6px 0;
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  overflow-x: auto;
}
.fd-sub {
  margin: -2px 0 6px 16px;
  padding: 3px 9px;
  border-left: 2px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  overflow-x: auto;
}
.verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--green) 30%, var(--line));
  border-radius: 13px;
  background: var(--green-soft);
  color: var(--green);
  margin-bottom: 16px;
}
.verdict.bad { border-color: color-mix(in srgb, var(--red) 30%, var(--line)); background: var(--red-soft); color: var(--red); }
.verdict.warn { border-color: color-mix(in srgb, var(--amber) 32%, var(--line)); background: var(--amber-soft); color: var(--amber); }
.verdict-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: 11px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 800;
}
.verdict strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.verdict span { display: block; font-size: 12.5px; opacity: .85; line-height: 1.55; }

.error-box {
  padding: 12px 15px;
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line));
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- SQL lab ---------- */

.sql-layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.sql-side {
  position: sticky;
  top: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}
.sql-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 650;
}
.sql-side-head span { color: var(--ink-3); font-weight: 500; font-size: 11.5px; }
.ex-list { max-height: calc(100vh - 210px); overflow: auto; padding: 6px; scrollbar-width: thin; }
.ex-item {
  display: flex;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  font-size: 12.5px;
  line-height: 1.45;
  transition: background .15s, color .15s;
}
.ex-item:hover { background: var(--bg-soft); color: var(--ink); }
.ex-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.ex-item.done .ex-dot { background: var(--green); border-color: var(--green); }
.ex-dot {
  width: 8px; height: 8px;
  flex: none;
  margin-top: 5px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
}
.ex-num { flex: none; color: var(--ink-3); font-family: var(--mono); font-size: 10.5px; padding-top: 1px; }

.sql-main { min-width: 0; }
.sql-task {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  margin-bottom: 14px;
}
.sql-task-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.sql-task h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.sql-task p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.75; }
.sql-task .hint { margin-top: 8px; color: var(--ink-3); font-size: 12px; }
.sql-task .hint b { color: var(--amber); }

.editor-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  color: #91a4b8;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
}
.editor-dots { display: flex; gap: 5px; }
.editor-dots i { width: 7px; height: 7px; border-radius: 50%; background: #334155; }
.editor-dots i:first-child { background: #f87171; }
.editor-dots i:nth-child(2) { background: #fbbf24; }
.editor-dots i:nth-child(3) { background: #4ade80; }
.sql-editor {
  display: block;
  width: 100%;
  min-height: 148px;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  resize: vertical;
  tab-size: 2;
}
.sql-editor:focus { outline: none; }
.sql-editor::placeholder { color: #64748b; }

.sql-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
}
.sql-actions .spacer { flex: 1; }
.sql-actions .kbd-hint { color: var(--ink-3); font-size: 11px; }

.status {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.status.ok { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); background: var(--green-soft); color: var(--green); }
.status.err { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); background: var(--red-soft); color: var(--red); }
.status.warn { border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); background: var(--amber-soft); color: var(--amber); }
.status b { font-weight: 700; }
.status .mono { font-size: 12px; }

.table-scroll {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-elev);
}
.result-table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.5; }
.result-table th, .result-table td {
  padding: 7px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-family: var(--mono);
}
.result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 650;
}
.result-table td { color: var(--ink-2); }
.result-table td.null { color: var(--ink-3); font-style: italic; }
.result-table tr:last-child td { border-bottom: 0; }
.result-table tbody tr:hover td { background: color-mix(in srgb, var(--bg-soft) 55%, transparent); }

.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.compare-grid h4 { margin: 0 0 7px; font-size: 12.5px; color: var(--ink-2); }
.compare-grid h4 span { color: var(--ink-3); font-weight: 500; }
.table-cap { margin: 0 0 6px; font-size: 12px; color: var(--ink-2); font-weight: 650; }

.schema-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}
.schema-box summary {
  padding: 13px 17px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.schema-box summary::-webkit-details-marker { display: none; }
.schema-box summary::before { content: "+"; font-family: var(--mono); color: var(--accent); font-weight: 700; }
.schema-box[open] summary::before { content: "−"; }
.schema-body { padding: 0 17px 17px; border-top: 1px solid var(--line); }
.schema-body h4 { margin: 14px 0 6px; font-family: var(--mono); font-size: 12.5px; color: var(--accent-ink); }
.schema-body pre {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  overflow-x: auto;
}
.sql-loading { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* ---------- quiz ---------- */

.quiz-shell { max-width: 800px; margin: 0 auto; }
.quiz-intro { text-align: center; padding: 14px 0 4px; }
.quiz-intro h1 { margin: 0; font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -.025em; }
.quiz-intro p { max-width: 560px; margin: 10px auto 0; color: var(--ink-2); font-size: 14px; }
.quiz-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 22px 0 18px; }
.quiz-start { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }

.quiz-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  color: var(--ink-3);
  font-size: 12px;
}
.quiz-top .bar { flex: 1; margin: 0; }
.quiz-top b { font-family: var(--mono); color: var(--ink-2); }

.quiz-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.quiz-card .q-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.quiz-q { margin: 0 0 18px; font-size: 17px; line-height: 1.55; letter-spacing: -.01em; }
.options { display: flex; flex-direction: column; gap: 9px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-elev);
  color: var(--ink-2);
  text-align: left;
  font-size: 13.5px;
  line-height: 1.55;
  transition: border-color .15s, background .15s, color .15s;
}
.option:hover { border-color: var(--line-strong); background: var(--bg-soft); color: var(--ink); }
.option .letter {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  flex: none;
  border-radius: 7px;
  background: var(--bg-soft);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}
.option.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.option.selected .letter { background: var(--accent); color: #fff; }
.option.correct { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.option.correct .letter { background: var(--green); color: #fff; }
.option.wrong { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.option.wrong .letter { background: var(--red); color: #fff; }
.option:disabled { cursor: default; }

.explain {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.75;
}
.explain strong { color: var(--ink); }
.quiz-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

.quiz-end { text-align: center; padding: 22px 10px; }
.score-num {
  font-family: var(--mono);
  font-size: 64px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.05em;
  color: var(--accent);
}
.score-num small { font-size: 20px; color: var(--ink-3); font-weight: 500; }
.quiz-end h2 { margin: 14px 0 4px; font-size: 22px; }
.quiz-end p { margin: 0; color: var(--ink-2); font-size: 14px; }
.review-list { margin: 26px 0 0; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.review-item {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-elev);
  font-size: 13px;
}
.review-item .rq { color: var(--ink); font-weight: 600; line-height: 1.55; }
.review-item .ra { margin-top: 5px; color: var(--green); font-size: 12.5px; }
.review-item .rx { margin-top: 4px; color: var(--ink-3); font-size: 12px; line-height: 1.6; }

/* ---------- plan ---------- */

.plan-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  margin-bottom: 18px;
}
.plan-top .pt-left { display: flex; align-items: center; gap: 15px; }
.plan-top .pt-num { font-family: var(--mono); font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1; }
.plan-top .pt-text { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.plan-top .pt-text b { display: block; color: var(--ink); font-size: 14px; }
.plan-top .bar { width: 180px; margin: 0; }

.plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.week-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.week-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.week-head h3 { margin: 0; font-size: 15.5px; }
.week-head .badge { margin-top: 2px; }
.week-sub { margin: 0 0 12px; color: var(--ink-3); font-size: 12px; line-height: 1.6; }
.week-progress { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.week-progress .bar { flex: 1; margin: 0; height: 5px; }
.week-progress span { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 7px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 12.8px;
  line-height: 1.55;
  cursor: pointer;
  transition: background .15s;
}
.check-item:hover { background: var(--bg-soft); }
.check-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
  width: 17px; height: 17px;
  flex: none;
  margin-top: 2px;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg-elev);
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s;
}
.check-box::after {
  content: "";
  width: 8px; height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(0.5px, -1px) scale(.4);
  opacity: 0;
  transition: opacity .12s, transform .12s;
}
.check-item input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.check-item input:checked + .check-box::after { opacity: 1; transform: rotate(-45deg) translate(0.5px, -1px) scale(1); }
.check-item input:focus-visible + .check-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-item input:checked ~ .check-text { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 55%, transparent); }

/* ---------- cheatsheet ---------- */

.cheat-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.cheat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; align-items: start; }
.cheat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  break-inside: avoid;
}
.cheat-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; font-size: 15px; }
.cheat-card h2 .no { font-family: var(--mono); font-size: 10.5px; color: var(--accent); }
.cheat-card .table-wrap { margin: 0; }
.cheat-card table { font-size: 12px; }
.cheat-card table th, .cheat-card table td { padding: 7px 9px; }
.cheat-card .mini-list { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; line-height: 1.7; }
.cheat-card .mini-list li { margin: 3px 0; }
.cheat-card code {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: .9em;
}

/* ---------- misc ---------- */

.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 150;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.hidden { display: none !important; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .learn-layout { grid-template-columns: 1fr; gap: 18px; }
  .module-nav {
    position: static;
    flex-direction: row;
    gap: 6px;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .module-nav-item { flex: none; border: 1px solid var(--line); background: var(--bg-elev); white-space: nowrap; }
  .module-nav-item b { display: none; }
  .learn-main { max-width: none; }
  .sql-layout { grid-template-columns: 1fr; }
  .sql-side { position: static; }
  .ex-list { max-height: 240px; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-102%);
    transition: transform .24s cubic-bezier(.22, .8, .28, 1);
    box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .icon-btn.menu-btn { display: grid; }
  .topbar { padding: 0 16px; height: 58px; }
  .view { padding: 26px 18px 56px; }
  .footer { padding: 18px 18px 26px; }
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .hero-visual { height: 280px; max-width: 520px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .plan-grid, .cheat-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .search kbd { display: none; }
  .search input { padding-right: 14px; }
  .hero { padding-top: 6px; }
  .hero-visual { height: 250px; }
  .db-card { width: 178px; font-size: 9.5px; }
  .db-card.c1 { top: 18px; left: 10px; }
  .db-card.c2 { top: 78px; right: 8px; }
  .db-card.c3 { bottom: 16px; left: 30px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .learn-head { flex-direction: column; gap: 12px; }
  .quiz-card { padding: 18px; }
  .quiz-q { font-size: 15.5px; }
  .score-num { font-size: 52px; }
  .footer { flex-direction: column; gap: 4px; }
  .sql-task { padding: 15px; }
  .tool-card { padding: 17px; }
  .plan-top .bar { width: 120px; }
}

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

@media print {
  .sidebar, .topbar, .footer, .cheat-toolbar, .toast, .scrim { display: none !important; }
  .main { margin-left: 0; }
  .view { max-width: none; padding: 0; animation: none; }
  body { background: #fff; font-size: 11px; }
  body::before { display: none; }
  .cheat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cheat-card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
