:root {
  color-scheme: light;
  /* Ink & Linen, shared with the desktop renderer in src/tokens.css. */
  --frame: #1d2a3a;
  --canvas: #faf8f5;
  --text: #192430;
  --muted: #5f6570;
  --line: #dad8d5;
  --green: #356b52;
  --coral: #ec7867;
  --coral-hover: #f68c7c;
  --on-frame: #f8f6f1;
  --on-frame-muted: #c1ccd6;
  --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  --wrap: 74rem;
  --gutter: clamp(1.125rem, 5vw, 4.5rem);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; background: var(--frame); color: var(--text); font: 1rem/1.55 var(--font); }
h1, h2, h3, p, figure, fieldset, ol { margin: 0; }
fieldset { min-inline-size: 0; padding: 0; border: 0; }
h1, h2, h3 { line-height: 1.08; font-weight: 650; }
h2 { font-size: clamp(2.15rem, 4.15vw, 3.9rem); letter-spacing: -.052em; }
h3 { font-size: clamp(1.35rem, 2.2vw, 1.75rem); letter-spacing: -.033em; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:focus-visible, input:focus-visible + span { outline: 3px solid currentColor; outline-offset: 4px; }
a:focus-visible img { opacity: .9; }
.wrap { width: min(var(--wrap), calc(100% - 2 * var(--gutter))); margin-inline: auto; }
.symbols { position: absolute; width: 0; height: 0; pointer-events: none; }
.icon { flex: 0 0 auto; width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sr, .screen-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip { position: absolute; z-index: 4; left: 1rem; top: .6rem; padding: .6rem 1rem; background: var(--canvas); border-radius: 6px; transform: translateY(-160%); }
.skip:focus { transform: none; }

.masthead, .hero, footer { background: var(--frame); color: var(--on-frame); }
.masthead-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; }
.masthead-inner { min-height: 5rem; border-bottom: 1px solid #ffffff22; }
.brand { display: inline-flex; gap: .65rem; align-items: center; font-weight: 680; font-size: 1.42rem; letter-spacing: -.047em; }
.brand img { flex: none; border-radius: 25%; }
.masthead nav { display: flex; align-items: center; gap: clamp(.85rem, 2.6vw, 2.5rem); }
.masthead nav a, .back { display: inline-flex; align-items: center; gap: .55em; min-height: 44px; color: var(--on-frame-muted); font-size: .95rem; }
.masthead nav a:hover, .back:hover { color: white; }
.masthead .install-nav { color: var(--on-frame); }
.hero { padding-bottom: 1.2rem; }
.hero-copy { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .85fr); gap: clamp(1.5rem, 5vw, 5rem); align-items: center; padding-block: clamp(3rem, 5.3vw, 5rem); }
.hero-lead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.hero-mascot { width: clamp(5.5rem, 11vw, 10.25rem); height: auto; margin-inline-end: 1.2rem; }
h1 { font-size: clamp(3.2rem, 5.8vw, 5.65rem); line-height: 1.01; letter-spacing: -.05em; }
h1 em { font-style: normal; color: var(--coral); }
.hero-side { max-width: 28rem; }
.hero-side p { color: var(--on-frame-muted); font-size: clamp(1.03rem, 1.35vw, 1.17rem); line-height: 1.52; }
.action { display: inline-flex; align-items: center; justify-content: center; gap: .75rem; min-height: 46px; padding: .65rem 1.1rem; border-radius: 7px; background: var(--coral); color: var(--text); font-weight: 650; }
.action:hover { background: var(--coral-hover); }
.hero-action { margin-top: 1.25rem; }
.action:focus-visible { outline-color: var(--on-frame); }

.route { padding-block: 0 .4rem; }
.route ol { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; padding: 1rem 0 0; border-top: 1px solid #ffffff25; list-style: none; }
.route a { display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; font-size: .96rem; color: var(--on-frame); }
.route a:hover { text-decoration: underline; text-underline-offset: .23em; }
.route a span { color: var(--coral); font: .8rem Consolas, monospace; }

.gallery { scroll-margin-top: 1rem; }
.screen-options { display: flex; flex-wrap: wrap; gap: .3rem; padding-bottom: .85rem; }
.screen-option { position: relative; }
.screen-option span { display: flex; align-items: center; gap: .52rem; min-height: 42px; padding: .45rem .95rem; color: var(--on-frame-muted); border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-size: .98rem; }
.screen-option:hover span { color: var(--on-frame); background: #ffffff0b; }
.screen-option input:checked + span { color: var(--on-frame); border-color: #ffffff25; background: #ffffff12; }
.screen-option input:checked + span .icon { color: var(--coral); }
.screen { min-width: 0; }
.enlarge { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 11px; overflow: hidden; background: var(--frame); color: inherit; font: inherit; cursor: zoom-in; }
.enlarge:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }
.screen .enlarge { border: 1px solid #ffffff32; box-shadow: 0 18px 35px -22px #09111d; }
.enlarge img { width: 100%; height: auto; }
.zoom { position: absolute; right: .75rem; bottom: .75rem; display: flex; align-items: center; gap: .45rem; padding: .45rem .72rem; color: white; background: var(--frame); border: 1px solid #ffffff36; border-radius: 5px; font-size: .8rem; opacity: 0; }
.enlarge:hover .zoom, .enlarge:focus-visible .zoom { opacity: 1; }
figcaption { margin-top: .75rem; font-size: .92rem; color: var(--muted); line-height: 1.5; }
.screen figcaption { color: var(--on-frame-muted); }
@supports selector(:has(*)) {
  .screen { display: none; }
  .gallery:has(#view-branches:checked) #screen-branches,
  .gallery:has(#view-board:checked) #screen-board,
  .gallery:has(#view-chat:checked) #screen-chat { display: block; }
}
@supports not selector(:has(*)) {
  .screen-options { display: none; }
  .screen + .screen { margin-top: 2rem; }
}

.paper { background: var(--canvas); color: var(--text); }
.first-chapter { border-radius: clamp(1rem, 2.2vw, 2rem) clamp(1rem, 2.2vw, 2rem) 0 0; }
.chapter { padding-block: clamp(2.8rem, 5.2vw, 4.8rem); }
.ruled { border-top: 1px solid var(--line); }
.split { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr); gap: clamp(1.5rem, 4.8vw, 4.25rem); align-items: center; }
.chapter-heading { display: grid; gap: .75rem; align-content: start; }
.chapter-number { color: var(--green); font: 500 .9rem/1.1 Consolas, monospace; letter-spacing: .07em; }
.chapter-number::before { content: ''; display: inline-block; vertical-align: middle; width: 1.9rem; height: 1px; margin-right: .55rem; background: currentColor; }
.chapter p { color: var(--muted); line-height: 1.57; font-size: 1.03rem; }
.chapter p + p { margin-top: .8rem; }
.chapter-copy h2 + p { margin-top: 1.2rem; }
.chapter .enlarge { border: 1px solid var(--line); }
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.8rem, 4vw, 3.75rem); margin-top: 2rem; }
.setup-grid article { display: flex; flex-direction: column; }
.setup-grid h3 { margin-bottom: .75rem; }
.setup-grid figure { margin-top: auto; padding-top: 1.5rem; }
.wide-intro { display: grid; grid-template-columns: minmax(0,.95fr) minmax(0,1.05fr); gap: clamp(1.5rem, 6vw, 5.5rem); margin-bottom: clamp(1.5rem, 3.8vw, 3rem); }
.ink-section { color: var(--on-frame); background: var(--frame); }
.ink-section p, .ink-section figcaption { color: var(--on-frame-muted); }
.ink-section .chapter-number { color: var(--coral); }
.ink-section .enlarge { border-color: #ffffff32; }
.automation { color: var(--text); background: #e7ece7; }
.automation figcaption { color: #4a594e; }
code { padding: .08em .26em; border-radius: 4px; color: var(--text); background: #e9e9e4; font: .9em/1.3 Consolas, monospace; overflow-wrap: anywhere; }
.download { background: #edeae4; color: var(--text); }
.download-inner { display: flex; align-items: center; gap: clamp(1.5rem, 5vw, 4.5rem); padding-block: clamp(2.75rem, 5.5vw, 5rem); }
.mascot { width: clamp(5rem, 9vw, 7rem); height: auto; flex: none; border-radius: 24%; }
.download h2 { font-size: clamp(2.05rem, 3.8vw, 3.5rem); }
.download-copy p { margin-top: .8rem; color: var(--muted); }
.download-copy .action { margin-top: 1.3rem; }
.footer-inner { min-height: 5.25rem; }
footer .brand { font-size: 1.12rem; }
.back .icon { transform: rotate(180deg); }

@media (max-width: 760px) {
  .masthead-inner { min-height: 4.2rem; }
  .masthead nav a:not(.install-nav) { display: none; }
  .brand { font-size: 1.28rem; }
  .brand img { width: 36px; height: 36px; }
  .hero-copy { grid-template-columns: 1fr; gap: 1.3rem; padding-block: 2.8rem 2rem; }
  h1 { font-size: clamp(2.8rem, 8.6vw, 4.1rem); }
  .hero-side { max-width: 36rem; }
  .hero-action { margin-top: 1rem; }
  .screen-options { gap: .1rem; }
  .screen-option span { padding-inline: .62rem; gap: .38rem; min-height: 42px; font-size: .9rem; }
  .enlarge { border-radius: 7px; }
  .split, .setup-grid, .wide-intro { grid-template-columns: 1fr; }
  .split, .setup-grid { gap: 1.8rem; }
  .wide-intro { gap: 1rem; }
  .hero-mascot { width: clamp(4.5rem, 17vw, 7rem); margin-inline-end: 0; }
  .route ol { gap: 0 .95rem; }
  .setup-grid figure { padding-top: 1rem; }
  .download-inner { gap: 1.3rem; }
  .zoom { position: static; justify-content: flex-end; opacity: 1; border: 0; border-radius: 0; min-height: 28px; padding: .3rem .6rem; }
}
@media (max-width: 520px) {
  .screen-option span { padding-inline: .5rem; }
  .screen-option .icon { display: none; }
  .screen-options { gap: .3rem; }
  .screen-option input:checked + span { border-color: #ffffff46; }
  .download-inner { align-items: flex-start; }
  .mascot { width: 4.25rem; }
  .download h2 { font-size: 1.8rem; }
}
@media (max-width: 365px) {
  .hero-lead { gap: .5rem; }
  .hero-mascot { width: 3.25rem; }
  h1 { font-size: 2.45rem; }
}
@media (forced-colors: active) {
  .screen-option input:checked + span { border: 2px solid Highlight; }
  .action { border: 1px solid ButtonText; }
}

body:has(.viewer[open]) { overflow: hidden; }
.viewer { width: min(1840px, calc(100vw - 2rem)); max-width: none; height: min(1160px, calc(100dvh - 2rem)); max-height: none; margin: auto; padding: 0; border: 1px solid #536274; border-radius: 12px; background: var(--frame); color: var(--on-frame); }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgb(10 17 26 / 88%); }
.viewer-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .5rem 1rem; border-bottom: 1px solid #ffffff26; }
.viewer-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1.12rem; letter-spacing: -.025em; }
.viewer-head form { margin: 0; }
.viewer-head label, .viewer-close { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; cursor: pointer; }
.viewer-head label { color: var(--on-frame-muted); font: .9rem var(--font); white-space: nowrap; }
.viewer-head input { accent-color: var(--coral); }
.viewer-close { padding: .35rem .7rem; border: 1px solid #ffffff45; border-radius: 6px; background: var(--canvas); color: var(--text); font: 600 .95rem var(--font); }
.viewer-close:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.viewer-scroll { display: flex; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.viewer-scroll img { flex: none; width: 100%; height: 100%; object-fit: contain; margin: auto; }
.viewer:has(input:checked) .viewer-scroll img { width: 1800px; max-width: none; height: auto; }
@media (max-width: 600px) {
  .viewer { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .viewer-head { padding: .4rem .7rem; }
}
