/* GME CHAIN · docs (the player's manual) and roadmap (the world map). Builds on base.css. */

.docs-main, .rm-main { width: min(var(--w), 100% - 2 * var(--gut)); margin-inline: auto; padding: clamp(36px, 5vw, 64px) 0 120px; }
.docs-main { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
@keyframes rm-blink { 50% { opacity: .2; } }
@keyframes rm-hop { 50% { transform: translateY(-6px); } }

/* ---------- manual contents: page numbers with dotted leaders ---------- */
.docs-side { position: sticky; top: calc(var(--nav-h) + 20px); display: grid; gap: 12px; max-height: calc(100vh - var(--nav-h) - 40px); overflow-y: auto; padding: 18px 16px; border: 2px solid var(--edge); border-radius: 18px; background: linear-gradient(180deg, #0d0d0d, #060606); counter-reset: pg; }
.docs-side::before { content: "Contents"; font: 400 1.5rem/1 var(--display); text-transform: uppercase; color: #fff; text-shadow: 0 3px 0 var(--up-deep); }
.docs-filter { width: 100%; padding: 10px 12px; border: 2px solid var(--edge); border-radius: 10px; background: #050505; font: 400 .875rem var(--mono); outline: none; }
.docs-filter:focus { border-color: var(--up); box-shadow: 0 0 0 4px var(--up-dim); }
.side-group { margin: 12px 0 4px; font: 400 .875rem/1 var(--hud); letter-spacing: .14em; text-transform: uppercase; color: var(--up); }
.docs-side ul { display: grid; gap: 0; }
.docs-side nav a { display: grid; grid-template-columns: auto minmax(8px, 1fr) auto; align-items: baseline; gap: 6px; padding: 6px 8px; border-radius: 8px; font-size: .9375rem; text-decoration: none; color: var(--fg-2); transition: color .15s, background .15s; }
.docs-side nav a[href^="#"] { counter-increment: pg; }
.docs-side nav a[href^="#"]::before { content: ""; order: 2; border-bottom: 2px dotted rgba(255, 255, 255, .16); transform: translateY(-4px); }
.docs-side nav a[href^="#"]::after { content: "P." counter(pg, decimal-leading-zero); order: 3; font: 400 .875rem/1 var(--hud); letter-spacing: .06em; color: var(--muted); }
.docs-side nav a:not([href^="#"]) { grid-template-columns: auto; color: var(--muted); }
.docs-side nav a:hover { color: var(--fg); background: rgba(255, 255, 255, .03); }
.docs-side nav a.on { color: #fff; background: rgba(255, 45, 45, .12); }
.docs-side nav a.on::after { color: var(--up); }
.docs-toggle { display: none; }
@media (max-width: 920px) {
  .docs-main { grid-template-columns: minmax(0, 1fr); }
  .docs-side { position: sticky; top: 8px; z-index: 20; max-height: none; padding: 10px; }
  .docs-side::before { display: none; }
  .docs-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 8px 10px; border: 0; background: transparent; font: 400 1.25rem var(--display); text-transform: uppercase; }
  .docs-toggle[aria-expanded="true"] span { transform: rotate(45deg); }
  .docs-side:not(.open) > :not(.docs-toggle) { display: none; }
  .docs-side.open nav { max-height: 60vh; overflow-y: auto; }
}

/* ---------- manual pages ---------- */
.doc { min-width: 0; counter-reset: sec; }
.doc-hero { display: grid; gap: 18px; padding-bottom: 44px; margin-bottom: 44px; border-bottom: 2px dashed var(--edge); }
.doc-hero h1 { font-size: clamp(2.8rem, 6.4vw, 5rem); text-shadow: 0 5px 0 var(--vio-deep); }
.doc-hero h1 em { font-style: normal; color: var(--up); }
/* key facts as a cartridge label */
.doc-facts { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 2px solid var(--edge); border-radius: 16px; background: linear-gradient(180deg, #120304, #060606); overflow: hidden; }
.doc-facts::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); }
.doc-facts div { display: grid; gap: 8px; padding: 16px 18px; border-right: 2px dashed rgba(255, 255, 255, .08); }
.doc-facts div:last-child { border-right: 0; }
.doc-facts dt { font: 400 .875rem/1.2 var(--hud); letter-spacing: .12em; text-transform: uppercase; color: var(--up); }
.doc-facts dd { font: 400 1.35rem/1.1 var(--display); color: #fff; }
@media (max-width: 720px) { .doc-facts { grid-template-columns: 1fr 1fr; } .doc-facts div:nth-child(2) { border-right: 0; } .doc-facts div:nth-child(-n+2) { border-bottom: 2px dashed rgba(255, 255, 255, .08); } }

/* every section is a numbered page: a red tab with P.xx above the title */
.doc-sec { counter-increment: sec; position: relative; display: grid; gap: 18px; padding: 30px 0 48px; margin-bottom: 8px; border-top: 3px solid #1a1a1a; scroll-margin-top: calc(var(--nav-h) + 24px); }
.doc-sec::before { content: "P." counter(sec, decimal-leading-zero); position: absolute; top: -3px; left: 0; padding: 7px 12px 6px; border-radius: 0 0 8px 8px; background: var(--up); color: #fff; font: 400 .9375rem/1 var(--hud); letter-spacing: .1em; box-shadow: 0 4px 0 var(--up-deep); }
.doc-sec h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 18px; font-size: clamp(1.9rem, 3.8vw, 2.8rem); text-shadow: 0 4px 0 var(--vio-deep); }
.doc-sec h3 { margin-top: 12px; font-size: clamp(1.2rem, 2vw, 1.4rem); color: #fff; }
.doc-sec > p, .doc-sec li, .doc-sec dd { color: var(--fg-2); max-width: 72ch; }
.doc-sec strong, .doc-sec b { color: var(--fg); }
.doc a:not(.btn):not(.app-card) { color: #FF5A5A; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.doc code { padding: 1px 6px; border: 1px solid #262626; border-radius: 5px; background: #0a0a0a; color: var(--fg); font-family: var(--mono); font-size: .875em; overflow-wrap: anywhere; }
.tag-soon { font: 400 .9375rem/1 var(--hud); text-transform: uppercase; letter-spacing: .1em; color: var(--warn); text-shadow: none; }

.doc-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 2px solid var(--edge); border-radius: 16px; overflow: hidden; background: linear-gradient(180deg, #0c0c0c, #070707); font-size: .9375rem; }
.doc-table th, .doc-table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 2px dashed rgba(255, 255, 255, .07); }
.doc-table tr:last-child > * { border-bottom: 0; }
.doc-table tbody th { width: 30%; font: 400 .875rem/1.7 var(--hud); letter-spacing: .1em; text-transform: uppercase; color: var(--up); }
.doc-table thead th { font: 400 .875rem var(--hud); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: #0e0e0e; }
.doc-table td { overflow-wrap: anywhere; color: var(--fg-2); }
@media (max-width: 640px) {
  .doc-table tbody th, .doc-table td { display: block; width: auto; }
  .doc-table tbody th { border-bottom: 0; padding-bottom: 2px; }
}

/* steps as control-pad buttons */
.doc-steps { counter-reset: d; display: grid; gap: 10px; }
.doc-steps li { counter-increment: d; position: relative; min-height: 48px; padding: 12px 0 12px 64px; }
.doc-steps li::before { content: counter(d); position: absolute; left: 0; top: 4px; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFA3A3, var(--up) 50%, var(--up-deep)); color: #fff; font: 400 1.3rem/1 var(--display); box-shadow: 0 4px 0 var(--up-deep); }
.doc-list { display: grid; gap: 10px; }
.doc-list li { position: relative; padding-left: 22px; }
.doc-list li::before { content: "▶"; position: absolute; left: 0; top: .2em; font-size: .7em; color: var(--up); }

/* tips and warnings as in-game hint boxes */
.callout { display: grid; gap: 6px; padding: 16px 18px; border: 2px solid rgba(255, 45, 45, .35); border-radius: 14px; background: linear-gradient(180deg, rgba(255, 45, 45, .08), rgba(255, 45, 45, .02)); }
.callout b { font: 400 .9375rem var(--hud); letter-spacing: .1em; text-transform: uppercase; color: var(--up); }
.callout b::before { content: "HINT · "; color: var(--muted); }
.callout p { color: var(--fg-2); }
.callout.warn { border-color: rgba(255, 176, 32, .4); background: linear-gradient(180deg, rgba(255, 176, 32, .08), rgba(255, 176, 32, .02)); }
.callout.warn b { color: var(--warn); }
.callout.warn b::before { content: "WARNING · "; }
.muted-note { font-size: .9375rem; color: var(--muted) !important; }

.term { margin: 0; padding: 18px 20px; overflow-x: auto; border: 2px solid var(--edge); border-radius: 16px; background: #050505; color: var(--fg-2); font: .8125rem/1.75 var(--mono); box-shadow: inset 0 0 40px rgba(0, 0, 0, .8); }
.term code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; overflow-wrap: normal; }
.term .c { color: var(--muted); }
.doc-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.faq-list { display: grid; gap: 8px; }
.faq-list details { border: 2px solid var(--edge); border-radius: 12px; background: #0a0a0a; }
.faq-list details[open] { border-color: rgba(255, 45, 45, .45); }
.faq-list summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; font-weight: 600; cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary:hover { color: #FF5A5A; }
.faq-list summary::after { content: "+"; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--panel-2); font: 400 1.2rem/1 var(--display); color: var(--muted); transition: transform .25s var(--ease); }
.faq-list details[open] summary::after { transform: rotate(45deg); color: var(--up); }
.faq-list details p { padding: 0 16px 16px; color: var(--fg-2); }

/* glossary as item cards */
.glossary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.glossary div { padding: 16px 18px; border: 2px solid var(--edge); border-radius: 14px; background: linear-gradient(180deg, #0d0d0d, #070707); }
.glossary dt { margin-bottom: 6px; font: 400 1.35rem var(--display); text-transform: uppercase; color: #fff; }
.glossary dd { font-size: .9375rem; }
@media (max-width: 640px) { .glossary { grid-template-columns: 1fr; } }

.doc-next { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.app-card { display: grid; gap: 6px; padding: 24px; border: 2px solid var(--edge); border-radius: 20px; background: linear-gradient(180deg, #0d0d0d, #070707); text-decoration: none; box-shadow: 0 6px 0 #000; transition: border-color .2s, transform .2s var(--ease); }
.app-card:hover { border-color: var(--up); transform: translateY(-3px); }
.app-no { font: 400 .875rem var(--hud); letter-spacing: .1em; text-transform: uppercase; color: var(--up); }
.app-name { font: 400 2.6rem/1 var(--display); text-transform: uppercase; }
.app-go { color: #FF5A5A; font-weight: 600; }
@media (max-width: 560px) { .doc-next { grid-template-columns: 1fr; } }

/* ---------- roadmap: the world map ---------- */
.rm-hero { display: grid; gap: 18px; max-width: 900px; margin-bottom: clamp(44px, 6vw, 72px); }
.rm-hero h1 { font-size: clamp(2.8rem, 6.4vw, 5rem); text-shadow: 0 5px 0 var(--vio-deep); }
.rm-hero h1 em { font-style: normal; color: var(--up); }
.rm-legend { display: flex; flex-wrap: wrap; gap: 10px 26px; font-size: .9375rem; color: var(--fg-2); }
.rm-legend li { display: inline-flex; align-items: center; gap: 10px; }

.st-state { display: inline-flex; align-items: center; gap: 7px; font: 400 .9375rem/1 var(--hud); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.st-state svg { width: 15px; height: 15px; }
.st-state i { display: inline-block; }
.st-clear .st-state { color: var(--ok); }
.st-live .st-state { color: var(--ok); }
.st-live .st-state i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: rm-blink 1.2s steps(2, end) infinite; }
.st-next .st-state { color: var(--warn); }
.st-next .st-state i { width: 0; height: 0; border-left: 9px solid var(--warn); border-top: 6px solid transparent; border-bottom: 6px solid transparent; animation: rm-blink .8s steps(2, end) infinite; }
.st-lock .st-state { color: var(--muted); }

.worlds { position: relative; display: grid; gap: 28px; }
.worlds::before { content: ""; position: absolute; left: 31px; top: 40px; bottom: 40px; width: 6px; background: repeating-linear-gradient(180deg, var(--up) 0 6px, transparent 6px 14px); opacity: .55; }
.rm-world { position: relative; display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: clamp(16px, 3vw, 32px); align-items: start; }
.w-node { position: relative; z-index: 1; display: grid; place-items: center; width: 68px; height: 68px; border: 3px solid var(--edge); border-radius: 16px; background: var(--panel-2); font: 400 2.2rem/1 var(--display); color: var(--muted); box-shadow: 0 6px 0 #000; }
.is-clear .w-node { border-color: var(--ok); background: var(--ok); color: #000; box-shadow: 0 6px 0 #0B4A26; }
.is-now .w-node { border-color: var(--up); background: var(--up); color: #fff; box-shadow: 0 6px 0 var(--up-deep), 0 0 0 8px rgba(255, 45, 45, .12); animation: rm-hop 1.6s var(--ease) infinite; }
.w-card { position: relative; padding: clamp(18px, 2.6vw, 28px); border: 2px solid var(--edge); border-radius: 22px; background: linear-gradient(180deg, #0d0d0d, #060606); }
.is-now .w-card { border-color: var(--up); box-shadow: 0 0 0 1px rgba(255, 45, 45, .2), 0 0 40px rgba(255, 45, 45, .12); }
.is-locked .w-card { border-style: dashed; background: repeating-linear-gradient(135deg, #070707 0 12px, #0a0a0a 12px 24px); }
.is-locked .w-head h2, .is-locked .rm-what { color: var(--muted); }
.here { margin-bottom: 10px; font: 400 .9375rem/1 var(--hud); letter-spacing: .14em; text-transform: uppercase; color: var(--up); animation: rm-blink 1s steps(2, end) infinite; }
.w-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: end; margin-bottom: 14px; }
.w-no { grid-column: 1 / -1; font: 400 .9375rem/1 var(--hud); letter-spacing: .14em; text-transform: uppercase; color: var(--up); }
.w-head h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.w-prog { font: 400 .9375rem var(--hud); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.w-prog b { font: 400 1.6rem/1 var(--display); color: #fff; }
.w-bar { grid-column: 1 / -1; display: flex; gap: 4px; }
.w-bar i { flex: 1; height: 10px; border-radius: 2px; background: #1a1a1a; }
.w-bar i.on { background: var(--up); box-shadow: 0 0 8px rgba(255, 45, 45, .5); }
.is-clear .w-bar i.on { background: var(--ok); box-shadow: 0 0 8px rgba(59, 224, 126, .4); }
.stages { display: grid; }
.stage { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: baseline; padding: 12px 0; border-top: 2px dashed rgba(255, 255, 255, .07); }
.st-no { font: 400 1.1rem/1 var(--display); color: var(--muted); }
.st-next .st-no { color: var(--warn); }
.rm-what { color: var(--fg-2); }
.rm-what a { color: #FF5A5A; }

.rm-fixed { margin-top: clamp(40px, 6vw, 72px); padding: clamp(24px, 4vw, 44px); border: 2px solid var(--edge); border-radius: 22px; background: linear-gradient(180deg, #120304, #060606); }
.rm-fixed h2 { margin-bottom: 24px; text-shadow: 0 4px 0 var(--vio-deep); }
.rm-fixed ul { display: grid; gap: 14px; margin-bottom: 24px; }
.rm-fixed li { position: relative; padding-left: 24px; color: var(--fg-2); }
.rm-fixed li::before { content: "▶"; position: absolute; left: 0; top: .2em; font-size: .7em; color: var(--up); }
.rm-fixed b { color: var(--fg); }
.rm-fixed a { color: #FF5A5A; }
@media (max-width: 640px) {
  .worlds::before { left: 19px; }
  .rm-world { grid-template-columns: 44px minmax(0, 1fr); }
  .w-node { width: 44px; height: 44px; border-radius: 12px; font-size: 1.5rem; }
  .stage { grid-template-columns: 34px minmax(0, 1fr); }
  .stage .st-state { grid-column: 2; }
  .w-head { grid-template-columns: minmax(0, 1fr); }
  .w-head h2 { font-size: 1.5rem; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) { .is-now .w-node, .here, .st-live .st-state i, .st-next .st-state i { animation: none; } }
