:root {
  color-scheme: dark;
  --bg: #1a1a1a;
  --surface: #252525;
  --surface2: #202020;
  --border: #3a3a3a;
  --accent: #c8a84b;
  --text: #e0e0e0;
  --muted: #aaa;
  --active: #2a2a1a;
  --guide-font-scale: 1.4;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: auto;
  scroll-padding-top: 16px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Yu Gothic",
    "Yu Gothic UI",
    Meiryo,
    sans-serif;
  font-size: calc(14px * var(--guide-font-scale));
  line-height: 1.75;
}
body.viewer-open {
  overflow: hidden;
}
a {
  color: inherit;
}
.page-heading {
  max-width: 1400px;
  margin: auto;
  padding: 22px 14px 14px;
}
.heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.page-heading h1 {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--accent);
  font-size: calc(20px * var(--guide-font-scale));
}
.page-heading-icon,
.app-open-button img {
  flex: 0 0 auto;
  width: 1.5em;
  height: 1.5em;
}
.xivca-wordmark {
  display: block;
  width: auto;
  height: 64px;
  flex: 0 0 auto;
}
.guide-brand {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.25;
}
.app-formal-name {
  display: block;
  max-width: 100%;
  color: var(--text);
  font-size: calc(14px * var(--guide-font-scale));
  font-weight: 600;
  white-space: nowrap;
}
.guide-edition {
  display: flex;
  max-width: 100%;
  align-items: flex-end;
  gap: 4px;
  white-space: nowrap;
}
.guide-title {
  flex: 0 0 auto;
  color: var(--accent);
}
.guide-version {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 600;
}
.page-heading > p {
  margin: 8px 0;
  color: var(--muted);
}
button {
  font: inherit;
}
.license-button {
  flex: 0 0 auto;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--muted);
  padding: 3px 7px;
  font-size: calc(10px * var(--guide-font-scale));
  cursor: pointer;
}
.app-open-button {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--active);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.guide-layout {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 14px;
  max-width: 1400px;
  margin: auto;
  padding: 0 14px 60px;
}
.toc {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  align-self: start;
  max-height: var(--toc-available-height, calc(100vh - 170px));
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  overflow: hidden;
}
.toc > ol {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.toc.collapsed > ol {
  display: none;
}
.toc-toggle {
  display: flex;
  width: 100%;
  justify-content: space-between;
  padding: 10px 12px;
  border: 0;
  background: var(--surface2);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}
.toc ol {
  margin: 0;
  padding: 8px 5px 10px 34px;
}
.toc ol ol {
  padding: 2px 0 2px 28px;
}
.toc li {
  padding: 2px 0;
  color: var(--muted);
  white-space: normal;
}
.toc a {
  display: block;
  max-width: 100%;
  text-decoration: none;
}
.toc a:hover {
  color: var(--accent);
}
.post-list {
  min-width: 0;
}
.mobile-only {
  display: none;
}
.post {
  min-width: 0;
  margin: 0 0 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.post h2 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: calc(18px * var(--guide-font-scale));
}
.share-code-example code {
  overflow-wrap: anywhere;
  user-select: all;
}
.post h3 {
  margin: 18px 0 6px;
  color: #f0d77d;
  font-size: calc(15px * var(--guide-font-scale));
}
.post p {
  margin: 0 0 10px;
}
.post ul,
.instructions {
  margin: 8px 0 12px;
  padding-left: 1.6em;
}
.eyebrow,
.step {
  color: var(--muted);
  font-size: calc(11px * var(--guide-font-scale));
  font-weight: 700;
  letter-spacing: 0.08em;
}
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.feature-grid div {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: var(--surface2);
  border-left: 3px solid var(--accent);
}
.feature-grid span {
  color: var(--muted);
  font-size: calc(12px * var(--guide-font-scale));
}
.hint {
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--active);
  color: var(--muted);
}
.image-grid {
  min-width: 0;
  max-width: 100%;
  position: relative;
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.image-frame {
  position: relative;
  max-width: 100%;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
  overflow: hidden;
}
.image-frame img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}
.image-frame figcaption {
  padding: 7px 9px;
  color: var(--muted);
  font-size: calc(12px * var(--guide-font-scale));
}
.zoom-button {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: rgba(37, 37, 37, 0.92);
  color: var(--accent);
  font-size: calc(20px * var(--guide-font-scale));
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.zoom-icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.gallery-ready {
  display: block;
}
.gallery-viewport {
  overflow: hidden;
  touch-action: pan-y;
}
.gallery-viewport::-webkit-scrollbar {
  display: none;
}
.gallery-track {
  display: flex;
}
.gallery-track > .image-frame {
  flex: 0 0 100%;
}
.gallery-dots {
  position: static;
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 8px;
}
.gallery-dots .swiper-pagination-bullet {
  width: 10px;
  height: 10px;
  margin: 0 3.5px;
  border: 1px solid var(--accent);
  background: transparent;
  opacity: 1;
}
.gallery-dots .swiper-pagination-bullet-active {
  background: var(--accent);
}
.gallery-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.gallery-dot.active {
  background: var(--accent);
}
.gallery-arrow {
  position: absolute;
  top: calc(50% - 30px);
  z-index: 3;
  width: 42px;
  height: 60px;
  border: 1px solid rgba(200, 168, 75, 0.8);
  border-radius: 5px;
  background: rgba(26, 26, 26, 0.82);
  color: #f4d978;
  font-size: calc(38px * var(--guide-font-scale));
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    opacity 0.15s;
}
.gallery-arrow:hover,
.gallery-arrow:focus-visible {
  background: rgba(62, 53, 25, 0.96);
  color: #fff2bd;
}
.gallery-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}
.gallery-arrow.swiper-button-disabled {
  opacity: 0.25;
  cursor: default;
}
.gallery-arrow-previous {
  left: 7px;
}
.gallery-arrow-next {
  right: 7px;
}
.gallery-arrow:focus-visible,
.gallery-dot:focus-visible,
.image-viewer-close:focus-visible {
  outline: 2px solid #fff2bd;
  outline-offset: 2px;
}
footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: 4px;
  background: transparent;
  color: #888;
  text-align: center;
  font-size: calc(11px * var(--guide-font-scale));
}
.top-button {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 30;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
}
.top-button.visible {
  opacity: 1;
  pointer-events: auto;
}
.top-button {
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}
.top-button:hover {
  border-color: #fff2bd;
  background: var(--active);
  color: #fff2bd;
}
.top-button:focus-visible {
  outline: 2px solid #fff2bd;
  outline-offset: 2px;
}
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.8);
}
.image-viewer.open {
  display: flex;
}
.image-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.68);
  color: #fff;
  font-size: calc(22px * var(--guide-font-scale));
  line-height: 1;
  cursor: pointer;
}
.image-viewer-close:hover {
  border-color: #fff;
  background: rgba(60, 60, 60, 0.88);
}
.image-viewer-stage {
  flex: 1;
  overflow: auto;
  cursor: grab;
  touch-action: none;
}
.image-viewer-stage.dragging {
  cursor: grabbing;
}
.image-viewer-img {
  display: block;
  max-width: none;
  pointer-events: none;
}
#licenseOverlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.76);
}
#licenseOverlay.open {
  display: flex;
}
#licenseDialog {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: calc(100dvh - 32px);
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
#licenseDialog h2 {
  color: var(--accent);
  font-size: calc(14px * var(--guide-font-scale));
}
#licenseText {
  min-height: 0;
  overflow: auto;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: calc(12px * var(--guide-font-scale));
}
.license-close {
  display: block;
  margin: 14px auto 0;
  padding: 6px 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text);
}
@media (max-width: 840px) {
  body {
    font-size: calc(13px * var(--guide-font-scale));
  }
  .page-heading {
    padding: 14px 10px 10px;
  }
  .page-heading h1 {
    font-size: calc(16px * var(--guide-font-scale));
  }
  .guide-brand {
    gap: 1px;
  }
  .xivca-wordmark {
    height: 48px;
  }
  .app-formal-name {
    font-size: calc(10px * var(--guide-font-scale));
  }
  .guide-layout {
    display: block;
    padding: 0 10px 50px;
  }
  .toc {
    position: static;
    max-height: none;
    margin-bottom: 10px;
  }
  .toc > ol {
    overflow: visible;
  }
  .post {
    padding: 12px;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .image-grid {
    display: block;
  }
  .image-frame + .image-frame {
    margin-top: 10px;
  }
  .gallery-track > .image-frame + .image-frame {
    margin-top: 0;
  }
  .top-button {
    right: 10px;
    bottom: 12px;
  }
}
@media (max-width: 480px) {
  .xivca-wordmark {
    height: 38px;
  }
}
@media (max-width: 600px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: revert;
  }
}
