/* Shared by index.html and explorer.html: tokens and the primitives both pages draw with. */
/* Each colour token holds its light and dark value. color-scheme picks one: the system setting,
   unless the theme button pinned light or dark. */
:root{color-scheme:light dark;--bg:light-dark(#F4F5F7,#0E1014);--panel:light-dark(#FFFFFF,#161920);--panel2:light-dark(#EEF0F3,#1D2129);--ink:light-dark(#15171C,#E6E8ED);--muted:light-dark(#535965,#A3A9B5);--faint:light-dark(#8A909B,#6F7684);--line:light-dark(#D7DAE0,#2B303B);--accent:light-dark(#2457D6,#7EA6FF);--pk:light-dark(#FBE5EE,#351A26);--pkS:light-dark(#B0305F,#F08DB0);--lv:light-dark(#EDE9FB,#241F3B);--lvS:light-dark(#5F45BA,#B3A1F5);--gr:light-dark(#E3F2E8,#13271A);--grS:light-dark(#27753F,#6FCB8F);--or:light-dark(#FCEAD4,#302210);--orS:light-dark(#9A5212,#F2AE6B);--yl:light-dark(#FFF6D1,#2C2610);--ylS:light-dark(#B08300,#E3BD45);--pkt:light-dark(#00A3C7,#4FE3FF);--mono:'IBM Plex Mono',ui-monospace,Menlo,monospace}
:root[data-theme="light"]{color-scheme:light}
:root[data-theme="dark"]{color-scheme:dark}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family:'IBM Plex Sans',system-ui,sans-serif;color:var(--ink);background:var(--bg);font-size:14px;line-height:1.45}
.mono{font-family:var(--mono)}
button{font:inherit;color:inherit;cursor:pointer}
button:disabled{cursor:default}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.cap{font-size:12px;font-weight:600}
.sp{flex:1}
.chip{font-family:var(--mono);font-size:12px;padding:3px 8px;border-radius:6px;border:1px solid var(--line);background:var(--panel);display:inline-flex;text-align:left;align-items:center;gap:6px;color:var(--ink)}
button.chip{min-height:24px}
.c-pk{background:var(--pk);border-color:var(--pkS)}.c-lv{background:var(--lv);border-color:var(--lvS)}.c-gr{background:var(--gr);border-color:var(--grS)}.c-or{background:var(--or);border-color:var(--orS)}
.tag{font-family:var(--mono);font-size:11.5px;line-height:1.3;padding:2px 6px;border-radius:4px;align-self:flex-start;font-weight:500;max-width:100%;overflow-wrap:anywhere}
.t-pk{background:var(--pk);color:var(--pkS)}.t-lv{background:var(--lv);color:var(--lvS)}.t-gr{background:var(--gr);color:var(--grS)}.t-or{background:var(--or);color:var(--orS)}
.btn{border:1px solid var(--line);background:var(--panel);border-radius:8px;padding:0 12px;height:32px;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--panel)}
.btn.active{border-color:var(--accent);color:var(--accent)}
.ibtn{width:32px;padding:0;justify-content:center}
.seg{display:flex;padding:3px;border-radius:8px;background:var(--panel2);border:1px solid var(--line)}
.seg button{border:0;background:transparent;padding:4px 10px;border-radius:6px;color:var(--muted);white-space:nowrap}
.seg button[aria-pressed=true]{background:var(--panel);color:var(--ink);box-shadow:0 0 0 1px var(--line);font-weight:600}
.crumbs{display:flex;align-items:center;gap:2px;font-size:12px;padding:3px;border:1px solid var(--line);border-radius:8px;background:var(--panel2);min-width:0;overflow-x:auto}
.crumb{border:0;background:transparent;padding:4px 8px;border-radius:5px;color:var(--muted);white-space:nowrap}
.crumb[aria-current=page]{background:var(--panel);color:var(--ink);box-shadow:0 0 0 1px var(--line);font-weight:600}
.crumb:disabled{opacity:.4}
.sep{color:var(--faint)}
.dots{background-color:var(--bg);background-image:radial-gradient(var(--line) 1px,transparent 1px);background-size:16px 16px}
.sw{width:12px;height:12px;border-radius:3px;border:1.5px solid;display:inline-block;flex:none}
.ill{background:var(--yl)!important;border:1.5px dashed var(--ylS)!important}

.k-pk{background:var(--pk);border-color:var(--pkS)}.k-pk>.cap,.k-pk>.lay-h>.cap{color:var(--pkS)}
.k-lv{background:var(--lv);border-color:var(--lvS)}.k-lv>.cap,.k-lv>.lay-h>.cap{color:var(--lvS)}
.k-gr{background:var(--panel);border-color:var(--grS)}.k-gr>.cap,.k-gr>.lay-h>.cap{color:var(--grS)}
.thin.k-gr{background:var(--panel2)}
.k-or{background:var(--or);border-color:var(--orS)}.k-or>.cap,.k-or>.lay-h>.cap{color:var(--orS)}
.k-vm{background:var(--panel2);border-color:var(--ink)}.k-vm>.cap,.k-vm>.lay-h>.cap{color:var(--ink)}
/* Outline style says what kind of boundary a box is. */
.b-vm{border-width:3px;border-style:solid}
.b-ns{border-width:2px;border-style:dashed}
.b-group,.lay.b-group,.thin.b-group{border:1.5px dotted var(--faint);background:transparent}
.kstrip{border:1.5px solid var(--lvS);background:var(--lv);border-radius:10px;padding:10px 12px;display:flex;flex-direction:column;gap:8px}
.kstrip b{color:var(--lvS)}
.kstrip .d{color:var(--muted);font-size:12.5px}
.kstrip .chips{display:flex;gap:8px;flex-wrap:wrap}
.proc{border:1.5px solid var(--grS);background:var(--panel);border-radius:10px;padding:8px 12px;display:flex;flex-direction:column;gap:1px;text-align:left;cursor:pointer}
.proc .n{font-family:var(--mono);font-weight:600;font-size:13.5px}
.proc .m{font-family:var(--mono);font-size:12px;color:var(--muted)}
.proc[aria-pressed=true],.chip[aria-pressed=true]{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent)}
.cell{border:1px solid var(--line);border-radius:8px;padding:7px 8px;background:var(--panel);display:flex;flex-direction:column;gap:5px;min-width:0}
.cell .v{font-family:var(--mono);font-size:12.5px;line-height:1.35;font-weight:500;overflow-wrap:anywhere}
.cell.real{border:2px solid var(--ink)}
.cell.chg{box-shadow:inset 3px 0 0 var(--accent)}
.realtag{font-size:11.5px;font-weight:600;color:var(--ink)}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
a.btn{text-decoration:none;color:inherit}
/* Shared application chrome: page-specific typography must not restyle it. */
.site-header{min-height:52px;flex:none;display:flex;align-items:center;gap:14px;padding:8px 16px;border-bottom:1px solid var(--line);background:var(--panel);position:relative;z-index:5;font-size:14px;line-height:1.45}
.site-brand{display:flex;align-items:center;gap:9px;flex:none;color:var(--ink);text-decoration:none;font-size:15px;line-height:1.45}
.site-brand:visited{color:var(--ink)}
.site-brand svg{display:block;flex:none}
.site-header .ibtn{flex:none}
@media(max-width:767px){.site-header{padding:8px 12px;gap:10px}.site-brand b{display:none}}
/* Narrow screens: the tab row may shrink and scroll inside itself, so the page never scrolls sideways. */
/* Phones: the six view tabs take their own full-width row under the logo, with "Guided story" and "Nitro review"
   shortened, so every tab (and the current one) is on screen without scrolling. */
@media(max-width:767px){.site-header{flex-wrap:wrap;row-gap:8px}
  .site-header .tabs{order:9;flex:1 0 100%;min-width:0;gap:2px;overflow-x:auto;scrollbar-width:none}.site-header .tabs::-webkit-scrollbar{display:none}
  .site-header .tabs a{flex:1 0 auto;justify-content:center;text-align:center;padding:5px 4px;font-size:13px}
  .tabs .tx{display:none}.tabs .tc{display:inline-block}.tabs .tc::first-letter{text-transform:uppercase}}
/* Shared view tabs. */
.tabs{display:flex;align-items:center;gap:4px;padding:3px;border-radius:10px;background:var(--panel2);border:1px solid var(--line);flex:none}
.tabs a{padding:5px 13px;border-radius:7px;font-size:14px;font-weight:600;color:var(--muted);text-decoration:none;white-space:nowrap}
.tabs a:hover{color:var(--ink)}
.tabs a[aria-current=page]{background:var(--accent);color:var(--panel)}
@media (max-width:767px){.tabs a{padding:5px 10px}}
/* How-to-use card, opened by the ? button in every header. */
.help{position:fixed;right:12px;width:min(380px,calc(100vw - 24px));z-index:30;background:var(--panel);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.28);padding:14px 16px;display:flex;flex-direction:column;gap:10px}
.help[hidden]{display:none}
.help h2{margin:0;font-size:16px;line-height:1.3}
.help p{margin:0;color:var(--muted);font-size:14px;line-height:1.45}
.help ol{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:8px;counter-reset:h}
.help li{display:grid;grid-template-columns:22px minmax(0,1fr);gap:8px;align-items:start;font-size:14px;line-height:1.4;counter-increment:h}
.help li::before{content:counter(h);width:22px;height:22px;border-radius:50%;background:var(--accent);color:var(--panel);font:600 12px/22px var(--mono);text-align:center}
.help .row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.help a{color:var(--accent);font-size:13.5px}
/* Fingers need bigger targets than pointers. */
@media (pointer:coarse){
  .btn{height:36px}.ibtn{width:36px}
  .seg button,.crumb{min-height:32px}
  .tabs a{display:inline-flex;align-items:center;min-height:32px}
    button.chip{min-height:32px}
  .rail button,.rail summary{min-height:34px;display:flex;align-items:center}
  .pip{height:28px;padding:12px 0;background-clip:content-box}
}
/* Second row under the site header: the views inside one section (Costs). */
.subnav{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:4px;padding:6px 16px;background:var(--bg);border-bottom:1px solid var(--line);overflow-x:auto;scrollbar-width:none;font-size:14px;line-height:1.45}
.subnav::-webkit-scrollbar{display:none}
.subnav a{flex:none;padding:5px 11px;border-radius:7px;color:var(--muted);text-decoration:none;font-weight:500;white-space:nowrap}
.subnav a:hover{color:var(--ink)}
.subnav a[aria-current=page]{background:var(--panel);color:var(--ink);font-weight:600;box-shadow:0 0 0 1px var(--line)}
@media(max-width:767px){.subnav{padding:6px 12px}}
@media (pointer:coarse){.subnav a{display:inline-flex;align-items:center;min-height:32px}}

/* The second row on every page but the home page: which chapter of the story this is, and its pages. */
.subnav.chapter .ch{flex:none;color:var(--muted);font-size:13px;padding:0 10px 0 2px;margin-right:4px;border-right:1px solid var(--line);white-space:nowrap}
.subnav.chapter .ch b{color:var(--ink);font-weight:600}
@media(max-width:767px){.subnav.chapter .ch{display:none}}
/* "Continue the story" at the end of a page. */
.next-ch{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:28px 0 8px;font-size:14px;line-height:1.4}
.next-ch a{display:flex;flex-direction:column;gap:2px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--ink);text-decoration:none}
.next-ch a:hover{border-color:var(--accent)}
.next-ch a small{font-size:12px;color:var(--muted)}
.next-ch a span{font-weight:600;color:var(--accent)}
.next-ch a.next{grid-column:2;text-align:right}
@media(max-width:600px){.next-ch{grid-template-columns:1fr}.next-ch a.next{grid-column:1}}

/* Page to page without a flash: every tab is its own page, so the browser holds the old page until the
   new one is ready and fades between them (Chrome, Edge, Safari 18.2+; others just navigate). The header
   and the chapter row keep their own names, so they stay put while only the page body changes. */
@view-transition{navigation:auto}
html{background:var(--bg)}
.site-header{view-transition-name:site-header}
.subnav{view-transition-name:chapter-row}
::view-transition-old(root),::view-transition-new(root){animation-duration:.12s}
::view-transition-group(site-header),::view-transition-group(chapter-row){animation-duration:0s}
@media (prefers-reduced-motion:reduce){::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}}
