
:root {
  --ink: #202122;
  --muted: #54595d;
  --line: #a2a9b1;
  --line-soft: #c8ccd1;
  --surface: #fff;
  --surface-alt: #f8f9fa;
  --blue: #36c;
  --blue-dark: #2a4b8d;
  --accent: #6b4c9a;
  --accent-soft: #f2eef8;
  --warning: #fcf4dc;
  --shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 18px rgba(0,0,0,.05);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { color: var(--ink); background: var(--surface); font: 15px/1.55 var(--sans); }
body { margin: 0; min-width: 300px; overflow-x: hidden; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
.site-header { min-height: 76px; padding: 12px clamp(18px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; gap: 28px; border-bottom: 1px solid var(--line-soft); background: #fff; position: sticky; top: 0; z-index: 50; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 290px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--ink); font-size: 22px; color: var(--accent); transform: rotate(-3deg); }
.brand strong { display: block; font: 19px/1.15 var(--serif); }
.brand small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .035em; }
.site-search { position: relative; width: min(440px, 45vw); }
.site-search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.site-search input { width: 100%; border: 1px solid #72777d; padding: 9px 12px 9px 38px; background: linear-gradient(90deg, transparent 36px, #eaecf0 36px, #eaecf0 37px, transparent 37px); }
.site-search::before { content: '⌕'; position: absolute; left: 12px; top: 4px; font-size: 23px; color: var(--muted); z-index: 1; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); max-height: min(70vh, 520px); overflow: auto; z-index: 80; }
.search-results a { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 9px 12px; border-bottom: 1px solid #eaecf0; color: var(--ink); }
.search-results a:hover, .search-results a[aria-selected='true'] { background: #eaf3ff; text-decoration: none; }
.search-results small { color: var(--muted); font-size: 12px; }
.search-results mark { background: #ffec99; }
.search-empty { padding: 14px; color: var(--muted); }
.site-shell { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); max-width: 1540px; margin: 0 auto; padding: 28px clamp(18px, 4vw, 64px) 64px; }
.side-nav { position: sticky; top: 104px; align-self: start; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--line-soft); padding-right: 20px; font-size: 14px; }
.side-nav-sub { display: flex; flex-direction: column; gap: 2px; padding: 1px 0 4px 12px; border-left: 2px solid var(--line-soft); }
.side-nav-sub a { font-size: 12px; color: var(--muted); }
.side-nav strong { font-size: 13px; border-bottom: 1px solid var(--line-soft); padding: 0 4px 7px; margin-bottom: 5px; }
.side-nav a { color: var(--ink); padding: 3px 4px; }
.side-nav a:hover { color: var(--blue); }
.content { min-width: 0; max-width: 1260px; }
.breadcrumbs { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.breadcrumbs span { margin: 0 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: normal; line-height: 1.2; }
h1 { font-size: clamp(30px, 4vw, 42px); border-bottom: 1px solid var(--line); margin: 0 0 20px; padding-bottom: 7px; }
h2 { font-size: 25px; border-bottom: 1px solid var(--line-soft); margin: 34px 0 14px; padding-bottom: 5px; }
h3 { font-size: 19px; }
.lede { font-size: 17px; max-width: 820px; color: #3a3a3a; }
.muted, .map-help { color: var(--muted); }
.sample-badge { display: inline-block; padding: 3px 8px; margin-bottom: 10px; background: var(--warning); border: 1px solid #e1c76f; border-radius: 2px; font-size: 12px; }
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: clamp(28px, 4vw, 52px); align-items: start; }
.article-main { min-width: 0; }
.lead-section { font-size: 16px; }
.lead-section p:first-child { margin-top: 0; }
.infobox { border: 1px solid var(--line); background: var(--surface-alt); box-shadow: 0 1px 2px rgba(0,0,0,.04); font-size: 13px; }
.infobox-title { padding: 8px 10px; background: #e3dced; border-bottom: 1px solid var(--line); text-align: center; font-weight: 700; font-size: 15px; }
.infobox-image { min-height: 150px; display: grid; place-items: center; padding: 14px; background: #fff; }
.entity-image { max-width: 180px; max-height: 180px; image-rendering: auto; }
.image-placeholder { width: 112px; height: 112px; display: grid; place-items: center; border: 1px dashed var(--line); color: var(--line); font-size: 36px; }
.infobox dl { margin: 0; }
.infobox-row { display: grid; grid-template-columns: minmax(105px, 42%) 1fr; border-top: 1px solid #eaecf0; }
.infobox-row dt, .infobox-row dd { margin: 0; padding: 6px 8px; }
.infobox-row dt { font-weight: 600; background: rgba(234,236,240,.6); }
.map-card { border-top: 1px solid var(--line); padding: 8px; background: #fff; }
.map-card h3 { text-align: center; margin: 0 0 7px; font: 700 13px var(--sans); }
.map-toolbar { display: flex; justify-content: center; margin-bottom: 6px; }
.map-toolbar button { min-width: 34px; padding: 3px 8px; border: 1px solid var(--line); background: var(--surface-alt); cursor: pointer; }
.map-toolbar button + button { border-left: 0; }
.world-map { width: 100%; height: 300px; overflow: hidden; position: relative; background: #d9d9d9; border: 1px solid #72777d; cursor: grab; touch-action: none; }
.world-map.dragging { cursor: grabbing; }
.map-stage { position: relative; }
.map-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #bbb; }
.map-tile { position: absolute; width: 128px; height: 128px; display: block; user-select: none; pointer-events: none; }
.map-marker { position: absolute; width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 1px 4px rgba(0,0,0,.85); cursor: help; z-index: 5; }
.map-marker.item { background: #c22; }
.map-marker.harvestable { background: #14845b; }
.map-marker.npc { background: #365ac7; }
.map-marker.shop { background: #8a4c13; }
.map-marker.travel { background: #14845b; }
.map-marker.house { background: #8b3f8f; }
.map-marker:focus { outline: 3px solid #ffbf00; outline-offset: 2px; }
.map-tooltip { position: fixed; z-index: 100; pointer-events: none; max-width: 260px; padding: 6px 8px; background: rgba(32,33,34,.94); color: #fff; font-size: 12px; border-radius: 2px; box-shadow: var(--shadow); }
.map-help { text-align: center; font-size: 11px; margin: 5px 0 0; }
.table-scroll { overflow-x: auto; max-width: 100%; margin: 8px 0 18px; }
.wikitable { border-collapse: collapse; width: 100%; background: #fff; font-size: 13px; }
.wikitable th, .wikitable td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: middle; }
.wikitable th { background: #eaecf0; font-weight: 700; }
.wikitable tbody tr:nth-child(even) { background: #f8f9fa; }
.wikitable tbody tr:hover { background: #eef4ff; }
.sortable th button { width: 100%; border: 0; padding: 0 18px 0 0; background: transparent; font-weight: 700; text-align: inherit; cursor: pointer; position: relative; white-space: nowrap; }
.sortable th button::after { content: '↕'; color: #72777d; position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.sortable th[aria-sort='ascending'] button::after { content: '↑'; color: var(--blue); }
.sortable th[aria-sort='descending'] button::after { content: '↓'; color: var(--blue); }
.table-icon { width: 34px; height: 34px; object-fit: contain; vertical-align: middle; }
.lazy-thumb { display: inline-grid; place-items: center; color: var(--line); overflow: hidden; }
.lazy-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mini-placeholder { width: 28px; height: 28px; display: inline-grid; place-items: center; color: var(--line); }
.gear-table { width: max-content; min-width: 100%; }
.gear-table th { min-width: 104px; }
.gear-table th:first-child { min-width: 48px; width: 48px; }
.gear-table td { text-align: center; min-width: 56px; }
.gear-table td:nth-child(2), .gear-table td:nth-child(4) { text-align: left; min-width: 150px; }
.stat-heading { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 76px; padding-right: 3px; white-space: normal; text-align: center; font-size: 11px; line-height: 1.25; }
.stat-heading img { width: 20px; height: 20px; object-fit: contain; }
.table-filter { display: flex; gap: 10px; align-items: center; width: min(520px, 100%); margin: 14px 0 8px; font-weight: 600; }
.table-filter input { flex: 1; min-width: 0; border: 1px solid #72777d; padding: 7px 9px; }
.empty-state { border-left: 3px solid var(--line-soft); color: var(--muted); padding: 8px 12px; background: var(--surface-alt); }
.coordinates { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
code { background: #f1f1f1; border: 1px solid #ddd; padding: 1px 4px; border-radius: 2px; font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.source-details { border: 1px solid var(--line-soft); margin-top: 36px; background: var(--surface-alt); }
.source-details summary { cursor: pointer; padding: 8px 10px; font-weight: 600; }
.field-list { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; margin: 0; border-top: 1px solid var(--line-soft); }
.field-list dt, .field-list dd { margin: 0; padding: 6px 10px; border-bottom: 1px solid #eaecf0; overflow-wrap: anywhere; }
.field-list dt { font-weight: 600; }
.phase-list { display: grid; gap: 12px; }
.phase-card { border: 1px solid var(--line-soft); background: #fff; }
.phase-card header { display: flex; gap: 14px; align-items: baseline; padding: 8px 12px; background: var(--surface-alt); border-bottom: 1px solid var(--line-soft); }
.phase-card header span { color: var(--muted); white-space: nowrap; }
.phase-card p { padding: 0 12px; }
.phase-failure { color: #8b1a1a; }
.notice { border: 1px solid #d6b656; border-left-width: 4px; background: var(--warning); padding: 12px 14px; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 12px; }
.portal-card { min-height: 125px; min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: 1fr 1fr; align-items: end; gap: 0 10px; padding: 14px; border: 1px solid var(--line-soft); color: var(--ink); box-shadow: 0 1px 0 rgba(0,0,0,.04); transition: transform .12s, box-shadow .12s; }
.portal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; border-color: var(--accent); }
.portal-card > span { grid-row: 1 / 3; align-self: center; font: 32px var(--serif); color: var(--accent); }
.portal-card strong { min-width: 0; overflow-wrap: normal; white-space: normal; font: 18px var(--serif); }
.portal-card small { align-self: start; color: var(--muted); }
.portal-card-compact { min-height: 96px; }
.portal-card-compact > span { font-size: 24px; }
.portal-subheading { margin: 30px 0 12px; font: 22px var(--serif); }
.gear-portal-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.jump-links, .gear-child-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 20px; }
.jump-links .chip { color: var(--blue); }
.back-to-top { text-align: right; font-size: 12px; margin: -8px 0 28px; }
.hero { border-bottom: 1px solid var(--line-soft); padding: 26px 0 42px; margin-bottom: 34px; background: radial-gradient(circle at 80% 30%, var(--accent-soft), transparent 37%); }
.hero h1 { max-width: 850px; font-size: clamp(42px, 6vw, 72px); border: 0; letter-spacing: -.025em; margin: 8px 0 18px; }
.hero h1 em { color: var(--accent); font-weight: normal; }
.hero p { font-size: 19px; max-width: 700px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .11em; font-size: 12px; font-weight: 700; }
.hero-actions { display: flex; align-items: center; gap: 20px; margin-top: 25px; }
.button-link { display: inline-block; padding: 9px 15px; border: 1px solid var(--blue-dark); background: var(--blue); color: #fff; font-weight: 600; }
.button-link:hover { background: var(--blue-dark); text-decoration: none; }
.text-link { font-weight: 600; }
.featured-entry { display: grid; grid-template-columns: 1fr 180px; align-items: center; gap: 28px; margin: 48px 0; padding: 26px; border: 1px solid var(--line-soft); background: var(--surface-alt); }
.featured-entry h2 { margin-top: 7px; }
.feature-icon { max-width: 160px; max-height: 160px; justify-self: center; }
.note-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.note-grid article { border-top: 3px solid var(--accent); padding: 12px 2px; }
.note-grid strong { font: 20px var(--serif); }
.chip-list { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 24px; }
.chip { background: var(--accent-soft); border: 1px solid #c9bcdd; padding: 3px 8px; border-radius: 999px; font-size: 12px; }
.prose-list li { margin: 8px 0; }
.warning-list { color: #8b1a1a; }
.site-footer { border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; padding: 18px clamp(18px, 4vw, 64px); text-align: center; background: var(--surface-alt); }

/* Standalone world map. Kept separate from compact article-map selectors so the
   existing widgets can be reverted independently from this page. */
.world-map-page { max-width: none; }
.standalone-map-card { border: 1px solid var(--line); background: var(--surface-alt); box-shadow: var(--shadow); }
.world-map-filters { padding: 16px; border-bottom: 1px solid var(--line); background: #fff; }
.npc-map-search { position: relative; max-width: 620px; margin-bottom: 14px; }
.npc-map-search > label { display: block; margin-bottom: 5px; font-weight: 700; }
.npc-map-search > input { width: 100%; padding: 9px 11px; border: 1px solid #72777d; background: #fff; }
.npc-map-results { position: absolute; left: 0; right: 0; top: 72px; max-height: 330px; overflow: auto; z-index: 30; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.npc-map-results button { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; border: 0; border-bottom: 1px solid #eaecf0; background: #fff; text-align: left; cursor: pointer; }
.npc-map-results button:hover, .npc-map-results button[aria-pressed='true'] { background: #eaf3ff; }
.npc-map-results img, .npc-map-chip img, .map-filter-option img { width: 28px; height: 28px; object-fit: contain; }
.npc-map-results small { color: var(--muted); }
.npc-map-selected { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.npc-map-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px 3px 3px; border: 1px solid #b7c7df; border-radius: 999px; background: #eef4ff; cursor: pointer; }
.world-map-filter-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; align-items: start; }
.map-filter-group { border: 1px solid var(--line-soft); background: var(--surface-alt); }
.map-filter-group summary { cursor: pointer; padding: 8px 10px; font-weight: 700; }
.map-filter-group[open] summary { border-bottom: 1px solid var(--line-soft); }
.map-filter-options { max-height: 245px; overflow: auto; padding: 7px 9px; background: #fff; }
.map-filter-all, .map-filter-option { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 4px 2px; cursor: pointer; }
.map-filter-all { padding-bottom: 7px; margin-bottom: 4px; border-bottom: 1px solid #eaecf0; font-weight: 600; }
.map-filter-option { grid-template-columns: 18px 30px minmax(0, 1fr) auto; font-size: 13px; }
.map-filter-option small { color: var(--muted); }
.map-filter-option input, .map-filter-all input { margin: 0; }
.map-filter-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.map-filter-actions button, .standalone-map-toolbar button { border: 1px solid var(--line); background: #fff; padding: 5px 9px; cursor: pointer; }
.standalone-map-toolbar { display: flex; justify-content: center; padding: 8px; background: var(--surface-alt); }
.standalone-map-toolbar button + button { border-left: 0; }
.standalone-world-map { position: relative; width: 100%; height: clamp(520px, 70vh, 820px); overflow: hidden; border-top: 1px solid #72777d; border-bottom: 1px solid #72777d; background: #b9b9b9; cursor: grab; touch-action: none; }
.standalone-world-map.dragging { cursor: grabbing; }
.standalone-map-stage { position: relative; }
.standalone-map-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #bbb; --map-inverse-scale: 1; }
.standalone-map-layer .map-tile { z-index: 1; }
.entrance-link-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: visible; }
.entrance-link-layer line { stroke: #b32424; stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 1px rgba(255,255,255,.9)); }
.standalone-map-marker { position: absolute; z-index: 6; width: 38px; height: 38px; padding: 2px; border: 1px solid rgba(32,33,34,.75); border-radius: 7px; background: rgba(255,255,255,.94); box-shadow: 0 1px 5px rgba(0,0,0,.65); transform: translate(-50%, -50%) scale(var(--map-inverse-scale)); cursor: pointer; transform-origin: center; }
.standalone-map-marker:hover, .standalone-map-marker:focus { z-index: 8; outline: 3px solid #ffbf00; outline-offset: 1px; }
.standalone-map-marker img { display: block; width: 32px; height: 32px; object-fit: contain; }

@media (max-width: 980px) {
  .site-shell { grid-template-columns: 1fr; }
  .side-nav { position: static; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 0 0 12px; }
  .side-nav strong { width: 100%; }
  .side-nav-sub { display: contents; }
  .article-grid { grid-template-columns: 1fr; }
  .infobox { width: min(480px, 100%); grid-row: 1; }
}
@media (max-width: 680px) {
  .site-header { position: static; align-items: stretch; flex-direction: column; gap: 10px; }
  .portal-grid, .gear-portal-grid { grid-template-columns: 1fr; }
  .brand { min-width: 0; }
  .site-search { width: 100%; }
  .site-shell { padding-top: 18px; }
  .side-nav { display: none; }
  h1 { font-size: 32px; }
  .hero h1 { font-size: 42px; }
  .featured-entry { grid-template-columns: 1fr; }
  .note-grid { grid-template-columns: 1fr; }
  .field-list { grid-template-columns: 1fr; }
  .field-list dd { padding-top: 0; }
  .world-map { height: 260px; }
}
@media print {
  .site-header, .side-nav, .site-footer, .map-toolbar, .map-help, .table-filter, .jump-links, .gear-child-links, .back-to-top { display: none !important; }
  .site-shell { display: block; max-width: none; padding: 0; }
  .article-grid { grid-template-columns: 1fr 280px; }
  a { color: inherit; text-decoration: none; }
  .world-map { break-inside: avoid; }
}
