/* ============================================================
   Dolce andante 公式攻略読本 — page-style sheet
   A4 portrait, mock-printed digital magazine layout
   ============================================================ */

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }

/* ----- Color & token system ----- */
:root {
  --paper:        #fbfaf6;   /* 紙の地色（オフホワイト） */
  --ink:          #2a2624;   /* 墨（本文） */
  --ink-soft:     #5b5450;   /* 墨・薄め */
  --rule:         #d6cfc2;   /* 罫線 */
  --ginkgo:       #d4a017;   /* 銀杏色（アクセント） */
  --ginkgo-pale:  #f5e6b3;
  --moss:         #2c5f3d;   /* 深緑（章番号など） */
  --rose:         #b85c6a;   /* バッドエンド帯 */
  --shadow:       0 6px 28px rgba(0, 0, 0, 0.45);

  --serif:        "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --sans:         "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
}

/* ----- Page geometry ----- */
@page {
  size: A4 portrait;
  margin: 0;
}

@media screen {
  body {
    background: #2a2624;
    padding: 36px 0;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
  }
  .book {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
  }
  .page {
    box-shadow: var(--shadow);
  }
}

@media print {
  body { background: #fff; padding: 0; }
  .book { display: block; }
  .page { box-shadow: none; }
}

/* ----- Page base ----- */
.page {
  width: 210mm;
  height: 297mm;
  padding: 18mm 16mm 20mm;
  background: var(--paper);
  position: relative;
  overflow: hidden;
  font-family: var(--serif);
  color: var(--ink);
  font-size: 10.5pt;
  line-height: 1.75;
  page-break-after: always;
  break-after: page;
}

/* page number (default) */
.page::after {
  content: counter(page);
  counter-increment: page;
  position: absolute;
  bottom: 8mm;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 8.5pt;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
}

/* running header — small label per chapter */
.page > .running {
  position: absolute;
  top: 8mm;
  left: 16mm; right: 16mm;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--sans);
  font-size: 8pt;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}
.page > .running .chapter { color: var(--moss); font-weight: 500; }

/* ============================================================
   Cover
   ============================================================ */
.page.cover {
  padding: 0;
  color: #fff;
  background: #1a1612;
}
.page.cover::after { display: none; }
.cover-art {
  position: absolute; inset: 0;
  background: url("../assets/cg/title.png") center/cover no-repeat;
  filter: saturate(0.85) brightness(0.55);
}
.cover-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
              rgba(0,0,0,0.10) 0%,
              rgba(0,0,0,0.55) 55%,
              rgba(0,0,0,0.85) 100%);
}
.cover-inner {
  position: relative;
  height: 100%;
  padding: 30mm 22mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.cover-band {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 9pt;
  letter-spacing: 0.4em;
  color: var(--ginkgo-pale);
  border-top: 1px solid rgba(245, 230, 179, 0.4);
  border-bottom: 1px solid rgba(245, 230, 179, 0.4);
  padding: 4mm 0;
  text-align: center;
}
.cover-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 56pt;
  letter-spacing: 0.05em;
  line-height: 1.05;
}
.cover-subtitle {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 13pt;
  letter-spacing: 0.18em;
  margin-top: 8mm;
  color: var(--ginkgo-pale);
}
.cover-tag {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 8.5pt;
  letter-spacing: 0.25em;
  color: rgba(255,255,255,0.75);
}
.cover-foot {
  font-family: var(--sans);
  font-size: 8pt;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.65);
  display: flex;
  justify-content: space-between;
}

/* ============================================================
   TOC
   ============================================================ */
.page.toc h1 {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 26pt;
  letter-spacing: 0.18em;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6mm;
  margin-bottom: 8mm;
}
.toc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12mm;
}
.toc-col h2 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11pt;
  letter-spacing: 0.3em;
  color: var(--moss);
  margin-bottom: 4mm;
  padding-left: 4mm;
  border-left: 3px solid var(--ginkgo);
}
.toc-col ol {
  list-style: none;
  margin-bottom: 8mm;
}
.toc-col li {
  display: flex;
  align-items: baseline;
  gap: 3mm;
  font-size: 10pt;
  padding: 1.4mm 0;
  border-bottom: 1px dotted var(--rule);
}
.toc-col li .ttl { flex: 0 0 auto; }
.toc-col li .dots { flex: 1; border-bottom: 1px dotted var(--rule); transform: translateY(-2px); }
.toc-col li .pg { font-family: var(--sans); font-size: 9pt; color: var(--ink-soft); flex: 0 0 auto; }
.toc-lead {
  margin-top: 6mm;
  padding: 5mm 6mm;
  background: var(--ginkgo-pale);
  font-family: var(--sans);
  font-size: 9pt;
  font-weight: 300;
  letter-spacing: 0.08em;
  line-height: 1.9;
  color: var(--ink);
}

/* ============================================================
   Common typographic blocks
   ============================================================ */
.section-mark {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 9pt;
  letter-spacing: 0.4em;
  color: var(--moss);
  margin-bottom: 2mm;
}
h1.kicker {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24pt;
  letter-spacing: 0.06em;
  line-height: 1.3;
  margin-bottom: 6mm;
  padding-bottom: 4mm;
  border-bottom: 1px solid var(--ink);
}
h2.sub {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13pt;
  letter-spacing: 0.18em;
  margin: 6mm 0 3mm;
  padding-left: 3mm;
  border-left: 4px solid var(--ginkgo);
}
h3.sm {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 10.5pt;
  letter-spacing: 0.15em;
  color: var(--moss);
  margin: 4mm 0 2mm;
}
p { margin-bottom: 3mm; }
.lead {
  font-family: var(--serif);
  font-size: 12pt;
  line-height: 1.95;
  color: var(--ink);
  margin-bottom: 6mm;
}
.note {
  font-family: var(--sans);
  font-size: 8.5pt;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}
.callout {
  background: #f3eee0;
  border-left: 3px solid var(--ginkgo);
  padding: 4mm 5mm;
  margin: 4mm 0;
  font-family: var(--sans);
  font-size: 9.5pt;
  line-height: 1.8;
}
.callout strong { color: var(--moss); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 9pt;
  margin: 3mm 0 5mm;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--rule);
  padding: 1.8mm 2mm;
  text-align: left;
  vertical-align: top;
}
table.data th {
  background: #efe7d2;
  color: var(--moss);
  font-weight: 500;
  letter-spacing: 0.1em;
  border-bottom: 1.5px solid var(--ginkgo);
  white-space: nowrap;
}
table.data tr:nth-child(even) td { background: #f8f3e6; }

/* ============================================================
   Character profile pages
   ============================================================ */
.profile {
  display: grid;
  grid-template-columns: 78mm 1fr;
  gap: 8mm;
  height: calc(100% - 18mm);
}
.profile-portrait {
  position: relative;
  border-radius: 2mm;
  overflow: hidden;
  background: linear-gradient(160deg, #efe7d2 0%, #fbfaf6 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.profile-portrait img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: bottom;
}
.profile-portrait .label {
  position: absolute;
  top: 4mm; left: 4mm;
  font-family: var(--sans);
  font-size: 8pt;
  letter-spacing: 0.3em;
  color: var(--moss);
  background: rgba(255,255,255,0.7);
  padding: 1mm 2.5mm;
  border-radius: 1mm;
}
.profile-body h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30pt;
  line-height: 1.1;
  color: var(--ink);
}
.profile-body .reading {
  font-family: var(--sans);
  font-size: 9pt;
  letter-spacing: 0.3em;
  color: var(--ginkgo);
  margin-top: 2mm;
  margin-bottom: 6mm;
}
.profile-stats {
  display: grid;
  grid-template-columns: 28mm 1fr;
  font-family: var(--sans);
  font-size: 9pt;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 5mm;
}
.profile-stats dt {
  background: #efe7d2;
  color: var(--moss);
  padding: 1.6mm 3mm;
  letter-spacing: 0.15em;
  border-bottom: 1px solid var(--rule);
  font-weight: 500;
}
.profile-stats dd {
  padding: 1.6mm 3mm;
  border-bottom: 1px solid var(--rule);
}
.profile-stats dt:last-of-type, .profile-stats dd:last-of-type { border-bottom: none; }

.keywords {
  display: flex;
  gap: 2mm;
  flex-wrap: wrap;
  margin: 3mm 0 5mm;
}
.keywords span {
  font-family: var(--sans);
  font-size: 8.5pt;
  letter-spacing: 0.15em;
  background: var(--moss);
  color: #f8f3e6;
  padding: 1.2mm 3mm;
  border-radius: 999px;
}

.expr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2mm;
  margin-top: 4mm;
}
.expr-grid figure {
  background: linear-gradient(160deg, #efe7d2 0%, #fbfaf6 100%);
  border-radius: 1.5mm;
  padding: 2mm 2mm 1.5mm;
  text-align: center;
}
.expr-grid img {
  width: 100%;
  height: 26mm;
  object-fit: contain;
  object-position: bottom;
}
.expr-grid figcaption {
  font-family: var(--sans);
  font-size: 7.5pt;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-top: 1mm;
}

/* sub-character "two-up" page */
.subchar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8mm;
  height: calc(100% - 22mm);
}
.subchar {
  display: grid;
  grid-template-rows: 95mm auto 1fr;
  border-top: 2px solid var(--ink);
  padding-top: 4mm;
}
.subchar .pic {
  position: relative;
  background: linear-gradient(160deg, #efe7d2 0%, #fbfaf6 100%);
  border-radius: 2mm;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.subchar .pic img {
  height: 100%;
  object-fit: contain;
  object-position: bottom;
}
.subchar h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16pt;
  margin: 3mm 0 1mm;
}
.subchar .role {
  font-family: var(--sans);
  font-size: 8.5pt;
  letter-spacing: 0.18em;
  color: var(--ginkgo);
  margin-bottom: 2.5mm;
}
.subchar p {
  font-size: 9pt;
  line-height: 1.85;
  color: var(--ink);
  margin-bottom: 1mm;
}

/* ============================================================
   Route attack pages
   ============================================================ */
.route-cover {
  padding: 0;
  position: relative;
  background: #1a1612;
  color: #fff;
}
.route-cover::after { color: #f5e6b3; }
.route-cover .bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  filter: saturate(0.85) brightness(0.55);
}
.route-cover .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
      rgba(0,0,0,0.05), rgba(0,0,0,0.65) 70%, rgba(0,0,0,0.92));
}
.route-cover .portrait {
  position: absolute;
  right: 14mm;
  bottom: 0;
  height: 220mm;
  pointer-events: none;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,0.6));
}
.route-cover .meta {
  position: relative;
  padding: 28mm 18mm 30mm;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.route-cover .ribbon {
  font-family: var(--sans);
  font-size: 9pt;
  letter-spacing: 0.4em;
  color: var(--ginkgo);
  border-top: 1px solid rgba(212, 160, 23, 0.7);
  border-bottom: 1px solid rgba(212, 160, 23, 0.7);
  padding: 3mm 0;
  width: 80mm;
  text-align: center;
}
.route-cover h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 48pt;
  letter-spacing: 0.05em;
  line-height: 1.1;
  margin-top: 8mm;
}
.route-cover .ja {
  font-family: var(--serif);
  font-size: 14pt;
  letter-spacing: 0.18em;
  margin-top: 4mm;
  color: var(--ginkgo-pale);
}
.route-cover .lede {
  font-family: var(--serif);
  font-size: 11pt;
  line-height: 2;
  color: rgba(255,255,255,0.86);
  margin-top: 8mm;
  max-width: 105mm;
}
.route-cover .info {
  display: flex;
  gap: 6mm;
  font-family: var(--sans);
  font-size: 9pt;
  letter-spacing: 0.18em;
  color: var(--ginkgo-pale);
}
.route-cover .info span strong {
  display: block;
  font-weight: 300;
  font-size: 7.5pt;
  letter-spacing: 0.3em;
  color: rgba(245, 230, 179, 0.65);
  margin-bottom: 1mm;
}

.route-flow {
  list-style: none;
  margin: 4mm 0 6mm;
  border-left: 2px solid var(--ginkgo);
  padding-left: 6mm;
}
.route-flow li {
  position: relative;
  padding: 2mm 0 5mm;
}
.route-flow li::before {
  content: "";
  position: absolute;
  left: -7.6mm;
  top: 4mm;
  width: 3mm; height: 3mm;
  background: var(--ginkgo);
  border-radius: 999px;
}
.route-flow li .when {
  font-family: var(--sans);
  font-size: 8.5pt;
  letter-spacing: 0.2em;
  color: var(--moss);
  display: block;
  margin-bottom: 1mm;
}
.route-flow li h4 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 11.5pt;
  margin-bottom: 1.5mm;
}
.route-flow li p {
  font-size: 9.5pt;
  line-height: 1.85;
  margin-bottom: 0;
}

.dialog {
  font-family: var(--serif);
  font-size: 10pt;
  line-height: 1.95;
  background: #f3eee0;
  padding: 4mm 5mm;
  margin: 3mm 0;
  border-left: 3px solid var(--moss);
}
.dialog .who {
  font-family: var(--sans);
  font-size: 8.5pt;
  font-weight: 500;
  color: var(--moss);
  letter-spacing: 0.15em;
  display: inline-block;
  min-width: 14mm;
}
.dialog p { margin-bottom: 1mm; }
.dialog em {
  display: block;
  font-style: normal;
  font-family: var(--serif);
  color: var(--ginkgo);
  font-size: 9pt;
  margin-top: 2mm;
  text-align: right;
  letter-spacing: 0.1em;
}

.monologue {
  background: linear-gradient(180deg, #1a1612 0%, #2a2624 100%);
  color: #f5e6b3;
  padding: 6mm 8mm;
  font-family: var(--serif);
  font-size: 12pt;
  line-height: 2;
  letter-spacing: 0.05em;
  margin: 5mm 0;
  border-radius: 1mm;
  position: relative;
}
.monologue::before {
  content: "ENDING MONOLOGUE";
  position: absolute;
  top: 2mm; left: 8mm;
  font-family: var(--sans);
  font-size: 7pt;
  letter-spacing: 0.4em;
  color: var(--ginkgo);
}
.monologue p { padding-top: 4mm; margin-bottom: 0; }

/* ============================================================
   Bad ending pages
   ============================================================ */
.spoiler-band {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: var(--rose);
  color: #fff;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 8pt;
  letter-spacing: 0.5em;
  text-align: center;
  padding: 2mm 0;
}
.page.bad {
  padding-top: 22mm;
  background: #f6efe9;
}
.bad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6mm 8mm;
}
.bad-card {
  border: 1px solid var(--rose);
  background: #fbf3ef;
  padding: 5mm;
  position: relative;
}
.bad-card .id {
  font-family: var(--sans);
  font-size: 8pt;
  letter-spacing: 0.25em;
  color: var(--rose);
  margin-bottom: 1mm;
}
.bad-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 13pt;
  margin-bottom: 3mm;
}
.bad-card h4 {
  font-family: var(--sans);
  font-size: 8.5pt;
  letter-spacing: 0.18em;
  color: var(--moss);
  margin: 3mm 0 1mm;
}
.bad-card p {
  font-size: 9pt;
  line-height: 1.8;
  margin-bottom: 0;
}

/* ============================================================
   Flowchart (chapter 3)
   ============================================================ */
.flow-chart {
  margin-top: 4mm;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3mm;
}
.flow-row {
  display: grid;
  grid-template-columns: 28mm 1fr;
  gap: 4mm;
  align-items: stretch;
}
.flow-row .stage {
  background: var(--moss);
  color: #f8f3e6;
  font-family: var(--sans);
  font-size: 9pt;
  letter-spacing: 0.18em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2mm;
  border-radius: 1mm;
}
.flow-row .body {
  background: #f8f3e6;
  border-left: 3px solid var(--ginkgo);
  padding: 3mm 4mm;
  font-family: var(--sans);
  font-size: 9pt;
  line-height: 1.8;
}
.flow-row .body strong { color: var(--moss); }

/* ============================================================
   Endnote / colophon
   ============================================================ */
.colophon {
  margin-top: 8mm;
  border-top: 2px solid var(--ink);
  padding-top: 6mm;
  font-family: var(--sans);
  font-size: 9pt;
  line-height: 2;
  display: grid;
  grid-template-columns: 32mm 1fr;
  row-gap: 2mm;
}
.colophon dt { color: var(--moss); letter-spacing: 0.18em; }
.colophon dd { color: var(--ink); }

/* small SPOILER tag inline */
.tag-spoiler {
  display: inline-block;
  background: var(--rose);
  color: #fff;
  font-family: var(--sans);
  font-size: 7pt;
  letter-spacing: 0.25em;
  padding: 0.5mm 2mm;
  margin-left: 2mm;
  vertical-align: middle;
}

/* miscellaneous */
.two-col {
  column-count: 2;
  column-gap: 8mm;
  column-rule: 1px solid var(--rule);
  font-size: 10pt;
  line-height: 1.85;
}
.two-col p { break-inside: avoid; margin-bottom: 3mm; }

.ed-summary {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 8.5pt;
}
.ed-summary th, .ed-summary td {
  border: 1px solid var(--rule);
  padding: 1.5mm 2mm;
  text-align: left;
}
.ed-summary th { background: var(--moss); color: #f8f3e6; letter-spacing: 0.1em; }
.ed-summary td.cat-happy { background: #f0eedc; }
.ed-summary td.cat-friend { background: #e7eee2; }
.ed-summary td.cat-bitter { background: #f3e7e0; }
.ed-summary td.cat-bad { background: #f8e2dc; color: var(--rose); }

/* heading-only chapter divider page */
.divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse at top, rgba(212,160,23,0.10), transparent 60%),
    var(--paper);
  height: 100%;
  padding: 0;
}
.divider::after { display: none; }
.divider .num {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 80pt;
  color: var(--ginkgo);
  line-height: 1;
}
.divider .label {
  font-family: var(--sans);
  font-size: 11pt;
  letter-spacing: 0.45em;
  color: var(--moss);
  margin: 6mm 0 4mm;
}
.divider .ttl {
  font-family: var(--serif);
  font-size: 24pt;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.divider .desc {
  font-family: var(--sans);
  font-size: 9.5pt;
  color: var(--ink-soft);
  margin-top: 8mm;
  letter-spacing: 0.1em;
  max-width: 100mm;
  line-height: 1.9;
}
