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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; color: var(--text-primary); background: var(--bg-main); font-family: var(--font-ui); font-size: 16px; line-height: 1.55; }
#main { flex: 1; min-width: 0; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: var(--color-link); text-underline-offset: .18em; }
a:hover { color: var(--color-link-hover); }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.skip-link { position: absolute; z-index: 100; top: 8px; left: 8px; padding: 8px 16px; color: #fff; background: var(--color-btn-primary-bg); border-radius: 8px; transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }
.mono { font-family: var(--font-mono); }

.site-header { position: sticky; z-index: 20; top: 0; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.site-header__grid { display: grid; grid-template-columns: 240px minmax(0, 1fr) auto; min-height: 64px; }
.brand-cell { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 20px; border-right: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; padding: 14px 24px; color: var(--text-primary); font-weight: 600; text-decoration: none; white-space: nowrap; }
.brand img { flex: none; width: 28px; height: 28px; }
.brand__by { color: var(--text-muted); font-size: 13px; font-weight: 400; text-decoration: none; white-space: nowrap; }
.product-nav { min-width: 0; }
.product-nav__list { display: flex; gap: 2px; height: 100%; margin: 0; padding: 0 14px; overflow-x: auto; list-style: none; scrollbar-width: none; }
.product-nav__list::-webkit-scrollbar { display: none; }
.product-nav__link { display: inline-flex; align-items: center; min-height: 64px; padding: 0 10px; color: var(--text-tertiary); font-size: 14px; white-space: nowrap; text-decoration: none; border-bottom: 2px solid transparent; }
.product-nav__link:focus-visible { outline-offset: -2px; }
.product-nav__link:hover { color: var(--text-primary); }
.product-nav__link[aria-current="page"] { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--brand-accent); }
.site-header__actions { display: flex; align-items: center; gap: 12px; padding: 10px 24px; }
.lang-switch { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; color: var(--text-tertiary); font: 500 12px var(--font-mono); text-decoration: none; white-space: nowrap; }
.lang-switch__visual { display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }
.only-narrow { display: none; }

.btn, .btn--primary, .btn--secondary { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; height: auto; padding: 10px 18px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-weight: 600; line-height: 1.3; text-align: center; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn--primary { color: var(--color-btn-primary-fg); background: var(--color-btn-primary-bg); border-color: var(--color-btn-primary-bg); }
.btn--primary:hover { color: #fff; background: var(--brand-accent-hover); border-color: var(--brand-accent-hover); }
.btn--secondary { color: var(--color-btn-secondary-fg); background: var(--color-btn-secondary-bg); border-color: var(--color-btn-secondary-border); }
.btn--secondary:hover { color: var(--text-primary); border-color: var(--brand-accent); }
.btn--small { min-height: 44px; padding: 10px 14px; font-size: 14px; }
.btn--donate { gap: 6px; color: var(--donate-fg); background: var(--donate-bg); border-color: var(--donate-border); }
.btn--donate:hover { color: var(--donate-fg); background: var(--donate-bg-hover); text-decoration: none; }
.donate-heart { font-size: 15px; line-height: 1; }
@media (max-width: 1279px) { .donate-label { display: none; } }

.breadcrumbs { max-width: 1160px; margin: 0 auto; padding: 14px 24px 0; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; color: var(--text-muted); font: 500 12px var(--font-mono); }
.breadcrumbs li + li::before { padding-right: 8px; color: var(--text-muted); content: "/"; }

.ds-hero, .ds-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); border-bottom: 1px solid var(--border); }
.ds-label { padding: 44px 24px; color: var(--text-muted); border-right: 1px solid var(--border); font: 500 12px var(--font-mono); letter-spacing: .06em; line-height: 1.7; text-transform: uppercase; }
.ds-label--facts { display: flex; flex-direction: column; gap: 0; padding-top: 28px; }
.ds-fact-primary { color: var(--text-primary); font-weight: 500; }
.ds-main { min-width: 0; padding: 44px 56px; }
.ds-hero__main { padding-top: 64px; padding-bottom: 56px; }
.ds-body { min-width: 0; padding: 44px 56px; }
.ds-h1 { max-width: 900px; margin: 0 0 22px; font-size: 64px; line-height: 1; letter-spacing: -.03em; font-weight: 600; text-wrap: balance; }
.ds-h1 em { padding: 0 .12em; color: #1d4ed8; background: var(--brand-accent-soft); border-radius: 6px; font-style: normal; }
.ds-lead { max-width: 640px; margin: 0 0 28px; color: var(--text-secondary); font-size: 18px; line-height: 1.55; text-wrap: pretty; }
.ds-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ds-h2 { margin: 0 0 24px; font-size: 30px; line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
.ds-sheet { margin-top: 44px; overflow: hidden; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; }
.ds-sheet__kicker { margin: 0; padding: 12px 16px; color: var(--text-muted); background: var(--bg-surface2); border-bottom: 1px solid var(--border); font: 500 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.feature-sheet { width: 100%; border-collapse: collapse; font-size: 14px; }
.feature-sheet th, .feature-sheet td { padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); text-align: left; vertical-align: top; }
.feature-sheet thead th { padding-block: 10px; color: var(--text-muted); background: var(--bg-surface2); border-bottom-color: var(--border); font: 500 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.feature-sheet tbody tr:last-child th, .feature-sheet tbody tr:last-child td { border-bottom: 0; }
.feature-sheet tbody th { color: var(--text-primary); font-weight: 600; }
.feature-sheet tbody td { color: var(--text-secondary); line-height: 1.5; }
.ds-row-number { width: 36px; color: #94a3b8 !important; font: 500 11px var(--font-mono) !important; }
.status-pill { display: inline-block; padding: 3px 8px; color: var(--brand-success); background: var(--brand-success-bg); border-radius: 999px; font: 500 11px var(--font-mono); white-space: nowrap; }
.status-pill--neutral { color: var(--text-tertiary); background: var(--brand-neutral-bg); }
.feature-records { display: none; }
.ds-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.ds-shot { margin: 0; overflow: hidden; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; }
.ds-shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.ds-shot figcaption { padding: 12px 16px; color: var(--text-tertiary); border-top: 1px solid var(--border); font-size: 14px; }
.ds-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; }
.ds-step { min-width: 0; padding: 24px; border-right: 1px solid var(--border); }
.ds-step:last-child { border-right: 0; }
.ds-step .mono { color: var(--brand-accent); font-size: 12px; }
.ds-step h3 { margin: 10px 0 6px; font-size: 18px; line-height: 1.3; }
.ds-step p { margin: 0; color: var(--text-tertiary); font-size: 15px; line-height: 1.5; }
.ds-cards { display: grid; gap: 16px; }
.ds-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ds-card { display: block; min-width: 0; padding: 22px; color: var(--text-primary); background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; }
.ds-card:hover { color: var(--text-primary); border-color: #93c5fd; text-decoration: none; }
.ds-card b, .ds-card span, .ds-card small { display: block; }
.ds-card b { margin-bottom: 6px; font-size: 17px; line-height: 1.3; }
.ds-card span { color: var(--text-tertiary); font-size: 14px; line-height: 1.5; }
.ds-card small { margin-top: 14px; color: var(--text-muted); font: 500 11px var(--font-mono); }
.ds-after { margin: 20px 0 0; }
.ds-after a { display: inline-flex; align-items: center; min-height: 44px; }
.ds-kv { display: grid; grid-template-columns: 220px minmax(0, 1fr); font-size: 15px; line-height: 1.55; }
.ds-kv__key, .ds-kv__value { padding: 14px 0; border-top: 1px solid var(--border-subtle); }
.ds-kv__key { padding-right: 24px; color: var(--text-primary); font-weight: 600; }
.ds-kv__value { color: var(--text-tertiary); }
.ds-faq__key { padding-right: 24px; font-weight: 600; }
.ds-actions--inline { margin-top: 24px; }
.ds-final { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 40px 56px; color: #fff; background: var(--brand-accent); }
.ds-final h2 { margin: 0 0 4px; font-size: 30px; line-height: 1.2; }
.ds-final p { margin: 0; color: #dbeafe; }
.ds-final__link { display: inline-flex; align-items: center; min-height: 44px; color: #dbeafe; }
.ds-final .btn { color: #1d4ed8; background: #fff; border-color: #fff; }
.ds-hero-shot { max-width: 720px; margin: 32px 0 0; }
.t-meta { display: flex; flex-direction: column; gap: 2px; text-transform: none; }
.t-meta b { color: var(--text-primary); font-weight: 500; }
.t-crumb { margin-bottom: 14px; color: var(--text-muted); font: 500 12px var(--font-mono); }
.t-h1 { max-width: 760px; font-size: 44px; }
.stack figcaption { padding: 10px 16px; color: var(--text-tertiary); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 10px 10px; font-size: 13px; }
.try-cta b, .try-cta span { display: block; }
.try-cta b { margin-bottom: 4px; font-size: 17px; }
.try-cta span { color: var(--text-secondary); font-size: 15px; }
.tutorial-check h2 { margin: 0; font-size: 16px; }

.site-footer { color: var(--text-secondary); background: var(--bg-surface); border-top: 1px solid var(--border); }
.site-footer__grid { display: grid; grid-template-columns: 240px minmax(0, 1fr) 240px; }
.site-footer__grid > * { min-width: 0; padding: 28px 24px; }
.site-footer__brand { border-right: 1px solid var(--border); }
.site-footer__brand .brand { min-height: 44px; padding: 0; }
.site-footer__brand p { margin: 10px 0 0; color: var(--text-muted); font-size: 13px; }
.site-footer nav ul { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.site-footer a:not(.btn), .touch-link { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer h2 { margin: 0 0 14px; color: var(--text-muted); font: 500 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.site-footer__version { border-left: 1px solid var(--border); }
.site-footer__version p { margin: 0 0 10px; font-size: 13px; }
.site-footer small { color: var(--text-muted); font-size: 12px; }

/* Shared content primitives retained for the non-home pages. */
.container { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: 24px; }
.section { padding-block: 48px; border-bottom: 1px solid var(--border); }
.section--alt { background: var(--bg-surface2); }
.hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; align-items: center; padding: 48px; color: var(--text-primary); background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; }
.hero__title { max-width: 18ch; margin: 0 0 16px; font-size: 48px; line-height: 1.05; letter-spacing: -.03em; }
.hero__lead { max-width: 62ch; margin: 0; color: var(--text-secondary); font-size: 18px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero__media { margin: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; }
.hero__media figcaption, .hero__media .note { padding: 12px 16px; margin: 0; }
.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.prose { max-width: 760px; margin-inline: auto; }
.prose h1, .prose h2 { line-height: 1.2; letter-spacing: -.02em; }
.prose h1 { font-size: 44px; }
.prose h2 { margin-top: 0; font-size: 30px; }
.card { padding: 24px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-sm); }
.card__title { margin: 0 0 8px; font-size: 20px; line-height: 1.3; }
.card__meta { color: var(--text-muted); font-size: 14px; }
.card--link { display: block; color: var(--text-primary); text-decoration: none; }
.card--link:hover { color: var(--text-primary); border-color: var(--brand-accent); }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding-inline: 8px; color: var(--text-secondary); background: var(--brand-neutral-bg); border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge--level { color: var(--text-primary); border: 1px solid var(--border-strong); }
.steps { display: grid; gap: 16px; margin: 0; padding: 0; counter-reset: step; list-style: none; }
.steps li { position: relative; padding: 16px 16px 16px 52px; counter-increment: step; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; }
.steps li::before { position: absolute; top: 16px; left: 16px; color: var(--brand-accent); content: counter(step, decimal-leading-zero); font: 500 12px var(--font-mono); }
.note, .warn { padding: 16px; border-left: 4px solid var(--border-strong); border-radius: 8px; }
.note { background: var(--brand-accent-soft); border-left-color: var(--brand-accent); }
.warn { background: var(--color-warn-bg); border-left-color: var(--color-warn-border); }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--bg-surface2); }
.compare tbody tr:nth-child(even) { background: var(--bg-surface2); }
.faq { padding: 12px 0; border-bottom: 1px solid var(--border); }
.faq summary { min-height: 44px; padding: 8px 0; color: var(--text-primary); font-weight: 600; cursor: pointer; }
.faq summary::marker { color: var(--brand-accent); }
.faq p { margin: 8px 0 0; color: var(--text-tertiary); }
.video-frame, .video-soon { width: 100%; overflow: hidden; background: var(--color-code-bg); border: 1px solid var(--border); border-radius: 10px; }
.video-frame { aspect-ratio: 16 / 9; }
.video-frame video { width: 100%; height: 100%; }
.video-soon { display: grid; min-height: 12rem; padding: 24px; place-items: center; text-align: center; }
.tutorial-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.tutorial-body ol { margin: 0; padding: 0; counter-reset: tutorial-step; list-style: none; }
.tutorial-body ol li { position: relative; display: block; padding: 16px 16px 16px 44px; counter-increment: tutorial-step; border-bottom: 1px solid var(--border-subtle); }
.tutorial-body ol li::before { position: absolute; top: 16px; left: 16px; color: var(--brand-accent); content: counter(tutorial-step); font: 500 12px var(--font-mono); }
.tutorial-body ol li:first-child { border-top: 1px solid var(--border-subtle); }
.try-cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; background: var(--brand-accent-soft); border: 1px solid #bfdbfe; border-radius: 10px; }
.try-cta > div { min-width: 0; }
.link-list { padding-left: 20px; }
.table-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.lesson-records, .compare-records { display: none; }
.table-links > span[aria-hidden="true"] { display: none; }
.table-links > a:not(:first-of-type)::before { display: inline-block; margin-right: 0.4em; color: var(--text-muted); text-decoration: none; content: '·'; }
.page-for-teachers .ds-row > .ds-body > h2.ds-h2,
.page-access-alternative .ds-row > .ds-body > h2.ds-h2,
.page-sqlite-editor .ds-row > .ds-body > h2.ds-h2,
.page-tutorials .ds-row > .ds-body > h2.ds-h2,
.page-privacy .ds-row > .ds-body > h2.ds-h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 900px) {
  .site-header__grid { grid-template-columns: 220px minmax(0, 1fr) auto; }
  .site-header__actions { padding-inline: 16px; }
  .ds-main, .ds-body { padding-inline: 36px; }
  .ds-cards--3 { grid-template-columns: 1fr; }
  .site-footer__grid { grid-template-columns: 220px minmax(0, 1fr); }
  .site-footer__version { grid-column: 1 / -1; border-top: 1px solid var(--border); border-left: 0; }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 112px; }
  .site-header__grid { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 56px 44px; min-height: 100px; }
  .brand-cell { padding-right: 0; border-right: 0; }
  .brand { padding: 8px 16px; }
  .brand__by, .only-wide { display: none; }
  .only-narrow { display: inline; }
  .site-header__actions { padding: 6px 16px 6px 8px; gap: 8px; }
  .site-header__actions { grid-column: 2; grid-row: 1; }
  .site-header__actions .btn-launch { min-width: 44px; padding: 10px; white-space: nowrap; }
  .product-nav { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid var(--border); }
  .product-nav__list { height: 43px; min-height: 43px; padding-inline: 16px; }
  .product-nav__link { min-height: 44px; padding-inline: 0; margin-right: 18px; }
  .btn, .btn--primary, .btn--secondary { max-width: 100%; white-space: normal; text-align: center; }
  .breadcrumbs { padding-inline: 16px; }
  .breadcrumbs a { display: inline-flex; align-items: center; min-height: 44px; }
  .breadcrumbs ol { align-items: center; }
  .breadcrumbs li { display: inline-flex; align-items: center; min-height: 44px; }
  .ds-hero, .ds-row { display: block; }
  .ds-label { padding: 12px 16px 8px; border-right: 0; border-bottom: 0; }
  .ds-label--facts { display: flex; flex-flow: row wrap; gap: 4px 14px; padding-top: 16px; border-bottom: 1px solid var(--border); }
  .ds-label--facts span { line-height: 1.5; }
  .ds-main, .ds-body { padding: 24px 16px; }
  .ds-hero__main { padding-top: 28px; padding-bottom: 32px; }
  .ds-h1 { font-size: 38px; }
  .t-h1 { font-size: 38px; }
  .ds-lead { font-size: 16px; }
  .ds-actions { flex-direction: column; }
  .ds-actions .btn { width: 100%; }
  .ds-sheet { margin-top: 32px; }
  .feature-sheet { display: none; }
  .feature-records { display: block; }
  .feature-record { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--border-subtle); font-size: 15px; }
  .feature-record:last-child { border-bottom: 0; }
  .ds-two, .ds-steps, .ds-kv { grid-template-columns: 1fr; }
  .ds-two { gap: 16px; }
  .ds-step { padding: 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .ds-step:last-child { border-bottom: 0; }
  .ds-h2 { font-size: 24px; }
  .ds-kv__row { grid-template-columns: 1fr; }
  .ds-kv__key, .ds-kv__value { padding: 12px 0; }
  .ds-kv__key { padding-bottom: 2px; }
  .ds-kv__value { border-top: 0; }
  .ds-kv__value { padding-top: 0; }
  .ds-faq__key { padding-right: 0; padding-bottom: 2px; }
  .ds-faq .ds-kv__value { padding-top: 0; }
  .ds-final { display: block; padding: 28px 16px; }
  .ds-final h2 { font-size: 24px; }
  .ds-final p { margin-bottom: 18px; }
  .ds-final .btn { width: 100%; }
  .site-footer__grid { display: block; }
  .site-footer__grid > * { padding: 24px 16px; }
  .site-footer__brand { border-right: 0; border-bottom: 1px solid var(--border); }
  .site-footer__version { border-top: 1px solid var(--border); }
  .try-cta { display: block; }
  .try-cta .btn { width: 100%; margin-top: 18px; }
  .ds-actions--inline { flex-direction: column; align-items: stretch; }
  .lesson-table-wrap, .compare-table-wrap { display: none; }
  .lesson-records, .compare-records { display: block; }
  .lesson-record, .compare-record { padding: 16px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; }
  .lesson-record + .lesson-record, .compare-record + .compare-record { margin-top: 12px; }
  .lesson-record h3, .compare-record h3 { margin: 0 0 14px; font-size: 17px; line-height: 1.35; }
  .lesson-record dl, .compare-record dl { margin: 0; }
  .lesson-record dl > div, .compare-record dl > div { padding-top: 12px; border-top: 1px solid var(--border-subtle); }
  .lesson-record dt, .compare-record dt { color: var(--text-muted); font: 500 11px var(--font-mono); letter-spacing: .04em; text-transform: uppercase; }
  .lesson-record dd, .compare-record dd { margin: 4px 0 0; color: var(--text-tertiary); }
  .ds-body { overflow-wrap: anywhere; }
  .container { padding-inline: 16px; }
  .section { padding-block: 32px; }
  .hero { display: block; padding: 24px 16px; }
  .hero__title { font-size: 38px; }
  .hero__media { margin-top: 24px; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .prose h1 { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
@media print { .site-header, .product-nav, .site-footer, .ds-final, .video-frame, .video-soon { display: none !important; } }
