:root {
  color-scheme: dark;
  --bg: #081321;
  --surface: #0e1c2d;
  --line: #26384f;
  --white: #f4f8ff;
  --muted: #b5c4d8;
  --mint: #8de9be;
  --ink: #112031;
  --ink-muted: #394d63;
  --paper: #ffffff;
  --tint: #eff6f3;
  --tint-blue: #eef4fc;
  --tint-amber: #fef8eb;
  --accent-dark: #0a5243;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--white);
  background: var(--bg);
  line-height: 1.52;
}

* { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #5598ff; outline-offset: 3px; }

/* Top bar (screen-only) */
.guide-header { position: sticky; top: 0; z-index: 50; background: #081321f2; border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.header-wrap { width: min(1240px, calc(100% - 36px)); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; flex-wrap: wrap; padding-block: 8px; }
.header-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; letter-spacing: -.04em; text-decoration: none; }
.wordmark img { border-radius: 7px; }
.back-flyers { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 650; }
.back-flyers:hover { border-color: var(--mint); color: var(--white); }
.header-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lang-switch { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: #0c1a2a; gap: 2px; }
.lang-switch button { min-width: 38px; min-height: 36px; padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .84rem; font-weight: 750; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--mint); color: #05291e; }
.btn-primary, .btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 14px; border-radius: 9px; font-size: .88rem; font-weight: 750; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: background-color .15s ease, border-color .15s ease; }
.btn-primary { background: var(--mint); color: #05291e; }
.btn-primary:hover { background: #b4f4d4; }
.btn-secondary { background: #102136; border-color: #3d5470; color: var(--white); }
.btn-secondary:hover { background: #18304d; border-color: var(--mint); }
.btn-secondary[aria-pressed="true"] { border-color: var(--mint); background: #132f39; color: var(--mint); }
.btn-full { width: 100%; }

/* Page shell */
.guide-shell { width: min(1240px, calc(100% - 36px)); margin: 26px auto 56px; display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 28px; align-items: start; }
.toc-sidebar { position: sticky; top: 86px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); max-height: calc(100vh - 106px); overflow-y: auto; min-width: 0; }
.toc-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .09em; color: var(--mint); font-weight: 800; margin-bottom: 10px; }
.toc-links { display: grid; gap: 4px; }
.toc-links a { display: flex; align-items: baseline; gap: 8px; padding: 7px 9px; border-radius: 8px; font-size: .85rem; color: var(--muted); text-decoration: none; line-height: 1.3; }
.toc-links a span { font-size: .72rem; font-weight: 800; color: var(--mint); flex: none; }
.toc-links a:hover { background: #152940; color: var(--white); }
.toc-cta { display: grid; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Book canvas (light paper sheets for reading & crisp A4 PDF print) */
.book-canvas { display: grid; gap: 24px; color-scheme: light; min-width: 0; }
.book-page { background: var(--paper); color: var(--ink); border-radius: 14px; padding: 34px 38px; box-shadow: 0 18px 46px #00000044; scroll-margin-top: 84px; min-width: 0; overflow-wrap: break-word; }

/* Cover Page */
.cover-page { background: linear-gradient(155deg, #0b1b2f 0%, #0e2c36 62%, #091726 100%); color: #ffffff; padding: 42px 44px; display: flex; flex-direction: column; gap: 24px; border-top: 8px solid var(--mint); }
.cover-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cover-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.6rem; font-weight: 850; letter-spacing: -.04em; }
.cover-brand img { width: 42px; height: 42px; border-radius: 10px; }
.cover-badge { padding: 6px 13px; border-radius: 999px; background: #ffffff18; border: 1px solid #ffffff30; color: var(--mint); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.cover-page h1 { font-size: clamp(2.15rem, 4.2vw, 3.2rem); line-height: 1.05; letter-spacing: -.045em; max-width: 19ch; }
.cover-subtitle { font-size: 1.08rem; color: #d6e4f5; max-width: 60ch; line-height: 1.5; }
.cover-pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cover-pillars div { padding: 12px; border-radius: 10px; background: #ffffff12; border: 1px solid #ffffff24; }
.cover-pillars strong { display: block; color: var(--mint); font-size: .92rem; }
.cover-pillars span { display: block; color: #dbe7f6; font-size: .8rem; margin-top: 3px; line-height: 1.3; }
.cover-toc-box { padding: 18px 20px; border-radius: 12px; background: #ffffff0e; border: 1px solid #ffffff24; }
.cover-toc-box h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .09em; color: var(--mint); margin-bottom: 10px; }
.cover-toc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; list-style: none; padding: 0; font-size: .86rem; color: #e8f1fc; }
.cover-toc-grid li { display: flex; gap: 8px; }
.cover-toc-grid b { color: var(--mint); font-weight: 800; }
.cover-bottom { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 16px 18px; border-radius: 12px; background: #ffffff; color: var(--ink); }
.profile-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.profile-line { display: flex; align-items: baseline; gap: 6px; font-size: .84rem; font-weight: 700; color: #203448; }
.profile-line span { flex: 1; border-bottom: 1px solid #8fa2b5; min-width: 40px; }
.cover-qr-box { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid #d4e0ea; }
.cover-qr-box img { width: 70px; height: 70px; }
.cover-qr-box strong { display: block; font-size: .84rem; color: var(--accent-dark); }
.cover-qr-box span { display: block; font-size: .74rem; color: var(--ink-muted); }

/* Chapter typography */
.chapter-head { border-bottom: 2px solid #d7e5e0; padding-bottom: 12px; margin-bottom: 18px; }
.chapter-num { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; color: var(--accent-dark); }
.chapter-head h2 { font-size: clamp(1.45rem, 2.5vw, 1.95rem); line-height: 1.12; letter-spacing: -.035em; color: var(--ink); margin-top: 4px; }
.chapter-lead { margin-top: 6px; font-size: .96rem; color: var(--ink-muted); }
.sub-title { font-size: 1.08rem; font-weight: 800; color: var(--ink); margin: 20px 0 9px; letter-spacing: -.015em; }
.body-copy { font-size: .94rem; color: #23374b; margin-bottom: 10px; }

/* Visual cards, callouts, scripts, tables */
.callout { padding: 14px 16px; border-radius: 10px; background: var(--tint); border-left: 4px solid var(--accent-dark); margin: 14px 0; }
.callout.amber { background: var(--tint-amber); border-left-color: #b45309; }
.callout.blue { background: var(--tint-blue); border-left-color: #1d4ed8; }
.callout strong { display: block; font-size: .92rem; color: var(--ink); margin-bottom: 4px; }
.callout p { font-size: .89rem; color: #24384c; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin: 12px 0; }
.info-card { padding: 13px 14px; border-radius: 10px; background: #f8fafc; border: 1px solid #d4e1ec; break-inside: avoid; }
.info-card .card-tag { display: inline-block; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-dark); margin-bottom: 4px; }
.info-card h4 { font-size: .95rem; font-weight: 800; color: var(--ink); margin-bottom: 5px; line-height: 1.25; }
.info-card p { font-size: .86rem; color: var(--ink-muted); line-height: 1.44; }
.info-card .say-line { margin-top: 7px; padding-top: 6px; border-top: 1px dashed #c1d2df; font-size: .83rem; color: #0a4e3f; font-weight: 650; }

/* Tables */
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .85rem; }
.data-table th, .data-table td { border: 1px solid #cbd9e4; padding: 8px 10px; text-align: left; vertical-align: top; }
.data-table th { background: #0e2438; color: #ffffff; font-weight: 750; font-size: .8rem; }
.data-table tr:nth-child(even) td { background: #f8fbfd; }
.data-table td strong { color: var(--ink); }

/* Industry Battlecards */
.battlecard { border: 1px solid #c9d8e4; border-radius: 12px; overflow: hidden; margin-bottom: 14px; background: #ffffff; break-inside: avoid; }
.battlecard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: #eff6f3; border-bottom: 1px solid #c9d8e4; }
.battlecard-head h3 { font-size: 1.02rem; font-weight: 800; color: var(--ink); }
.battlecard-meta { font-size: .78rem; font-weight: 700; color: var(--accent-dark); }
.battlecard-body { display: grid; grid-template-columns: 1fr 220px; gap: 14px; padding: 12px 14px; align-items: start; }
.battlecard-body.no-img { grid-template-columns: 1fr; }
.battlecard-points { display: grid; gap: 6px; font-size: .85rem; color: #24384c; }
.battlecard-points div strong { color: var(--ink); }
.battlecard-img { border-radius: 8px; overflow: hidden; border: 1px solid #c6d6e2; background: #f4f7fa; }
.battlecard-img img { width: 100%; height: auto; }
.battlecard-img figcaption { padding: 4px 6px; font-size: .72rem; font-weight: 700; text-align: center; color: #283d52; background: #ffffff; border-top: 1px solid #dce6ee; }

/* Scripts & dialogues */
.script-box { padding: 13px 15px; border-radius: 10px; background: #f5f9fc; border: 1px solid #c7d7e6; margin: 10px 0; break-inside: avoid; }
.script-box h4 { font-size: .92rem; color: var(--accent-dark); margin-bottom: 6px; }
.script-box p { font-size: .87rem; color: #1d3144; white-space: pre-wrap; line-height: 1.48; }

/* Checklists & Steps */
.step-list { list-style: none; padding: 0; display: grid; gap: 8px; margin: 10px 0; }
.step-list li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 9px 11px; border-radius: 9px; background: #f8fafc; border: 1px solid #d5e2ec; font-size: .87rem; break-inside: avoid; }
.step-list .step-num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 999px; background: #0e2438; color: var(--mint); font-size: .78rem; font-weight: 800; }
.step-list strong { color: var(--ink); }

/* FAQ / Objections */
.faq-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.faq-item { padding: 11px 13px; border-radius: 9px; background: #f8fafc; border: 1px solid #d4e1ec; break-inside: avoid; }
.faq-item h4 { font-size: .88rem; color: #0a4f40; margin-bottom: 4px; line-height: 1.28; }
.faq-item p { font-size: .83rem; color: #24384c; line-height: 1.42; }

/* Quiz */
.quiz-list { display: grid; gap: 8px; margin: 12px 0; }
.quiz-item { padding: 10px 13px; border-radius: 9px; background: #f8fafc; border: 1px solid #d4e1ec; font-size: .86rem; break-inside: avoid; }
.quiz-item strong { display: block; color: var(--ink); margin-bottom: 4px; }
.quiz-answer { color: #0a5243; font-weight: 650; font-size: .84rem; margin-top: 4px; }
.quiz-toggle-row { margin-top: 10px; }

/* Printable Field Tracker Worksheet */
.tracker-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .78rem; }
.tracker-table th, .tracker-table td { border: 1px solid #7f94a8; padding: 7px 6px; }
.tracker-table th { background: #0e2438; color: #ffffff; text-align: left; }
.tracker-table td { height: 28px; }

/* Footer */
.guide-footer { border-top: 1px solid var(--line); padding: 22px 0 30px; background: #060f1a; font-size: .88rem; color: var(--muted); }
.footer-inner { justify-content: space-between; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--mint); text-decoration: underline; }

/* B&W / Ink-Saver Mode (Screen & Print) */
.eco-print .cover-page { background: #ffffff; color: #111827; border: 2px solid #111827; border-top: 6px solid #111827; }
.eco-print .cover-badge { background: #ffffff; border-color: #111827; color: #111827; }
.eco-print .cover-subtitle { color: #374151; }
.eco-print .cover-pillars div, .eco-print .cover-toc-box { background: #ffffff; border-color: #9ca3af; }
.eco-print .cover-pillars strong, .eco-print .cover-toc-box h2, .eco-print .cover-toc-grid b { color: #111827; }
.eco-print .cover-pillars span, .eco-print .cover-toc-grid { color: #1f2937; }
.eco-print .cover-bottom { border: 1px solid #9ca3af; }
.eco-print .data-table th, .eco-print .tracker-table th { background: #f3f4f6; color: #111827; border-color: #6b7280; }
.eco-print .callout, .eco-print .battlecard-head, .eco-print .info-card, .eco-print .script-box, .eco-print .faq-item, .eco-print .step-list li { background: #ffffff; border-color: #9ca3af; }
.eco-print .callout { border-left-color: #111827; }
.eco-print .step-list .step-num { background: #ffffff; color: #111827; border: 1.5px solid #111827; }
.eco-print .chapter-num, .eco-print .card-tag, .eco-print .battlecard-meta, .eco-print .faq-item h4, .eco-print .script-box h4 { color: #111827; }

@media screen and (max-width: 980px) {
  .guide-shell { grid-template-columns: 1fr; }
  .toc-sidebar { position: static; max-height: none; }
  .cover-pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 700px) {
  .book-page, .cover-page { padding: 22px 18px; }
  .grid-2, .grid-3, .faq-list, .cover-toc-grid, .profile-lines, .cover-bottom, .battlecard-body { grid-template-columns: 1fr; }
  .cover-qr-box { border-left: 0; border-top: 1px solid #d4e0ea; padding-left: 0; padding-top: 12px; }
}

/* Crisp A4 Portrait PDF & Print Layout */
@page { size: A4 portrait; margin: 11mm; }

@media print {
  :root { color-scheme: light; background: #ffffff; }
  body { background: #ffffff; color: #112031; }
  .screen-only { display: none !important; }
  .guide-shell { width: auto; margin: 0; display: block; }
  .table-scroll { overflow: visible; }
  .book-canvas { display: block; }
  .book-page { border-radius: 0; box-shadow: none; padding: 0; margin: 0; break-after: page; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .book-page:last-child { break-after: auto; }
  .cover-page { height: 273mm; max-height: 273mm; overflow: hidden; padding: 9.5mm 10.5mm; gap: 11px; border-radius: 3.5mm; justify-content: space-between; }
  .cover-page h1 { font-size: 23.5pt; line-height: 1.06; }
  .cover-subtitle { font-size: 9.2pt; line-height: 1.4; }
  .cover-pillars { gap: 7px; }
  .cover-pillars div { padding: 8px 9px; }
  .cover-pillars strong { font-size: 8.5pt; }
  .cover-pillars span { font-size: 7.4pt; }
  .cover-toc-box { padding: 10px 13px; }
  .cover-toc-box h2 { font-size: 7.6pt; margin-bottom: 6px; }
  .cover-toc-grid { font-size: 7.7pt; gap: 3.5px 14px; line-height: 1.3; }
  .cover-bottom { padding: 10px 13px; gap: 12px; }
  .profile-lines { gap: 7px 14px; }
  .profile-line { font-size: 8pt; }
  .cover-qr-box img { width: 58px; height: 58px; }
  .chapter-head h2 { font-size: 15.5pt; }
  .sub-title { font-size: 10.5pt; margin: 11px 0 6px; break-after: avoid; page-break-after: avoid; }
  .body-copy, .callout p, .info-card p, .script-box p, .step-list li { font-size: 8.9pt; }
  .faq-item p, .battlecard-points, .data-table { font-size: 8.1pt; }
  .battlecard-body { grid-template-columns: 1fr 48mm; gap: 8px; padding: 8px 10px; }
  .quiz-answer { display: block !important; }
  .tracker-table td { height: 28px; }
}
