:root {
  color-scheme: light;
  --ink: #1f2937;
  --muted: #667085;
  --line: #cbd5e1;
  --line-strong: #94a3b8;
  --canvas: #edf2f7;
  --panel: #ffffff;
  --steel: #315f86;
  --steel-dark: #204865;
  --steel-soft: #e8f0f7;
  --menu: #f7f9fb;
  --blue: #0645d1;
  --orange: #c35a00;
  --green: #147a35;
  --red: #c00000;
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.7; }
a { color: #0759a5; text-underline-offset: 2px; }
a:hover { color: #003e75; }
button, input { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  color: #fff;
  background: linear-gradient(110deg, var(--steel-dark), var(--steel));
  border-bottom: 3px solid #15364e;
  box-shadow: 0 4px 14px rgb(15 40 60 / 18%);
}
.header-inner { max-width: 1560px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 18px; }
.brand { color: #fff; text-decoration: none; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.header-note { margin-left: auto; font-size: .78rem; opacity: .82; }
.menu-button { display: none; border: 1px solid rgb(255 255 255 / 55%); color: #fff; background: transparent; border-radius: 6px; padding: 5px 10px; }

.site-shell { width: min(1560px, 100%); margin: 0 auto; display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.sidebar { position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px); overflow-y: auto; padding: 18px 14px 28px; background: var(--menu); border-right: 1px solid var(--line); }
.sidebar-title { margin: 0 4px 12px; font-size: .78rem; color: var(--muted); font-weight: 800; letter-spacing: .12em; }
.nav-group { margin: 0 0 8px; border: 1px solid var(--line); background: #fff; }
.nav-group summary { cursor: pointer; padding: 8px 10px; font-weight: 800; background: #e2e5e9; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::before { content: "＋"; display: inline-block; width: 1.5em; color: var(--steel); }
.nav-group[open] summary::before { content: "−"; }
.nav-links { margin: 0; padding: 6px 8px 9px 30px; }
.nav-links li { margin: 3px 0; }
.nav-links a { font-size: .88rem; text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--steel-dark); font-weight: 800; text-decoration: underline; }
.nav-subgroup { list-style: disc; margin-top: 8px !important; }
.nav-subtitle { display: block; color: var(--ink); font-size: .86rem; font-weight: 800; }
.nav-sublinks { margin: 3px 0 0; padding-left: 17px; }
.nav-sublinks li { margin: 3px 0; }
.nav-sublinks a { font-size: .86rem; text-decoration: none; }
.nav-sublinks a[aria-current="page"] { color: var(--steel-dark); font-weight: 800; text-decoration: underline; }
.nav-placeholder { color: var(--muted); font-size: .86rem; }

.content { min-width: 0; padding: 24px clamp(16px, 3vw, 44px) 56px; }
.page-card { min-width: 0; max-width: 100%; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 24px rgb(31 41 55 / 7%); padding: clamp(18px, 3vw, 36px); }
.page-card > :first-child { margin-top: 0; }
h1, h2, h3 { line-height: 1.35; color: #172536; }
h1 { margin: 0 0 22px; padding-bottom: 9px; border-bottom: 3px solid var(--steel); font-size: clamp(1.55rem, 3vw, 2rem); }
h2 { margin-top: 30px; padding: 7px 10px; background: #dedede; border-left: 5px solid var(--steel); font-size: 1.18rem; }
h3 { margin-top: 24px; font-size: 1.05rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

.table-scroll { width: 100%; overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--line); }
.quest-origin-group { min-width: 0; max-width: 100%; }
.quest-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.quest-table.is-overflowing {
  overflow-x: scroll;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #64748b #e2e8f0;
}
@supports selector(::-webkit-scrollbar) {
  .quest-table.is-overflowing::-webkit-scrollbar { height: 22px; }
  .quest-table.is-overflowing::-webkit-scrollbar-track { background: #e2e8f0; border: 1px solid #cbd5e1; }
  .quest-table.is-overflowing::-webkit-scrollbar-thumb { min-width: 48px; background: #64748b; border: 3px solid #e2e8f0; border-radius: 12px; }
  .quest-table.is-overflowing::-webkit-scrollbar-thumb:hover { background: #315f86; }
}
table { width: max-content; min-width: 100%; border-collapse: collapse; table-layout: auto; background: #fff; }
th, td { border: 1px solid var(--line); padding: 7px 10px; text-align: center; vertical-align: middle; white-space: nowrap; }
th { background: #dcdcdc; font-weight: 800; }
td.long-text { white-space: normal; min-width: 28rem; text-align: left; }
tr:hover td { background-color: #f6f9fc; }
.tone-blue, .tone-blue a { color: var(--blue) !important; font-weight: 800; }
.tone-orange, .tone-orange a { color: var(--orange) !important; font-weight: 800; }
.tone-green, .tone-green a { color: var(--green) !important; font-weight: 800; }
.tone-red, .tone-red a { color: var(--red) !important; font-weight: 800; }

.top-intro { font-size: 1.03rem; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 20px 0; }
.quick-card { border: 1px solid var(--line); background: var(--steel-soft); padding: 14px; text-decoration: none; color: var(--ink); }
.quick-card strong { display: block; color: var(--steel-dark); }
.notice { padding: 12px 14px; border-left: 4px solid var(--steel); background: #f0f5fa; }
.breadcrumbs { margin: 0 0 10px; color: var(--muted); font-size: .78rem; }
.page-footer { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.search { width: 100%; margin-bottom: 12px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 7px 9px; background: #fff; }
.search-empty { padding: 20px; color: var(--muted); text-align: center; }
.map-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: -6px 0 20px; padding: 9px 12px; border: 1px solid var(--line); background: var(--steel-soft); }
.map-pager > :last-child { justify-self: end; }
.map-pager a { font-weight: 700; text-decoration: none; }
.map-page .site-shell { width: 100%; }
.map-page .content { padding: 16px 16px 40px; }
.map-page .page-card { padding: 20px 16px; }
.map-image-panel { margin: 0 0 26px; padding: 4px; background: #070a0e; border: 1px solid var(--line); text-align: center; }
.map-preview-button { display: block; width: 100%; margin: 0; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.map-image-panel img { display: block; width: 100%; max-width: 2400px; height: auto; margin: 0 auto; }
.map-image-panel figcaption { margin-top: 9px; color: #d8dee8; font-size: .82rem; }
.map-expand-button { border: 1px solid #9fb3c8; border-radius: 6px; background: #f4f7fa; color: #244f7a; padding: 7px 18px; font: inherit; font-weight: 800; cursor: zoom-in; }
.map-dialog { width: 96vw; max-width: none; height: 94vh; max-height: none; margin: auto; padding: 0; border: 1px solid #718399; background: #070a0e; color: #fff; }
.map-dialog::backdrop { background: rgba(0, 0, 0, .82); }
.map-dialog-toolbar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 12px; box-sizing: border-box; background: #263f59; }
.map-dialog-toolbar button { border: 1px solid #fff; border-radius: 5px; background: #fff; color: #21364d; padding: 6px 16px; font-weight: 800; cursor: pointer; }
.map-dialog-scroll { height: calc(94vh - 48px); overflow: auto; overscroll-behavior: contain; }
.map-dialog-scroll img { display: block; width: auto; max-width: none; height: auto; margin: 0 auto; }

@media (max-width: 900px) {
  .header-inner { padding: 10px 12px; }
  .header-note { display: none; }
  .menu-button { display: inline-block; margin-left: auto; }
  .site-shell { display: block; }
  .sidebar { display: none; position: fixed; inset: 55px 0 0 0; z-index: 25; height: auto; border-right: 0; padding: 14px; }
  .sidebar.is-open { display: block; }
  .content { padding: 14px 10px 40px; }
  .page-card { padding: 16px 12px 28px; }
  .map-page .content { padding: 10px 4px 32px; }
  .map-page .page-card { padding: 16px 6px 24px; }
  th, td { padding: 6px 8px; font-size: .84rem; }
}
