:root {
  --ink: #111827;
  --ink-soft: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f0fe;
  --panel: #ffffff;
  --coral: #7107e7;
  --coral-deep: #5c06c2;
  --navy: #32036c;
  --ok: #1b7f4e;
  --ok-bg: #e7f7ee;
  --warn: #9a6700;
  --warn-bg: #fff6db;
  --no: #b42318;
  --no-bg: #feeceb;
  --shadow: 0 12px 40px rgba(113, 7, 231, 0.08);
}
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(113,7,231,0.14), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(50,3,108,0.10), transparent 50%),
    var(--bg);
  line-height: 1.55;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--coral-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere; }
a:hover { color: var(--navy); }
.shell {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: auto;
  background: linear-gradient(180deg, #32036c 0%, #5c06c2 55%, #7107e7 100%);
  color: #edf2f7; padding: 28px 20px 40px; border-right: 1px solid rgba(255,255,255,0.06);
}
.brand-mark { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 8px; min-width: 0; }
.brand-mark .dot {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #7107e7, #a56ef2);
  box-shadow: 0 6px 16px rgba(113,7,231,0.35);
  display:grid; place-items:center; font-weight:700; color:#fff; font-family:"Fraunces",serif;
}
.sidebar h1 {
  font-family: "Fraunces", Georgia, serif; font-size: 1.35rem; line-height: 1.2;
  margin: 0 0 6px; font-weight: 700; color: #fff;
  overflow-wrap: anywhere;
}
.sidebar .tag { color: #c5d0e0; font-size: 0.85rem; margin: 0 0 18px; }
.sidebar .meta {
  font-size: 0.78rem; color: #9fb0c9; margin-bottom: 22px; padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  overflow-wrap: anywhere;
}
.toc { display: flex; flex-direction: column; gap: 4px; }
.toc a {
  color: #d7e0ee; text-decoration: none; font-size: 0.82rem; padding: 7px 10px; border-radius: 8px;
  overflow-wrap: anywhere;
}
.toc a:hover, .toc a:focus { background: rgba(255,255,255,0.08); color: #fff; }
.toc-l3 { padding-left: 1.25rem !important; font-size: 0.76rem !important; color: #a8b8d0 !important; }
.toc-l3:hover, .toc-l3:focus { color: #fff !important; }
.content {
  min-width: 0;
  width: 100%;
  max-width: 980px;
  padding: 36px 48px 80px;
  overflow-wrap: break-word;
}
.hero {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px 30px; box-shadow: var(--shadow); margin-bottom: 28px;
  max-width: 100%;
}
.hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.35rem, 5.2vw, 2.4rem);
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
.hero p { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.legend { display:flex; flex-wrap:wrap; gap:10px; margin-top:14px; font-size:0.85rem; color:var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: #faf8f5; color: var(--muted);
  max-width: 100%;
}
.article { min-width: 0; max-width: 100%; }
.article h2, .article h3, .article h4 {
  font-family: "Fraunces", Georgia, serif; letter-spacing: -0.015em; scroll-margin-top: 24px;
  overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
}
.article h2 {
  font-size: clamp(1.15rem, 4.2vw, 1.45rem); margin-top: 2.4rem; padding: 1.1rem 0 0;
  border-top: 1px solid var(--line);
}
.article h2:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.article h3 { font-size: clamp(1.02rem, 3.6vw, 1.15rem); margin-top: 1.6rem; color: var(--navy); }
.article h4 { font-size: 1.02rem; margin-top: 1.2rem; color: var(--ink-soft); }
.article p { color: var(--ink-soft); overflow-wrap: anywhere; }
.article ul, .article ol { color: var(--ink-soft); padding-left: 1.2rem; }
.article li { margin: 0.35rem 0; overflow-wrap: anywhere; }
.article blockquote {
  margin: 1.2rem 0; padding: 14px 16px; border-left: 4px solid var(--coral);
  background: #fff; border-radius: 0 12px 12px 0; box-shadow: var(--shadow);
  max-width: 100%;
}
.article blockquote p { margin: 0.35rem 0; }
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0 1.4rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  max-width: 100%;
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; table-layout: fixed; }
th, td {
  padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top;
  overflow-wrap: anywhere; word-break: break-word;
}
th { background: #eef2f7; color: var(--navy); font-weight: 600; }
tr:last-child td { border-bottom: none; }
code, pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86em;
}
p code, li code, td code, th code, .footer-note code, .sidebar code {
  background: #eef2f7; padding: 0.12em 0.4em; border-radius: 6px; color: #17324f;
  overflow-wrap: anywhere; word-break: break-word; white-space: normal;
}
.sidebar code { background: rgba(255,255,255,0.12); color: #f2c4b7; }
pre {
  background: #12233f; color: #e8eef8; padding: 14px 16px; border-radius: 14px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow); max-width: 100%;
}
pre code { background: transparent; color: inherit; padding: 0; white-space: pre; word-break: normal; }
hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }
.badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; padding: 3px 7px; border-radius: 999px; vertical-align: middle;
  white-space: nowrap;
}
.badge-yes { background: var(--ok-bg); color: var(--ok); }
.badge-partial { background: var(--warn-bg); color: var(--warn); }
.badge-no { background: var(--no-bg); color: var(--no); }
.checklist { list-style: none; padding-left: 0; }
.checklist li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 6px 0; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; min-width: 0; }
.checklist label span, .checklist label { overflow-wrap: anywhere; }
.checklist input { margin-top: 4px; accent-color: var(--coral-deep); flex-shrink: 0; }
.footer-note {
  margin-top: 48px; padding: 18px 16px; border-radius: 14px; background: #fff;
  border: 1px solid var(--line); color: var(--muted); font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.mobile-bar {
  display: none;
  position: sticky; top: 0; z-index: 60;
  align-items: center; gap: 12px;
  padding: 12px 14px;
  background: #32036c; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  max-width: 100%;
}
.mobile-bar .menu-btn {
  appearance: none; border: 0; background: rgba(255,255,255,0.12);
  color: #fff; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.mobile-bar .menu-btn:focus-visible { outline: 2px solid #a56ef2; outline-offset: 2px; }
.mobile-bar .menu-btn svg { width: 22px; height: 22px; }
.mobile-bar .title {
  min-width: 0; flex: 1; font-size: 0.95rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mobile-bar .title span {
  display: block; font-size: 0.72rem; font-weight: 500; color: #c5d0e0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-close {
  display: none; appearance: none; border: 0; background: rgba(255,255,255,0.12);
  color: #fff; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  margin-left: auto; flex-shrink: 0; font-size: 1.25rem; line-height: 1;
}
.nav-overlay {
  display: none; position: fixed; inset: 0; z-index: 70;
  background: rgba(17, 24, 39, 0.48); border: 0; cursor: pointer;
}
body.nav-open { overflow: hidden; }
@media (max-width: 960px) {
  .shell { display: block; width: 100%; max-width: 100%; }
  .mobile-bar { display: flex; }
  .sidebar-close { display: grid; place-items: center; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 80;
    width: min(86vw, 320px); height: 100dvh; max-height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 12px 0 40px rgba(17, 24, 39, 0.25);
    padding: 20px 16px 32px;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay { display: block; }
  .content {
    padding: 16px 12px 64px;
    max-width: 100%;
  }
  .hero {
    padding: 16px 14px;
    border-radius: 14px;
    margin-bottom: 20px;
  }
  .hero h1 { font-size: clamp(1.25rem, 7vw, 1.55rem); }
  .hero p { font-size: 0.95rem; }
  .pills { gap: 6px; }
  .pill { font-size: 0.65rem; padding: 5px 8px; }
  .legend { gap: 8px; font-size: 0.8rem; }
  .article h2 { margin-top: 1.8rem; padding-top: 0.9rem; }
  .article blockquote { padding: 12px 12px; }
  .table-wrap {
    margin: 0.85rem 0 1.1rem;
    border-radius: 12px;
  }
  .table-wrap table {
    font-size: 0.82rem;
  }
  th, td { padding: 8px 10px; }
  /* 2-column meta tables → stacked labeled rows */
  .table-wrap.table-stack table thead { display: none; }
  .table-wrap.table-stack table,
  .table-wrap.table-stack table tbody,
  .table-wrap.table-stack table tr,
  .table-wrap.table-stack table th,
  .table-wrap.table-stack table td {
    display: block;
    width: 100%;
  }
  .table-wrap.table-stack table tr {
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap.table-stack table tr:last-child { border-bottom: none; }
  .table-wrap.table-stack table th,
  .table-wrap.table-stack table td {
    padding: 2px 0;
    border: none;
  }
  .table-wrap.table-stack table td:first-child {
    font-weight: 600;
    color: var(--navy);
    font-size: 0.78rem;
    margin-bottom: 2px;
  }
  /* Wide matrices: intentional horizontal scroll */
  .table-wrap.table-scroll table {
    width: max(100%, 720px);
    table-layout: auto;
  }
  .table-wrap.table-scroll th,
  .table-wrap.table-scroll td {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }
  pre { padding: 12px 12px; font-size: 0.82rem; }
  .footer-note { padding: 14px 12px; font-size: 0.85rem; }
}
@media (max-width: 420px) {
  .content { padding: 12px 10px 56px; }
  .hero { padding: 14px 12px; }
  .hero h1 { font-size: 1.22rem; }
}
@media print {
  body { background: #fff; overflow: visible; }
  .mobile-bar, .nav-overlay, .sidebar, .sidebar-close { display: none !important; }
  .shell { display: block; }
  .content { max-width: none; padding: 0; }
  .hero, .table-wrap, pre { box-shadow: none; }
}
