:root {
  color-scheme: dark;
  --background: #08111d;
  --sidebar: #0c1726;
  --surface: #101e30;
  --surface-soft: #132338;
  --border: #243850;
  --border-soft: rgba(139, 169, 199, 0.18);
  --accent: #31c6da;
  --accent-soft: rgba(49, 198, 218, 0.12);
  --warning: #d8a24a;
  --warning-soft: rgba(216, 162, 74, 0.09);
  --text: #f3f6fa;
  --muted: #b0bfd0;
  --subtle: #8092a6;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 280px;
  background: var(--background);
  color: var(--text);
  font: 17px/1.72 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, table { font: inherit; }

.device-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.device-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 34px 22px 26px;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  font-size: 16px;
}

.sidebar-kicker,
.article-index {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.sidebar-heading h1 {
  margin: 5px 0 7px;
  font-size: 1.8rem;
  line-height: 1.15;
}

.sidebar-heading p,
.sidebar-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.project-menu {
  display: grid;
  gap: 7px;
  margin-top: 32px;
}

.project-menu-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 11px;
  width: 100%;
  padding: 14px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}

.project-menu-item:hover { background: rgba(255, 255, 255, 0.035); }

.project-menu-item.is-active {
  border-color: rgba(49, 198, 218, 0.42);
  background: var(--accent-soft);
}

.menu-number {
  padding-top: 2px;
  color: var(--subtle);
  font-size: 0.76rem;
  font-weight: 800;
}

.project-menu-item.is-active .menu-number { color: var(--accent); }
.project-menu-item strong,
.project-menu-item small { display: block; }
.project-menu-item strong { font-size: 0.94rem; line-height: 1.35; }
.project-menu-item small { margin-top: 2px; color: var(--subtle); font-size: 0.76rem; line-height: 1.35; }

.sidebar-note {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  color: var(--subtle);
  font-size: 0.78rem;
}

.device-main {
  min-width: 0;
  width: min(960px, calc(100% - 64px));
  margin: 0 auto;
  padding: 48px 0 76px;
}

.project-panel { min-width: 0; animation: content-in .24s ease both; }
.project-panel[hidden] { display: none; }

.guide-loading,
.guide-error {
  margin: 0;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
}

.guide-error {
  border-color: rgba(216, 162, 74, 0.48);
  color: var(--text);
}

@keyframes content-in {
  from { opacity: 0; transform: translateY(6px); }
}

.article-header {
  max-width: 820px;
  margin-bottom: 32px;
}

.article-index { margin: 0 0 6px; }

.article-header h2 {
  margin: 0 0 13px;
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.article-header > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.board-figure,
.tutorial-figure,
.wide-photo,
.component-figure,
.photo-pair figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #070d16;
}

.board-figure img,
.tutorial-figure img,
.wide-photo img,
.component-figure img,
.photo-pair img {
  display: block;
  width: 100%;
}

.board-interactive-stage { position: relative; }
.board-figure img { max-height: 690px; object-fit: contain; }
.board-hotspots { position: absolute; inset: 0; }
.board-hotspot {
  position: absolute;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.board-hotspot:hover,
.board-hotspot:focus-visible {
  border-color: var(--accent);
  background: rgba(49, 198, 218, .1);
  outline: none;
  box-shadow: 0 0 0 3px rgba(49, 198, 218, .18);
}
.board-info-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 19px 21px;
  border-top: 1px solid var(--border);
  background: #0d1928;
}
.board-info-panel[hidden] { display: none; }
.board-info-panel strong { display: block; margin-bottom: 3px; color: var(--accent); font-size: 1.08rem; }
.board-info-panel p { margin: 0; color: var(--muted); font-size: 1em; }
.board-info-panel button {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.board-info-panel button:hover { border-color: var(--accent); color: var(--text); }
.tutorial-figure img { aspect-ratio: 16 / 9; object-fit: cover; }
.wide-photo img { max-height: 650px; object-fit: contain; background: #0b1522; }

figcaption {
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
  color: var(--subtle);
  font-size: 0.88rem;
}

.prose-block,
.recommendation-block,
.intro-media,
.photo-pair,
.tutorial-figure,
.wide-photo {
  margin-top: 28px;
}

.prose-block {
  min-width: 0;
  padding-top: 2px;
}

.prose-block + .prose-block {
  padding-top: 27px;
  border-top: 1px solid var(--border-soft);
}

.prose-block h3,
.intro-copy h3,
.recommendation-block h3 {
  margin: 0 0 8px;
  font-size: 1.28rem;
  line-height: 1.3;
}

.prose-block h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.prose-block p,
.intro-copy p,
.recommendation-block p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 1.04em;
}

.simple-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
  margin-top: 23px;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
}

.component-list {
  margin: 17px 0 0;
}

.component-list > div {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
}

.component-list dt { font-weight: 700; }
.component-list dd { margin: 0; color: var(--muted); }
.component-list dd { font-size: 1.04em; }

.intro-media {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: center;
}

.component-figure img {
  height: 230px;
  padding: 24px;
  object-fit: contain;
  background: #f5f5f3;
}

.recommendation-block {
  padding: 20px 22px;
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
}

.table-wrap {
  max-width: 100%;
  margin-top: 19px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  min-width: 530px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: #cce9ee;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td { color: var(--muted); font-size: 1em; }
tbody tr:last-child td { border-bottom: 0; }

code {
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: var(--accent-soft);
  color: #9be8f1;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
}

.bus-choice,
.caution-text {
  margin-top: 16px !important;
  padding: 14px 16px;
  border-left: 2px solid var(--accent);
  background: rgba(49, 198, 218, 0.055);
  font-size: 1em;
}

.caution-text {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.procedure-block ol {
  margin: 14px 0 0;
  padding-left: 1.4rem;
}

.procedure-block li {
  margin-bottom: 9px;
  padding-left: 5px;
  color: var(--muted);
  font-size: 1.04em;
}

.photo-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.photo-pair img {
  height: 420px;
  object-fit: cover;
}

.compact-table { max-width: 760px; }

@media (max-width: 860px) {
  .device-layout { grid-template-columns: 1fr; }
  .device-sidebar {
    position: static;
    min-height: 0;
    padding: 24px 20px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .project-menu { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 20px; }
  .project-menu-item { grid-template-columns: 1fr; gap: 3px; }
  .sidebar-note { display: none; }
  .device-main { width: min(100% - 36px, 960px); padding-top: 34px; }
}

@media (max-width: 620px) {
  .device-sidebar { padding-inline: 14px; }
  .project-menu { grid-template-columns: 1fr; }
  .project-menu-item { grid-template-columns: 34px 1fr; gap: 10px; }
  .device-main { width: min(100% - 24px, 960px); padding-top: 28px; }
  .article-header h2 { font-size: 2rem; }
  .intro-media,
  .simple-columns,
  .photo-pair { grid-template-columns: 1fr; }
  .component-list > div { grid-template-columns: 1fr; gap: 3px; }
  .component-figure img { height: 210px; }
  .photo-pair img { height: auto; max-height: 470px; object-fit: contain; }
  .tutorial-figure img { aspect-ratio: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
