:root {
  color-scheme: light;
  --paper: #f8f4f0;
  --card: #fff;
  --ink: #32202a;
  --muted: #6f5861;
  --border: #e7d9db;
  --accent: #86384e;
  --dark: #2d1721;
  --gold: #f8cd87;
  font: 16px/1.55 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
a { color: inherit; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #b87529; outline-offset: 3px; }
.wrap { width: min(1200px, calc(100% - 44px)); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip:focus { position: fixed; top: 12px; left: 14px; background: var(--card); padding: 10px; z-index: 3; }
.top { background: #22131c; color: #fff6f2; border-bottom: 1px solid #633848; }
.top-inner { display: flex; align-items: center; gap: 32px; min-height: 65px; }
.brand, nav a { text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; white-space: nowrap; }
.brand img { border-radius: 8px; }
nav { display: flex; gap: 3px; }
nav a { border-radius: 8px; padding: 7px 12px; color: #f5e0e6; font-weight: 700; }
nav a[aria-current] { background: #603344; color: white; }
.version { margin-left: auto; font-size: .84rem; color: #ebcbd4; white-space: nowrap; }
.hero { background: radial-gradient(ellipse at 83% 15%, #704238 0%, transparent 53%), var(--dark); color: #fff; }
.hero-inner { min-height: 243px; display: grid; grid-template-columns: minmax(0, 620px) 1fr; gap: 30px; align-items: center; padding-block: 28px 35px; }
.hero-title { color: var(--gold); font-weight: 750; margin: 0 0 1px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.45rem, 5vw, 3.7rem); line-height: 1.12; letter-spacing: -.055em; }
.hero-meta { color: #f3dee5; margin-top: 10px; }
.hero-icon { justify-self: center; border-radius: 25%; box-shadow: 0 16px 32px #08141087; }
.search-box { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 0 14px; background: #fff; border-radius: 10px; color: var(--ink); }
.search-box:focus-within { outline: 3px solid var(--gold); }
.search-icon { position: relative; border: 2px solid #815363; border-radius: 50%; width: 14px; height: 14px; flex: none; }
.search-icon::after { content: ''; position: absolute; width: 7px; height: 2px; background: #815363; transform: rotate(45deg); bottom: -3px; right: -5px; }
.search-box input { width: 100%; min-width: 0; padding: 11px 1px; border: 0; background: transparent; color: inherit; outline: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box button, .detail-bar button { background: transparent; color: inherit; border: 0; font-size: 1.45rem; line-height: 1; padding: 6px 5px; }
.guide { min-height: 36vh; padding: 27px 0 44px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
h2 { font-size: 1.55rem; letter-spacing: -.035em; }
#status { font-size: .88rem; color: var(--muted); text-align: right; }
.filters, .pills { display: flex; flex-wrap: wrap; gap: 7px; }
.filters { justify-content: space-between; margin-bottom: 11px; }
.pills button { min-height: 36px; color: var(--ink); background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 4px 11px; font-size: .9rem; font-weight: 700; }
.pills button:hover { border-color: #a66b7e; }
.pills button[aria-pressed="true"] { color: #fff; background: var(--accent); border-color: var(--accent); }
.area-picker { padding: 10px 0 13px; border-top: 1px solid var(--border); margin-bottom: 3px; }
.areas { margin-top: 7px; }
.areas button { color: #623044; padding-inline: 9px; }
.columns, .record { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(110px, .36fr) minmax(285px, 1.15fr); align-items: center; gap: 13px; }
.columns { padding: 6px 13px; color: var(--muted); font-size: .83rem; }
#results { display: grid; gap: 7px; }
.record { padding: 10px 13px; min-height: 75px; border: 1px solid var(--border); background: var(--card); border-radius: 11px; content-visibility: auto; contain-intrinsic-size: auto 75px; }
.identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.identity > div, .record-meta, .sources, .detail-body { min-width: 0; overflow-wrap: anywhere; }
.art { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; background: #f3e9e8; border: 1px solid #ebdcde; border-radius: 9px; }
.art img { display: block; width: 86%; height: 86%; object-fit: contain; image-rendering: pixelated; }
.item-icon { display: block; width: 86%; height: 86%; background-repeat: no-repeat; image-rendering: pixelated; }
.art.small { width: 32px; height: 32px; border-radius: 7px; }
.item-name { font-weight: 770; text-decoration: none; }
.item-name:hover { color: #952a4d; text-decoration: underline; }
.support, .record-meta { color: var(--muted); font-size: .855rem; }
.record-meta { display: grid; gap: 3px; justify-items: start; }
.record-meta span { max-width: 100%; }
.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; }
.source, .tag { min-width: 0; display: inline-flex; align-items: center; gap: 6px; }
.source { background: #f9f0ef; color: #642d43; border: 1px solid #efe0e2; border-radius: 8px; text-decoration: none; padding: 2px 7px 2px 3px; font-size: .855rem; font-weight: 700; }
.source:hover, .more:hover { border-color: #a66b7e; }
.tag, .more { color: #6c334a; background: #f6e7ea; padding: 1px 7px; border-radius: 6px; font-size: .815rem; text-decoration: none; }
.tag.boss { background: #f8ecd2; color: #734708; }
.more { border: 1px solid transparent; }
.empty { border: 1px dashed var(--border); border-radius: 10px; padding: 18px; color: var(--muted); }
.map-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(235px, 1fr); gap: 15px; align-items: start; }
.map-frame { display: grid; place-items: start center; background: #2b1a23; border-radius: 11px; min-height: 160px; color: white; overflow: hidden; }
.map-frame .empty { align-self: center; color: #fff3f1; border-color: #875b69; }
.map-art { position: relative; width: 100%; }
.map-art img { width: 100%; display: block; height: auto; image-rendering: pixelated; }
.marker { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); min-height: 27px; padding: 1px 5px; font-size: .75rem; color: white; background: #462334ed; border: 1px solid #f0d8e3; border-radius: 7px; white-space: nowrap; }
.marker.boss { background: #ffe4a4; border: 1px solid #714314; color: #483015; font-weight: 800; z-index: 1; }
.marker[aria-pressed="true"] { outline: 3px solid #fff5cc; z-index: 2; }
.map-panel { border: 1px solid var(--border); border-radius: 11px; padding: 14px; background: var(--card); }
.map-panel h3 { margin-bottom: 8px; }
.map-panel .support { display: block; margin-bottom: 8px; }
.map-panel .stack { max-height: 550px; overflow: auto; }
.foot { border-top: 1px solid var(--border); padding-block: 15px 24px; display: grid; gap: 5px; color: var(--muted); font-size: .87rem; }
.foot details p { padding-block: 5px; }
dialog { max-width: min(720px, calc(100% - 20px)); width: 720px; max-height: calc(100% - 24px); padding: 0; border: 1px solid #b18a99; background: var(--card); color: var(--ink); border-radius: 15px; }
dialog::backdrop { background: #2a1620bd; }
.detail-bar { position: sticky; z-index: 1; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 8px 15px; color: white; background: var(--dark); }
.detail-bar button { padding-inline: 8px; }
.detail-body { padding: 15px; }
.detail-heading .art { width: 72px; height: 72px; }
.detail-heading h2 { line-height: 1.2; padding-bottom: 3px; }
.detail-body h3 { margin: 15px 0 6px; font-size: 1.02rem; }
.stack { display: grid; gap: 5px; }
.detail-row, .condition, .stat { background: #faf2f1; border: 1px solid #eee0e2; border-radius: 8px; padding: 8px 9px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.condition { margin-top: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 5px; }
.stat strong, .stat small { display: block; overflow-wrap: normal; }
.stat small { color: var(--muted); }
.recipe { display: grid; gap: 3px; margin: 0; padding-left: 1.5em; }
.detail-section { margin-top: 14px; }
.count-label { display: flex; align-items: center; gap: 8px; margin-block: 8px; }
.count-label input { max-width: 6.5rem; color: var(--ink); background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; }
@media (max-width: 790px) {
  .record { grid-template-columns: minmax(0, 1fr) auto; }
  .record .sources { grid-column: 1 / -1; }
  .columns { display: none; }
  .map-layout { grid-template-columns: 1fr; }
}
@media (max-width: 530px) {
  .wrap { width: calc(100% - 24px); }
  .top-inner { gap: 6px 14px; flex-wrap: wrap; padding-block: 9px; }
  .version { order: 2; }
  nav { order: 3; flex-basis: 100%; }
  nav a { padding: 5px 10px; }
  .hero-inner { min-height: auto; grid-template-columns: 1fr; padding-block: 20px; }
  .hero-icon { display: none; }
  .guide { padding-top: 16px; }
  .section-heading { gap: 5px; }
  .record { padding: 8px; gap: 7px; }
  .identity { gap: 7px; }
  .pills { gap: 5px; }
  .pills button { padding-inline: 8px; }
  .marker { min-height: 22px; font-size: .65rem; }
}
