body { line-height: 1.7; }
a { text-underline-offset: 0.18em; }
table { border-collapse: collapse; }
th, td { vertical-align: top; }

:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px;
}

.card,
.research-panel {
  border: 1px solid rgb(226 232 240);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
}

.dark .card,
.dark .research-panel {
  border-color: rgb(51 65 85);
  background: rgba(15, 23, 42, 0.82);
}

.neutral-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(22, 78, 99, 0.08);
  color: rgb(22 78 99);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dark .neutral-badge {
  background: rgba(125, 211, 252, 0.08);
  color: rgb(125 211 252);
}

.matrix-table th,
.matrix-table td {
  border-bottom: 1px solid rgb(226 232 240);
  padding: 0.9rem 1rem;
}

.premium-table-wrap {
  overflow-x: auto;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.9rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  background: white;
}

.premium-table-wrap:focus {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.premium-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.premium-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  font-size: 0.96rem;
  color: rgb(30 41 59);
  padding: 0.85rem 1rem;
}

.premium-table thead th {
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgb(203 213 225);
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.9), rgba(248, 250, 252, 0.95));
  color: rgb(15 23 42);
}

.premium-table th,
.premium-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgb(226 232 240);
}

.premium-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.75);
}

.premium-table tbody tr:hover {
  background: rgba(186, 230, 253, 0.2);
}

.premium-table th.sortable {
  cursor: pointer;
}

.premium-table th.sortable::after {
  content: "  ↕";
  color: rgb(100 116 139);
  font-size: 0.75rem;
}

.premium-table-wrap + .table-note {
  margin-top: 0.5rem;
  color: rgb(71 85 105);
  font-size: 0.82rem;
}

.premium-figure {
  margin: 1.3rem 0;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.9rem;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(248, 250, 252, 0.92));
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.premium-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.premium-figure figcaption {
  border-top: 1px solid rgb(226 232 240);
  padding: 0.7rem 0.9rem;
  font-size: 0.84rem;
  color: rgb(51 65 85);
  background: rgba(248, 250, 252, 0.9);
}

.dark .matrix-table th,
.dark .matrix-table td {
  border-bottom-color: rgb(51 65 85);
}

.dark .premium-table-wrap {
  border-color: rgb(51 65 85);
  background: rgb(15 23 42);
}

.dark .premium-table caption {
  color: rgb(226 232 240);
}

.dark .premium-table thead th {
  border-bottom-color: rgb(71 85 105);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 1));
  color: rgb(241 245 249);
}

.dark .premium-table th,
.dark .premium-table td {
  border-bottom-color: rgb(51 65 85);
}

.dark .premium-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.88);
}

.dark .premium-table tbody tr:hover {
  background: rgba(14, 116, 144, 0.22);
}

.dark .premium-table-wrap + .table-note {
  color: rgb(148 163 184);
}

.dark .premium-figure {
  border-color: rgb(51 65 85);
  background: linear-gradient(180deg, rgba(15, 23, 42, 1), rgba(2, 6, 23, 1));
}

.dark .premium-figure figcaption {
  border-top-color: rgb(51 65 85);
  color: rgb(203 213 225);
  background: rgba(15, 23, 42, 0.92);
}

.matrix-table tr:last-child td {
  border-bottom: none;
}

.prose pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
}

.prose code,
code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.92em;
}

.prose img {
  border: 1px solid rgb(226 232 240);
  border-radius: 1rem;
  background: white;
}

.dark .prose img {
  border-color: rgb(51 65 85);
  background: rgb(15 23 42);
}

.toc ul { list-style: none; margin: 0; padding-left: 0; }
.toc ul ul { margin-top: 0.4rem; padding-left: 0.85rem; border-left: 1px solid rgb(203 213 225); }
.dark .toc ul ul { border-left-color: rgb(71 85 105); }
.toc a { color: inherit; text-decoration: none; }
.toc li { margin: 0.45rem 0; }

.section-grid {
  display: grid;
  gap: 1.5rem;
}

.diagram-frame {
  border: 1px solid rgb(203 213 225);
  border-radius: 1rem;
  overflow: hidden;
  background: white;
}

.dark .diagram-frame {
  border-color: rgb(51 65 85);
  background: rgb(15 23 42);
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 1024px) {
  .toc { max-height: 320px; overflow-y: auto; }
}

@media (max-width: 768px) {
  .premium-table {
    min-width: 620px;
  }

  .premium-table th,
  .premium-table td {
    padding: 0.72rem 0.8rem;
  }
}
