/* Nexus of Fates doc site: one stylesheet, light and dark from the system setting. */
:root {
    --bg: #f7f8fa;
    --panel: #ffffff;
    --side: #20242c;
    --side-text: #c9ced8;
    --text: #1d2129;
    --muted: #667085;
    --line: #e2e5ea;
    --accent: #f2b134;
    --link: #2a6fdb;
    --code-bg: #eef1f5;
    --row-group: #f0f2f6;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171c;
        --panel: #1b1f26;
        --side: #0f1115;
        --side-text: #aeb4bf;
        --text: #e6e8ec;
        --muted: #8b93a1;
        --line: #2c323c;
        --link: #6ea8ff;
        --code-bg: #252a33;
        --row-group: #222731;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.9em; }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
pre code { background: none; padding: 0; }
pre.mermaid { background: var(--panel); border: 1px solid var(--line); text-align: center; }

.layout { display: flex; min-height: 100vh; }

.side {
    width: 250px;
    flex-shrink: 0;
    background: var(--side);
    color: var(--side-text);
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side a { color: var(--side-text); padding: 5px 10px; border-radius: 6px; }
.side a:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.side a.active { background: rgba(242, 177, 52, 0.16); color: var(--accent); }
.side .brand { color: #fff; font-weight: 700; font-size: 1.15em; margin-bottom: 8px; }
.side .version { color: var(--accent); font-weight: 400; font-size: 0.75em; margin-left: 6px; }
.side .group { text-transform: uppercase; font-size: 0.72em; letter-spacing: 0.08em; opacity: 0.6; margin: 14px 10px 4px; }
.side details.sub { display: flex; flex-direction: column; gap: 1px; }
/* The entry keeps the same padding as the others (aligned with them); the arrow sits on the right and folds the list. */
.side details.sub summary { list-style: none; cursor: pointer; display: flex; align-items: center; border-radius: 6px; }
.side details.sub summary::-webkit-details-marker { display: none; }
.side details.sub summary a { flex: 1; }
.side details.sub summary::after { content: "▸"; display: inline-block; padding: 5px 10px; font-size: 0.8em; opacity: 0.6; transition: transform 0.15s; }
.side details.sub summary:hover::after { opacity: 1; }
.side details.sub[open] summary::after { transform: rotate(90deg); }
/* Its items: one column under the entry's text, a thin line on their left. */
.side details.sub > a { display: block; margin-left: 10px; padding: 3px 10px 3px 12px; font-size: 0.9em; border-left: 1px solid rgba(255, 255, 255, 0.12); border-radius: 0 6px 6px 0; }
.side .foot { margin-top: auto; padding: 14px 10px 0; font-size: 0.8em; display: flex; flex-direction: column; gap: 4px; }
.side .foot a { padding: 0; }
.side .foot code { background: rgba(255, 255, 255, 0.08); }

main { flex: 1; min-width: 0; max-width: 1100px; padding: 28px 40px 60px; }

h1 { margin-top: 0; }
h2 { margin-top: 2em; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
h3 { margin-top: 1.6em; }

.muted, .crumb { color: var(--muted); }
.crumb { font-size: 0.85em; margin-top: 0; }

.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; margin: 12px 0; background: var(--panel); font-size: 0.92em; }
th, td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: var(--row-group); font-weight: 600; }
table.compact { width: auto; min-width: 50%; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.row-group td { background: var(--row-group); font-weight: 600; }

.tag { display: inline-block; font-size: 0.78em; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; }
.use { margin: 1px 0; }
.use b { font-weight: 600; margin-right: 4px; }
a.src { font-size: 0.82em; margin-right: 6px; }
h3 a.src { font-weight: 400; margin-left: 8px; }
section.type { margin-bottom: 18px; }

.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1px solid var(--line); }

figure.shot { margin: 14px 0 18px; }
figure.shot img { display: block; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #2e3440; }
figure.shot.portrait img { max-height: 420px; }
figure.shot figcaption { color: var(--muted); font-size: 0.86em; margin-top: 6px; }
.card img.thumb { width: 100%; height: 150px; object-fit: contain; border-radius: 7px; background: #2e3440; margin-bottom: 6px; }
.card img.thumb.wide { object-fit: cover; }
img.map { display: block; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); image-rendering: pixelated; }
img.map.small { width: 512px; }

.swatch.big { width: 22px; height: 22px; border-radius: 5px; vertical-align: -2px; margin-right: 10px; }
table.info th { width: 1%; white-space: nowrap; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 12px; padding: 1px 9px; margin: 2px 4px 2px 0; background: var(--panel); }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.pager { display: flex; justify-content: space-between; margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 28px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card span { color: var(--muted); font-size: 0.88em; }

.md img { max-width: 100%; }

svg.chart { width: 100%; max-width: 620px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
svg.chart .axis { stroke: var(--muted); }
svg.chart .grid { stroke: var(--line); }
svg.chart .tick { fill: var(--muted); font-size: 11px; }
svg.chart .label { font-size: 12px; font-weight: 600; }

svg.world { width: 100%; max-width: 900px; display: block; border-radius: 8px; border: 1px solid var(--line); }
svg.world .cells rect { fill: transparent; stroke: rgba(0, 0, 0, 0.18); stroke-width: 1; }
svg.world .cells rect:hover { fill: rgba(255, 255, 255, 0.18); }
svg.world .active { fill: none; stroke: #f2b134; stroke-width: 4; stroke-dasharray: 14 8; }
svg.world .safe { fill: none; stroke: #3fd0ff; stroke-width: 4; }
svg.world .mob { fill: #d9453b; stroke: #fff; stroke-width: 1.2; }
svg.world .spawn { fill: #ffd23f; stroke: #000; stroke-width: 1.5; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 14px; font-size: 0.88em; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--line); }
.legend i.dot { border-radius: 50%; }
.legend i.line { border: 1px solid rgba(0, 0, 0, 0.4); background: transparent; }

@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .side { width: auto; height: auto; position: static; }
    main { padding: 20px 16px 40px; }
}

/* The quests page for players (QuestGuidePage): one card per quest. */
.qg-langs .chip.on { border-color: var(--accent); font-weight: 600; }
.qg-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 24px; }
.qg-nav a { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 2px 12px 2px 4px; color: var(--text); }
.qg-nav a span { display: inline-block; min-width: 22px; margin-right: 6px; border-radius: 50%; background: var(--accent); color: #20242c; text-align: center; font-weight: 700; }
section.quest { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin: 22px 0; }
section.quest > header { display: flex; gap: 14px; align-items: flex-start; }
section.quest .num { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #20242c; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1em; }
section.quest h2 { margin: 0; padding: 0; border: 0; }
section.quest .head { min-width: 0; }
section.quest .meta { margin: 4px 0 0; color: var(--muted); }
section.quest .meta .giver { font-weight: 600; color: var(--text); margin-right: 8px; }
section.quest .chip.gift { border-color: var(--accent); }
section.quest .goal span { display: inline-block; margin-right: 8px; font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
section.quest h3 { margin: 1.2em 0 0.4em; font-size: 1em; color: var(--muted); }
ol.steps { padding-left: 22px; margin: 0; }
ol.steps li { margin-bottom: 10px; }
ol.steps .step b { display: block; }
ol.steps .step small { display: block; color: var(--muted); }
p.say { margin: 4px 0 0; padding-left: 10px; border-left: 3px solid var(--line); font-style: italic; }
p.say span { font-style: normal; font-weight: 600; margin-right: 4px; }
dl.lines { margin: 0; }
dl.lines .line { margin-bottom: 8px; }
dl.lines dt { font-size: 0.82em; color: var(--muted); }
dl.lines dd { margin: 0; padding-left: 10px; border-left: 3px solid var(--line); font-style: italic; overflow-wrap: anywhere; }
section.quest > footer { display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
section.quest .next { color: var(--muted); }

/* the controls hint under an NPC line (quests guide) */
.quest .hint { font-size: .8em; opacity: .7; margin: .15em 0 0 1em; display: block; }
