:root {
  color-scheme: dark;
  --bg: #10181b;
  --panel: #182326;
  --panel-raised: #202d30;
  --border: #344548;
  --text: #edf3ef;
  --muted: #a2b4b0;
  --accent: #c8ee9a;
  --accent-ink: #19251b;
  --warning: #f2c777;
  --focus: #e4ffae;
  font-family: "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, [tabindex="0"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 20px clamp(16px, 3vw, 38px); border-bottom: 1px solid var(--border); background: #131e21; }
.brand h1 { margin: 0; font-size: clamp(20px, 2.1vw, 27px); line-height: 1.2; letter-spacing: -.03em; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.status-pill { display: inline-flex; vertical-align: 3px; margin-left: 8px; padding: 3px 8px; border: 1px solid #78985e; border-radius: 999px; color: var(--accent); font-size: 11px; letter-spacing: 0; }
.header-note { max-width: 520px; margin: 0; color: var(--muted); text-align: right; font-size: 12px; }
.layout { display: grid; grid-template-columns: minmax(270px, 335px) minmax(0, 1fr); gap: 16px; max-width: 1760px; margin: 0 auto; padding: 16px; }
.sidebar { display: grid; align-content: start; gap: 10px; min-width: 0; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.search-panel, .category-panel, .result-panel, .detail-panel { padding: 14px; }
.field-label, .toolbar-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; }
.search-row { display: flex; gap: 7px; }
input[type="search"] { min-width: 0; width: 100%; padding: 10px 11px; border: 1px solid var(--border); border-radius: 8px; background: #0f1719; color: var(--text); }
.subtle { color: var(--muted); font-size: 11px; }
.search-panel .subtle { margin: 7px 0 0; }
.quiet-button, .text-button, .icon-button, .zoom-controls button, .layer-button { border: 1px solid var(--border); border-radius: 8px; background: var(--panel-raised); }
.quiet-button { flex: 0 0 auto; padding: 7px 10px; color: var(--muted); font-size: 11px; }
.text-button { padding: 5px 8px; color: var(--muted); font-size: 11px; }
.icon-button { width: 30px; height: 30px; padding: 0; font-size: 19px; line-height: 1; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h2 { margin: 0; font-size: 13px; letter-spacing: -.01em; }
.category-list { display: grid; gap: 5px; margin-top: 10px; }
.category-row { display: flex; align-items: center; gap: 9px; min-height: 35px; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: #121c1e; cursor: pointer; }
.category-row:hover { border-color: var(--border); }
.category-row input { accent-color: var(--accent); }
.category-icon { display: inline-grid; width: 22px; height: 22px; place-items: center; border: 1px solid currentColor; border-radius: 7px; font-size: 12px; font-weight: 800; }
.category-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.category-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.count-badge { padding: 3px 7px; border-radius: 999px; background: #27373a; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.result-panel { display: flex; flex-direction: column; min-height: 140px; max-height: 37vh; }
.result-list { display: grid; gap: 5px; overflow: auto; margin-top: 10px; padding-right: 2px; }
.result-item { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 39px; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: #121c1e; text-align: left; }
.result-item:hover, .result-item.selected { border-color: #78985e; background: #26352a; }
.result-item .item-icon { color: var(--item-color); text-align: center; font-size: 15px; }
.result-item .item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.result-item .item-count { color: var(--muted); font-size: 10px; }
.empty-list, .detail-empty { padding: 14px 4px; color: var(--muted); font-size: 12px; }
.detail-panel[hidden] { display: none; }
.detail-panel { position: fixed; z-index: 30; right: 18px; bottom: 18px; width: min(340px, calc(100vw - 28px)); max-height: 68vh; overflow-y: auto; box-shadow: 0 8px 28px #0008; }
.detail-panel > .section-heading { position: sticky; top: -14px; z-index: 1; padding: 8px 0; background: var(--panel); }
.detail-content { margin-top: 10px; }
.detail-kicker { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 750; }
.detail-title { margin: 0 0 9px; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.detail-alert { margin: 0 0 10px; padding: 8px 9px; border-left: 2px solid var(--warning); background: #f2c7770c; color: #eedebd; font-size: 11px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0; }
.detail-grid div { min-width: 0; padding: 7px 8px; border-radius: 7px; background: #111a1c; }
.detail-grid dt { color: var(--muted); font-size: 10px; }
.detail-grid dd { margin: 2px 0 0; overflow-wrap: anywhere; font-size: 11px; font-variant-numeric: tabular-nums; }
.occurrence-list { display: grid; gap: 5px; margin-top: 10px; }
.occurrence-button { padding: 7px 8px; border: 1px solid var(--border); border-radius: 7px; background: #121c1e; text-align: left; font-size: 11px; }
.occurrence-button.active { border-color: var(--accent); }
.evidence details { margin-top: 10px; color: var(--muted); font-size: 10px; }
.evidence summary { cursor: pointer; }
.evidence code { overflow-wrap: anywhere; color: #cad4d0; }
.map-column { min-width: 0; }
.map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; padding: 10px 12px; }
.region-switch, .layer-switch, .zoom-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.region-switch { flex: 0 1 270px; }
.region-switch .toolbar-label { flex: 0 0 auto; margin: 0; }
.region-switch select { min-width: 150px; max-width: 100%; flex: 1 1 auto; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-raised); color: var(--text); font: inherit; font-size: 11px; }
.region-switch select:disabled { opacity: .75; }
.toolbar-label { display: inline; margin: 0 5px 0 0; }
.layer-button { padding: 7px 10px; color: var(--muted); font-size: 11px; }
.layer-button.active { border-color: #78985e; background: #26352a; color: var(--accent); }
.layer-note { margin-left: 4px; }
.zoom-controls button { min-width: 32px; height: 31px; padding: 3px 8px; }
#zoomLabel { min-width: 42px; color: var(--muted); text-align: center; font-size: 10px; font-variant-numeric: tabular-nums; }
.map-viewport { position: relative; display: grid; min-height: 420px; height: min(72vh, 880px); place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: radial-gradient(ellipse at center, #263438, #11191b 75%); touch-action: none; user-select: none; }
.map-stage { position: relative; flex: none; width: min(100%, 72vh); aspect-ratio: 1 / 1; transform-origin: center; will-change: transform; }
.map-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.pin-layer { position: absolute; inset: 0; }
.source-footprint { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; fill: #8fc18c26; stroke: #bce1a4; stroke-width: 1; }
.pin-layer .map-pin { z-index: 1; }
.map-pin { position: absolute; display: grid; width: 12px; min-width: 12px; height: 12px; transform: translate(-50%, -50%); place-items: center; padding: 0; border: 1px solid #f3ffe5; border-radius: 50%; background: var(--pin-color); box-shadow: 0 1px 3px #0009; color: #172016; cursor: pointer; font-size: 9px; font-weight: 900; line-height: 1; }
.map-pin:hover, .map-pin.selected { z-index: 2; outline: 2px solid #efffc4; outline-offset: 2px; transform: translate(-50%, -50%) scale(1.35); }
.map-pin .pin-label { position: absolute; left: 50%; top: calc(100% + 5px); max-width: 150px; transform: translateX(-50%); overflow: hidden; padding: 3px 6px; border: 1px solid #f3ffe566; border-radius: 5px; background: #111a1ddd; color: #f3f5ee; font-size: 9px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
#mapStage .pin-label { display: none; }
#mapStage.zoom-labels .pin-label, #mapStage .map-pin.selected .pin-label { display: block; }
.map-message { position: absolute; inset: 0; display: grid; place-items: center; padding: 22px; color: var(--muted); text-align: center; pointer-events: none; }
.map-message:empty { display: none; }
.map-message.error { color: #f1c8a0; }
.map-hint { position: absolute; right: 10px; bottom: 10px; padding: 5px 8px; border: 1px solid #ffffff1b; border-radius: 7px; background: #101719dd; color: #d0d9d5; font-size: 10px; pointer-events: none; }
.map-caption { display: flex; justify-content: space-between; gap: 10px; margin-top: 9px; padding: 9px 12px; color: var(--muted); font-size: 11px; }
.caption-warning { color: var(--warning); white-space: nowrap; }
.data-note, .footer-note { color: var(--muted); font-size: 10px; }
.data-note { margin: 9px 2px 0; }
.footer-note { max-width: 1760px; margin: 0 auto; padding: 0 16px 20px; }
.header-tools { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.header-tools select, .guide-filters select { max-width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 5px; background: var(--panel); color: var(--text); font: inherit; }
.guide-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 clamp(10px, 2vw, 30px); background: #131e21; overflow-x: auto; }
.guide-tabs button { flex-shrink: 0; padding: 13px 18px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); }
.guide-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); background: #ffffff06; }
.guide-view { max-width: 1600px; padding: 22px; margin: auto; }
.guide-heading { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.guide-heading h2 { font-size: 25px; }
.guide-search-label { display: grid; gap: 6px; min-width: min(360px, 100%); color: var(--muted); font-size: 12px; }
.guide-filters { display: flex; flex-wrap:wrap; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 0; }
.guide-stat-filters { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
.guide-stat-filters[hidden] { display:none; }
.guide-stat-filters input { width:75px; max-width:100%; padding:8px; border:1px solid var(--border); border-radius:5px; background:var(--panel); color:var(--text); font:inherit; }
.guide-filters label { display: flex; gap: 12px; align-items: center; }
#guideCount { font-size: 12px; color: var(--muted); }
.guide-columns { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 1.4fr); gap: 24px; align-items: start; }
.guide-list { display: grid; gap: 1px; max-height: 65vh; overflow: auto; border: 1px solid var(--border); }
.guide-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 10px 14px; text-align: left; border: 0; background: var(--panel); }
.guide-item:hover, .guide-item.selected { background: #293b35; }
.guide-item strong { display: block; overflow-wrap: anywhere; font-size: 14px; }
.guide-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.guide-item .guide-icon { font-size: 19px; color: var(--accent); }
.guide-detail { min-height: 240px; border-top: 2px solid var(--accent); padding: 20px; background: var(--panel); }
.guide-detail h3 { margin: 0 0 8px; font-size: 24px; line-height: 1.35; overflow-wrap: anywhere; }
.guide-detail h4 { margin: 20px 0 8px; font-size: 14px; }
.guide-detail p { overflow-wrap: anywhere; }
.game-description { white-space: pre-line; color: #d1ddd5; padding-block: 8px; }
.guide-detail .source-note { color: var(--muted); font-size: 12px; }
.configured-acquisition pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.guide-detail .link-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.guide-link { padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-raised); color: var(--accent); }
.guide-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); margin: 14px 0; gap: 7px; }
.guide-stats div { padding: 9px; border-bottom: 1px solid var(--border); }
.guide-stats dt { font-size: 11px; color: var(--muted); }
.guide-stats dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.guide-ingredients { list-style: none; padding: 0; }
.guide-ingredients li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.guide-status { padding: 10px 12px; border-left: 2px solid var(--warning); color: #d9c6a1; font-size: 12px; background: #f2c77708; }

@media (min-width: 1180px) {
  .sidebar { grid-template-rows: auto auto minmax(120px, 1fr) auto; }
  .result-panel { max-height: min(43vh, 580px); }
  .map-viewport { min-height: 560px; }
}
@media (max-width: 900px) {
  .guide-heading { align-items: stretch; flex-direction: column; gap: 12px; }
  .guide-columns { grid-template-columns: 1fr; gap: 16px; }
  .guide-list { max-height: 35vh; }
  .guide-view { padding: 14px 10px; }
  .guide-detail { padding: 16px; }
  .guide-tabs button { padding: 11px 13px; font-size: 12px; }
  .map-toolbar { position: sticky; top: 0; z-index: 15; }
  .topbar { align-items: start; flex-direction: column; gap: 9px; }
  .header-note { text-align: left; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .sidebar { order: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .search-panel, .category-panel { grid-column: span 1; }
  .result-panel, .detail-panel { grid-column: 1 / -1; }
  .result-panel { max-height: 27vh; }
  .map-column { order: 0; }
  .map-viewport { min-height: 360px; height: min(64vh, 680px); }
  .map-stage { width: min(100%, 64vh); }
}
@media (max-width: 560px) {
  .map-pin { width: 16px; height: 16px; }
  .map-pin::before { content: ''; position: absolute; inset: -6px; }
  .detail-panel { left: 10px; right: 10px; bottom: 8px; width: auto; max-height: 30vh; }
  body { font-size: 13px; }
  .topbar { flex-direction: row; align-items: center; gap: 8px; padding: 12px 14px; }
  .brand { min-width: 0; }
  .brand h1 { font-size: 19px; }
  .eyebrow { font-size: 8px; letter-spacing: .06em; }
  .header-tools label,.status-pill { display: none; }
  .header-tools select { max-width: 135px; padding: 7px; }
  .layout { gap: 9px; }
  .map-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 9px; }
  .region-switch { grid-column: 1 / -1; }
  .region-switch select { min-width: 0; }
  .layer-switch { gap: 5px; }
  .layer-switch .toolbar-label,.layer-note { display: none; }
  .zoom-controls { justify-content: flex-end; }
  .zoom-controls button { min-width: 26px; padding-inline: 5px; }
  #zoomLabel { min-width: 34px; }
  #resetView { font-size: 0; }
  #resetView::after { content: '↺'; font-size: 17px; }
  .map-viewport { min-height: 345px; height: 54vh; max-height: 560px; }
  .map-stage { width: min(100%, 54vh); }
  .sidebar { gap: 8px; }
  .search-panel, .category-panel { padding: 10px; }
  .category-row { min-height: 32px; padding: 4px 5px; }
  .category-name { font-size: 10px; }
  .category-count { font-size: 10px; }
  .result-panel, .detail-panel { padding: 11px; }
  .map-caption { align-items: start; flex-direction: column; gap: 3px; }
  .map-hint { right: 6px; bottom: 6px; font-size: 9px; }
  .footer-note { padding: 0 10px 14px; }
}

@media (min-width: 561px) and (max-width: 900px) and (max-height: 500px) {
  .detail-panel { left: auto; right: 8px; bottom: 8px; width: 300px; max-height: 75vh; }
}
.progress-panel { display:grid; gap:10px; }
.progress-hide,.found-toggle { display:flex; align-items:center; gap:9px; cursor:pointer; }
.progress-hide input,.found-toggle input { width:17px; height:17px; accent-color:#c7b16f; }
.progress-actions { display:flex; flex-wrap:wrap; gap:8px; }
.progress-actions button { flex:1; min-width:105px; }
.progress-panel p { margin:0; }
.found-toggle { margin:12px 0; min-height:36px; font-weight:600; }
.found-badge { color:#a9d18e; font-size:15px; }
.result-item.is-found .item-name { opacity:.68; }
