:root { color-scheme: light dark; --fg: #231d2a; --muted: #5c5466; --link: #a3360b; --bg: #faf7f2; --panel: #f2ece2; --raised: #fffdf9; --hi: #fbe2c2; --head: #2a2133; --head-fg: #f7f0e7; --head-muted: #c8bcd0; --head-accent: #ffa060; --field: #3b3046; --line: #ddd3c5; --line-strong: #958777; --accent: #e2620e; --focus: #a3360b; --shadow: #2a213326; }
@media (prefers-color-scheme: dark) { :root { --fg: #ede7f2; --muted: #aca2b6; --link: #ffa56e; --bg: #15121b; --panel: #1f1a27; --raised: #251f2e; --hi: #3e2b1b; --head: #0e0c13; --head-fg: #ede7f2; --head-muted: #aea4b8; --head-accent: #ffa060; --field: #221c2b; --line: #3b3346; --line-strong: #7d7090; --accent: #ff8a3d; --focus: #ffa56e; --shadow: #00000066; } }
:root { --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", "Apple SD Gothic Neo", "Malgun Gothic", serif; --glass: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aea4b8' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E"); }

:root { --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --radius: 10px; --page: 88rem; --gutter: 16px; --thumb: 40px; }
@media (min-width: 720px) { :root { --gutter: 24px; } }
@media (min-width: 1440px) { :root { --gutter: 32px; } }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--sans); color: var(--fg); background: var(--bg);
  overflow-wrap: break-word; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
a { color: var(--link); text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; z-index: 20; padding: var(--s2) var(--s3);
  color: var(--fg); background: var(--raised); }
.skip:focus { left: var(--s2); top: var(--s2); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; }
.muted, .label, .unit { color: var(--muted); }
[lang=ko] { word-break: keep-all; }

/* header band: logo, search, section tabs */
.site-head { color: var(--head-fg); background: var(--head); }
.head-in { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5);
  max-width: var(--page); margin: 0 auto; padding: var(--s3) var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--head-fg);
  text-decoration: none; line-height: 1.1; flex: none; }
.brand .mark { width: 28px; height: 28px; color: var(--accent); flex: none; }
.brand-name { font: 700 1.3rem/1 var(--serif); letter-spacing: 0.01em; }
.brand-sub { display: block; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--head-accent); margin-top: 3px; }
.brand:hover .brand-name { text-decoration: underline; text-decoration-thickness: 2px;
  text-underline-offset: 0.2em; }
.search { position: relative; flex: 1 1 18rem; max-width: 30rem; margin: 0 0 0 auto; }
.search input { font: inherit; font-size: 1rem; width: 100%; min-height: 42px;
  padding: 8px 12px 8px 38px; color: var(--head-fg); background: var(--field) var(--glass)
  no-repeat 11px 50% / 18px; border: 1px solid transparent; border-radius: 999px; }
.search input::placeholder { color: var(--head-muted); opacity: 1; }
.search input:hover { border-color: var(--line-strong); }
.search input:focus-visible { outline-color: var(--head-accent); }
.site-nav { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }
.site-nav ul { display: flex; gap: var(--s1); margin: 0 calc(-1 * var(--gutter)); padding: 0
  var(--gutter); list-style: none; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; }
.site-nav ul::-webkit-scrollbar { display: none; }
.site-nav li { flex: none; }
.site-nav a { display: block; padding: 10px 12px 9px; color: var(--head-muted);
  text-decoration: none; font-weight: 600; font-size: 0.95rem; white-space: nowrap;
  border-bottom: 3px solid transparent; }
.site-nav a:hover { color: var(--head-fg); border-bottom-color: var(--line-strong); }
.site-nav a[aria-current], .site-nav a.in { color: var(--head-fg);
  border-bottom-color: var(--accent); }
.site-nav a:focus-visible { outline-color: var(--head-accent); outline-offset: -3px; }
@media (max-width: 719px) {
  .search { flex-basis: 100%; max-width: none; margin: 0; }
  .site-nav ul { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .site-nav ul.end { -webkit-mask-image: none; mask-image: none; }
}

/* search results: the header's list and the search page */
#q-results, .search ul[role=listbox] { position: absolute; left: 0; right: 0; top: 100%;
  z-index: 15; margin: 6px 0 0; padding: var(--s1) 0; list-style: none; color: var(--fg);
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px var(--shadow); max-height: 70vh; overflow: auto; }
.search li a, .results li a { display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0 var(--s2); padding: 7px 14px; color: var(--fg); text-decoration: none; }
.search li[aria-selected=true] a, .search li a:hover, .results li a:hover {
  background: var(--hi); }
.kindtag { color: var(--muted); font-size: 0.85em; }
.kindtag:last-child { margin-left: auto; }
.search-page input { font: inherit; width: 100%; max-width: 36rem; min-height: 46px;
  padding: 8px 14px; color: var(--fg); background: var(--raised);
  border: 1px solid var(--line-strong); border-radius: var(--radius); }
.results { list-style: none; padding: 0; max-width: 40rem; }
.results li { border-bottom: 1px solid var(--line); }

/* page frame */
.page-top { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }
.crumbs ol { display: flex; flex-wrap: wrap; margin: var(--s4) 0 0; padding: 0;
  list-style: none; font-size: 0.875rem; color: var(--muted); }
.crumbs li + li::before { content: "\203A"; padding: 0 8px; }
.crumbs a { color: var(--muted); }
main { display: block; width: 100%; max-width: var(--page); margin: 0 auto;
  padding: 0 var(--gutter) var(--s7); }
main::after { content: ""; display: table; clear: both; }

/* type */
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -0.005em; }
h1 { font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.6rem); line-height: 1.15;
  margin: var(--s3) 0 var(--s5); }
h2 { display: flow-root; font-size: 1.55rem; line-height: 1.25; margin: var(--s6) 0 var(--s3);
  padding-bottom: 6px; border-bottom: 1px solid var(--line); }
h3 { font-size: 1.1rem; line-height: 1.3; margin: var(--s5) 0 var(--s2); }
p, li, dd { max-width: 68ch; }
p { margin: 0 0 var(--s3); }
code { font: 0.88em/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
blockquote { margin: var(--s3) 0; padding: var(--s2) var(--s4); background: var(--panel);
  border-radius: var(--radius); }
img { max-width: 100%; height: auto; }
img.pixel, .infobox img, .gallery img, .thumb img, .card-pic img {
  image-rendering: pixelated; }
section { display: block; }

/* infobox */
.infobox { margin: 0 0 var(--s5); background: var(--raised); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px var(--shadow); }
/* phone: above the text, one column; tablet: above the text, the picture beside the facts;
   wide: floated beside the text and the tables */
@media (min-width: 560px) and (max-width: 999px) {
  .infobox { display: grid; grid-template-columns: minmax(12rem, 2fr) 3fr;
    align-items: stretch; }
  .ib-title, .ib-foot { grid-column: 1 / -1; }
  .infobox:not(:has(.ib-image)) dl { grid-column: 1 / -1; }
  .ib-image { border-right: 1px solid var(--line); }
  .infobox dl { align-content: start; padding-top: var(--s2); }
}
@media (min-width: 1000px) {
  .infobox { float: right; width: 21rem; margin: 0 0 var(--s5) var(--s6); }
}
@media (min-width: 1440px) { .infobox { width: 24rem; } }
.ib-title { padding: var(--s3) var(--s4); text-align: center; background: var(--panel);
  border-bottom: 1px solid var(--line); }
.ib-head { margin: 0; font: 700 1.3rem/1.25 var(--serif); }
.ib-sub { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; }
.ib-image { display: grid; place-items: center; gap: var(--s2); min-height: 9rem; margin: 0;
  padding: var(--s5) var(--s4);
  background: radial-gradient(ellipse at 50% 85%, var(--hi), transparent 70%), var(--raised); }
.ib-image img { display: block; }
.ib-image img[width] { max-width: 100%; }
.infobox dl { display: grid; grid-template-columns: minmax(7.5rem, max-content) 1fr;
  margin: 0; padding: var(--s1) var(--s4) var(--s2); }
.infobox dt, .infobox dd { margin: 0; padding: 7px 0; border-top: 1px solid var(--line); }
.infobox dt:first-of-type, .infobox dd:first-of-type { border-top: 0; }
.infobox dt { color: var(--muted); font-size: 0.9rem; font-weight: 600; padding-right: var(--s3);
  line-height: 1.5rem; }
.infobox dd { font-variant-numeric: tabular-nums; }
.ib-foot { padding: var(--s3) var(--s4); border-top: 1px solid var(--line);
  background: var(--panel); font-size: 0.95rem; }
.ib-desc { margin: 0; font-style: italic; }
.ib-desc[lang=ko] { font-style: normal; color: var(--muted); margin-top: var(--s1); }

/* tables: each fills its column (the content column, or the space beside a floated
   infobox, since .wrap is a block formatting context); text columns share the spare
   width, numbers stay tight. A table wider than its column scrolls inside .wrap, with a
   shadow at each edge that has more to show (the shadows are fixed to the box, the covers
   that hide them at the ends scroll with the content). .compact keeps a small table at
   its natural width. */
.viewer-table { margin: var(--s3) 0 var(--s5); }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3);
  margin: 0 0 var(--s2); color: var(--muted); font-size: 0.875rem; }
.filter { font: inherit; font-size: 0.95rem; padding: 6px 10px; width: 16rem; max-width: 100%;
  color: var(--fg); background: var(--raised); border: 1px solid var(--line-strong);
  border-radius: 8px; }
.wrap { display: flow-root; max-width: 100%; overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background:
    linear-gradient(90deg, var(--raised) 40%, transparent) left / 32px 100% no-repeat local,
    linear-gradient(270deg, var(--raised) 40%, transparent) right / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--shadow), transparent) left / 14px 100%
      no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--shadow), transparent) right / 14px 100%
      no-repeat scroll,
    var(--raised); }
.viewer-table .wrap { max-height: 80vh; }
.wrap > table { width: 100%; }
.compact > .wrap { width: fit-content; }
.viewer-table { display: flex; flex-direction: column; }
.viewer-table > .wrap { order: 2; }
.viewer-table[data-scrolls]::before { content: "Scroll sideways for more columns \2192";
  order: 1; margin: 0 0 6px; font-size: 0.8rem; color: var(--muted); text-align: right; }
.viewer-table[data-scrolls=end]::before {
  content: "\2190  Scroll back for the first columns"; }
table { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 14px; vertical-align: middle; text-align: left;
  border-bottom: 1px solid var(--line); }
@media (max-width: 559px) { th, td { padding: 6px 10px; } }
th.num { width: 1%; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--panel); font-size: 0.85rem; font-weight: 700; color: var(--fg);
  white-space: nowrap; }
table.sortable th { position: sticky; top: 0; z-index: 1; cursor: pointer;
  user-select: none; }
table.sortable th:hover { background: var(--hi); }
th[aria-sort=ascending]::after { content: " \25B2"; font-size: 0.75em; }
th[aria-sort=descending]::after { content: " \25BC"; font-size: 0.75em; }
td.num, th.num { text-align: right; white-space: nowrap; }
tbody tr:hover td { background: var(--panel); }
tr:target td { background: var(--hi); }
.entry { display: inline-flex; align-items: center; gap: 10px; min-height: var(--thumb);
  vertical-align: middle; }
.thumb { display: inline-grid; place-items: center; width: var(--thumb);
  height: var(--thumb); flex: none; overflow: hidden; }
.thumb img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.per { color: var(--muted); font-size: 0.85em; }
.drops td:nth-child(3) { white-space: nowrap; }
@media (max-width: 559px) { td .per { display: block; } }
.pct { font-weight: 600; }

/* figures */
.gallery { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s3) 0; }
.gallery figure { display: grid; justify-items: center; align-content: end; gap: 6px;
  min-width: 7rem; margin: 0; padding: var(--s3); text-align: center;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); }
figcaption { font-size: 0.85rem; color: var(--muted); }
.chart { margin: var(--s3) 0; max-width: 40rem; }
.chart svg { width: 100%; height: auto; color: var(--fg); }

/* dialogue */
.dialogue ol { list-style: none; padding: 0; margin: var(--s2) 0; }
.dialogue li { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.dialogue .who { font-weight: 700; margin-right: 0.5em; }
.dialogue .ko { display: block; color: var(--muted); }
.dialogue[data-show=en] .ko, .dialogue[data-show=ko] .en { display: none; }
.dialogue[data-show=ko] .ko { color: var(--fg); }
.lang-toggle button { font: inherit; font-size: 0.9rem; padding: 4px 12px; color: var(--fg);
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: 999px; }
.lang-toggle button[aria-pressed=true] { font-weight: 700; color: var(--fg);
  background: var(--hi); border-color: var(--accent); }

/* quests (#223): conversation parts, quest steps, the quest chain diagram */
.talk .part { margin: var(--s3) 0; padding: var(--s2) var(--s4);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); }
.talk .part:target { border-color: var(--accent); background: var(--hi); }
.talk .part ol { margin: var(--s1) 0; }
.talk .part li:last-child { border-bottom: 0; }
.talk .part-head, .talk .stage, .talk .leads { margin: var(--s1) 0; font-size: 0.9rem; }
.talk .part-no { font-weight: 700; margin-right: 0.5em; }
.talk .cond, .talk .leads { color: var(--muted); }
.talk .stage { font-style: italic; }
.talk li.choice .who, .talk li.again { color: var(--muted); }
.sources { margin: 0; padding-left: 1.1em; }
.sources li + li { margin-top: 2px; }
.chain { margin: var(--s3) 0; }
.chain-wrap { max-width: 100%; overflow-x: auto; }
.chain-svg { display: block; margin: 0 auto; color: var(--line-strong); }
.chain-svg rect { fill: var(--raised); stroke: var(--line-strong); stroke-width: 1; }
.chain-svg .main rect { stroke: var(--accent); stroke-width: 2.5; }
.chain-svg text { fill: var(--link); }
.chain-svg a:hover rect, .chain-svg a:focus rect { fill: var(--hi); }

details.spoiler { margin: var(--s3) 0; padding: var(--s2) var(--s4);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--panel); }
details.spoiler > summary { cursor: pointer; font-weight: 700; color: var(--fg); }
details.spoiler[open] > summary { margin-bottom: var(--s2); }

/* home */
main:has(> .hero) > h1 { margin: var(--s6) 0 var(--s4); }
.hero { display: grid; gap: var(--s4); margin: 0 0 var(--s6); padding: 0 0 var(--s6);
  border-bottom: 1px solid var(--line); }
.hero .lede { margin: 0; font-size: 1.15rem; line-height: 1.55; max-width: 40rem; }
.search.search-hero { margin: 0; max-width: 36rem; flex: none; width: 100%; }
.search-hero input { min-height: 52px; font-size: 1.05rem; padding-left: 44px;
  color: var(--fg); background-color: var(--raised); background-position: 14px 50%;
  background-size: 20px; border: 1px solid var(--line-strong);
  box-shadow: 0 2px 10px var(--shadow); }
.search-hero input::placeholder { color: var(--muted); }
.search-hero input:focus-visible { outline-color: var(--focus); }
.hero .counts { margin: 0; color: var(--muted); font-size: 0.95rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: var(--s4); margin: 0; padding: 0; list-style: none; }
.cards li { max-width: none; }
.cards a { display: grid; grid-template-columns: 88px 1fr; align-items: center;
  gap: var(--s4); height: 100%; padding: var(--s4); color: var(--fg); text-decoration: none;
  background: var(--raised); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color 0.2s cubic-bezier(0.25, 1, 0.5, 1),
    box-shadow 0.2s cubic-bezier(0.25, 1, 0.5, 1); }
.cards a:hover { border-color: var(--accent); box-shadow: 0 6px 20px var(--shadow); }
.cards li { position: relative; }
.cards li:has(> .card-more) > a:first-child { padding-bottom: calc(var(--s4) + 2.25rem); }
.cards a.card-more { position: absolute; right: var(--s4); bottom: var(--s3); display: block;
  height: auto; padding: 3px 12px; font-size: 0.875rem; font-weight: 600; color: var(--link);
  background: var(--hi); border: 1px solid transparent; border-radius: 999px; }
.cards a.card-more:hover { border-color: var(--accent); box-shadow: none; }
.card-pic { display: grid; place-items: center; width: 88px; height: 88px; overflow: hidden;
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 80%, var(--hi), transparent 72%), var(--panel); }
.card-pic img { max-width: 80px; max-height: 80px; object-fit: contain; }
.card-pic img.cover { max-width: none; max-height: none; width: 100%; height: 100%;
  object-fit: cover; image-rendering: auto; }
.card-pic .initial { font: 700 2.2rem/1 var(--serif); color: var(--accent); }
@media (max-width: 559px) {
  .cards a { grid-template-columns: 64px 1fr; gap: var(--s3); padding: var(--s3); }
  .card-pic { width: 64px; height: 64px; }
  .card-pic img { max-width: 60px; max-height: 60px; }
}
.map-figure { position: relative; display: block; width: fit-content; max-width: 100%;
  margin: var(--s3) 0; }
.map-figure img { display: block; image-rendering: pixelated; }
.map-figure .overlay { position: absolute; inset: 0; width: 100%; height: auto; }
.map-figure figcaption { margin-top: 6px; }
/* the World section (#221): overlay toggle and the area and atlas diagrams */
.map-view { clear: none; }
.ov-label { margin-left: 6px; font-size: 0.95rem; }
.ov-toggle:not(:checked) ~ .map-figure .overlay { visibility: hidden; }
.world-diagram { display: flow-root; margin: var(--s3) 0; max-width: 100%; }
.world-diagram svg { display: block; width: 100%; height: auto; color: var(--fg); }
.wd-edge { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.wd-dashed { stroke-dasharray: 5 4; }
.wd-node rect { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
.wd-node text { fill: var(--fg); font: 600 13px/1 var(--sans); }
.wd-node .wd-sub { font-weight: 400; font-size: 11px; fill: var(--muted); }
a.wd-node:hover rect, a.wd-node:focus rect { stroke: var(--link); }
.wd-town rect { stroke: var(--accent); stroke-width: 3; }
.wd-boss rect { stroke: var(--fg); stroke-width: 3; }
.wd-unreached rect { stroke-dasharray: 4 3; }
.wd-out rect { stroke-dasharray: 2 3; }
.world-chapters { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s3); }
.card-title { display: block; font: 700 1.2rem/1.25 var(--serif); color: var(--link); }
.card-blurb { display: block; margin-top: 2px; font-size: 0.95rem; }
.card-count { display: block; margin-top: 4px; font-size: 0.85rem; color: var(--muted); }

/* footer */
.site-foot { clear: both; flex: none; padding: var(--s5) var(--gutter); font-size: 0.875rem;
  color: var(--muted); border-top: 1px solid var(--line); background: var(--panel); }
.site-foot p { margin: 0 auto; max-width: calc(var(--page) - 2 * var(--gutter)); }
.site-foot { width: 100%; }
.site-foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-head, .site-foot, .tools { display: none; }
  .infobox { float: none; }
}
