/* The game wiki's faces (plan 108 round 3, skill wiki-site-design "Identity"): Inter for Latin, IBM Plex Sans Thai for
   Thai (loopless, made to pair with a Latin sans), Cinzel for English display titles. The look: theme.css; maps: atlas.css. */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url(fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-thai-thai-400-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-thai-thai-500-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-thai-thai-600-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-sans-thai-thai-700-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Cinzel'; font-weight: 600; font-display: swap; src: url(fonts/cinzel-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 700; font-display: swap; src: url(fonts/cinzel-latin-700-normal.woff2) format('woff2'); }

/* The wiki's look (plan 108 round 3; skill wiki-site-design "Identity": international, still Dragon Quest). Royal navy and
   gold as the brand, the game's window (a navy panel with a thin white inner border) for callouts, a warm paper reading
   area, an 8-px spacing grid, one type scale, Inter + IBM Plex Sans Thai, Cinzel for display titles. Light and dark.
   The pages' own parts (hero, history, tables, story, phone): pages.css. */
:root {
  --bg: #f6f4ef; --surface: #ffffff; --surface2: #f1eee6; --text: #141826; --muted: #5d6476; --border: #e3dfd4; --hair: rgba(20,24,38,.08);
  --brand: #1e3a8a; --brand2: #3159d6; --gold: #e3a92b; --gold2: #f7d774; --navy: #0b1530; --navy2: #13224d; --ink-on-navy: #eef1fa;
  --link: #2148b8; --accent: #c2410c; --accent2: #f59e0b;
  --chest: #f59e0b; --hidden: #10b981; --entry: #ef4444; --exit: #3b82f6; --travel: #a855f7; --door: #a16207; --service: #8b5cf6; --npc: #64748b;
  --ch1: #e5484d; --ch2: #e93d82; --ch3: #f08c00; --ch4: #8e4ec6; --ch5: #12a594;
  --radius: 16px; --shadow: 0 1px 2px rgba(16,24,48,.06), 0 8px 24px rgba(16,24,48,.07); --shadow2: 0 18px 44px rgba(16,24,48,.18);
  --sans: 'Inter', 'IBM Plex Sans Thai', 'Leelawadee UI', system-ui, sans-serif; --display: 'Cinzel', 'IBM Plex Sans Thai', Georgia, serif;
}
:root[data-theme="dark"] {
  --bg: #0a0f1f; --surface: #111a31; --surface2: #17223e; --text: #e8ebf4; --muted: #9aa3bd; --border: #25304f; --hair: rgba(255,255,255,.07);
  --link: #8fb0ff; --accent: #fb923c; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.35); --shadow2: 0 18px 44px rgba(0,0,0,.55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1f; --surface: #111a31; --surface2: #17223e; --text: #e8ebf4; --muted: #9aa3bd; --border: #25304f; --hair: rgba(255,255,255,.07);
    --link: #8fb0ff; --accent: #fb923c; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.35); --shadow2: 0 18px 44px rgba(0,0,0,.55);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16.5px/1.72 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html:lang(en) body { line-height: 1.6; }
h1, h2, h3 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 2.15rem; margin: 0; }
html:lang(en) h1, html:lang(en) h2 { letter-spacing: -.015em; }
h2 { font-size: 1.4rem; margin: 2.2em 0 .7em; display: flex; align-items: center; gap: 12px; }
h2 .count { font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; padding: 1px 10px; }
h3 { font-size: 1.08rem; margin: 1.4em 0 .4em; }
.display { font-family: var(--display); font-weight: 700; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; text-underline-offset: 3px; }
a.ext::after { content: '↗'; font-size: .7em; margin-left: .15em; opacity: .5; }
p { margin: .5em 0 .9em; }
.muted { color: var(--muted); } .small { font-size: .87rem; } .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.prose { max-width: 46rem; } .lead { font-size: 1.06rem; color: var(--muted); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.ic.h { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: color-mix(in srgb, var(--brand2) 12%, transparent); color: var(--brand2); }
.ic.tile { width: 56px; height: 56px; padding: 13px; border-radius: 16px; color: var(--gold2); background: linear-gradient(135deg, var(--navy2), var(--brand)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.12), var(--shadow); }
:root[data-theme="dark"] .ic.h { color: #9db4ff; }

/* Shell: a navy sidebar with gold accents, a glass top bar */
.app { display: grid; grid-template-columns: 276px 1fr; min-height: 100vh; }
.side { background: radial-gradient(120% 60% at 0% 0%, rgba(49,89,214,.35), transparent 60%), linear-gradient(180deg, var(--navy), #0e1a3a 60%, var(--navy)); color: var(--ink-on-navy); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px 40px; border-right: 1px solid rgba(255,255,255,.06); }
.side .brand { display: flex; gap: 12px; align-items: center; color: #fff; padding: 4px 8px 18px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.08); text-decoration: none; }
.side .brand b { display: block; font-family: var(--display); font-size: 1.12rem; letter-spacing: .02em; }
.side .brand small { display: block; font-size: .74rem; color: #a9b4d6; }
.side .logo { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #5b8cff, #1e3a8a); box-shadow: 0 0 0 2px var(--gold), 0 6px 16px rgba(0,0,0,.4); flex: none; }
.side .logo .ic { width: 22px; height: 22px; color: #fff; }
.side a { display: flex; gap: 10px; align-items: center; color: #d6dcf0; padding: 7px 10px; border-radius: 10px; font-size: .93rem; text-decoration: none; position: relative; }
.side a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.active { background: linear-gradient(90deg, rgba(227,169,43,.2), rgba(227,169,43,.04)); color: var(--gold2); font-weight: 600; }
.side a.active::before { content: ''; position: absolute; left: -14px; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--gold); }
.side .group { margin: 18px 0 6px; padding: 0 10px; font-size: .72rem; font-weight: 600; color: #8592b8; }
html:lang(en) .side .group { text-transform: uppercase; letter-spacing: .1em; }
.side .sub a { padding-left: 16px; font-size: .88rem; color: #b8c2e0; }
.chnum { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 7px; color: #fff; font-weight: 700; font-size: .76rem; font-family: 'Inter', sans-serif; flex: none; }
.ch1 { --c: var(--ch1); } .ch2 { --c: var(--ch2); } .ch3 { --c: var(--ch3); } .ch4 { --c: var(--ch4); } .ch5 { --c: var(--ch5); }
.chnum[class*="ch"] { background: var(--c); box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--hair); display: flex; gap: 10px; align-items: center; padding: 12px 32px; }
.top input[type=search] { flex: 1; min-width: 0; max-width: 560px; font: inherit; font-size: .95rem; padding: 9px 16px 9px 42px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a90a2' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 15px center / 18px; color: var(--text); box-shadow: var(--shadow); }
.top input[type=search]:focus { outline: 3px solid color-mix(in srgb, var(--brand2) 30%, transparent); border-color: var(--brand2); }
.top .spacer { flex: 1; }
.langs { display: inline-flex; padding: 3px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--border); flex: none; }
.langs button { font: 600 .84rem/1 var(--sans); border: 0; background: none; color: var(--muted); padding: 7px 13px; border-radius: 99px; cursor: pointer; }
.langs button.on { background: var(--navy2); color: var(--gold2); box-shadow: 0 2px 8px rgba(11,21,48,.3); }
.top button.round { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; padding: 0; flex: none; }
.top button.round.menu { display: none; }
.btn { font: inherit; font-size: .9rem; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--brand2); text-decoration: none; }
.content { padding: 26px 40px 80px; max-width: 1360px; width: 100%; }
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: 12px; } .crumbs a { color: var(--muted); }
.results { position: absolute; top: 58px; left: 32px; right: 32px; max-width: 600px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow2); max-height: 70vh; overflow: auto; padding: 6px; }
.results a { display: flex; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 9px; color: var(--text); }
.results a:hover { background: var(--surface2); text-decoration: none; }
.results .kind { font-size: .72rem; color: var(--gold2); background: var(--navy2); border-radius: 6px; padding: 1px 7px; min-width: 70px; text-align: center; }

/* The game's window: a navy panel, a thin white inner border, rounded */
.window { background: linear-gradient(180deg, #13224d, #0b1530); color: var(--ink-on-navy); border: 2px solid #f1f4fb; border-radius: 12px; box-shadow: 0 0 0 3px #0b1530, var(--shadow2); padding: 16px 20px; }
.window a { color: #b9cbff; } .window .muted { color: #a9b4d6; }
.window .win-title { display: flex; gap: 8px; align-items: center; color: var(--gold2); font-weight: 700; margin-bottom: 6px; }
.window ul { padding-left: 1.1em; margin: .4em 0 0; } .window li { margin: .35em 0; }

/* Page heads, cards, badges */
.pagehead { display: flex; gap: 18px; align-items: center; margin: 6px 0 22px; }
.pagehead .meta { margin-top: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: .9rem; }
.stat { display: inline-flex; gap: 5px; align-items: center; font-size: .88rem; color: var(--muted); }
.badge { display: inline-block; font-size: .76rem; font-weight: 500; padding: 2px 10px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge[class*="ch"] { background: color-mix(in srgb, var(--c) 12%, transparent); border-color: color-mix(in srgb, var(--c) 35%, transparent); color: var(--c); font-weight: 600; }
.badge[class*="ch"] a { color: inherit; }
.badge.opt { background: #fff1d6; border-color: #e9c27a; color: #7a5212; } .badge.curse { background: #fde8e8; border-color: #f3b4b4; color: #a12b2b; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 16px; box-shadow: var(--shadow); color: var(--text); transition: transform .18s, box-shadow .18s, border-color .18s; text-decoration: none; }
a.card:hover { transform: translateY(-4px); box-shadow: var(--shadow2); border-color: color-mix(in srgb, var(--brand2) 35%, var(--border)); text-decoration: none; }
.card h3 { margin: .6em 0 .3em; color: var(--text); }
.card img.thumb { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 11px; image-rendering: pixelated; background: #000; display: block; }
.card.chapter { border-top: 4px solid var(--c); } .card.chapter h3 { display: flex; gap: 8px; align-items: center; }
.card .meta + .meta { margin-top: 6px; }
.grid.chapters { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.people { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card.person { text-align: center; } .card.person img { width: 120px; height: 120px; object-fit: contain; border-radius: 50%; background: radial-gradient(circle, var(--surface2), transparent 70%); }
.card.person .meta { justify-content: center; }
.icon { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; margin-right: 6px; }
.icon.big { width: 84px; height: 84px; }
.hero { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.hero .prose { flex: 1 1 420px; }
.infobox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; min-width: 260px; box-shadow: var(--shadow); }
.infobox table { width: 100%; } .infobox td { padding: 5px 6px; border: 0; } .infobox td:first-child { color: var(--muted); white-space: nowrap; }
.infobox.window td:first-child { color: #a9b4d6; }
.sidebox { background: #fff7e6; border: 1px solid #f2d39b; border-radius: 12px; padding: 10px 14px; color: #4a3a1a; margin: 10px 0; }
:root[data-theme="dark"] .sidebox { background: #2d2416; color: #f1e2c2; border-color: #5c4a28; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sidebox { background: #2d2416; color: #f1e2c2; border-color: #5c4a28; } }
.profile { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; margin: 8px 0 10px; }
.profile > img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 18px; background: radial-gradient(circle at 50% 40%, #22346b, var(--navy)); padding: 18px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.1), var(--shadow2); }
.profile h1 { margin-bottom: 6px; } .profile .infobox { margin-top: 14px; display: inline-block; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 14px 0; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow); }
.stat-tile span { display: block; font-size: .78rem; color: var(--muted); } .stat-tile b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

/* The pages' own parts (plan 108 round 3): the home hero, the game's history and its versions, stat tiles, the map
   legend, chapter banners, tables, the story steps, the lightbox, and the phone layout. The shell: theme.css. */

/* Heroes: the game's pictures under a navy veil, a gold kicker, a Cinzel title */
.banner { position: relative; border-radius: 24px; overflow: hidden; min-height: 360px; display: flex; align-items: flex-end; padding: 40px; color: #fff; box-shadow: var(--shadow2); margin-bottom: 30px; isolation: isolate; }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.banner .collage { position: absolute; inset: 0; max-width: none; z-index: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.banner .collage img { position: static; width: 100%; height: 100%; object-fit: cover; }
.banner::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(8,14,36,.94), rgba(8,14,36,.6) 55%, rgba(8,14,36,.25)), linear-gradient(180deg, transparent 35%, rgba(8,14,36,.7)); }
.banner::after { content: ''; position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 4px; background: var(--c, linear-gradient(90deg, var(--ch1), var(--ch2), var(--ch3), var(--ch4), var(--ch5))); }
.banner > div:not(.collage) { position: relative; z-index: 2; max-width: 780px; }
.banner.home { min-height: 440px; }
.banner .kicker { color: var(--gold2); font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
html:lang(en) .banner .kicker { text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; }
.banner h1 { font-size: 3.3rem; line-height: 1.12; text-shadow: 0 3px 18px rgba(0,0,0,.55); background: linear-gradient(180deg, #fff 30%, #f6dc8c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.banner .subtitle { font-family: var(--display); font-size: 1.25rem; color: #e8dcb8; margin: 2px 0 10px; letter-spacing: .04em; }
.banner p { font-size: 1.06rem; color: rgba(255,255,255,.88); max-width: 640px; }
.banner .btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.banner .btns a { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 10px 18px; border-radius: 12px; backdrop-filter: blur(8px); display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: .95rem; }
.banner .btns a.primary { background: linear-gradient(135deg, #f7d774, #e3a92b); border: 0; color: #1b1406; box-shadow: 0 8px 24px rgba(227,169,43,.35); }
.banner .btns a:hover { text-decoration: none; filter: brightness(1.08); transform: translateY(-1px); }
.banner.slim { min-height: 250px; padding: 30px 34px; margin: 12px 0 24px; }
.banner.slim h1 { font-size: 2.4rem; margin: .1em 0 .2em; }
.chnum.big { min-width: 48px; height: 48px; font-size: 1.4rem; border-radius: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.35); margin-bottom: 10px; }
.meta.light, .meta.light .stat { color: rgba(255,255,255,.88); }

/* The game's history: text and the NES window side by side, then the versions as a timeline */
.about { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 32px; align-items: start; }
.about-text h2 { margin-top: .4em; } .about-text p { max-width: 46rem; }
.staff { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.staff div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.staff b { display: block; } .staff span { font-size: .84rem; color: var(--muted); }
.nes-note { margin-top: 18px; font-size: .95rem; }
.timeline-v { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; position: relative; }
.timeline-v::before { content: ''; position: absolute; left: 0; right: 0; top: 19px; height: 2px; background: linear-gradient(90deg, var(--gold), var(--brand2)); opacity: .5; }
.ver { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 44px 16px 16px; box-shadow: var(--shadow); font-size: .9rem; }
.ver::before { content: ''; position: absolute; left: 18px; top: 12px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand2); }
.ver .plat { position: absolute; top: 9px; left: 42px; font-weight: 700; font-size: .78rem; color: #fff; background: var(--brand); padding: 2px 10px; border-radius: 99px; }
.ver.fc .plat { background: #b4232c; } .ver.nes .plat { background: #3a3a3a; } .ver.ps .plat { background: #2a4ea8; } .ver.ds .plat { background: #555b66; } .ver.mobile .plat { background: #0f7a6c; }
.ver .when { font-size: .8rem; color: var(--muted); } .ver .jp { font-size: .78rem; color: var(--muted); } .ver h3 { margin: .3em 0 .1em; font-size: 1rem; } .ver .by { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.ver p { margin: 0; line-height: 1.6; }
.ver.ours { border: 2px solid var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent), var(--shadow2); }
.ver.ours::before { border-color: var(--gold); background: var(--gold2); }
.ver .ribbon { position: absolute; right: 10px; top: -11px; background: linear-gradient(135deg, #f7d774, #e3a92b); color: #1b1406; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; box-shadow: var(--shadow); }

/* Stat tiles and the map legend */
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.statgrid .card { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 16px 10px; }
.statgrid b { display: block; font-size: 1.75rem; color: var(--text); line-height: 1.15; font-variant-numeric: tabular-nums; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px 18px; padding: 18px 20px; }
.legend-row { display: flex; gap: 12px; align-items: center; font-size: .92rem; }
.legend .mk { position: static; flex: none; transform: none !important; }
.legend p { grid-column: 1 / -1; margin: 4px 0 0; }
.chapnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 0; }
.chapnav .chip { text-decoration: none; } .chapnav .chip.on { border-color: var(--c, var(--brand2)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, var(--brand2)) 30%, transparent); font-weight: 700; }

/* Tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); margin: .6em 0 1.4em; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--surface2); font-weight: 600; font-size: .8rem; color: var(--muted); z-index: 1; }
html:lang(en) th { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
tr:last-child td { border-bottom: 0; } tbody tr:hover { background: color-mix(in srgb, var(--brand2) 5%, transparent); }

/* Story */
.timeline { position: relative; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 22px; margin: 18px 0; box-shadow: var(--shadow); }
.chapter-page .step { border-left: 4px solid var(--c); }
.step.opt, .chapter-page .step.opt { border-left: 4px dashed #e3a92b; }
.step h3 { margin: 0 0 .3em; font-size: 1.15rem; display: flex; gap: 12px; align-items: center; }
.step h3 .no { display: inline-grid; place-items: center; min-width: 32px; height: 32px; border-radius: 10px; background: var(--c, var(--brand)); color: #fff; font-size: .9rem; font-family: 'Inter', sans-serif; flex: none; }
.boss { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: color-mix(in srgb, var(--ch1) 8%, transparent); border: 1px solid color-mix(in srgb, var(--ch1) 22%, transparent); border-radius: 10px; padding: 6px 12px; }
.boss .ic { color: var(--ch1); }
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 14px 0 4px; }
.pics figure { margin: 0; } .pics img { width: 100%; border-radius: 11px; image-rendering: pixelated; cursor: zoom-in; background: #000; display: block; box-shadow: var(--shadow); }
.pics figcaption { font-size: .8rem; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.pics figure.main { grid-column: span 2; }
blockquote { margin: .7em 0; padding: .6em 1.1em; border-left: 3px solid var(--gold); background: var(--surface2); border-radius: 0 12px 12px 0; white-space: pre-line; }
blockquote b { display: block; font-size: .78rem; color: var(--brand2); }
:root[data-theme="dark"] blockquote b { color: #9db4ff; }
.pager { display: flex; justify-content: space-between; margin: 24px 0; }
.lightbox { position: fixed; inset: 0; background: rgba(5,9,22,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 96vw; max-height: 84vh; image-rendering: pixelated; border-radius: 10px; }
.lightbox p { color: #eee; max-width: 900px; text-align: center; }

.foot { padding: 22px 40px 40px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--hair); max-width: 1360px; }

/* Tablets and phones */
@media (max-width: 1180px) { .timeline-v { grid-template-columns: repeat(3, minmax(0, 1fr)); } .timeline-v::before { display: none; } .about { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 82vw; max-width: 300px; z-index: 60; transform: translateX(-102%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .top { padding: 8px 16px; gap: 8px; } .top button.round.menu { display: grid; }
  .langs button { padding: 7px 9px; }
  .content { padding: 14px 16px 60px; } .foot { padding: 18px 16px 30px; }
  .pics figure.main { grid-column: auto; }
  h1 { font-size: 1.65rem; } .banner { min-height: 280px; padding: 22px; border-radius: 18px; } .banner.home { min-height: 380px; } .banner h1 { font-size: 2.2rem; }
  .banner .collage { grid-template-columns: repeat(2, minmax(0, 1fr)); } .banner .collage img:nth-child(n+3) { display: none; }
  .ic.tile { width: 46px; height: 46px; padding: 11px; }
  .timeline-v { grid-template-columns: 1fr; } .profile { grid-template-columns: 1fr; } .profile > img { max-width: 220px; }
}

/* The atlas and world canvases (plan 108, round 2; skill wiki-site-design "The place atlas"). */
.atlas { margin: 6px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: .88rem; cursor: pointer; user-select: none; box-shadow: var(--shadow); color: var(--text); font-family: inherit; }
.chip b { font-weight: 700; color: var(--muted); font-size: .8rem; }
.chip input { display: none; }
.chip.off { opacity: .45; } .chip.off .dot { background: transparent !important; }
.chip .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #0003; background: var(--d, #999); }
.chip.chest { --d: var(--chest); } .chip.hidden { --d: var(--hidden); } .chip.entry { --d: var(--entry); } .chip.stairs { --d: var(--exit); } .chip.hole { --d: #374151; }
.chip.door { --d: var(--door); } .chip.shop { --d: var(--service); } .chip.npc { --d: var(--npc); } .chip.place { --d: var(--exit); } .dot.moon { --d: #334155; }
.chip select { font: inherit; font-size: .85rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text); padding: 0 4px; }
.floorbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.floorbar .chip { box-shadow: none; } .floorbar .chip.all { background: var(--surface2); }
.hint { font-size: .84rem; color: var(--muted); margin: 6px 0 0; }

.canvas { position: relative; height: calc(100vh - 230px); min-height: 520px; border-radius: 18px; overflow: hidden; touch-action: none; cursor: grab; background: radial-gradient(120% 90% at 20% 10%, #1c2d63, #0b1530 55%, #070d22); box-shadow: var(--shadow2); border: 1px solid #0006; }
.canvas.drag { cursor: grabbing; }
.canvas .stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.canvas img.frame { position: absolute; image-rendering: pixelated; user-select: none; border-radius: 6px; box-shadow: 0 0 0 3px rgba(255,255,255,.14), 0 12px 40px rgba(0,0,0,.65); }
.canvas.smooth img.frame { image-rendering: auto; }
.canvas .overlay { position: absolute; inset: 0; pointer-events: none; }
.flabel { position: absolute; left: 0; top: 0; white-space: nowrap; font: 600 13px/1 'Sarabun', sans-serif; color: #fff; background: rgba(15,23,42,.9); border: 1px solid rgba(255,255,255,.18); padding: 5px 10px; border-radius: 8px 8px 8px 0; }
.canvas.far .flabel { font-size: 11px; padding: 3px 7px; }
svg.links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.ln { color: #7dd3fc; cursor: pointer; pointer-events: auto; }
.ln .vis { fill: none; stroke: currentColor; stroke-width: 3; stroke-opacity: .78; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.ln .hit { fill: none; stroke: transparent; stroke-width: 16; vector-effect: non-scaling-stroke; pointer-events: stroke; }
.ln.travel { color: #d8b4fe; } .ln.hole { color: #cbd5e1; } .ln.hole .vis { stroke-dasharray: 6 6; } .ln.edge, .ln.warp { color: #93c5fd; }
.ln:hover .vis { stroke-opacity: 1; stroke-width: 4; }
svg.links.focus .ln:not(.hl) .vis { stroke-opacity: .12; }
.ln.hl { color: #fde047; } .ln.hl .vis { stroke-width: 5; stroke-opacity: 1; stroke-dasharray: 14 8; animation: flow 0.8s linear infinite; filter: drop-shadow(0 0 6px rgba(253,224,71,.8)); }
@keyframes flow { to { stroke-dashoffset: -22; } }

.mk { position: absolute; left: 0; top: 0; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font: 700 12px/1 'Sarabun', sans-serif; color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.55); pointer-events: auto; cursor: pointer; background: var(--exit); }
.mk:hover { z-index: 6; filter: brightness(1.15); }
.mk.chest { background: linear-gradient(135deg, #fbbf24, #d97706); } .mk.hidden, .mk.pot { background: linear-gradient(135deg, #34d399, #059669); }
.mk.entry { background: var(--entry); } .mk.travel { background: var(--travel); } .mk.door { background: var(--door); }
.mk.shop, .mk.inn, .mk.church, .mk.vault { background: var(--service); }
.mk.hole { background: #1f2937; border-color: #9ca3af; min-width: 12px; height: 12px; padding: 0; }
.mk.npc { background: #475569; min-width: 14px; height: 14px; padding: 0; border-width: 2px; }
.mk.place { min-width: 16px; height: 16px; padding: 0; }
.mk.hl { outline: 3px solid #fde047; outline-offset: 2px; z-index: 7; animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 50% { outline-offset: 5px; } }
.mk .lbl { position: absolute; left: 18px; top: -3px; white-space: nowrap; font: 600 12px/1.3 'Sarabun', sans-serif; color: #fff; background: rgba(10,14,22,.82); padding: 2px 7px; border-radius: 6px; pointer-events: none; }
.mk.edge { background: #64748b; min-width: 20px; height: 20px; font-size: 12px; opacity: .85; }
.canvas.mid .mk { min-width: 18px; height: 18px; padding: 0 3px; font-size: 10px; border-width: 1.5px; }
.canvas.mid .mk.npc, .canvas.mid .mk.hole { min-width: 9px; height: 9px; padding: 0; }
.canvas.mid .mk.edge { min-width: 14px; height: 14px; font-size: 9px; }
.canvas.far .mk { min-width: 10px; height: 10px; padding: 0; font-size: 0; border-width: 1.5px; }
.canvas.far .mk.chest { min-width: 12px; height: 12px; }
.canvas.far .mk.npc, .canvas.far .mk.edge, .canvas.far .mk.hole { display: none; }
.canvas.far .mk .lbl, .canvas.mid .mk .lbl { display: none; }
.pulse { position: absolute; left: 0; top: 0; width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 3px solid #fde047; border-radius: 50%; animation: pulse 1.3s ease-out infinite; pointer-events: none; }
@keyframes pulse { from { scale: .5; opacity: 1; } to { scale: 1.9; opacity: 0; } }
.tip { position: absolute; z-index: 20; background: rgba(15,18,25,.96); color: #fff; font-size: .82rem; line-height: 1.45; padding: 6px 10px; border-radius: 8px; pointer-events: none; max-width: 280px; }
.zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 8; }
.zoom button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(15,23,42,.85); color: #fff; font-size: 18px; cursor: pointer; }
.zoom button:hover { background: rgba(30,41,59,.95); }

.pop { position: absolute; z-index: 15; width: 340px; max-height: calc(100% - 20px); overflow: auto; background: var(--surface); color: var(--text); border-radius: 16px; padding: 14px 16px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.5); border: 1px solid var(--border); cursor: auto; animation: popin .14s ease-out; }
@keyframes popin { from { opacity: 0; transform: translateY(6px); } }
.pop .x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; }
.pop-kind { display: inline-block; font-size: .76rem; font-weight: 700; color: #fff; background: var(--exit); padding: 2px 10px; border-radius: 99px; }
.pop-kind.chest { background: #d97706; } .pop-kind.hidden, .pop-kind.pot { background: #059669; } .pop-kind.npc { background: #475569; } .pop-kind.entry { background: var(--entry); }
.pop-kind.door { background: var(--door); } .pop-kind.shop, .pop-kind.inn, .pop-kind.church { background: var(--service); } .pop-kind.travel { background: var(--travel); } .pop-kind.hole { background: #374151; }
.pop-where { font-size: .82rem; color: var(--muted); margin: 6px 0 8px; }
.pop-item { display: flex; gap: 14px; align-items: center; background: var(--surface2); border-radius: 12px; padding: 10px; }
.pop-item img { width: 76px; height: 76px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
.pop-name { font-size: 1.12rem; font-weight: 700; }
.pop-desc { font-size: .84rem; color: var(--muted); line-height: 1.55; margin-top: 4px; }
.pop-note { font-size: .86rem; background: var(--surface2); border-left: 3px solid var(--accent2); padding: 6px 10px; border-radius: 0 8px 8px 0; margin: 10px 0 0; }
.pop-route { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; background: var(--surface2); border-radius: 12px; padding: 10px; margin-top: 8px; font-size: .9rem; }
.pop-route .arrow { font-size: 1.6rem; color: #eab308; }
.pop-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; } .pop-btns .btn { font-size: .84rem; }
.lines { margin: 8px 0 0; padding: 0; list-style: none; max-height: 340px; overflow: auto; }
.lines li { margin: 5px 0; padding: 6px 9px; background: var(--surface2); border-radius: 8px; white-space: pre-line; font-size: .88rem; }
.lines li.when { border-left: 3px solid #f2c26b; }
@media (max-width: 760px) {
  .canvas { height: 62vh; min-height: 380px; border-radius: 14px; }
  .pop { position: fixed; left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-height: 55vh; }
}
