/* RPG layer styles. Everything is scoped to body.rpg so Classic view is the untouched original UI. */
@font-face { font-family: "PressStart2P"; src: url("../fonts/PressStart2P-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "VT323"; src: url("../fonts/VT323-Regular.ttf") format("truetype"); font-display: swap; }
:root { --px: "PressStart2P", "Courier New", monospace; --vt: "VT323", "Courier New", monospace; --ink: #140e1c; --win1: #2b3a9e; --win2: #121a58; --gold: #ffd84a; --parch: #f6ecd3; --parch2: #eadbb5; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
canvas.pix, .pix { image-rendering: pixelated; image-rendering: crisp-edges; }
.gold-chip, .music-btn { display: none; }
body.rpg .gold-chip { display: inline-flex; }
body.rpg .music-btn { display: inline-block; }
.music-btn.off { opacity: .55; text-decoration: line-through; }
.coin { display: inline-block; width: 12px; height: 12px; background: radial-gradient(circle at 35% 35%, #fff3b0 0 18%, #ffd84a 20% 55%, #c8901a 57% 100%); border: 2px solid var(--ink); border-radius: 50%; vertical-align: -1px; }

/* ---------- frames & buttons ---------- */
.pix-frame { background: linear-gradient(180deg, var(--win1), var(--win2)); color: #f4f1ff; border: 3px solid #f4f1ff; border-radius: 6px; box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px rgba(0,0,0,.35); }
.pix-frame a { color: var(--gold); }
.pbtn { display: inline-flex; align-items: center; gap: 6px; font-family: var(--px); font-size: .62rem; line-height: 1.5; padding: 9px 12px; color: #fff; background: #3b4bb8; border: 2px solid #f4f1ff; box-shadow: 0 0 0 2px var(--ink), 0 3px 0 2px var(--ink); border-radius: 3px; cursor: pointer; text-decoration: none; letter-spacing: .02em; }
.pbtn:hover { filter: brightness(1.15); text-decoration: none; }
.pbtn:active { transform: translateY(2px); box-shadow: 0 0 0 2px var(--ink), 0 1px 0 2px var(--ink); }
.pbtn.primary { background: #c0283c; }
.pbtn.small { font-size: .55rem; padding: 7px 9px; }
.pbtn.tiny { font-size: .52rem; padding: 6px 8px; }
.pbtn[disabled] { filter: grayscale(.8) brightness(.8); cursor: not-allowed; }
.pbtn:focus-visible, .b-cmd:focus-visible, .rd-choice:focus-visible, .t-item:focus-visible, .ql-item:focus-visible, .region-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.kicker { font-family: var(--px); font-size: .55rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }

/* ---------- body.rpg shell ---------- */
body.rpg { background: #0d0b1a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='1' height='1' x='3' y='5' fill='%23ffffff' fill-opacity='.05'/%3E%3C/svg%3E"); }
body.rpg .topbar { background: linear-gradient(180deg, #232c7a, #141a52); border-bottom: 3px solid var(--ink); box-shadow: 0 3px 0 #f4f1ff33; color: #fff; }
body.rpg .brand { font-family: var(--px); font-size: .7rem; color: var(--gold); text-shadow: 2px 2px 0 var(--ink); }
body.rpg .brand-logo { font-size: 1.1rem; }
body.rpg .icon-btn { background: #2b3a9e; border: 2px solid #f4f1ff; box-shadow: 0 0 0 2px var(--ink); color: #fff; border-radius: 4px; }
body.rpg #searchInput { background: #0f1440; color: #fff; border: 2px solid #8090ff; border-radius: 4px; font-family: var(--vt); font-size: 1.15rem; padding: 5px 12px; }
body.rpg .track-chip, body.rpg .xp-chip, body.rpg .streak-chip, body.rpg .gold-chip { font-family: var(--px); font-size: .55rem; background: #0f1440; border: 2px solid #8090ff; color: #fff; border-radius: 4px; }
.gold-chip { align-items: center; gap: 6px; padding: 6px 9px; color: #fff; text-decoration: none; white-space: nowrap; }
.gold-chip:hover { text-decoration: none; filter: brightness(1.2); }
body.rpg .menu-btn { display: inline-block; }
body.rpg .sidebar { position: fixed; left: 0; top: var(--top-h); z-index: 20; transform: translateX(-105%); transition: transform .2s; box-shadow: 4px 0 0 var(--ink); background: #11163f; color: #e8eaff; }
body.rpg.menu-open .sidebar { transform: none; }
body.rpg .content { margin: 0 auto; max-width: 1040px; }
body.rpg.rpg-full .content { max-width: none; padding: 0; margin: 0; }
body.rpg.rpg-lock { overflow: hidden; }

/* ---------- dialogue ---------- */
.rpg-dialog { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(860px, calc(100vw - 24px)); z-index: 60; }
.rpg-dialog.in-host { position: absolute; }
.rd-box { display: flex; gap: 14px; padding: 14px 16px 16px; min-height: 120px; outline: none; cursor: pointer; }
.rd-portrait { flex: none; width: 70px; height: 62px; background: #0d1240; border: 2px solid #f4f1ff; box-shadow: 0 0 0 2px var(--ink); display: grid; place-items: center; }
.rd-portrait canvas { width: 64px; height: 56px; image-rendering: pixelated; }
.rd-main { flex: 1; min-width: 0; position: relative; }
.rd-name { font-family: var(--px); font-size: .6rem; color: var(--gold); margin-bottom: 6px; }
.rd-text { font-family: var(--vt); font-size: 1.55rem; line-height: 1.15; min-height: 2.4em; }
.rd-text strong { color: #ffe9a8; }
.rd-text code { background: #0d1240; color: #9df0b4; font-size: .85em; }
.rd-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.rd-choice, .t-item, .b-cmd { text-align: left; font-family: var(--vt); font-size: 1.4rem; line-height: 1.1; color: #fff; background: transparent; border: 0; padding: 4px 8px 4px 26px; position: relative; cursor: pointer; border-radius: 3px; }
.rd-choice::before, .t-item::before { content: "▶"; position: absolute; left: 6px; color: var(--gold); opacity: 0; font-size: .9em; }
.rd-choice:hover, .rd-choice:focus, .t-item:hover, .t-item:focus { background: #ffffff1f; outline: none; }
.rd-choice:hover::before, .rd-choice:focus::before, .t-item:hover::before, .t-item:focus::before { opacity: 1; }
.rd-more { position: absolute; right: 0; bottom: -8px; color: var(--gold); animation: rd-bob .8s steps(2) infinite; }
.rd-more[hidden] { display: none; }
@keyframes rd-bob { 50% { transform: translateY(3px); } }

/* ---------- overworld ---------- */
.rpg-world { position: relative; height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); overflow: hidden; background: #0b0a12; user-select: none; -webkit-user-select: none; touch-action: none; }
.w-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; outline: none; cursor: pointer; }
.w-hud { position: absolute; left: 12px; top: 12px; padding: 8px 12px; max-width: min(340px, 60vw); }
.w-reg { font-family: var(--px); font-size: .62rem; color: var(--gold); line-height: 1.5; }
.w-zone, .w-prog { font-family: var(--vt); font-size: 1.2rem; line-height: 1.1; }
.w-actions { position: absolute; right: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 60vw; }
.w-banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); font-family: var(--px); font-size: clamp(.8rem, 2.4vw, 1.2rem); color: #fff; text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink); opacity: 0; transition: opacity .4s; pointer-events: none; white-space: nowrap; }
.w-banner.show { opacity: 1; }
.w-log { position: absolute; right: 12px; top: 64px; bottom: 12px; width: min(380px, calc(100% - 24px)); overflow: auto; padding: 10px 12px; z-index: 5; }
.w-log[hidden] { display: none; }
.w-log-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--px); font-size: .62rem; color: var(--gold); margin-bottom: 8px; }
.ql-zone summary { cursor: pointer; display: flex; justify-content: space-between; gap: 8px; font-family: var(--vt); font-size: 1.3rem; color: var(--gold); padding: 4px 0; }
.ql-zone ol { list-style: none; margin: 0 0 8px; padding: 0; }
.ql-item { display: flex; gap: 8px; width: 100%; text-align: left; font-family: var(--vt); font-size: 1.2rem; line-height: 1.05; color: #fff; background: transparent; border: 0; padding: 4px 6px; cursor: pointer; border-radius: 3px; }
.ql-item:hover, .ql-item:focus { background: #ffffff1f; }
.ql-item.locked { color: #9aa0c8; }
.ql-item.done .ql-ic { color: var(--gold); }
.ql-item.current { color: var(--gold); }
.ql-item.boss .ql-ic { color: #ff6b8b; }
.ql-ic { width: 1.1em; flex: none; text-align: center; }
.dpad, .abtn { display: none; }
@media (pointer: coarse), (max-width: 760px) {
  .dpad { display: grid; position: absolute; left: 14px; bottom: 14px; grid-template: 48px 48px 48px / 48px 48px 48px; z-index: 4; opacity: .85; }
  .dp { font-size: 1.1rem; color: #fff; background: #1d2366; border: 2px solid #f4f1ff; box-shadow: 0 0 0 2px var(--ink); border-radius: 6px; touch-action: none; }
  .dp.up { grid-area: 1 / 2; } .dp.left { grid-area: 2 / 1; } .dp.right { grid-area: 2 / 3; } .dp.down { grid-area: 3 / 2; }
  .abtn { display: block; position: absolute; right: 18px; bottom: 34px; width: 64px; height: 64px; border-radius: 50%; font-family: var(--px); font-size: .9rem; color: #fff; background: #c0283c; border: 3px solid #f4f1ff; box-shadow: 0 0 0 3px var(--ink); z-index: 4; touch-action: none; }
  body.rpg .rpg-dialog { bottom: 8px; }
}
@media (max-width: 760px) {
  .w-actions { top: auto; bottom: 168px; right: 10px; flex-direction: column; align-items: flex-end; }
  .w-actions .pbtn { font-size: .5rem; padding: 7px 8px; }
  .w-hud { left: 8px; top: 8px; max-width: calc(100vw - 16px); }
  .w-log { top: 8px; bottom: 8px; right: 8px; }
  .rd-text { font-size: 1.35rem; }
  .rd-portrait { width: 52px; height: 46px; } .rd-portrait canvas { width: 48px; height: 42px; }
  .rd-choice { font-size: 1.25rem; }
}

/* ---------- title ---------- */
.rpg-title { position: relative; min-height: calc(100vh - var(--top-h)); min-height: calc(100dvh - var(--top-h)); display: grid; place-items: center; overflow: hidden; }
.t-bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; object-fit: cover; }
.t-inner { position: relative; text-align: center; padding: 24px 16px 40px; width: min(720px, 100%); }
.t-logo { margin: 0 0 10px; display: flex; flex-direction: column; gap: 14px; }
.t-l1 { font-family: var(--px); font-size: clamp(1.4rem, 6vw, 3rem); color: var(--gold); text-shadow: 4px 4px 0 #c0283c, 8px 8px 0 var(--ink); letter-spacing: .04em; }
.t-l2 { font-family: var(--px); font-size: clamp(.7rem, 2.6vw, 1.1rem); color: #fff; text-shadow: 3px 3px 0 var(--ink); }
.t-logo.small .t-l2 { font-size: 1rem; }
.t-tag { font-family: var(--vt); font-size: 1.45rem; color: #e8e2ff; text-shadow: 2px 2px 0 var(--ink); margin: 0 auto 10px; max-width: 560px; }
.t-party { display: flex; justify-content: center; gap: 18px; margin: 6px 0 16px; min-height: 80px; }
.t-party canvas { width: 64px; height: 80px; }
.t-party .walk { animation: t-walk 1s steps(2) infinite; }
.t-party .w1 { animation-delay: .25s; } .t-party .w2 { animation-delay: .5s; } .t-party .w3 { animation-delay: .75s; }
@keyframes t-walk { 50% { transform: translateY(-4px); } }
.t-menu { display: inline-flex; flex-direction: column; text-align: left; padding: 12px 14px; min-width: min(420px, 100%); gap: 2px; }
.t-item .small { font-family: var(--px); font-size: .5rem; color: var(--gold); margin-left: 6px; }
.t-foot { font-family: var(--vt); font-size: 1.15rem; color: #b8b0e0; margin-top: 16px; }
.prologue .t-inner { width: 100%; height: calc(100vh - var(--top-h)); }
.pro-host { position: relative; height: 70%; }
.pro-host .rpg-dialog { bottom: 0; }

/* ---------- pages (hero, choose, guild, shop) ---------- */
.pix-page { color: #f1eeff; padding-bottom: 40px; }
.pix-page h1 { font-family: var(--px); font-size: clamp(1rem, 3.2vw, 1.5rem); line-height: 1.5; color: #fff; text-shadow: 3px 3px 0 var(--ink); }
.pix-page h2, .g-h2 { font-family: var(--px); font-size: .8rem; line-height: 1.6; color: var(--gold); text-shadow: 2px 2px 0 var(--ink); margin: 22px 0 12px; }
.pix-page .lead, .pix-page p { font-size: 1rem; }
.pix-page .muted { color: #b8b0e0; }
.carry { padding: 10px 14px; }
.hero-cols { display: grid; grid-template-columns: 1fr 260px; gap: 22px; align-items: start; }
.hf-name { display: flex; flex-direction: column; gap: 6px; font-family: var(--px); font-size: .6rem; color: var(--gold); margin-bottom: 14px; }
.hf-name input { font-family: var(--vt); font-size: 1.6rem; padding: 6px 12px; background: #0f1440; color: #fff; border: 2px solid #f4f1ff; box-shadow: 0 0 0 2px var(--ink); border-radius: 3px; max-width: 340px; }
.cls-pick, .look-pick { border: 0; padding: 0; margin: 0 0 16px; }
.cls-pick legend, .look-pick legend { font-family: var(--px); font-size: .6rem; color: var(--gold); margin-bottom: 8px; }
.cls-card { display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin-bottom: 12px; cursor: pointer; }
.cls-card input { position: absolute; opacity: 0; }
.cls-card:has(input:checked) { background: linear-gradient(180deg, #8a2333, #4a1020); }
.cls-card:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 3px; }
.cls-txt { display: flex; flex-direction: column; gap: 2px; }
.cls-txt strong { font-family: var(--px); font-size: .62rem; line-height: 1.6; }
.cls-txt .perk b { color: var(--gold); }
.cls-spr canvas { width: 48px; height: 60px; }
.swatches { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.swatches > .small { width: 3.5em; }
.sw input { position: absolute; opacity: 0; }
.sw span { display: block; width: 30px; height: 30px; border: 2px solid #f4f1ff; box-shadow: 0 0 0 2px var(--ink); border-radius: 3px; cursor: pointer; }
.sw input:checked + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.sw input:focus-visible + span { outline: 3px dashed #fff; outline-offset: 2px; }
.hero-right { padding: 16px; text-align: center; position: sticky; top: calc(var(--top-h) + 12px); }
.hero-preview { min-height: 170px; display: grid; place-items: center; background: repeating-conic-gradient(#1c2470 0 25%, #222a7c 0 50%) 0 0/24px 24px; border: 2px solid var(--ink); }
.hero-preview canvas { width: 128px; height: 160px; }
.hp-name { font-family: var(--px); font-size: .75rem; margin-top: 12px; color: var(--gold); }
.hero-actions { display: flex; gap: 12px; margin-top: 10px; }
.hf-err { color: #ff9aa9; min-height: 1.2em; }
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.region-card { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 14px; cursor: pointer; font: inherit; }
.region-card:hover { filter: brightness(1.12); }
.region-card.is-current { background: linear-gradient(180deg, #8a2333, #4a1020); }
.rc-art canvas { width: 100%; height: auto; max-width: 192px; border: 2px solid var(--ink); }
.rc-name { font-family: var(--px); font-size: .7rem; line-height: 1.5; color: var(--gold); }
.rc-track { font-family: var(--vt); font-size: 1.25rem; }
.rc-blurb { font-size: .92rem; color: #dcd6ff; }
.rc-stats { color: #b8b0e0; }
.region-card .pbtn { align-self: flex-start; }
.g-head { display: flex; gap: 22px; padding: 16px 18px; align-items: center; flex-wrap: wrap; }
.g-hero { position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 8px; background: repeating-conic-gradient(#1c2470 0 25%, #222a7c 0 50%) 0 0/24px 24px; border: 2px solid var(--ink); }
.g-hero canvas:first-child { width: 96px; height: 120px; }
.g-pet { width: 48px; height: 40px; }
.g-id { flex: 1; min-width: 240px; }
.g-id h1 { margin: 4px 0; }
.g-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 12px; font-family: var(--vt); font-size: 1.25rem; }
.g-acts { display: flex; flex-wrap: wrap; gap: 10px; }
.g-id .xpbar { background: #0d1240; border: 2px solid var(--ink); height: 12px; }
.g-id .xpbar span { background: linear-gradient(90deg, #3ddc97, #ffd84a); }
.g-id .xp-meta { color: #c8c2f0; }
.g-mapwrap { margin-top: 22px; padding: 12px 14px 16px; }
.g-mapwrap h2 { margin-top: 4px; }
.g-map { position: relative; }
.g-world { width: 100%; height: auto; image-rendering: pixelated; border: 2px solid var(--ink); display: block; }
.g-pin { position: absolute; transform: translate(-50%, 0); font-family: var(--px); font-size: .5rem; line-height: 1.4; color: #fff; background: #141a52e6; border: 2px solid #f4f1ff; padding: 5px 7px; border-radius: 3px; cursor: pointer; white-space: nowrap; box-shadow: 0 0 0 2px var(--ink); }
.g-pin.active { background: #c0283c; color: #fff; }
.g-journal { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.g-quest { padding: 12px 14px; }
.g-quest header { display: flex; gap: 10px; align-items: center; }
.g-quest h3 { font-family: var(--px); font-size: .6rem; line-height: 1.5; margin: 0; color: var(--gold); }
.g-quest .rc-art canvas { width: 96px; }
.g-quest .tag { margin-left: auto; font-family: var(--px); font-size: .45rem; background: #c0283c; padding: 4px 6px; border: 2px solid #fff; }
.g-quest.is-focus { background: linear-gradient(180deg, #8a2333, #4a1020); }
.g-quest .pbar { background: #0d1240; border: 2px solid var(--ink); height: 10px; margin: 10px 0 4px; }
.g-relics { margin-top: 22px; padding: 12px 14px; }
.relic-row { display: flex; flex-wrap: wrap; gap: 8px; }
.relic { width: 40px; height: 40px; display: grid; place-items: center; font-size: 1.3rem; background: #0d1240; border: 2px solid #5a64b8; border-radius: 4px; color: #5a64b8; font-family: var(--px); }
.relic.got { border-color: var(--gold); background: #2b2a6e; box-shadow: 0 0 8px #ffd84a66; }
.g-settings { margin-top: 22px; padding: 12px 14px; }
.g-settings .settings { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.g-epilogue { margin-top: 22px; padding: 12px 16px; background: linear-gradient(180deg, #8a6a1a, #3d2a08); }
.g-archive { margin-top: 22px; padding: 10px 14px; }
.g-archive > summary { cursor: pointer; font-family: var(--px); font-size: .6rem; line-height: 1.6; color: var(--gold); }
.g-archive-body { margin-top: 12px; color: var(--text); }
.g-archive .hq-hero, .g-archive .hq-tracks, .g-archive h2.section-title { display: none; }
.rpg-shop .shop-head { display: flex; gap: 18px; align-items: center; padding: 14px 16px; flex-wrap: wrap; }
.shop-head > div:nth-child(2) { flex: 1; min-width: 240px; }
.shop-keeper canvas { width: 64px; height: 80px; }
.shop-preview { display: flex; align-items: flex-end; gap: 6px; padding: 8px; background: repeating-conic-gradient(#1c2470 0 25%, #222a7c 0 50%) 0 0/24px 24px; border: 2px solid var(--ink); }
.shop-preview canvas:first-child { width: 96px; height: 120px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.shop-item { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; align-items: flex-start; }
.shop-item strong { font-family: var(--px); font-size: .55rem; line-height: 1.5; color: var(--gold); }
.shop-item .small { color: #d0caff; flex: 1; }
.si-art canvas { width: 48px; height: auto; }
.shop-item.equipped { background: linear-gradient(180deg, #2f7a4a, #123a22); }

/* ---------- battle ---------- */
.rpg-battle { max-width: 900px; margin: 0 auto; padding: 14px 12px 24px; }
body.rpg.rpg-full .rpg-battle { min-height: calc(100vh - var(--top-h)); overflow: auto; }
.b-stage { position: relative; aspect-ratio: 16 / 9; border: 3px solid #f4f1ff; box-shadow: 0 0 0 3px var(--ink); border-radius: 6px; overflow: hidden; background: #000; }
.b-bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.b-enemy { position: absolute; right: 6%; top: 8%; display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 10px; }
.b-enemy .b-espr { margin-top: 10%; }
.b-espr, .b-hspr { position: relative; }
.b-espr canvas { width: clamp(84px, 18vw, 140px); height: auto; }
.b-boss { width: clamp(110px, 26vw, 200px) !important; }
.b-hero { position: absolute; left: 7%; bottom: 6%; display: flex; align-items: flex-end; gap: 12px; }
.b-hspr canvas { width: clamp(56px, 11vw, 88px); height: auto; }
.b-plate { padding: 6px 10px; min-width: 150px; max-width: 46vw; }
.b-name { font-family: var(--px); font-size: clamp(.45rem, 1.3vw, .6rem); line-height: 1.5; color: var(--gold); }
.hpbar { display: block; height: 10px; background: #0d1240; border: 2px solid var(--ink); margin: 5px 0 2px; position: relative; }
.hpbar > span { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #6cf08f, #2fb35a); transition: width .4s steps(6); }
.hpbar.low > span { background: linear-gradient(180deg, #ff8a8a, #d9334a); }
.hpbar.mini { display: inline-block; width: 120px; vertical-align: middle; margin: 0 6px 0 0; }
.b-hpnum { font-family: var(--vt); font-size: 1.1rem; line-height: 1; }
.hearts { display: inline-flex; gap: 4px; margin-top: 4px; }
.heart { width: 16px; height: 14px; background: #ff3355; clip-path: polygon(0 25%, 25% 0, 50% 20%, 75% 0, 100% 25%, 100% 50%, 50% 100%, 0 50%); filter: drop-shadow(0 0 0 #000); }
.heart.empty { background: #3a3f6a; }
.b-window { margin-top: 14px; padding: 12px 16px 14px; }
.b-msg { font-family: var(--vt); font-size: 1.5rem; line-height: 1.15; min-height: 2.6em; }
.b-msg strong { color: #ffe9a8; }
.b-msg code { background: #0d1240; color: #9df0b4; font-size: .85em; }
.b-msg .small, .b-explain { font-size: 1.15rem; color: #d6d0ff; display: inline-block; margin-top: 4px; }
.b-explain { border-left: 3px solid var(--gold); padding-left: 8px; }
.b-qn { font-family: var(--px); font-size: .55rem; color: var(--gold); display: block; margin-bottom: 6px; }
.b-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 12px; }
.b-cmd { padding-left: 26px; }
.b-cmd .cur { position: absolute; left: 6px; color: var(--gold); opacity: 0; }
.b-cmd:hover .cur, .b-cmd:focus .cur { opacity: 1; }
.b-cmd:hover, .b-cmd:focus { background: #ffffff1f; outline: none; }
.b-cmd .k { font-family: var(--px); font-size: .55rem; color: var(--gold); margin-right: 4px; }
.b-cmd.primary { color: var(--gold); }
.b-cmd.right { background: #2f7a4a; }
.b-cmd.wrong { background: #8a2333; }
.b-cmd[disabled] { cursor: default; }
.b-cmd[disabled]:not(.right):not(.wrong) { opacity: .5; }
.b-objs { list-style: none; padding: 0; margin: 8px 0 0; font-family: var(--vt); font-size: 1.2rem; columns: 2; }
.b-objs li.ok { color: #9df0b4; }
.b-result .b-big { font-family: var(--px); font-size: 1.1rem; color: var(--gold); text-shadow: 3px 3px 0 var(--ink); margin-bottom: 6px; }
.b-result .b-big.bad { color: #ff8a9a; }
.loot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.loot .chip { font-family: var(--px); font-size: .55rem; background: #0d1240; border: 2px solid #f4f1ff; padding: 6px 8px; border-radius: 3px; }
.perk { color: #9df0ff; }
.dmg { position: absolute; left: 50%; top: 10%; font-family: var(--px); font-size: .9rem; color: #fff; text-shadow: 2px 2px 0 var(--ink); animation: dmg .9s ease-out forwards; pointer-events: none; white-space: nowrap; }
.dmg.bad { color: #ff6b8b; } .dmg.heal { color: #6cf08f; }
@keyframes dmg { from { transform: translate(-50%, 0); opacity: 1; } to { transform: translate(-50%, -36px); opacity: 0; } }
.hit { animation: hit .45s steps(3); }
@keyframes hit { 0%, 100% { transform: none; filter: none; } 33% { transform: translateX(6px); filter: brightness(3); } 66% { transform: translateX(-6px); } }
.hurt { animation: hurt .45s steps(3); }
@keyframes hurt { 0%, 100% { filter: none; } 50% { filter: brightness(.4) sepia(1) hue-rotate(-50deg) saturate(6); } }
.shake { animation: shake .4s steps(4); }
@keyframes shake { 25% { transform: translate(4px, -2px); } 50% { transform: translate(-4px, 2px); } 75% { transform: translate(3px, 1px); } }
canvas.fallen { filter: grayscale(1) brightness(.6); transform: translateY(12px) rotate(8deg); transition: transform .5s, filter .5s; }
.rpg-victory .v-icon canvas { width: 120px; height: auto; image-rendering: pixelated; }
.rpg-victory .victory { background: linear-gradient(180deg, var(--win1), var(--win2)); color: #fff; border: 3px solid #f4f1ff; box-shadow: 0 0 0 3px var(--ink); }
.rpg-victory .victory h2, .rpg-victory .v-kicker { font-family: var(--px); color: var(--gold); line-height: 1.5; }
.v-gold { font-family: var(--px); font-size: .7rem; color: var(--gold); }

/* ---------- classic pages inside the RPG ---------- */
.rpg-crumb { display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin-bottom: 18px; flex-wrap: wrap; }
.rc-place { flex: 1; font-family: var(--px); font-size: .62rem; line-height: 1.5; color: var(--gold); }
body.rpg .content > :not(.rpg-world):not(.rpg-battle):not(.rpg-title):not(.pix-page):not(.rpg-crumb) { }
body.rpg main.content { color: #ecebff; }
body.rpg article.lesson { --card: #fbf4e0; --card2: #efe3c4; --text: #2b2118; --muted: #6b5a45; --border: #d3bf94; --inline-code: #eadbb5; --accent: #9a3b12; --note-bg: #efe6cd; --warn-bg: #f7e6b8;
  background: var(--parch); color: var(--text); padding: 18px clamp(14px, 3.5vw, 40px) 30px; border: 3px solid #7a5a32; box-shadow: 0 0 0 3px var(--ink), inset 0 0 40px #c9a86a55, 0 8px 0 3px rgba(0,0,0,.4); border-radius: 4px; position: relative; }
body.rpg article.lesson::before, body.rpg article.lesson::after { content: ""; position: absolute; left: -10px; right: -10px; height: 14px; background: linear-gradient(180deg, #c9a86a, #8a6a3a); border: 3px solid var(--ink); border-radius: 8px; }
body.rpg article.lesson::before { top: -12px; } body.rpg article.lesson::after { bottom: -12px; }
body.rpg article.lesson h1 { font-family: var(--px); font-size: clamp(.95rem, 2.6vw, 1.35rem); line-height: 1.55; color: #3a1d0a; }
body.rpg article.lesson h2 { font-family: var(--vt); font-size: 2rem; color: #5a2a0e; letter-spacing: .01em; }
body.rpg article.lesson h3 { font-family: var(--vt); font-size: 1.55rem; color: #5a2a0e; }
body.rpg article.lesson .crumbs a, body.rpg article.lesson a { color: var(--accent); }
body.rpg .boss-tag { font-family: var(--px); font-size: .6em; }
.quest-head { display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin: 0 0 18px; flex-wrap: wrap; }
.quest-head.boss { background: linear-gradient(180deg, #5a1e3a, #2a0c1c); }
.qh-portrait canvas { width: 48px; height: auto; background: #0d1240; border: 2px solid #f4f1ff; }
.qh-txt { flex: 1; min-width: 200px; }
.qh-who { font-family: var(--vt); font-size: 1.3rem; line-height: 1.1; margin-top: 4px; color: #fff; }
.qh-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.quiz-battle-link { vertical-align: middle; margin-left: 8px; }
body.rpg .content > .card, body.rpg .content section.card, body.rpg .content .roi-tool > .card, body.rpg .content .daily, body.rpg .content .badge-card { color: var(--text); }
body.rpg .content h1:not(.t-logo) { font-family: var(--px); font-size: clamp(.95rem, 2.6vw, 1.35rem); line-height: 1.55; }
body.rpg .content h2 { font-family: var(--vt); font-size: 1.9rem; }
body.rpg .game-pop { font-family: var(--vt); font-size: 1.25rem; border: 3px solid #f4f1ff; box-shadow: 0 0 0 3px var(--ink); background: linear-gradient(180deg, var(--win1), var(--win2)); color: #fff; border-radius: 6px; }
body.rpg .game-pop .gp-kicker { font-family: var(--px); font-size: .5rem; color: var(--gold); }
body.rpg .toast { font-family: var(--vt); font-size: 1.3rem; border: 3px solid #f4f1ff; box-shadow: 0 0 0 3px var(--ink); background: #141a52; color: #fff; border-radius: 4px; }

@media (max-width: 860px) { .hero-cols { grid-template-columns: 1fr; } .hero-right { position: static; order: -1; } .b-menu { grid-template-columns: 1fr; } .b-objs { columns: 1; } }
@media (max-width: 640px) {
  body.rpg .brand span:last-child { display: none; }
  body.rpg .track-chip { display: none; }
  .b-plate { min-width: 110px; padding: 4px 6px; }
  .b-enemy { right: 3%; top: 4%; } .b-hero { left: 3%; bottom: 4%; }
  .b-msg { font-size: 1.3rem; } .rd-choice, .b-cmd { font-size: 1.25rem; }
  .g-pin { font-size: .4rem; padding: 3px 4px; }
  .t-party canvas { width: 48px; height: 60px; }
}
@media (max-width: 420px) { body.rpg .view-btn, body.rpg .music-btn { width: 32px; } body.rpg .gold-chip { padding: 5px 6px; } }
@media (prefers-reduced-motion: reduce) {
  .hit, .hurt, .shake, .t-party .walk, .rd-more, .dmg { animation: none !important; }
  .w-banner, canvas.fallen, .hpbar > span { transition: none; }
}

/* ---- crowded top bar at mid widths ---- */
@media (max-width: 1180px) {
  body.rpg .topbar .py-status { display: none; }
  body.rpg .topbar .brand-logo { display: none; }
}
