:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #18212f;
  --muted: #667085;
  --border: #e3e7ed;
  --accent: #1677ff;
  --accent-soft: #eaf3ff;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --header-height: 72px;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
html[lang="zh-CN"] body {
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  letter-spacing: .008em;
}
html[lang="ja"] body {
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, "Segoe UI", sans-serif;
  letter-spacing: .012em;
}
body.dark {
  color-scheme: dark;
  --bg: #0f141d;
  --surface: #171e29;
  --surface-soft: #1d2633;
  --text: #ecf2f8;
  --muted: #aab6c5;
  --border: #2c3746;
  --accent: #61a7ff;
  --accent-soft: #183451;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
}

button, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 28px;
  border-bottom: 1px solid #202936;
  background: #050505;
  color: #fff;
}
.brand { display: inline-flex; min-width: 0; align-items: flex-end; gap: 14px; color: #fff; text-decoration: none; }
.brand picture { display: flex; align-items: center; flex: 0 0 auto; }
.brand img { display: block; width: 156px; height: auto; }
.brand span { color: #9aa5b5; font-size: .76rem; font-weight: 500; line-height: 1.15; letter-spacing: .01em; white-space: nowrap; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.language-menu { position: relative; display: inline-flex; }
.language-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #334155;
  border-radius: 10px;
  background: #182230;
  color: #fff;
  padding: 0;
  font-size: 1.08rem;
  cursor: pointer;
}
.language-button:hover, .language-button[aria-expanded="true"] { background: #263449; }
.language-button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.language-options {
  position: absolute;
  z-index: 70;
  top: calc(100% + 10px);
  right: 0;
  width: max-content;
  min-width: 190px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(420px, calc(100vh - var(--header-height) - 24px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #334155;
  border-radius: 12px;
  background: #111827;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .36);
}
.language-options[hidden] { display: none; }
.language-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e5edf7;
  padding: 9px 11px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.language-option:hover, .language-option:focus-visible { background: #263449; outline: none; }
.language-option[aria-selected="true"] { color: #fff; background: #1d4f86; font-weight: 700; }
.language-option[aria-selected="true"]::after { content: "✓"; }
.theme-button, .menu-button {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #fff;
  padding: 7px 11px;
  font-weight: 650;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.theme-button:hover, .menu-button:hover { background: #182230; }
.theme-button:active, .menu-button:active { transform: translateY(1px); }
.theme-button { display: inline-flex; align-items: center; gap: 7px; margin-left: 2px; border-left: 1px solid #334155; border-radius: 0 9px 9px 0; }
.menu-button { display: none; align-items: center; gap: 7px; }

.page-shell { min-height: 100vh; padding-top: var(--header-height); }
.sidebar {
  position: fixed;
  inset: var(--header-height) auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  background: var(--surface-soft);
}
.sidebar-inner { height: 100%; overflow-y: auto; padding: 30px 22px 40px; }
.sidebar h2 { margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); font-size: 1rem; font-weight: 720; letter-spacing: .025em; }
.sidebar ul { margin: 0; padding: 0; list-style: none; }
.sidebar li { margin: 0 0 4px; }
.sidebar a {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: .84rem;
  font-weight: 500;
  line-height: 1.4;
}
.sidebar a:hover, .sidebar a.active { color: var(--accent); background: var(--accent-soft); }
.sidebar a.active { font-weight: 680; }
.sidebar .submenu { margin: 2px 0 10px 12px; padding-left: 10px; border-left: 1px solid var(--border); }
.sidebar .submenu a { font-size: .77rem; }
.sidebar-backdrop { display: none; }

.document {
  width: min(1080px, calc(100% - var(--sidebar-width) - 88px));
  min-height: 100vh;
  margin-left: calc(var(--sidebar-width) + 44px);
  padding: 34px 0 84px;
}
.document > h1 { margin: 0; font-size: clamp(2rem, 3vw, 2.7rem); font-weight: 760; line-height: 1.16; letter-spacing: -.026em; text-wrap: balance; }
.subtitle { margin: 8px 0 30px; padding-bottom: 22px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 1.02rem; font-weight: 450; letter-spacing: .005em; }
section { margin: 0 0 42px; scroll-margin-top: 80px; }
h2 { margin: 38px 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 1.5rem; font-weight: 760; line-height: 1.35; letter-spacing: -.012em; text-wrap: balance; }
h3 { margin: 25px 0 12px; font-size: 1.14rem; font-weight: 720; line-height: 1.45; letter-spacing: -.006em; scroll-margin-top: 85px; text-wrap: balance; }
section > h2 + h3 { margin-top: 0; }
h3.unnumbered-heading { display: inline-flex; align-items: center; gap: 10px; }
p { margin: 0 0 14px; text-wrap: pretty; }
li { margin: 6px 0; text-wrap: pretty; }
strong { font-weight: 700; }
code { padding: 2px 6px; border-radius: 5px; background: var(--surface-soft); color: #d14c72; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; font-weight: 600; }
.figure-ref { display: inline-block; margin-left: .45em; color: var(--muted); font-size: .78em; font-weight: 500; white-space: nowrap; }
.driver-download { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.driver-download:hover { text-decoration-thickness: 2px; }
.driver-download:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; border-radius: 6px; }

.document table { width: 100%; margin: 18px 0 24px; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; font-size: .92rem; }
.document th, .document td { padding: 13px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); vertical-align: top; }
.document th:last-child, .document td:last-child { border-right: 0; }
.document tbody tr:last-child td { border-bottom: 0; }
.document th { background: var(--surface-soft); font-weight: 700; text-align: left; }
.document td.flow-next { position: relative; padding-right: 21px; }
.document td.flow-next::after {
  content: "➜";
  position: absolute;
  z-index: 2;
  top: 50%;
  right: -9px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: 0 3px 10px rgba(15, 23, 42, .18);
  pointer-events: none;
}

.image-wrapper, .image-group-container { margin: 24px 0 30px; }
.image-wrapper { display: grid; justify-items: start; }
.image-group-container { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.image-container {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0d1420;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
  cursor: zoom-in;
}
.image-container img { display: block; width: 100%; height: auto; }
.img-rule-w600 { max-width: 690px; margin-inline: 0; }
.img-rule-w300 .image-group-item { max-width: 440px; }
.img-rule-h450 img { max-height: 450px; object-fit: contain; }
.img-caption { margin-top: 7px; color: var(--muted); font-size: .82rem; font-weight: 500; line-height: 1.5; text-align: center; }

.example-box, .note-box { margin: 18px 0; padding: 18px 20px; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface-soft); }
.example-title { margin-bottom: 8px; font-weight: 750; }
.note-box > p:first-child strong { display: inline-block; font-size: 1.01rem; line-height: 1.55; letter-spacing: -.004em; }
.note-box p:last-child { margin-bottom: 0; }
.faq-item { margin: 0 20px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; overflow: visible; }
.faq-question { position: relative; padding: 20px 46px 20px 0; font-size: 1.01rem; font-weight: 720; line-height: 1.55; cursor: pointer; list-style: none; }
#faq > h2 + .faq-item > .faq-question { padding-top: 0; }
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after { content: ">"; position: absolute; top: 50%; right: 0; transform: translateY(-50%) rotate(0deg); transform-origin: center; color: var(--text); font-size: 1.45rem; font-weight: 500; transition: transform .18s ease; }
.faq-item[open] > .faq-question { padding-bottom: 8px; }
.faq-item[open] > .faq-question::after { transform: translateY(-50%) rotate(90deg); }
.faq-question:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 3px; border-radius: 4px; }
.faq-answer { padding: 0 46px 24px 0; border: 0; color: var(--muted); font-size: .92rem; font-weight: 400; line-height: 1.75; }
.faq-answer > :first-child { margin-top: 0; }
.faq-answer > :last-child { margin-bottom: 0; }
.faq-steps { margin: 0 0 2px; padding-left: 1.55rem; }
.faq-jump-link { color: inherit; font-weight: inherit; text-decoration: underline; text-underline-offset: 3px; }
.faq-jump-link:hover, .faq-jump-link:focus-visible { color: var(--accent); }
#faq-custom-binding { scroll-margin-top: calc(var(--header-height) + 24px); }
.tutorial-video { width: 100%; margin: 16px 0 2px; }
.tutorial-video video { display: block; width: 100%; max-height: 70vh; border-radius: 12px; background: #05070a; box-shadow: 0 8px 26px rgba(15, 23, 42, .16); }
.video-caption { margin-top: 8px; color: var(--muted); font-size: .82rem; font-weight: 500; line-height: 1.5; text-align: center; }

.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.game-card { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: 0 5px 18px rgba(15, 23, 42, .07); transition: transform .2s ease, box-shadow .2s ease; }
.game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.game-card img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: #0c1320; }
.game-cover-pair { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); aspect-ratio: 4 / 5; overflow: hidden; background: #0c1320; }
.game-cover-pair img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; object-position: center; }
.game-cover-pair img:first-child { object-position: center 68%; }
.game-cover-pair img:last-child { object-position: center 24%; }
.game-title { padding: 10px 8px 12px; font-size: .88rem; font-weight: 680; text-align: center; line-height: 1.35; }
.section-note { margin-top: 1rem; color: var(--muted); font-size: .9rem; font-weight: 500; line-height: 1.65; }

.lightbox { width: min(1120px, 92vw); max-width: none; padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 30px 90px rgba(0, 0, 0, .42); }
.lightbox::backdrop { background: rgba(3, 8, 16, .82); backdrop-filter: blur(6px); }
.lightbox img { display: block; max-width: 100%; max-height: 82vh; margin: auto; object-fit: contain; }
.lightbox p { margin: 0; padding: 12px 20px 16px; color: var(--muted); text-align: center; }
.lightbox-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(10, 15, 24, .76); color: white; font-size: 26px; line-height: 1; cursor: pointer; }

footer { margin-top: 4rem !important; padding: 26px 0 !important; border-top: 1px solid var(--border) !important; color: var(--muted) !important; }
.footer-link { color: var(--text); font-weight: 650; text-decoration: none; }
.footer-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 1080px) {
  .site-header { padding-inline: 18px; }
  .menu-button { display: inline-flex; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .sidebar-backdrop { display: block; position: fixed; inset: var(--header-height) 0 0; z-index: 20; background: rgba(2, 8, 18, .45); }
  .document { width: min(920px, calc(100% - 40px)); margin: 0 auto; padding-top: 32px; }
}

@media (max-width: 720px) {
  :root { --header-height: 64px; }
  body { font-size: 15px; }
  .site-header { gap: 10px; padding-inline: 12px; }
  .brand { align-items: center; gap: 9px; }
  .brand img { width: 38px; height: 38px; }
  .brand span { display: block; font-size: .68rem; }
  .toolbar { gap: 3px; }
  .language-button { width: 36px; height: 36px; }
  .language-options { right: -44px; min-width: 180px; }
  .theme-button, .menu-button { padding: 7px 9px; white-space: nowrap; }
  .theme-button span:last-child, .menu-button span:last-child { display: none; }
  .document { width: min(100% - 28px, 680px); padding-top: 26px; }
  .faq-item { margin-inline: 8px; }
  .faq-question { padding-right: 36px; }
  .faq-answer { padding-right: 36px; }
  .image-group-container { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .document table { display: block; overflow-x: auto; white-space: normal; }
  .document td.flow-next { padding-right: 18px; }
  .document td.flow-next::after { right: -7.5px; width: 15px; height: 15px; border-width: 1px; font-size: 10.5px; }
}

@media (max-width: 420px) {
  .site-header { gap: 6px; padding-inline: 9px; }
  .brand { gap: 7px; }
  .brand img { width: 34px; height: 34px; }
  .brand span { font-size: .6rem; }
  .theme-button, .menu-button { padding-inline: 7px; }
}

@media print {
  .site-header, .sidebar, .sidebar-backdrop { display: none !important; }
  body { background: white; }
  .page-shell { padding-top: 0; }
  .document { width: 100%; margin: 0; padding: 0; }
  .document > h1 { padding-right: 0; }
  .game-card, .image-wrapper, .image-group-item, .note-box, .faq-item, .tutorial-video { break-inside: avoid; }
  .document td.flow-next::after { display: none; }
}
