:root { --faces-img: url(img/faces/faces.png); --frames-img: url(img/sprites/frames_p0.png); --small-img: url(img/font/small.png); --frames-auto: url(img/sprites/frames_auto.png); --large-img: url(img/font/large.png); --bg: #121417; --panel: #1b1f24; --line: #2d333b; --fg: #e6e6e6; --muted: #9aa4af; --accent: #f0c060; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: -apple-system, "PingFang TC", "PingFang SC", "Noto Sans CJK TC", sans-serif; font-size: 14px; }
header { position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; z-index: 5; }
h1 { font-size: 16px; margin: 0; }
nav a { color: var(--fg); text-decoration: underline; margin-right: 12px; }
nav a.active { color: var(--accent); }
#search { margin-left: auto; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-width: 220px; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
footer { color: var(--muted); padding: 24px 16px; font-size: 12px; }
.hint { color: var(--muted); }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; position: sticky; top: 52px; background: var(--bg); }
tr.hidden { display: none; }
tr:hover td { background: var(--panel); }
td.raw, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); }
/* 像素字 */
.px { display: inline-block; white-space: nowrap; vertical-align: middle; image-rendering: pixelated; }
.px i { display: inline-block; background-repeat: no-repeat; image-rendering: pixelated; vertical-align: top; }
.px.small i { width: 24px; height: 24px; background-image: var(--small-img); background-size: 1536px auto; }
.px.large i { width: 32px; height: 32px; background-image: var(--large-img); background-size: 1024px auto; }
.px.small1x i { width: 12px; height: 12px; background-image: var(--small-img); background-size: 768px auto; }
/* 詳情 */
.detail { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.detail h2 { margin: 0 0 8px; font-size: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; }
.fields div { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.fields b { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
/* 對白 */
.dlg { border-bottom: 1px solid var(--line); padding: 8px 0; }
.dlg .meta { color: var(--muted); font-size: 12px; }
.dlg pre { margin: 4px 0 0; white-space: pre-wrap; font-family: inherit; }
/* 地圖 */
.mapwrap { position: relative; overflow: auto; height: 75vh; border: 1px solid var(--line); background: #000; }
.mapwrap img { display: block; image-rendering: pixelated; }
.marker { position: absolute; transform: translate(-50%, -100%); background: rgba(240,192,96,.9); color: #000; font-size: 12px; padding: 1px 5px; border-radius: 4px; white-space: nowrap; cursor: pointer; }
.marker.hl { background: #ff6060; color: #fff; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.toolbar select, .toolbar input, .toolbar button { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
/* 圖塊 */
.banks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.bank { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.bank canvas { width: 100%; image-rendering: pixelated; display: block; }
.bank b { display: block; color: var(--muted); font-weight: 500; margin-bottom: 4px; font-size: 12px; }
.swatches span { display: inline-block; width: 22px; height: 22px; border: 1px solid var(--line); margin-right: 4px; cursor: pointer; vertical-align: middle; }
.fontsheet { background: #000; image-rendering: pixelated; max-width: 100%; }
/* 場景 */
.scene h3 { font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 500; }
.scene .shot { image-rendering: pixelated; width: 512px; max-width: 100%; background: #000; }
.scene .row { display: flex; gap: 12px; flex-wrap: wrap; }
.scene figure { margin: 0; }
.scene figure img { display: block; image-rendering: pixelated; width: 256px; background: #333; margin-top: 4px; }
.scene .sheet { width: 1024px; max-width: 100%; background: #2a2e34; }
.px.frames i { width: 32px; height: 32px; background-image: var(--frames-img); background-size: 192px auto; margin-right: 2px; }
.px.frames.big i { width: 64px; height: 64px; background-size: 384px auto; margin-right: 4px; }
.px.frames.auto i { background-image: var(--frames-auto); }
td.anim { white-space: nowrap; }
.walk { display: inline-block; width: 64px; height: 64px; background-image: var(--frames-auto); background-size: 384px auto; background-repeat: no-repeat; image-rendering: pixelated; margin-right: 6px; vertical-align: middle; animation: walk 0.5s steps(1) infinite; }
.walk.flip { transform: scaleX(-1); }
@keyframes walk { 0%, 49.9% { background-position: var(--f0); } 50%, 100% { background-position: var(--f1); } }
.scene .strip { width: 100%; image-rendering: pixelated; }
/* 導航分組 */
nav .group { display: inline-block; margin-right: 14px; padding-right: 14px; border-right: 1px solid var(--line); }
nav .group:last-child { border-right: 0; }
nav .group b { color: var(--muted); font-weight: 500; margin-right: 8px; font-size: 12px; }
/* 文檔頁 */
.doc { max-width: 1100px; line-height: 1.6; }
.doc h1 { font-size: 20px; margin: 8px 0 12px; }
.doc h2 { font-size: 17px; margin: 24px 0 8px; color: var(--accent); }
.doc h3 { font-size: 15px; margin: 18px 0 6px; }
.doc p { margin: 6px 0; }
.doc pre { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; font-size: 12.5px; line-height: 1.5; }
.doc code, .card code { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.doc table { margin: 8px 0 12px; }
.doc td, .doc th { white-space: normal; }
.doc ul, .doc ol { padding-left: 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 12px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.card a { color: var(--fg); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; }
.kv b { color: var(--muted); font-weight: 500; }
/* 計算器 */
.calc { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 14px; margin: 12px 0; }
.calc label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.calc input, .calc select { margin-top: 2px; background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.result { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 8px 0; }
.result .big { font-size: 26px; color: var(--accent); }
.steps td { white-space: normal; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; font-size: 11px; color: var(--muted); margin-left: 4px; }
.msg .meta { color: var(--muted); font-size: 12px; }
.maps { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 16px; }
.maps figure { margin: 0; }
.maps figcaption { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.maps img { image-rendering: pixelated; width: 512px; max-width: 100%; background: #000; display: block; }
/* 世界地圖上可點的標記與門 */
.marker.link { text-decoration: underline; }
.marker.link:hover { background: #fff; }
.mapwrap .door { position: absolute; border: 2px solid #ff4040; background: rgba(255,64,64,.25); box-sizing: border-box; cursor: pointer; }
.mapwrap .door.exit { border-color: #ff9a20; background: rgba(255,154,32,.3); }
.mapwrap .door.warp { border-color: #c060ff; background: rgba(192,96,255,.3); }
.mapwrap .door:hover, .mapwrap .door.hl { background: rgba(255,255,255,.7); border-color: #fff; }
.mdoor { position: absolute; border: 2px solid #40a0ff; background: rgba(64,160,255,.2); box-sizing: border-box; }
.mdoor:hover { background: rgba(255,255,255,.6); }
.dmap .opened { position: absolute; border: 2px dashed #ffe040; box-sizing: border-box; pointer-events: none; }
.dmap.flash { outline: 2px solid var(--accent); }
/* 文字連結：正常文字色 + 下劃線 */
.doc a, .hint a, .dmap a:not(.mdoor), td a { color: inherit; text-decoration: underline; }
.face { display: inline-block; width: 48px; height: 48px; background-image: var(--faces-img); background-size: 768px auto; background-repeat: no-repeat; image-rendering: pixelated; vertical-align: middle; }
.face.big { width: 96px; height: 96px; background-size: 1536px auto; }
.facegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; margin: 12px 0; }
.facecard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; font-size: 13px; }
.facecard small { display: block; color: var(--muted); font-size: 11px; }

.table-sort { appearance: none; border: 0; background: transparent; color: inherit; font: inherit; padding: 0; cursor: pointer; }
.table-sort:hover, th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--fg); }
.table-sort:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.sort-arrow { font-size: 0.8em; }
