:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #5f6b7a;
  --line: #dde3ea;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --tag: #eef2f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", system-ui, sans-serif; line-height: 1.7; }
a { color: var(--accent); }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 17px; }
.count { color: var(--muted); font-size: 13px; }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; }
.layout { display: flex; min-height: calc(100vh - 52px); }
.side { width: 300px; flex: 0 0 300px; background: var(--panel); border-right: 1px solid var(--line); padding: 12px 10px 40px; overflow-y: auto; position: sticky; top: 52px; height: calc(100vh - 52px); }
.side-head { font-size: 12px; color: var(--muted); padding: 4px 8px 8px; letter-spacing: .04em; }
.group { margin-bottom: 4px; }
.group > summary { cursor: pointer; list-style: none; padding: 6px 8px; border-radius: 6px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary:hover { background: var(--accent-soft); }
.group .n { color: var(--muted); font-weight: 400; font-size: 12px; }
.leaf { display: block; padding: 4px 8px 4px 22px; font-size: 14px; color: var(--ink); text-decoration: none; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaf:hover { background: var(--accent-soft); }
.leaf.on { background: var(--accent); color: #fff; }
.leaf .id { display: inline-block; min-width: 34px; color: var(--muted); font-size: 12px; }
.leaf.on .id { color: #e8f0fe; }
.main { flex: 1 1 auto; min-width: 0; padding: 20px 24px 60px; max-width: 1240px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; margin-bottom: 18px; }
h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.tag { background: var(--tag); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.summary { font-size: 16px; margin: 6px 0 10px; }
.note { background: #fff8e6; border: 1px solid #f0d9a0; border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.loc { font-family: Consolas, "Courier New", monospace; font-size: 13px; color: var(--muted); word-break: break-all; }
.diagram-wrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0b1020; }
.diagram-wrap iframe { display: block; width: 100%; border: 0; }
.diagram-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 0 8px; font-size: 13px; color: var(--muted); }
.btn { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); text-decoration: none; font-size: 13px; }
.btn:hover { background: var(--accent-soft); }
.text p { margin: 0 0 10px; }
.text ul { margin: 0 0 10px 20px; padding: 0; }
.text li { margin: 2px 0; }
.overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.overview a { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.overview a:hover { border-color: var(--accent); }
.overview .k { font-weight: 700; }
.overview .d { font-size: 13px; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .menu-btn { display: inline-block; }
  .side { position: fixed; left: 0; top: 52px; width: 84vw; max-width: 340px; height: calc(100vh - 52px); transform: translateX(-100%); transition: transform .2s ease; z-index: 30; box-shadow: 0 0 24px rgba(0,0,0,.2); }
  .side.open { transform: translateX(0); }
  .main { padding: 14px 12px 40px; }
  .card { padding: 14px; }
  h1 { font-size: 20px; }
}
