:root {
  color-scheme: light dark;
  --text: #1f2328;
  --muted: #5f6670;
  --border: #d8dee4;
  --soft-bg: #f6f8fa;
  --heading-accent: #7aa2f7;
  --note-bg: #f0f8f3;
  --note-border: #38a169;
  --warning-bg: #fff8e6;
  --warning-border: #d97706;
  --link: #0969da;
  --page-bg: #ffffff;
}

html {
  scroll-behavior: smooth;
  color-scheme: light dark;
  background: var(--page-bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6edf3;
    --muted: #9aa4b2;
    --border: #30363d;
    --soft-bg: #161b22;
    --heading-accent: #5b8def;
    --note-bg: #102018;
    --note-border: #5fbf7a;
    --warning-bg: #2a2112;
    --warning-border: #d29922;
    --link: #58a6ff;
    --page-bg: #0d1117;
  }
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 32px 64px;
}

h1,
h2,
h3,
h4 {
  scroll-margin-top: 84px;
  line-height: 1.35;
  margin: 1.8em 0 0.65em;
}

h1 {
  margin-top: 0;
  margin-bottom: 1.1em;
  padding-bottom: 0.5em;
  border-bottom: 2px solid var(--border);
  font-size: 2.15rem;
  font-weight: 750;
}

h2 {
  margin-top: 3em;
  margin-bottom: 0.8em;
  padding: 0.25em 0 0.45em;
  border-bottom: 2px solid var(--border);
  font-size: 1.65rem;
  font-weight: 750;
}

h3 {
  margin-top: 2em;
  margin-bottom: 0.6em;
  padding-left: 0.65em;
  border-left: 4px solid var(--heading-accent);
  font-size: 1.28rem;
  font-weight: 700;
}

h4 {
  margin-top: 1.65em;
  margin-bottom: 0.5em;
  font-size: 1.05rem;
  font-weight: 700;
}

p {
  margin: 0.75em 0;
}

ul,
ol {
  margin: 0.75em 0 1em;
  padding-left: 1.6em;
}

li + li {
  margin-top: 0.25em;
}

a {
  color: var(--link);
}

.sticky-doc-nav {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 10;
  color: var(--text);
  background: var(--page-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(31, 35, 40, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
  transition: opacity 160ms ease, transform 160ms ease;
}

.sticky-doc-nav.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sticky-doc-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  min-height: 48px;
  margin: 0 auto;
  padding: 7px 32px;
  gap: 18px;
}

.sticky-doc-title {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.sticky-doc-select-label {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.sticky-doc-select-text {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.sticky-doc-select {
  width: auto;
  min-width: 220px;
  max-width: min(56vw, 420px);
  padding: 5px 8px;
  color: var(--text);
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
}

.toc {
  margin: 1.4em 0 2.2em;
  padding: 1em 1.2em;
  background: var(--soft-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.toc h2 {
  margin: 0 0 0.55em;
  padding: 0;
  border: 0;
  font-size: 1.2rem;
}

.toc ul {
  margin: 0;
}

.toc ul ul {
  margin-top: 0.2em;
}

.image-figure {
  margin: 14px 0 22px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.image-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
}

.image-figure figcaption {
  max-width: 100%;
  margin-top: 0.35em;
  color: var(--muted);
  font-size: 0.85em;
  line-height: 1.35;
  text-align: center;
}

blockquote {
  margin: 1em 0;
  padding: 0.85em 1em;
  color: var(--text);
  background: var(--note-bg);
  border-left: 4px solid var(--note-border);
  border-radius: 0 6px 6px 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

blockquote.admonition-warning,
blockquote.admonition-important {
  background: var(--warning-bg);
  border-left-color: var(--warning-border);
}

blockquote p:first-child {
  margin-top: 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

code {
  padding: 0.12em 0.32em;
  overflow-wrap: anywhere;
  background: var(--soft-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

pre {
  margin: 1em 0;
  padding: 1em;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--soft-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  break-inside: avoid;
  page-break-inside: avoid;
}

pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.9em;
}

table {
  width: 100%;
  margin: 1em 0 1.4em;
  border-spacing: 0;
  border-collapse: collapse;
  font-size: 0.94rem;
}

thead {
  display: table-header-group;
}

tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

th,
td {
  padding: 0.55em 0.65em;
  overflow-wrap: anywhere;
  vertical-align: top;
  border: 1px solid var(--border);
}

th {
  background: var(--soft-bg);
  font-weight: 700;
  text-align: left;
}

.align-right {
  text-align: right;
}

.align-center {
  text-align: center;
}

hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.doc-footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.doc-footer p {
  margin: 0.35em 0;
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  main {
    padding: 24px 18px 48px;
  }

  .sticky-doc-nav-inner {
    align-items: flex-start;
    flex-direction: column;
    min-height: 54px;
    padding: 7px 18px;
    gap: 5px;
  }

  .sticky-doc-select {
    width: calc(100vw - 36px);
    min-width: 0;
    max-width: calc(100vw - 36px);
  }
}

@page guide-ja {
  size: A4 portrait;
  margin: 17mm 16mm 18mm;

  @top-left {
    content: "INT DCP Baker v1.0 ユーザーガイド";
    color: #5f6670;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
    font-size: 8.5pt;
  }

  @bottom-center {
    content: counter(page) " / " counter(pages);
    color: #5f6670;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
    font-size: 8pt;
  }
}

@page guide-en {
  size: A4 portrait;
  margin: 17mm 16mm 18mm;

  @top-left {
    content: "INT DCP Baker v1.0 User Guide";
    color: #5f6670;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
    font-size: 8.5pt;
  }

  @bottom-center {
    content: counter(page) " / " counter(pages);
    color: #5f6670;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
    font-size: 8pt;
  }
}

@media print {
  :root {
    --text: #1f2328;
    --muted: #5f6670;
    --border: #c8cdd3;
    --soft-bg: #f6f8fa;
    --heading-accent: #5b8def;
    --note-bg: #f0f8f3;
    --note-border: #38a169;
    --warning-bg: #fff8e6;
    --warning-border: #d97706;
    --link: #0969da;
    --page-bg: #ffffff;
  }

  html,
  body {
    color-scheme: light only;
    background: #ffffff !important;
  }

  body {
    font-size: 10.5pt;
    line-height: 1.55;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html:lang(ja) body {
    page: guide-ja;
  }

  html:lang(en) body {
    page: guide-en;
  }

  main {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .sticky-doc-nav {
    display: none;
  }

  h1 {
    font-size: 22pt;
  }

  h2 {
    font-size: 17pt;
    margin-top: 0;
    break-before: page;
    page-break-before: always;
  }

  .toc h2 {
    font-size: 13pt;
    break-before: auto;
    page-break-before: auto;
  }

  h2,
  h3,
  h4 {
    break-after: avoid;
    page-break-after: avoid;
  }

  h3 {
    font-size: 13pt;
  }

  h4[id="5-5-3-dcp素材と既存イメージの内容が異なる場合"],
  h4[id="5-5-3-if-the-dcp-source-and-existing-image-do-not-match"] {
    break-before: page;
    page-break-before: always;
  }

  h3[id="5-6-confirm-that-prep-is-complete"] {
    break-before: page;
    page-break-before: always;
  }

  h4 {
    font-size: 11pt;
  }

  a {
    color: #0969da;
    text-decoration: none;
  }

  .image-figure {
    max-width: 100% !important;
  }

  .image-figure.screen-large {
    width: 158mm !important;
  }

  .image-figure.screen-medium {
    width: 132mm !important;
  }

  .image-figure.screen-dialog {
    width: 104mm !important;
  }

  .image-figure.screen-compact {
    width: 52mm !important;
  }

  .image-figure.screen-medium-compact {
    width: 66mm !important;
  }

  .image-figure:has(img[src$="/ja_06_02_bake_authorization.png"]),
  .image-figure:has(img[src$="/en_06_02_bake_authorization.png"]) {
    float: left;
    width: 80mm !important;
    margin-right: 6mm;
  }

  .image-figure:has(img[src$="/ja_06_02b_bake_authorization.png"]),
  .image-figure:has(img[src$="/en_06_02b_bake_authorization.png"]) {
    float: right;
    width: 80mm !important;
    margin-left: 6mm;
  }

  h3[id="6-2-メディアへの書き込み"],
  h3[id="6-2-writing-to-the-media"] {
    clear: both;
  }

  .image-figure:has(img[src$="/ja_06_04_readback_progress.png"]) {
    break-before: page;
    page-break-before: always;
  }

  .image-figure:has(img[src$="/ja_09_01_settings_image_size.png"]),
  .image-figure:has(img[src$="/ja_09_02_settings_filesystem.png"]),
  .image-figure:has(img[src$="/en_09_01_settings_image_size.png"]),
  .image-figure:has(img[src$="/en_09_02_settings_filesystem.png"]) {
    width: 145mm !important;
  }

  .image-figure img {
    max-height: 218mm;
    object-fit: contain;
  }

  table {
    font-size: 8.6pt;
  }

  .toc,
  blockquote,
  ul,
  ol,
  pre,
  figure {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .doc-footer {
    display: none;
  }
}
