:root {
  color-scheme: dark;
  --espresso: #181310;
  --espresso-raised: #28201b;
  --paper: #f5efe4;
  --paper-raised: #fffaf1;
  --ink: #2f251f;
  --muted: #716056;
  --copper: #a94f31;
  --line: #d6c7b5;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Trebuchet MS", Verdana, sans-serif;
  --mono: Consolas, "Courier New", monospace;
  font-family: var(--sans);
  background: var(--espresso);
  color: var(--paper);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
a, button, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary { touch-action: manipulation; }
button { font-family: inherit; }
svg.control-icon { display: block; width: 17px; height: 17px; flex-shrink: 0; }
.toolbar {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  min-height: 52px;
  border-bottom: 1px solid #47352a;
  background: var(--espresso);
}
.player-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-identity img { width: 28px; height: 28px; flex-shrink: 0; }
h1 { margin: 0; min-width: 0; font-size: 13px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.short-title { display: none; }
.portal-label { margin: 0; color: #bca995; font: 10px/1.4 var(--mono); letter-spacing: .08em; }
.toolbar-actions, .player-controls { display: flex; align-items: center; flex-shrink: 0; }
.toolbar-actions { gap: 8px; }
.player-controls { gap: 2px; padding-right: 8px; border-right: 1px solid #45362c; }
.player-controls button, .player-controls a, .game-guide > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 11px;
  border: 0;
  border-radius: 4px;
  color: #e6d8c8;
  background: transparent;
  font: 12px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.player-controls button:hover, .player-controls a:hover { color: #fff9ee; background: var(--espresso-raised); }
.player-controls button:active, .player-controls a:active { background: #3c2c22; }
.player-controls button[aria-pressed="true"] { color: #ffcc98; background: #37251b; }
:focus-visible { outline: 2px solid #d98258; outline-offset: 3px; }
.toolbar :focus-visible { outline-offset: -3px; }
main { flex: 1 1 0; min-height: 0; width: 100%; position: relative; }
iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--espresso); }
.frame-status { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 max(12px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(16px, env(safe-area-inset-left, 0px)); border-top: 1px solid #47352a; background: var(--espresso); }
.frame-status p { min-width: 0; margin: 0; color: #c9b7a4; font: 11px/1.5 var(--sans); }
.frame-status p::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: #d79c69; }
.frame-status p[data-state="opened"]::before { background: #8eb995; }
.frame-status a { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; min-height: 44px; color: #efc29d; font-size: 11px; text-underline-offset: 3px; }
.frame-status a:hover { color: #fff2df; }
.skip { position: fixed; top: -80px; left: 12px; z-index: 20; padding: 12px 16px; background: var(--paper); color: var(--ink); font-size: 14px; }
.skip:focus { top: 4px; }
#notice {
  position: fixed;
  z-index: 10;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 13px 18px;
  border: 1px solid #bfa184;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 8px 28px #0004;
  pointer-events: none;
}
[hidden] { display: none !important; }

/* Keep the first screen playable; the site's own guide text follows it. */
html.portal-document { height: auto; overflow-x: clip; overflow-y: auto; }
body.portal-page { height: auto; min-height: 100dvh; display: block; overflow: visible; }
.player-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.frame-links { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.portal-reading { background: var(--paper); color: var(--ink); color-scheme: light; border-top: 3px solid var(--copper); scroll-margin-top: 0; }
.portal-reading-inner { max-width: 1120px; margin: auto; padding: 64px 28px 24px; display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 44px 72px; }
.home-intro { max-width: 690px; }
.home-intro h2 { margin: 12px 0 24px; font: 400 clamp(36px, 5vw, 54px)/1.08 var(--serif); letter-spacing: -.04em; }
.home-intro > p:not(.eyebrow) { font-size: 16px; line-height: 1.8; margin: 0 0 18px; }
.home-intro .article-return { margin-top: 6px; }
.home-scope { align-self: start; margin-top: 8px; padding-left: 24px; border-left: 1px solid var(--line); }
.home-scope p:not(.eyebrow) { margin: 16px 0 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.home-scope a, .home-reading-footer a { color: #894127; text-underline-offset: 4px; }
.home-scope a { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; }
.home-scope svg, .home-intro svg { width: 15px; height: 15px; }
.home-guide-list { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.home-guide-list > a { display: grid; grid-template-columns: 38px minmax(0, 1fr) 18px; gap: 20px; align-items: center; padding: 23px 0; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.home-guide-list > a:hover strong { color: var(--copper); text-decoration: underline; text-underline-offset: 4px; }
.guide-number { align-self: start; margin-top: 4px; color: var(--copper); font: 11px/1.5 var(--mono); }
.home-guide-list strong { display: block; font: 400 25px/1.25 var(--serif); letter-spacing: -.02em; }
.home-guide-list small { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.home-guide-list svg { color: var(--copper); }
.home-reading-footer { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; color: var(--muted); font-size: 11px; }
.home-reading-footer p { flex: 1 1 220px; margin: 0; line-height: 1.7; }
.home-reading-footer a { display: inline-flex; align-items: center; min-height: 44px; }
.first-steps { padding-left: 24px; }
.observation-terms { margin: 24px 0; }
.observation-terms dt { padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.observation-terms dd { margin: 6px 0 18px; color: var(--muted); font-size: 14px; }
.experiment-template { padding: 20px; background: #eae0d0; border-left: 3px solid var(--copper); font: 13px/2 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Native, user-controlled help. The closed state occupies only the toolbar. */
.game-guide { position: relative; flex-shrink: 0; }
.game-guide > summary { list-style: none; color: #efc29d; background: #2d2119; }
.game-guide > summary:hover, .game-guide[open] > summary { background: #463025; color: #fff2df; }
.game-guide > summary::-webkit-details-marker { display: none; }
.guide-indicator { font-family: var(--mono); font-size: 17px; line-height: 1; transition: transform 160ms ease; }
.game-guide[open] .guide-indicator { transform: rotate(45deg); }
.game-guide > section {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  width: min(392px, calc(100vw - 24px));
  max-height: calc(100dvh - 78px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #c0a991 var(--paper);
  padding: 24px;
  border: 1px solid #b69b7e;
  border-top: 3px solid var(--copper);
  border-radius: 0 0 6px 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  box-shadow: 0 20px 56px #0006;
}
.game-guide h2 { margin: 5px 0 10px; color: var(--ink); font: 400 30px/1.15 var(--serif); letter-spacing: -.035em; }
.game-guide p { margin: 0 0 14px; }
.game-guide .guide-intro { color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0; color: var(--copper); font: 700 10px/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.quick-help { margin: 20px 0; padding: 0; list-style: none; }
.quick-help li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.quick-help svg { width: 18px; height: 18px; margin-top: 2px; color: var(--copper); flex-shrink: 0; }
.quick-help strong { display: block; margin-bottom: 3px; font-size: 13px; }
.quick-help p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); }
.guide-route { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; border: 1px solid var(--ink); color: var(--paper); background: var(--ink); text-decoration: none; font-size: 13px; }
.guide-route:hover { background: #523a2c; }
.guide-route small { display: block; margin-bottom: 4px; color: #d2bfae; font: 10px var(--mono); letter-spacing: .05em; }
.guide-route svg { width: 18px; height: 18px; flex-shrink: 0; }
.scope { margin: 20px 0 15px; border-bottom: 1px solid var(--line); }
.scope > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; color: var(--ink); font-size: 12px; font-weight: 700; }
.scope > summary::-webkit-details-marker { display: none; }
.scope > summary::after { content: "+"; font: 16px var(--mono); }
.scope[open] > summary::after { content: "−"; }
.scope p { font-size: 12px; line-height: 1.65; color: var(--muted); }
.guide-links { display: flex; flex-wrap: wrap; gap: 0 16px; }
.guide-links a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: #87402b; font-size: 12px; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.guide-links a:hover { color: var(--ink); }
.game-guide .new-tab-note { margin: 10px 0 0; color: var(--muted); font: 10px/1.6 var(--mono); }

/* Independent information pages: a quiet editorial reading surface. */
html.info-document { height: auto; overflow: auto; color-scheme: light; background: var(--paper); }
body.info-page { height: auto; min-height: 100dvh; display: block; overflow: visible; background: var(--paper); color: var(--ink); }
.info-header { background: var(--espresso); color: var(--paper); }
.info-header-inner { max-width: 1160px; margin: auto; padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.identity { display: inline-flex; align-items: center; gap: 12px; color: var(--paper); text-decoration: none; }
.identity img { width: 34px; height: 34px; }
.identity-wordmark { display: flex; flex-direction: column; gap: 3px; font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.identity-wordmark small { color: #bba994; font: 9px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.info-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.info-nav a { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 12px; color: #cfbfae; text-decoration: none; font-size: 12px; border-bottom: 2px solid transparent; transition: color 140ms ease, border-color 140ms ease; }
.info-nav a:hover { color: #fff5e6; }
.info-nav a[aria-current="page"] { color: #ffca98; border-bottom-color: #c17e52; }
.info-nav .return-link { color: var(--paper); border: 1px solid #70513b; border-radius: 3px; margin-right: 10px; }
.info-nav .return-link:hover { background: #32241b; }
.reading-layout { max-width: 1120px; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 64px; align-items: start; margin: 68px auto 80px; padding: 0 28px; }
.article-index { position: sticky; top: 30px; padding-top: 7px; }
.article-index > p { margin: 0 0 16px; color: var(--muted); font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.article-index nav { display: flex; flex-direction: column; padding-left: 15px; border-left: 1px solid var(--line); }
.article-index a { display: block; padding: 8px 0; color: var(--muted); text-decoration: none; font-size: 12px; line-height: 1.5; }
.article-index a:hover { color: var(--copper); }
.article { max-width: 730px; min-height: auto; font-size: 16px; line-height: 1.8; color: var(--ink); overflow-wrap: anywhere; }
.article-lead { padding-bottom: 32px; margin-bottom: 34px; border-bottom: 1px solid var(--line); }
.article h1 { white-space: normal; overflow: visible; font: 400 clamp(36px, 4.7vw, 62px)/1.06 var(--serif); letter-spacing: -.045em; margin: 12px 0 23px; color: var(--ink); }
.article-lead > p:not(.eyebrow) { max-width: 660px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.75; }
.article h2 { scroll-margin-top: 24px; margin: 38px 0 14px; color: var(--ink); font: 400 28px/1.2 var(--serif); letter-spacing: -.025em; }
.article-body > h2:first-child { margin-top: 0; }
.article p { margin: 0 0 18px; }
.article a { color: #894127; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.article a:hover { color: var(--ink); }
.article ul { padding-left: 23px; }
.article li { margin-bottom: 12px; padding-left: 4px; }
.article .controls { list-style: none; padding: 0; margin: 0; }
.controls li { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 22px; padding: 18px 0; border-bottom: 1px solid var(--line); margin: 0; }
.controls strong { font-size: 13px; }
.controls p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.review-note { margin-top: 36px !important; padding: 20px 0 0; border-top: 1px solid var(--line); font: 12px/1.65 var(--sans); color: var(--muted); }
.article-return { display: inline-flex; align-items: center; gap: 18px; min-height: 44px; margin-top: 24px; padding: 10px 16px; border: 1px solid #9d8067; color: var(--ink) !important; text-decoration: none; font-size: 13px; }
.article-return:hover { background: #e8ddcb; }
.info-footer { max-width: 1120px; margin: auto; padding: 32px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); }
.info-footer .info-nav a { color: var(--muted); padding: 0 8px; font-size: 11px; }
.info-footer .info-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--copper); }
.info-footer .return-link { border: 0; margin: 0; }
.info-footer p { margin: 0; max-width: 260px; color: var(--muted); font: 10px/1.7 var(--mono); }
.not-found .article { max-width: 780px; margin: 90px auto; padding: 0 28px; }

@media (max-width: 800px) {
  .portal-reading-inner { grid-template-columns: minmax(0, 1fr) 210px; gap: 32px; }
  .reading-layout { gap: 34px; grid-template-columns: 170px minmax(0, 1fr); }
  .info-header-inner { padding: 14px 20px; gap: 12px; }
  .info-nav { gap: 0; }
  .info-nav a { padding: 0 9px; }
  .info-nav .return-link { margin-right: 3px; }
  .identity-wordmark small { display: none; }
}
@media (max-width: 640px) {
  .portal-reading-inner { display: block; padding: 38px 20px 18px; }
  .home-scope { margin: 30px 0; padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .home-guide-list { display: block; margin-top: 30px; }
  .home-guide-list > a { gap: 12px; grid-template-columns: 24px minmax(0, 1fr) 16px; }
  .home-guide-list strong { font-size: 23px; }
  .home-reading-footer { margin-top: 20px; gap: 0 22px; }
  .frame-links { gap: 10px; }
  .toolbar { min-height: 48px; gap: 8px; padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .player-identity { gap: 6px; }
  .player-identity img { width: 24px; height: 24px; }
  .full-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .short-title { display: inline; color: #efc29d; font: 700 12px var(--mono); letter-spacing: .02em; }
  .portal-label { display: none; }
  .frame-status { gap: 8px; padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .frame-status p { font-size: 10px; }
  .frame-status a { font-size: 10px; gap: 4px; }
  .frame-status a svg { width: 13px; height: 13px; }
  .toolbar-actions { gap: 4px; }
  .player-controls { padding-right: 4px; gap: 0; }
  .player-controls button, .player-controls a { width: 44px; padding: 0; }
  .player-controls .control-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .game-guide > summary { gap: 7px; padding: 0 10px; }
  .game-guide > section { padding: 20px; max-height: calc(100dvh - 70px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
  .info-header-inner { flex-wrap: wrap; padding: 17px 20px 8px; }
  .identity-wordmark small { display: block; }
  .info-header .info-nav { width: 100%; justify-content: space-between; margin-top: 4px; }
  .info-header .info-nav a { padding: 0 7px; font-size: 11px; }
  .info-header .info-nav .return-link { border: 0; padding-left: 0; }
  .reading-layout { display: flex; flex-direction: column; gap: 26px; padding: 0 20px; margin: 34px auto 56px; }
  .article-index { position: static; padding: 0; width: 100%; }
  .article-index > p { margin-bottom: 10px; }
  .article-index nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 0 18px; padding: 0 0 10px; border-left: 0; border-bottom: 1px solid var(--line); }
  .article-index a { font-size: 11px; padding: 7px 0; }
  .article { font-size: 15px; }
  .article h1 { font-size: clamp(35px, 10vw, 48px); }
  .article h2 { font-size: 26px; }
  .article-lead { margin-bottom: 28px; padding-bottom: 27px; }
  .article-lead > p:not(.eyebrow) { font-size: 16px; }
  .controls li { grid-template-columns: 1fr; gap: 7px; }
  .info-footer { flex-wrap: wrap; padding: 24px 20px; gap: 16px; }
  .info-footer .info-nav a { padding: 0 7px; }
  .info-footer .info-nav a:first-child { padding-left: 0; }
  .info-footer p { max-width: 100%; }
  .not-found .article { margin: 60px auto; padding: 0 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
