:root {
  --bg: #0c0b15; --panel: #151425; --panel2: #1b1a2b; --ink: #f7f1e8;
  --muted: #aaa6bd; --muted2: #898498; --stroke: #383449;
  --pink: #ff7ab4; --mint: #7df2cf; --yellow: #ffcc72; --bad: #fc7890;
  --main-width: 1120px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(ellipse 68% 600px at 70% 3%, #242038 0%, transparent 76%),
  radial-gradient(ellipse 45% 700px at 0 58%, #181327 0%, transparent 90%), var(--bg);
  color: var(--ink); font-family: ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  letter-spacing: .002em; line-height: 1.54; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, svg g:focus-visible, #play:focus-visible, #puzzle-name:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
a { color: var(--mint); }
.skip { position: absolute; left: 10px; top: -100px; z-index: 10; padding: 8px 16px; background: white; color: black; }
.skip:focus { top: 10px; }
.site-shell { width: min(calc(100% - 40px), var(--main-width)); margin: 0 auto; }
.topbar { height: 85px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid #4b445d; font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.brand-symbol { font-size: 29px; color: var(--yellow); font-weight: 300; }
.faint { color: var(--muted2); } .edition { margin-left: auto; color: var(--muted2); font-size: 10px; }
.hero { padding: 62px 0 47px; max-width: 850px; }
.hero-kicker, .eyebrow { font-size: 11px; font-weight: 850; letter-spacing: .17em; color: var(--yellow); text-transform: uppercase; }
.kicker-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; background: var(--yellow); box-shadow: 0 0 14px var(--yellow); }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { letter-spacing: -.055em; }
h1 { font-size: clamp(54px, 8.6vw, 111px); line-height: .98; margin: 18px 0 28px; font-weight: 880; }
h1 em { color: var(--pink); font-style: normal; }
.period { color: var(--yellow); }
.hero > p { max-width: 740px; font-size: clamp(18px, 2.4vw, 22px); color: #c8c3d1; line-height: 1.56; }
.hero strong { color: white; }
.hero-instruction { border-left: 2px solid var(--mint); padding-left: 16px; margin-top: 25px; color: #b8b7c9; font-size: 13px; }
.chapter-nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-bottom: 11px; }
.chapter-button { text-align: left; border: 1px solid var(--stroke); background: #181626; color: #d3cfdf; padding: 15px 16px; border-radius: 13px 13px 3px 3px; min-height: 80px; transition: background .15s,border .15s; }
.chapter-button:hover { background: #242137; }
.chapter-button.selected { border-color: var(--pink); border-bottom: 3px solid var(--pink); background: #2d2237; color: white; }
.chapter-button .chapter-no { display: block; color: var(--yellow); font-size: 10px; letter-spacing: .12em; font-weight: 750; margin-bottom: 3px; }
.chapter-button strong { display: block; font-size: 14px; }
.game { border-radius: 4px 4px 16px 16px; border: 1px solid var(--stroke); background: linear-gradient(125deg,#181526, #131322 75%); overflow: hidden; }
.game-head { display: flex; justify-content: space-between; padding: 30px 35px 20px; gap: 20px; align-items: flex-start; }
.game-head h2 { font-size: clamp(29px, 3.9vw, 42px); margin: 5px 0 7px; line-height: 1.1; }
.puzzle-story { color: var(--muted); max-width: 580px; margin: 0; font-size: 15px; }
.score-tile { flex-shrink: 0; min-width: 150px; padding: 12px 16px; border-radius: 10px; border: 1px solid #504354; background: #2a2034; text-align: center; }
.score-tile span, .oracle-number span { color: #cbbdd0; font-size: 10px; font-weight: 750; letter-spacing: .12em; display: block; }
.score-tile strong { display: block; font-size: 36px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.score-tile small { display: block; font-size: 11px; color: var(--muted); }
.playfield { margin: 0 20px; background: radial-gradient(ellipse at center, #252137 0%,#181525 70%); border: 1px solid #373247; border-radius: 13px; padding: 12px 12px 20px; }
.playfield-heading { display: flex; align-items: center; gap: 9px; font-size: 10px; letter-spacing: .15em; color: var(--yellow); font-weight: 800; padding: 8px 13px; }
.playfield-icon { font-size: 23px; line-height: 10px; }
.quiet { margin-left: auto; color: var(--muted2); font-size: 11px; font-weight: 400; letter-spacing: 0; }
#graph { display: block; width: 100%; max-height: 370px; touch-action: manipulation; overflow: visible; }
#graph .graph-edge { stroke-width: 6; stroke-linecap: round; transition: stroke .2s; }
#graph .edge-good { stroke: var(--mint); filter: drop-shadow(0 0 4px rgba(125,242,207,.4)); }
#graph .edge-bad { stroke: #6c485d; stroke-dasharray: 7 9; }
#graph .edge-label-bg { fill: #151425; stroke: #4a425a; }
#graph .edge-label { fill: var(--ink); font-size: 18px; text-anchor: middle; dominant-baseline: central; font-weight: 800; }
#graph .node-hit { cursor: pointer; }
#graph .node-halo { fill: none; stroke: rgba(255,255,255,.13); stroke-width: 3; }
#graph .node-core { stroke: rgba(255,255,255,.47); stroke-width: 2; }
#graph .node-title { font-size: 21px; font-weight: 850; fill: #14121c; text-anchor: middle; }
#graph .node-number { font-size: 12px; font-weight: 750; fill: #251d2d; text-anchor: middle; }
.node-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.node-button { background: #2a283e; color: #faf6fa; border: 1px solid #554d66; border-radius: 12px; padding: 10px 13px; min-width: 115px; min-height: 50px; font-size: 13px; }
.node-button:hover { background: #37304c; }
.color-chip { display: inline-block; width: 12px; height: 12px; margin: 0 6px 0 8px; border-radius: 50%; vertical-align: middle; border: 1px solid #ffffff75; }
.rules-grid { display: grid; grid-template-columns: minmax(0,1.18fr) minmax(0,1fr); gap: 38px; padding: 34px 35px; }
h3 { font-size: 12px; letter-spacing: .12em; font-weight: 850; margin-bottom: 12px; }
.small-muted { color: var(--muted2); font-size: 12px; line-height: 1.55; }
.rule-list { list-style: none; padding: 0; margin: 20px 0 0; }
.rule-list li { display: flex; align-items: center; gap: 11px; padding: 11px 5px; border-bottom: 1px solid #332f45; font-size: 13px; }
.rule-status { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; border-radius: 50%; font-size: 12px; flex-shrink: 0; }
.rule-good .rule-status { background: #194b43; color: var(--mint); }
.rule-bad .rule-status { background: #502e40; color: var(--bad); }
.rule-description { color: #ddd7e8; }
.action { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; margin-bottom: 8px; }
.primary, .secondary, .subtle { padding: 12px 15px; border-radius: 10px; font-weight: 720; font-size: 13px; border: 1px solid transparent; min-height: 44px; }
.primary { color: #190f1b; background: var(--yellow); }
.primary:hover { background: #ffe0a2; }
.secondary { color: #eae3f7; background: #292538; border-color: #564b64; }
.secondary:hover { background: #393145; }
.subtle { color: var(--muted); background: transparent; border-color: #3a334c; }
.subtle:hover { background: #242137; }
.status { font-size: 12px; color: var(--mint); margin: 12px 0 0; min-height: 2.5em; }
.oracle { margin: 0 20px 23px; padding: 25px; border: 1px solid #766349; border-radius: 12px; background: linear-gradient(135deg,#2b2836,#222130); }
.oracle[hidden] { display: none; }
.oracle-top { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.oracle-top h3 { font-size: 24px; letter-spacing: -.04em; margin: 4px 0; }
.oracle-top p { color: #c6bfce; font-size: 13px; max-width: 580px; }
.oracle-number { border: 1px solid #766349; border-radius: 12px; padding: 13px; min-width: 105px; text-align: center; }
.oracle-number strong { font-size: 26px; color: var(--yellow); }
.histogram { margin: 15px 0 20px; }
.histogram-row { display: grid; grid-template-columns: 85px 1fr 42px; align-items: center; gap: 13px; margin: 7px 0; color: #e5dce7; font-size: 12px; font-variant-numeric: tabular-nums; }
.histogram-track { border-radius: 5px; height: 12px; background: #3b3249; overflow: hidden; }
.histogram-bar { height: 100%; border-radius: 5px; background: var(--mint); min-width: 0; }
.histogram-row.best .histogram-bar { background: var(--yellow); }
.reason { color: #f4dbb0; margin-bottom: 8px; font-size: 13px; }
.journal-section { border: 1px solid #443a52; border-radius: 15px; margin-top: 32px; padding: 32px 35px; background: #171521; }
.journal-section h2, .about h2 { font-size: 32px; line-height: 1.18; margin: 9px 0; }
.journal-section p { max-width: 730px; color: #c1bccc; font-size: 14px; }
.journal-section .journal-warning { border-left: 3px solid var(--yellow); padding: 10px 14px; color: var(--yellow); background: #242031; }
.journal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 19px 0 14px; }
.journal-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 9px; margin-bottom: 0; }
.journal-list li { border: 1px solid #393247; border-radius: 9px; padding: 10px; background: #211e2e; }
.journal-list button { width: 100%; background: none; border: none; color: #f7eff9; text-align: left; font-size: 13px; cursor: pointer; padding: 5px; }
.journal-list small { color: var(--muted); display: block; font-size: 11px; }
.journal-list button:hover { color: var(--mint); }
.about { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 67px 30px 55px; }
.about-mark { font-size: 115px; line-height: 1; color: #856a8b; font-weight: 200; }
.about p { color: #c4becd; font-size: 15px; max-width: 740px; }
.about strong { color: white; }
.about .sources { font-size: 12px; color: #aba1bb; margin-top: 24px; }
.footer { display: flex; justify-content: space-between; border-top: 1px solid #43374e; padding: 26px 0 36px; gap: 20px; color: var(--muted2); font-size: 11px; }
.footer span:first-child { color: var(--yellow); letter-spacing: .13em; font-weight: 800; white-space: nowrap; }
@media(max-width:760px) {
  .site-shell { width: min(calc(100% - 24px),var(--main-width)); }
  .topbar { height: 66px; font-size: 10px; } .edition { display: none; }
  .hero { padding: 48px 8px 36px; }
  .hero > p { font-size: 17px; }
  .chapter-button { padding: 12px; min-height: 86px; }
  .chapter-button strong { font-size: 12px; }
  .game-head { padding: 20px; flex-wrap: wrap; } .score-tile { width: 100%; }
  .playfield { margin: 0 9px; padding: 8px 0 15px; }
  .playfield-heading { font-size: 9px; } .quiet { display: none; }
  .node-button { min-width: 107px; }
  .rules-grid { grid-template-columns: 1fr; padding: 27px 21px; gap: 21px; }
  .oracle { margin: 0 9px 18px; padding: 18px; }
  .journal-section { padding: 25px 21px; }
  .about { grid-template-columns: 1fr; padding: 48px 13px; }
  .about-mark { font-size: 55px; line-height: .5; }
  .footer { flex-direction: column; }
}
@media(max-width:420px) {
  h1 { font-size: 49px; } .chapter-button .chapter-no { font-size: 9px; }
  .chapter-nav { gap: 5px; } .chapter-button { padding: 10px 8px; }
  .node-button { min-width: 85px; padding: 9px 6px; }
  .oracle-top { flex-wrap: wrap; } .oracle-number { width: 100%; }
}
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
/* v0.2: rule editing, evidence and prediction are explicit separate surfaces. */
.chapter-nav { grid-template-columns: repeat(5,minmax(0,1fr)); }
.chapter-button { padding-inline: 13px; }
.prediction-panel { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px;
  align-items: center; margin: 23px 20px 0; padding: 21px 22px;
  border: 1px solid #554363; border-radius: 13px;
  background: linear-gradient(115deg,#251f37,#1c192d); }
.prediction-panel h3 { margin-bottom: 7px; color: var(--yellow); }
.prediction-panel p { color: #d4c9dd; font-size: 13px; margin: 0; }
.prediction-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.prediction-actions button { flex: 1 1 135px; }
.prediction-actions button[aria-pressed="true"] { border-color: var(--mint); color: #1a1a26; background: var(--mint); }
.rule-list li { flex-wrap: wrap; }
.rule-list li.rule-core { border-left: 3px solid var(--yellow); padding-left: 9px; background: rgba(255,204,114,.055); }
.rule-description { flex: 1 1 160px; }
.rule-edit { font-size: 11px; color: var(--yellow); background: transparent;
  border: 1px solid #5d4b63; border-radius: 7px; padding: 6px 8px; min-height: 36px; }
.rule-edit:hover { border-color: var(--yellow); background: #322638; }
#graph .edge-core { stroke: var(--yellow); stroke-width: 9; filter: drop-shadow(0 0 6px rgba(255,204,114,.48)); }
#graph .label-core { stroke: var(--yellow); }
.repair-detail { font-size: 13px; color: #d7cee1; border-top: 1px solid #55475c; padding-top: 15px; }
.prediction-feedback { font-size: 13px; font-weight: 700; color: var(--mint); }
.oracle-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 19px 0; }
.oracle-actions button { flex: 1 1 195px; }
[hidden] { display: none !important; }
@media(max-width:950px) { .chapter-nav { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media(max-width:760px) { .prediction-panel { grid-template-columns: 1fr; margin: 16px 9px 0; padding: 17px; }
  .prediction-actions { justify-content: stretch; } }
@media(max-width:500px) { .chapter-nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .rule-edit { width: 100%; } }

/* Discovery edition: brief evidence cues and a map derived only from recorded attempts. */
.moment-banner { margin: 20px 20px 0; padding: 18px 22px; border: 1px solid var(--mint);
  border-radius: 12px; background: #18332e; animation: moment-arrive .5s ease-out; }
.moment-banner strong { display: block; color: var(--mint); font-size: 19px; letter-spacing: -.02em; }
.moment-banner p { color: #d4e7df; font-size: 13px; margin: 6px 0 0; }
.game[data-moment="contradiction"] .moment-banner { border-color: var(--yellow); background: #352d23; }
.game[data-moment="contradiction"] .moment-banner strong { color: var(--yellow); }
.game[data-moment="record"] .moment-banner { border-color: var(--pink); background: #302235; }
.game[data-moment="record"] .moment-banner strong { color: var(--pink); }
@keyframes moment-arrive { from { opacity: .45; } to { opacity: 1; } }
.journey-section { margin-top: 32px; padding: 32px 35px; border: 1px solid #514058;
  border-radius: 15px; background: linear-gradient(135deg,#201b2d,#151521); }
.journey-section h2 { font-size: 32px; margin: 8px 0; line-height: 1.2; }
.journey-section p { max-width: 750px; color: #c9c0d3; font-size: 14px; }
.journey-map { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,260px),1fr)); gap: 10px; }
.journey-card { text-align: left; min-width: 0; padding: 16px; border: 1px solid #4a4057;
  border-radius: 10px; background: #221e30; color: #d4cadf; }
.journey-card strong, .journey-card span { display: block; }
.journey-card strong { font-size: 14px; line-height: 1.4; }
.journey-card span { font-size: 12px; margin-top: 8px; color: var(--muted); }
.journey-card.recorded { border-color: #588d7b; }
.journey-card.recorded strong { color: var(--mint); }
.journey-card:hover { background: #30283e; }
.journey-closing { padding: 25px; margin-top: 22px; border: 1px solid #9c8459;
  border-radius: 12px; background: #2b2431; }
.journey-closing h3 { margin: 6px 0 12px; font-size: 27px; letter-spacing: -.04em; }
.journey-closing summary { color: var(--yellow); cursor: pointer; min-height: 44px; padding-block: 10px; }
.journey-closing li { color: #ded3e4; margin-block: 12px; font-size: 14px; }
.journey-closing details { margin-bottom: 15px; }
.journal-list { grid-template-columns: repeat(auto-fit,minmax(min(100%,260px),1fr)); }
@media(max-width:760px) { .moment-banner { margin: 16px 9px 0; padding: 17px; }
  .journey-section { padding: 25px 21px; } .journey-closing { padding: 18px; } }
@media(prefers-reduced-motion:reduce) { .moment-banner { animation: none; } }
