:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #151922;
  --panel-2: #202636;
  --text: #e8edf7;
  --muted: #aeb7c8;
  --accent: #68d7ff;
  --accent-2: #9db7ff;
  --line: #30384a;
  --line-light: #566178;
  --line-dark: #05070b;
  --titlebar: #173f8f;
  --danger: #fca5a5;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #0b0e15 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "MS PGothic", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hero {
  border-bottom: 2px solid var(--line-dark);
  background:
    linear-gradient(180deg, #1f5dc4 0 28px, #102039 28px 100%);
  box-shadow: inset 0 1px 0 #77a6ff, inset 0 -1px 0 var(--line-light);
}

.hero__content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 44px 20px 34px;
  display: flex;
  flex-direction: column-reverse;
  gap: 32px;
}

.hero__text {
  flex: 1;
}

.hero__visual {
  flex-shrink: 0;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.hero__image {
  width: 100%;
  height: auto;
  border: 2px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  border-radius: 4px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
  filter: contrast(1.15) brightness(0.9);
  display: block;
}

@media (min-width: 768px) {
  .hero__content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .hero__visual {
    width: 280px;
    margin: 0;
  }
}

.eyebrow {
  margin: 0;
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  background: #10182a;
  color: var(--accent-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1 {
  margin: 8px 0 12px;
  line-height: 1.25;
  font-size: clamp(1.6rem, 2vw + 1rem, 2.5rem);
  color: #f7fbff;
  text-shadow: 2px 2px 0 #000;
}

.hero__lead {
  margin: 0 0 22px;
  color: var(--muted);
  max-width: 840px;
}

.hero__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input[type="search"] {
  flex: 1;
  min-width: 280px;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--line-dark);
  border-right-color: var(--line-light);
  border-bottom-color: var(--line-light);
  border-radius: 2px;
  background: #070a10;
  color: var(--text);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.55);
}

button {
  padding: 10px 14px;
  border: 2px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  border-radius: 2px;
  background: linear-gradient(180deg, #30384d 0%, #171c28 100%);
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08);
}

button:hover {
  background: linear-gradient(180deg, #3b4660 0%, #202739 100%);
  color: #ffffff;
}

button:active {
  border-color: var(--line-dark);
  border-right-color: var(--line-light);
  border-bottom-color: var(--line-light);
  transform: translate(1px, 1px);
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 32px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
}

.sidebar {
  position: sticky;
  top: 14px;
  align-self: start;
  border: 2px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  border-radius: 4px;
  background: var(--panel);
  padding: 16px;
  max-height: calc(100vh - 30px);
  overflow: auto;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.05);
}

.sidebar h2 {
  margin: 0;
  font-size: 1rem;
  color: #ffffff;
  text-shadow: 1px 1px 0 #000;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -8px -8px 12px;
  padding: 6px 8px;
  border: 1px solid #2d5faf;
  background: linear-gradient(90deg, var(--titlebar), #0c1c3a);
}

.sidebar__toggle {
  display: none;
  padding: 6px 10px;
  border-radius: 2px;
  font-size: 0.86rem;
  white-space: nowrap;
}

#tocList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

#tocList a {
  display: block;
  padding: 2px 4px;
  border: 1px dotted transparent;
  text-decoration: none;
  color: var(--text);
  opacity: 0.9;
}

#tocList a[data-level="3"] {
  padding-left: 12px;
  font-size: 0.94rem;
  color: #c8cfdb;
}

#tocList a:hover {
  border-color: var(--accent);
  background: #0d1422;
  color: var(--accent);
}

.content {
  display: grid;
  gap: 18px;
}

.quick-guide,
.timeline,
.markdown-body {
  border: 2px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  border-radius: 4px;
  background: var(--panel);
  padding: 18px;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.04);
}

.quick-guide h2,
.timeline h2,
.markdown-body h2 {
  margin-top: 0;
  padding: 4px 8px;
  border: 1px solid #2d5faf;
  background: linear-gradient(90deg, var(--titlebar), #0d1d3a);
  color: #ffffff;
  text-shadow: 1px 1px 0 #000;
}

.guide-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-card {
  border: 2px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  border-radius: 3px;
  background: #111724;
  padding: 12px;
}

.guide-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
}

.timeline ol {
  margin: 0;
  padding-left: 20px;
}

.timeline li {
  margin-bottom: 8px;
}

.timeline span {
  display: inline-block;
  min-width: 95px;
  color: var(--accent);
  font-weight: 600;
}

.search-toolbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.search-toolbar.is-active {
  display: flex;
  position: sticky;
  top: 10px;
  z-index: 20;
  padding: 8px 12px;
  border: 2px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  border-radius: 3px;
  background: rgba(16, 24, 42, 0.96);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}

.search-nav {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.search-nav[hidden] {
  display: none;
}

.search-nav button {
  padding: 5px 10px;
  font-size: 0.86rem;
}

.status {
  min-height: 1.4em;
  color: var(--accent);
  margin: 0;
}

.status.error {
  color: var(--danger);
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  scroll-margin-top: 18px;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body ul ul {
  margin-top: 4px;
  margin-bottom: 6px;
  list-style-type: circle;
}

.markdown-body ul ul ul {
  list-style-type: square;
}

.markdown-body code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #0c111c;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.markdown-body blockquote {
  margin-left: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-light);
  border-left: 5px solid var(--accent-2);
  background: #0f1624;
}

.markdown-body mark {
  background: #fde68a;
  color: #1f2937;
  padding: 0 2px;
  border-radius: 2px;
}

.markdown-body mark.is-active {
  background: #fb923c;
  color: #090b10;
  outline: 2px solid #fff;
}

.back-to-toc {
  display: flex;
  justify-content: flex-end;
  margin: 28px 0 8px;
  padding-top: 16px;
  border-top: 1px dotted var(--line-light);
}

.back-to-toc__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 2px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  border-radius: 2px;
  background: linear-gradient(180deg, #263047, #131824);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92rem;
}

.back-to-toc__link:hover {
  background: linear-gradient(180deg, #33405d, #1c2435);
  color: var(--text);
}

/* コールアウト（枠囲み）のスタイル */
.callout {
  padding: 16px 18px;
  border-radius: 3px;
  margin: 24px 0;
  border-left: 4px solid var(--line);
  background: var(--panel-2);
}

.callout p {
  margin: 0 0 8px 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Note / Info / Tip用（青系） */
.callout-note,
.callout-info {
  border-left-color: var(--accent);
  background: rgba(125, 211, 252, 0.08);
}

.callout-tip {
  border-left-color: #6ee7b7;
  background: rgba(110, 231, 183, 0.08);
}

.callout-warning {
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
}

.callout-danger {
  border-left-color: var(--danger);
  background: rgba(252, 165, 165, 0.08);
}

/* 隠し要素用（紫・ピンク系） */
.callout-secret {
  border-left-color: #c084fc;
  background: rgba(192, 132, 252, 0.08);
}

.callout-secret strong:first-child {
  color: #c084fc;
  display: block;
  margin-bottom: 4px;
  font-size: 1.05em;
}

/* Wiki画像スタイル */
.wiki-figure {
  margin: 24px 0;
  text-align: center;
}

.wiki-image {
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  border-radius: 3px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.45);
  border: 2px solid var(--line-light);
  border-right-color: var(--line-dark);
  border-bottom-color: var(--line-dark);
  display: block;
  margin: 0 auto;
}

.wiki-figure figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.footer {
  border-top: 2px solid var(--line-dark);
  box-shadow: inset 0 1px 0 var(--line-light);
  color: var(--muted);
  text-align: center;
  padding: 16px 12px 26px;
}

.footer__top {
  margin-left: 12px;
  white-space: nowrap;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 20px 14px 28px;
    gap: 16px;
  }

  .sidebar {
    position: static;
    top: auto;
    max-height: none;
  }

  .sidebar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero__content {
    padding: 28px 14px 24px;
    gap: 18px;
  }

  .hero__actions {
    flex-direction: column;
  }

  input[type="search"] {
    min-width: 0;
  }

  .hero__actions button {
    width: 100%;
  }

  .quick-guide,
  .timeline,
  .markdown-body,
  .sidebar {
    padding: 14px;
    border-radius: 4px;
  }

  .timeline span {
    min-width: 84px;
  }

  .back-to-toc {
    justify-content: stretch;
  }

  .back-to-toc__link {
    width: 100%;
  }
}
