/* Field Guide v2 look: an adventurer's journal read by campfire.
   Moss-dark pages, bone ink, ember only for "do this", metal-tier colours carry information.
   The one loud element is the medallion: every record wears a stamped icon seal.
   Icons: game-icons.net (CC BY 3.0). Type: Alegreya (book serif, headings) + Alegreya Sans (UI). */
:root {
  color-scheme: dark;
  --ink: #ECE4D0;          /* bone */
  --ink-soft: #ABA894;     /* lichen */
  --page: #161B18;         /* moss night */
  --leaf: #1F2520;         /* saddle (cards) */
  --leaf-2: #273029;       /* raised */
  --rule: #343E36;
  --rune: #E8A33D;         /* ember: actions and "you are here" only */
  --rune-ink: #1E1405;
  --ok: #6DB193; --warn: #E2C068; --bad: #D86A52; --info: #86A9D6;
  --vault: #A88BD6; --gold: #D9B24C;
  /* metal tiers */
  --t-bronze: #C08552; --t-iron: #9A9C9F; --t-steel: #B9C4CE; --t-mithril: #6F8FD6; --t-adamant: #5FAE7C;
  --t-rune: #4FC1D2; --t-dragon: #D4483B; --t-blurite: #7EA2EC; --t-gold: #E2BE45; --t-silver: #D3D6DA;
  --t-obsidian: #8C7AA8; --t-abyssal: #B06ACB;
  --display: "Alegreya", "Iowan Old Style", Georgia, serif;
  --body: "Alegreya Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: "Alegreya Sans", system-ui, sans-serif;
  --r: 14px;
  --tap: 52px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--page); color: var(--ink); font: 18px/1.45 var(--body); -webkit-text-size-adjust: 100%; font-variant-numeric: lining-nums; }
a { color: var(--rune); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--rune); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; text-wrap: balance; margin: 0; letter-spacing: 0; line-height: 1.15; }
h1 { font-size: 30px; } h2 { font-size: 24px; } h3 { font-size: 20px; }
.num, .mono { font-family: var(--body); font-variant-numeric: tabular-nums lining-nums; font-weight: 700; }

/* icons */
.gi { width: 1em; height: 1em; display: block; fill: currentColor; flex: none; }
.ib { --c: var(--ink-soft); width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--c);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 22%, var(--leaf-2)) 0%, var(--page) 78%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 70%, transparent), inset 0 0 0 4px var(--page), inset 0 0 0 5px color-mix(in srgb, var(--c) 30%, transparent); }
.ib .gi { width: 22px; height: 22px; }
.ib.lg { width: 64px; height: 64px; } .ib.lg .gi { width: 36px; height: 36px; }
.ib.sm { width: 28px; height: 28px; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 70%, transparent); } .ib.sm .gi { width: 16px; height: 16px; }
.k-enemy { --c: var(--bad); } .k-boss { --c: var(--bad); box-shadow: inset 0 0 0 2px var(--bad), inset 0 0 0 4px var(--page), inset 0 0 0 6px var(--bad); }
.k-fish { --c: var(--info); } .k-quest { --c: var(--rune); } .k-chest, .k-collectible, .k-lootTable { --c: var(--gold); } .k-vault { --c: var(--vault); }
.k-resourceNode { --c: var(--ok); } .k-npc, .k-shop { --c: var(--ink); } .k-spell, .k-lodestone { --c: var(--info); }
.k-station, .k-skill { --c: var(--rune); } .k-item, .k-recipe { --c: var(--ink); } .k-region, .k-subregion, .k-landmark { --c: var(--ink-soft); }
.t-bronze { --c: var(--t-bronze); } .t-iron { --c: var(--t-iron); } .t-steel { --c: var(--t-steel); } .t-mithril { --c: var(--t-mithril); }
.t-adamant { --c: var(--t-adamant); } .t-rune { --c: var(--t-rune); } .t-dragon { --c: var(--t-dragon); } .t-blurite { --c: var(--t-blurite); }
.t-gold { --c: var(--t-gold); } .t-silver { --c: var(--t-silver); } .t-obsidian { --c: var(--t-obsidian); } .t-abyssal { --c: var(--t-abyssal); }

/* shell */
.app { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--rule); background: var(--page); position: sticky; top: 0; z-index: 5; }
.brand { font-family: var(--display); font-weight: 800; font-size: 21px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand .gi { width: 26px; height: 26px; color: var(--rune); }
.brand small { display: none; }
.top .grow { flex: 1; min-width: 0; }
.search { width: 100%; min-height: 44px; border-radius: 22px; border: 1px solid var(--rule); background: var(--leaf); padding: 0 14px; font-size: 16px; }
.search::placeholder { color: var(--ink-soft); }
main { overflow-y: auto; padding: 14px; padding-bottom: 32px; }
.wrap { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
.tabs { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--rule); background: var(--page); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { min-height: 62px; background: none; border: 0; color: var(--ink-soft); font-size: 12.5px; display: grid; place-items: center; align-content: center; gap: 3px; padding: 6px 0; }
.tabs button .gi { width: 24px; height: 24px; }
.tabs button[aria-current="page"] { color: var(--rune); box-shadow: inset 0 3px 0 var(--rune); font-weight: 700; }

/* chips */
.who { display: flex; gap: 6px; }
.chip { min-height: 38px; padding: 0 13px; border-radius: 19px; border: 1px solid var(--rule); background: transparent; display: inline-flex; align-items: center; gap: 6px; font-size: 16px; color: var(--ink-soft); }
.chip .gi { width: 18px; height: 18px; }
.chip[aria-pressed="true"] { background: var(--rune); color: var(--rune-ink); border-color: var(--rune); font-weight: 700; }
.chip.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
#me { color: var(--ink); background: var(--leaf); }

/* cards and rows */
.card { background: var(--leaf); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; }
.card.hero { border-color: color-mix(in srgb, var(--rune) 55%, var(--rule)); background: linear-gradient(180deg, color-mix(in srgb, var(--rune) 7%, var(--leaf)), var(--leaf) 60%); }
.eyebrow { font-size: 15px; font-style: italic; color: var(--ink-soft); }
.row { display: flex; gap: 12px; align-items: center; min-height: var(--tap); padding: 9px 0; border-top: 1px solid var(--rule); }
.row:first-child { border-top: 0; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 700; }
.row .sub { color: var(--ink-soft); font-size: 16px; }
.list { display: grid; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 15px; }
.dhead { display: flex; gap: 14px; align-items: center; }
.dhead .main { flex: 1; min-width: 0; }

/* buttons */
.btn { text-decoration: none; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--rule); background: var(--leaf-2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 500; }
.btn .gi { width: 18px; height: 18px; }
.btn.primary { background: var(--rune); color: var(--rune-ink); border-color: var(--rune); font-weight: 700; }
.btn.ghost { background: none; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 16px; }
.btn:disabled { opacity: .45; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.check { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--ink-soft); background: none; flex: none; display: grid; place-items: center; }
.check[aria-checked="true"] { background: var(--ok); border-color: var(--ok); color: #0F2018; }
.check[aria-checked="true"]::after { content: "✓"; font-weight: 800; }

/* status pills: text + colour */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 1px 9px; border-radius: 10px; border: 1px solid currentColor; white-space: nowrap; vertical-align: 2px; }
.pill.verified, .pill.ready, .pill.done { color: var(--ok); }
.pill.supported { color: var(--info); }
.pill.tentative, .pill.waiting, .pill.estimate { color: var(--warn); }
.pill.conflicting, .pill.danger, .pill.blocked { color: var(--bad); }
.pill.unknown, .pill.historical { color: var(--ink-soft); }

/* forms */
label { display: grid; gap: 4px; font-size: 16px; color: var(--ink-soft); min-width: 0; }
input, select, textarea { min-height: 44px; border-radius: 10px; border: 1px solid var(--rule); background: var(--page); padding: 8px 12px; color: var(--ink); width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
textarea { min-height: 120px; font: 15px/1.4 var(--body); }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* spoilers */
.spoiler { background: repeating-linear-gradient(45deg, var(--rule), var(--rule) 6px, var(--leaf) 6px, var(--leaf) 12px); color: transparent; border-radius: 6px; cursor: pointer; user-select: none; }
.spoiler::after { content: "Tap to reveal"; color: var(--ink-soft); font-size: 14px; padding: 0 6px; }
.spoiler * { visibility: hidden; }

/* chapter prose */
.prose { line-height: 1.6; }
.prose h1 { font-size: 30px; margin-bottom: 8px; } .prose h2 { margin: 22px 0 8px; color: var(--rune); } .prose h3 { margin: 16px 0 6px; }
.prose p, .prose li { max-width: 65ch; }
.prose table { border-collapse: collapse; font-size: 16px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 6px 8px; text-align: left; vertical-align: top; }
.prose blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--rune); background: var(--leaf-2); border-radius: 0 8px 8px 0; }
.prose code { font-family: var(--body); font-weight: 700; }

/* atlas */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.schematic { width: 100%; height: auto; display: block; }
.region-tile { cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 22px; font-weight: 700; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.feed { font-size: 16px; }
.feed time { font-size: 14px; color: var(--ink-soft); margin-right: 6px; }
.bar { height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--rune); }
dialog { background: var(--leaf); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r); max-width: min(560px, calc(100vw - 24px)); width: 100%; padding: 16px; }
dialog::backdrop { background: rgba(6,9,7,.72); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .2s ease-out; } @keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }
  dialog[open] { animation: open .16s ease-out; } @keyframes open { from { transform: translateY(10px); opacity: 0; } }
}
@media (max-width: 420px) { h1 { font-size: 27px; } .brand .word { display: none; } }
.tbl { width: 100%; border-collapse: collapse; font-size: 16px; }
.tbl th { text-align: left; font-weight: 700; color: var(--ink-soft); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--rule); }
.tbl td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: break-word; }
.tbl td.n { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.card h3 { margin: 6px 0 0; font-size: 18px; }
.card ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.logline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
.logline .who { font-weight: 700; min-width: 52px; }
.logline .btn:last-child { margin-left: auto; }
.cat-row .ins, .ins { font-size: 15px; color: var(--ink-soft); }
.cat-tag { font-size: 14px; color: var(--ink-soft); }
.ilink { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--rune) 70%, transparent); text-underline-offset: 3px; font: inherit; cursor: pointer; text-align: left; }
.ilink.title { font-weight: 700; }
.ilink-ic { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.search.small { min-height: 40px; }
details > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; }
.wiki { color: var(--ink); }
/* skill strip: medallions you can flick through */
.skillstrip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; margin: 0 -14px; padding-left: 14px; scroll-snap-type: x proximity; }
.skillstrip::-webkit-scrollbar { display: none; }
.skpick { flex: none; width: 74px; display: grid; justify-items: center; gap: 4px; background: none; border: 0; padding: 6px 0; border-radius: 12px; color: var(--ink-soft); font-size: 13px; scroll-snap-align: start; position: relative; }
.skpick .ib { width: 52px; height: 52px; } .skpick .ib .gi { width: 28px; height: 28px; }
.skpick b { position: absolute; top: 2px; right: 6px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--page); border: 1px solid var(--rule); font-size: 12px; display: grid; place-items: center; color: var(--ink); }
.skpick[aria-pressed="true"] { color: var(--rune); font-weight: 700; background: var(--leaf); }
.skpick[aria-pressed="true"] .ib { --c: var(--rune); }
.ib.xs { width: 20px; height: 20px; box-shadow: none; background: none; } .ib.xs .gi { width: 17px; height: 17px; }
/* atlas map */
.atlas-map { border-radius: 12px; }
.atlas-map .region-tile { cursor: pointer; outline: none; }
.atlas-map .region-tile:focus-visible polygon { stroke: var(--rune); stroke-width: 3; }
.atlas-map .mlabel { font: 700 13px var(--display); fill: #ECE4D0; paint-order: stroke; stroke: #161B18; stroke-width: 3px; }
.atlas-map .mlabel.on { fill: var(--rune); font-size: 14px; }
.atlas-map .msub { font: 700 9.5px var(--body); fill: #ABA894; paint-order: stroke; stroke: #161B18; stroke-width: 2.5px; }
.filters.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.filters.scroll::-webkit-scrollbar { display: none; }
.filters .chip { flex: none; }
details.more { border-top: 1px solid var(--rule); padding-top: 4px; }
details.more > summary { color: var(--ink-soft); font-size: 16px; }
details.more[open] > summary { color: var(--ink); margin-bottom: 8px; }
.learn-head { border-top: 0; min-height: 0; padding: 0 0 4px; }
.learn-head .cat-tag { width: 30px; text-align: center; font-size: 12px; }
details > summary { list-style: none; } details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--rune); transition: transform .15s; display: inline-block; }
details[open] > summary::before { transform: rotate(90deg); }
.wikilink { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 15px; color: var(--ink-soft); text-decoration: none; min-height: 32px; }
.wikilink .gi { width: 16px; height: 16px; color: var(--rune); }
.wikilink:hover, .wikilink:focus-visible { color: var(--ink); text-decoration: underline; }
.skpick { width: 80px; } .skpick span { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
/* quest progress: three clear choices */
.qstates { gap: 8px; }
.qline { display: grid; gap: 4px; }
.qwho { font-weight: 700; font-size: 15px; }
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.segb { min-height: 46px; background: var(--page); border: 0; border-left: 1px solid var(--rule); color: var(--ink-soft); font-weight: 500; }
.segb:first-child { border-left: 0; }
.segb[aria-pressed="true"] { background: var(--leaf-2); color: var(--ink); font-weight: 700; box-shadow: inset 0 -3px 0 var(--rune); }
.segb.fin[aria-pressed="true"] { background: var(--ok); color: #0F2018; box-shadow: none; }
/* how to fight it */
.fight { display: grid; gap: 8px; }
.dmg { display: inline-block; font-weight: 700; padding: 0 8px; border-radius: 8px; font-size: 15px; }
.dmg.good { background: var(--ok); color: #0F2018; }
.dmg.bad { border: 1px solid var(--bad); color: #F2AC9C; }
