:root {
  --bg: #ffffff; --surface: #f5f6fa; --border: #e2e4ec; --text: #1c1e26; --muted: #5b6070;
  --accent: #4f46e5; --accent-soft: #eef0ff; --note: #fff8e6; --note-border: #f0d48a;
  --radius: 12px; --wrap: 1100px; --measure: 46rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12131a; --surface: #1b1d27; --border: #2c2f3d; --text: #e7e8ee; --muted: #a2a6b6;
    --accent: #8f8afc; --accent-soft: #23234a; --note: #2a2414; --note-border: #6b5a2a;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-wrap: break-word; }
main { overflow-x: clip; }
.prose p, .prose li, .prose td, .lead { overflow-wrap: anywhere; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 8px; z-index: 10; }

.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand img { border-radius: 8px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.menu summary { list-style: none; cursor: pointer; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; }
.menu summary::-webkit-details-marker { display: none; }
.menu nav { position: absolute; right: 16px; top: 60px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; min-width: 220px; }
.menu nav a, .main-nav a { padding: 8px 12px; color: var(--text); text-decoration: none; border-radius: 8px; }
.menu nav a:hover, .menu nav a[aria-current], .main-nav a:hover, .main-nav a[aria-current] {
  background: var(--accent-soft); color: var(--accent); }
.main-nav { display: none; font-size: 15px; }
@media (min-width: 960px) {
  .menu { display: none; }
  .main-nav { display: flex; gap: 2px; }
}

.hero { padding: 48px 0 16px; max-width: var(--measure); }
.hero h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.2; margin: 0 0 16px; }
.lead { font-size: 19px; color: var(--muted); }
.notice { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-size: 15px; }
.home-section { margin: 40px 0; }
.home-section h2 a { color: var(--text); text-decoration: none; }

.cards { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.cards a { display: block; height: 100%; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none; }
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; margin-bottom: 4px; }
.cards span { font-size: 15px; color: var(--muted); }

.article { padding-bottom: 48px; }
.crumbs { font-size: 14px; color: var(--muted); padding: 16px 0 0; }
.crumbs a { color: var(--muted); }
.article-head { max-width: var(--measure); padding: 16px 0 8px; }
.article-head h1 { font-size: clamp(28px, 4.5vw, 40px); line-height: 1.2; margin: 4px 0 12px; }
.kicker { margin: 0; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kicker a { text-decoration: none; }
.meta { font-size: 14px; color: var(--muted); }
.prose { max-width: var(--measure); }
.prose h2 { font-size: 26px; line-height: 1.3; margin: 40px 0 12px; }
.prose h3 { font-size: 20px; margin: 28px 0 8px; }
.prose h4 { font-size: 17px; margin: 20px 0 6px; }
.prose figure { margin: 24px 0; }
.prose figure img { border-radius: var(--radius); display: block; }
.prose .box, .prose .note { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px; margin: 16px 0; background: var(--surface); }
.prose .note { background: var(--note); border-color: var(--note-border); }
.prose .lead-in { margin-bottom: 4px; }
.table-wrap { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
tr:first-child td, th { background: var(--surface); font-weight: 600; }
details { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
code, pre { background: var(--surface); border-radius: 6px; padding: 1px 5px; font-size: .92em; overflow-wrap: anywhere; }
mark { background: #ffe58a; color: #1c1e26; padding: 0 3px; }
.related { margin-top: 48px; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0; font-size: 15px; color: var(--muted); }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.footer-inner nav a, .cookie-settings { color: var(--muted); }
.cookie-settings { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

#cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; z-index: 20;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18); font-size: 15px; }
#cookie-banner div { display: flex; gap: 8px; justify-content: flex-end; }
#cookie-banner button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
#cookie-banner .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
