:root {
  --bg: #edf5ff;
  --bg-2: #f7fbff;
  --surface: rgba(255,255,255,.9);
  --surface-solid: #fff;
  --surface-soft: #f5f9fe;
  --text: #142033;
  --muted: #667891;
  --line: #d9e6f4;
  --line-strong: #b8cbe2;
  --blue: #1f74c9;
  --blue-soft: #e7f2ff;
  --gold: #f4b642;
  --gold-soft: #fff5dc;
  --green: #31a66a;
  --red: #d84a4a;
  --shadow: 0 18px 45px rgba(38, 82, 128, .13);
  --radius: 8px;
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #071120;
  --bg-2: #101b31;
  --surface: rgba(17, 29, 52, .86);
  --surface-solid: #111d34;
  --surface-soft: rgba(26, 39, 64, .94);
  --text: #f6ecd7;
  --muted: #b7bdc9;
  --line: rgba(232, 208, 150, .16);
  --line-strong: rgba(255, 207, 112, .46);
  --blue: #7cbfff;
  --blue-soft: rgba(124, 191, 255, .13);
  --gold: #ffc759;
  --gold-soft: rgba(255, 199, 89, .16);
  --shadow: 0 16px 36px rgba(0,0,0,.24);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
[hidden] { display: none !important; }

@media (any-pointer: fine) {
  html.ms-cursor-boot,
  html.ms-cursor-boot body,
  html.ms-cursor-boot body * {
    cursor: url("./cursors/dynamic-cursor-default-v2.png?v=007") 25 28, auto !important;
  }
  html.ms-cursor-boot a[href],
  html.ms-cursor-boot button:not([disabled]),
  html.ms-cursor-boot summary,
  html.ms-cursor-boot select:not([disabled]),
  html.ms-cursor-boot label[for],
  html.ms-cursor-boot input[type="button"]:not([disabled]),
  html.ms-cursor-boot input[type="checkbox"]:not([disabled]),
  html.ms-cursor-boot input[type="radio"]:not([disabled]),
  html.ms-cursor-boot input[type="range"]:not([disabled]),
  html.ms-cursor-boot input[type="submit"]:not([disabled]),
  html.ms-cursor-boot input[type="reset"]:not([disabled]),
  html.ms-cursor-boot [role="button"],
  html.ms-cursor-boot [role="link"],
  html.ms-cursor-boot [data-clickable],
  html.ms-cursor-boot [tabindex]:not([tabindex="-1"]) {
    cursor: url("./cursors/dynamic-cursor-click-v2.png?v=007") 30 30, pointer !important;
  }
  html.ms-cursor-boot input:not([type]),
  html.ms-cursor-boot input[type="email"],
  html.ms-cursor-boot input[type="number"],
  html.ms-cursor-boot input[type="password"],
  html.ms-cursor-boot input[type="search"],
  html.ms-cursor-boot input[type="tel"],
  html.ms-cursor-boot input[type="text"],
  html.ms-cursor-boot input[type="url"],
  html.ms-cursor-boot textarea,
  html.ms-cursor-boot [contenteditable="true"] { cursor: text !important; }
}

html.ms-cursor-overlay-ready,
html.ms-cursor-overlay-ready body,
html.ms-cursor-overlay-ready body * { cursor: none !important; }
html.ms-cursor-overlay-ready.ms-cursor-text input:not([type]),
html.ms-cursor-overlay-ready.ms-cursor-text input[type="email"],
html.ms-cursor-overlay-ready.ms-cursor-text input[type="number"],
html.ms-cursor-overlay-ready.ms-cursor-text input[type="password"],
html.ms-cursor-overlay-ready.ms-cursor-text input[type="search"],
html.ms-cursor-overlay-ready.ms-cursor-text input[type="tel"],
html.ms-cursor-overlay-ready.ms-cursor-text input[type="text"],
html.ms-cursor-overlay-ready.ms-cursor-text input[type="url"],
html.ms-cursor-overlay-ready.ms-cursor-text textarea,
html.ms-cursor-overlay-ready.ms-cursor-text [contenteditable="true"] { cursor: text !important; }

.ms-cursor-overlay {
  --cursor-x: -80px;
  --cursor-y: -80px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147483647;
  width: 30px;
  height: 30px;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--cursor-x), var(--cursor-y), 0);
  transition: opacity 80ms ease;
  will-change: transform;
}
html.ms-cursor-visible:not(.ms-cursor-text) .ms-cursor-overlay { opacity: 1; }
.ms-cursor-frame {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
  image-rendering: auto;
  opacity: 0;
  user-select: none;
}
.ms-cursor-frame-default,
.ms-cursor-frame-press { width: 25px; height: 28px; }
.ms-cursor-frame-click,
.ms-cursor-frame-click-red { width: 30px; height: 30px; }
.ms-cursor-frame-default { opacity: 1; }
.ms-cursor-overlay.is-clickable .ms-cursor-frame-default,
.ms-cursor-overlay.is-pressed .ms-cursor-frame-default,
.ms-cursor-overlay.is-text .ms-cursor-frame-default { opacity: 0; }
.ms-cursor-overlay.is-clickable:not(.is-pressed) .ms-cursor-frame-click {
  opacity: 1;
  animation: ms-cursor-click-base 700ms steps(1, end) infinite;
}
.ms-cursor-overlay.is-clickable:not(.is-pressed) .ms-cursor-frame-click-red {
  animation: ms-cursor-click-red 700ms steps(1, end) infinite;
}
.ms-cursor-overlay.is-pressed .ms-cursor-frame-press { opacity: 1; }
.ms-cursor-overlay.is-text { opacity: 0; }
@keyframes ms-cursor-click-base {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes ms-cursor-click-red {
  0%, 49% { opacity: 0; }
  50%, 100% { opacity: 1; }
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(255,232,162,.42), transparent 28%, rgba(183,220,255,.58) 78%, transparent),
    linear-gradient(180deg, var(--bg-2), var(--bg) 340px, #f7fbff 100%);
}
body[data-theme="dark"] {
  background:
    linear-gradient(90deg, rgba(89, 55, 30, .34), transparent 28%, rgba(13, 74, 123, .38) 74%, transparent),
    radial-gradient(circle at 50% 0%, rgba(42,139,219,.18), transparent 40%),
    linear-gradient(180deg, #050914, var(--bg) 360px, #091325 100%);
}

button, input, select { font: inherit; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.site-shell { min-width: 320px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 82px;
  padding: 14px max(18px, calc((100vw - 1540px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  backdrop-filter: blur(18px);
}
body[data-theme="dark"] .topbar { background: rgba(4, 8, 22, .78); }

.brand { display: flex; align-items: center; gap: 12px; min-width: 250px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  background: url("./site-icon.png") center / contain no-repeat;
  filter: drop-shadow(0 8px 14px rgba(255, 191, 73, .18));
}
.brand strong { display: block; font-size: 16px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-links { display: flex; flex-wrap: wrap; justify-content: start; gap: 14px 18px; }
.nav-links button {
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}
.nav-links .active { color: var(--blue); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.language-toggle {
  height: 36px;
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.language-toggle button {
  height: 28px;
  border: 0;
  border-radius: 5px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.language-toggle button.active {
  background: var(--blue-soft);
  color: var(--blue);
}
.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31,116,201,.08);
}
body[data-theme="dark"] .icon-button {
  color: var(--gold);
  border-color: rgba(255,226,163,.32);
  background: rgba(17, 22, 38, .76);
}

.workspace {
  width: min(1540px, calc(100% - 32px));
  margin: 18px auto 28px;
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.module-rail, .result-pane, .hero-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 10px;
}
body[data-theme="dark"] .module-rail,
body[data-theme="dark"] .result-pane,
body[data-theme="dark"] .hero-panel {
  background: linear-gradient(135deg, rgba(17, 29, 52, .88), rgba(12, 20, 36, .82));
}
.module-rail {
  position: sticky;
  top: 100px;
  min-height: calc(100vh - 118px);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rail-title { padding: 0 8px 8px; font-size: 18px; font-weight: 900; }
.filter-group { display: grid; gap: 10px; }
.field {
  min-width: 0;
  height: 48px;
  display: grid;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.search-field { grid-template-columns: 22px minmax(0, 1fr); gap: 8px; padding: 0 14px; color: var(--muted); }
.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
}
.select-field { grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 0 10px 0 12px; }
.select-field span { color: var(--muted); font-size: 12px; font-weight: 900; }
select {
  min-width: 0;
  width: 100%;
  height: 34px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
}
select option,
select optgroup { background: #fff; color: #142033; }
body[data-theme="dark"] .select-field { background: #111d34; border-color: rgba(255, 226, 163, .24); }
body[data-theme="dark"] select { color: #f6ecd7; background-color: #111d34; color-scheme: dark; }
body[data-theme="dark"] select option,
body[data-theme="dark"] select optgroup { background: #111d34; color: #f6ecd7; }
body[data-theme="dark"] select option:checked { background: #294261; color: #fff4d6; }
.ghost-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}
body[data-theme="dark"] .ghost-button {
  background: linear-gradient(180deg, #ffd77d, #ffbd55);
  border-color: rgba(255,226,163,.55);
  color: #1e1306;
}
.rail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
}
.rail-stats button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 8px;
  background: var(--surface-soft);
  text-align: center;
  cursor: pointer;
}
.rail-stats button.active { border-color: var(--line-strong); background: var(--blue-soft); color: var(--blue); }
.rail-stats strong, .rail-stats small { display: block; }
.rail-stats strong { color: var(--text); font-size: 20px; line-height: 1; }
.rail-stats small { margin-top: 6px; color: var(--muted); font-weight: 900; font-size: 12px; }
.catalog-workbench { min-width: 0; display: grid; gap: 14px; }
.hero-panel {
  min-width: 0;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}
.hero-panel h1 { margin: 0; font-size: 30px; line-height: 1.2; }
.count-pill {
  min-width: 128px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 900;
}
.result-pane { min-width: 0; padding: 14px; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(134px, 1fr));
  gap: 12px;
}
.result-card {
  min-width: 0;
  min-height: 158px;
  display: grid;
  grid-template-rows: 84px auto auto;
  justify-items: center;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.result-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--blue) 48%, var(--line));
  background: color-mix(in srgb, var(--blue-soft) 42%, var(--surface-solid));
}
.result-card.active {
  border-color: color-mix(in srgb, var(--blue) 56%, var(--line));
  background: color-mix(in srgb, var(--blue-soft) 56%, var(--surface-solid));
}
.thumb-box {
  width: 100%;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.thumb-box img {
  max-width: 78px;
  max-height: 78px;
  object-fit: contain;
  image-rendering: auto;
}
.thumb-fallback {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 1000;
}
.result-card strong,
.result-card small,
.result-card em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-card > span:last-child { width: 100%; min-width: 0; }
.result-card strong { font-size: 15px; }
.result-card small { margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.result-card em { margin-top: 5px; color: var(--gold); font-size: 12px; font-style: normal; font-weight: 900; }
body[data-active-module="overview"] .result-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
body[data-active-module="overview"] .result-card {
  min-height: 104px;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-rows: 1fr;
  align-items: center;
  justify-items: stretch;
  gap: 12px;
  padding: 10px;
  text-align: left;
}
body[data-active-module="overview"] .thumb-box { width: 72px; height: 72px; }
.overview-icon {
  position: relative;
  border: 1px solid color-mix(in srgb, currentColor 24%, var(--line));
  overflow: hidden;
}
.overview-icon img { max-width: 58px; max-height: 58px; margin: auto; }
.overview-icon-items { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--surface-soft)); }
.overview-icon-monsters { color: var(--green); background: color-mix(in srgb, var(--green) 13%, var(--surface-soft)); }
.overview-icon-npcs { color: var(--blue); background: color-mix(in srgb, var(--blue) 13%, var(--surface-soft)); }
.overview-icon-skills { color: #a98bff; background: color-mix(in srgb, #765bd0 16%, var(--surface-soft)); }
.overview-icon-maps { color: #d89545; background: color-mix(in srgb, #d89545 14%, var(--surface-soft)); }
.overview-icon-quests { color: #df6f76; background: color-mix(in srgb, #df6f76 14%, var(--surface-soft)); }
.overview-icon-crafting { color: #50a8a1; background: color-mix(in srgb, #50a8a1 14%, var(--surface-soft)); }
.overview-icon-cash { color: #ce6ca9; background: color-mix(in srgb, #ce6ca9 14%, var(--surface-soft)); }
.result-card[data-overview-module="items"] { border-left: 3px solid var(--gold); }
.result-card[data-overview-module="monsters"] { border-left: 3px solid var(--green); }
.result-card[data-overview-module="npcs"] { border-left: 3px solid var(--blue); }
.result-card[data-overview-module="skills"] { border-left: 3px solid #a98bff; }
.result-card[data-overview-module="maps"] { border-left: 3px solid #d89545; }
.result-card[data-overview-module="quests"] { border-left: 3px solid #df6f76; }
.result-card[data-overview-module="crafting"] { border-left: 3px solid #50a8a1; }
.result-card[data-overview-module="cash"] { border-left: 3px solid #ce6ca9; }
body[data-active-module="quests"] .result-grid {
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}
.result-card-quests {
  min-height: 96px;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-rows: 1fr;
  align-items: center;
  justify-items: stretch;
  gap: 12px;
  padding: 10px;
  text-align: left;
}
.result-card-quests .thumb-box { width: 58px; height: 58px; }
.result-card-quests .thumb-box img { max-width: 48px; max-height: 48px; }
.result-card-items em,
.result-card-monsters em {
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
}
.result-card-items[data-category="equipment"] em { background: color-mix(in srgb, var(--gold) 18%, var(--surface-soft)); color: var(--gold); }
.result-card-items[data-category="consumable"] em,
.result-card-items[data-category="consumables"] em { background: color-mix(in srgb, var(--green) 16%, var(--surface-soft)); color: var(--green); }
.result-card-items[data-category="setup"] em { background: color-mix(in srgb, var(--blue) 16%, var(--surface-soft)); color: var(--blue); }
.result-card-monsters[data-boss="true"] em { background: color-mix(in srgb, var(--red) 16%, var(--surface-soft)); color: var(--red); }
.load-sentinel {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}
.load-sentinel span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  animation: load-pulse 1s ease-in-out infinite;
}
.load-sentinel span:nth-child(2) { animation-delay: .14s; }
.load-sentinel span:nth-child(3) { animation-delay: .28s; }
@keyframes load-pulse {
  0%, 100% { opacity: .28; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.inspector {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(5, 11, 22, .66);
  backdrop-filter: blur(5px);
}
body[data-detail-open="true"] { overflow: hidden; }
body[data-detail-open="true"] .inspector { display: grid; }
.detail-dialog {
  width: min(1600px, 100%);
  height: min(820px, calc(100vh - 48px));
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,.42);
  overflow: hidden;
}
.detail-dialog-bar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.detail-dialog-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.detail-dialog-copy { min-width: 0; }
.detail-dialog-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.detail-dialog-bar h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 23px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-back {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
}
.detail-back:hover { border-color: var(--blue); color: var(--blue); }
.detail-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
}
.detail-close:hover { border-color: var(--blue); color: var(--blue); }
.detail-panel {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
  padding: 14px;
  overflow: auto;
  overscroll-behavior: contain;
}
.detail-panel[data-module="npcs"],
.detail-panel[data-module="skills"],
.detail-panel[data-module="maps"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-panel[data-module="quests"] { grid-template-columns: 1fr; }
.detail-panel[data-module="items"] {
  grid-template-columns: minmax(210px, .72fr) minmax(330px, 1.12fr) minmax(390px, 1.45fr);
  align-content: stretch;
}
.detail-panel[data-module="monsters"] {
  grid-template-columns: minmax(190px, .75fr) minmax(260px, 1fr) minmax(360px, 1.48fr) minmax(280px, 1fr);
  align-content: stretch;
  overflow: hidden;
}
.detail-panel[data-module="items"] > *,
.detail-panel[data-module="monsters"] > * { min-width: 0; min-height: 0; }
.detail-panel > .detail-head,
.detail-panel > .empty-state { grid-column: 1 / -1; }
.detail-panel > .full-span { grid-column: 1 / -1; }
.detail-head {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
.detail-art {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.detail-art img { max-width: 86px; max-height: 86px; object-fit: contain; }
.detail-title h2 { margin: 0; font-size: 24px; line-height: 1.25; overflow-wrap: anywhere; }
.detail-dialog .detail-title h2 { display: none; }
.detail-title p { margin: 6px 0 0; color: var(--muted); font-weight: 800; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}
.tag.gold { background: var(--gold-soft); color: var(--gold); }
.tag.green { background: rgba(49,166,106,.14); color: var(--green); }
.detail-section {
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-solid);
}
.detail-section h3 { margin: 0; font-size: 15px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.summary-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-soft);
}
.summary-item span, .summary-item strong { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-item span { color: var(--muted); font-size: 12px; font-weight: 900; }
.summary-item strong { margin-top: 5px; font-size: 16px; }
.stat-list { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: var(--surface-soft);
  font-weight: 900;
}
.stat-chip span { color: var(--muted); font-size: 12px; }
.text-list { display: grid; gap: 8px; }
.text-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 9px 10px;
  color: var(--text);
  line-height: 1.55;
}
.related-quest-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
}
.related-quest-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: var(--surface-soft);
}
.related-quest-row strong,
.related-quest-row small { display: block; min-width: 0; }
.related-quest-row strong { overflow-wrap: anywhere; }
.related-quest-row small { margin-top: 4px; color: var(--muted); font-weight: 800; }
.related-quest-row > span:last-child { color: var(--blue); font-size: 12px; font-weight: 900; white-space: nowrap; }
.linked-row {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.linked-row:hover { border-color: var(--blue); background: color-mix(in srgb, var(--blue-soft) 55%, var(--surface-soft)); }
.linked-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 9px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}
.linked-chip:hover { border-color: var(--blue); color: var(--blue); }
.linked-chip img { width: 26px; height: 26px; object-fit: contain; }

.quest-brief { margin: 0; color: var(--text); line-height: 1.75; }
.quest-npcs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.quest-npcs h3 { grid-column: 1 / -1; }
.quest-npc-card,
.quest-data-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: var(--surface-soft);
}
.quest-npc-card { color: inherit; text-align: left; cursor: pointer; }
.quest-npc-card:hover { border-color: var(--blue); }
.quest-npc-card .thumb-box,
.quest-data-row .thumb-box,
.quest-ui-icon { width: 44px; height: 44px; background: var(--surface-solid); }
.quest-npc-card .thumb-box img,
.quest-data-row .thumb-box img,
.quest-ui-icon img { max-width: 38px; max-height: 38px; }
.quest-npc-card small,
.quest-npc-card strong,
.quest-npc-card em,
.quest-data-row small,
.quest-data-row strong,
.quest-data-row em { display: block; min-width: 0; }
.quest-npc-card small,
.quest-data-row small { color: var(--muted); font-size: 12px; font-weight: 900; }
.quest-npc-card em,
.quest-data-row em { margin-top: 3px; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 800; }
.quest-data-list { display: grid; gap: 8px; }
.quest-data-row.linked-row { cursor: pointer; }
.quest-data-row-static { grid-template-columns: 44px minmax(0, 1fr); }
.quest-resource-group-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-soft);
}
.quest-resource-label {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  padding: 6px 8px;
  background: var(--surface-solid);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
.quest-resource-assets { min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.quest-resource-chip {
  min-width: 0;
  min-height: 52px;
  display: inline-grid;
  grid-template-columns: 40px minmax(0, auto);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  background: var(--surface-solid);
  color: var(--text);
  text-align: left;
}
.quest-resource-link { cursor: pointer; }
.quest-resource-link:hover { border-color: var(--blue); background: var(--blue-soft); }
.quest-resource-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-soft);
}
.quest-resource-icon img { display: block; max-width: 36px; max-height: 36px; margin: auto; object-fit: contain; }
.quest-resource-chip > span:last-child,
.quest-resource-chip strong,
.quest-resource-chip em { display: block; min-width: 0; }
.quest-resource-chip strong { font-size: 13px; overflow-wrap: anywhere; }
.quest-resource-chip em { margin-top: 3px; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 800; }
.quest-prerequisite-chip {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface-solid);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.quest-prerequisite-chip:hover { border-color: var(--blue); background: var(--blue-soft); }
.quest-prerequisite-chip strong { overflow-wrap: anywhere; }
.quest-prerequisite-chip em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 900; white-space: nowrap; }
.map-list { display: grid; gap: 8px; }
.map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: var(--surface-soft);
}
.map-row strong, .map-row small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-row small { margin-top: 4px; color: var(--muted); font-weight: 800; }
.skill-level-row {
  grid-template-columns: minmax(0, 1fr);
}
.skill-level-row small {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.55;
}
.map-preview-frame {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  overflow: hidden;
}
.map-preview-frame img {
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
}
.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
  background: var(--surface-soft);
}

.item-identity-panel,
.monster-identity-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}
.item-detail-art,
.monster-detail-art {
  width: 100%;
  min-height: 210px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.item-detail-art img,
.monster-detail-art img {
  display: block;
  max-width: min(150px, 82%);
  max-height: 150px;
  margin: auto;
  object-fit: contain;
}
.monster-detail-art { min-height: 180px; }
.detail-value-list { display: grid; gap: 8px; }
.detail-value-row {
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: var(--surface-soft);
}
.detail-value-row span { color: var(--muted); font-size: 12px; font-weight: 900; }
.detail-value-row strong { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.item-content-column { min-width: 0; display: grid; align-content: start; gap: 12px; }
.item-description {
  min-height: 130px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  line-height: 1.75;
  white-space: pre-wrap;
}
.item-source-panel,
.monster-drops-panel,
.monster-spawns-panel { overflow: hidden; }
.item-source-panel { grid-template-rows: none; grid-auto-rows: auto; align-content: start; overflow: auto; }
.source-group { min-width: 0; display: grid; gap: 7px; }
.source-group h4,
.spawn-group h4 { margin: 0; font-size: 14px; }
.source-list {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
}
.source-empty {
  padding: 4px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.source-quest-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--surface-soft);
}
.source-row-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-solid);
}
.source-row-icon img { display: block; max-width: 42px; max-height: 42px; margin: auto; object-fit: contain; }
.source-quest-row > span:last-child,
.source-quest-row strong,
.source-quest-row small { display: block; min-width: 0; }
.source-quest-row strong { overflow-wrap: anywhere; }
.source-quest-row small { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.item-task-panel .source-list { max-height: 340px; }

.monster-identity-panel,
.monster-stats-panel,
.monster-drops-panel,
.monster-spawns-panel { height: 100%; }
.monster-quest-list { max-height: 360px; }
.monster-section-title { margin-top: 2px !important; padding-top: 2px; }
.monster-elements { margin-top: 0; }
.monster-drops-panel { grid-template-rows: auto minmax(0, 1fr); }
.monster-drops-panel .empty-state { min-height: 150px; display: grid; place-items: center; }
.monster-spawns-panel { grid-template-rows: auto minmax(0, 1fr); }
.spawn-groups { min-height: 0; display: grid; align-content: start; gap: 12px; overflow: auto; padding-right: 3px; }
.spawn-group { display: grid; gap: 0; }
.spawn-group h4 { padding: 3px 0 8px; }
.spawn-map-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 8px 2px;
  background: transparent;
  color: inherit;
  text-align: left;
}
.spawn-map-row > strong { color: var(--blue); font-size: 16px; }
.spawn-map-row span,
.spawn-map-row span strong,
.spawn-map-row span small { display: block; min-width: 0; }
.spawn-map-row span strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spawn-map-row span small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 800; }
.spawn-map-row.linked-row:hover { background: var(--blue-soft); }

.quest-npc-card .thumb-box,
.quest-data-row .thumb-box,
.quest-ui-icon { display: grid; place-items: center; }
.quest-npc-card .thumb-box img,
.quest-data-row .thumb-box img,
.quest-ui-icon img { display: block; margin: auto; object-fit: contain; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: minmax(220px, 1fr) auto; }
  .nav-links { grid-column: 1 / -1; }
  .workspace { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
  .detail-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-panel[data-module="items"] { grid-template-columns: minmax(210px, .7fr) minmax(0, 1.5fr); }
  .detail-panel[data-module="items"] > .item-source-panel { grid-column: 1 / -1; }
  .detail-panel[data-module="monsters"] { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; overflow: auto; }
  .monster-identity-panel,
  .monster-stats-panel,
  .monster-drops-panel,
  .monster-spawns-panel { height: auto; }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 68px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px 16px;
  }
  .workspace { width: min(100% - 18px, 680px); grid-template-columns: 1fr; margin-top: 10px; }
  .brand { min-width: 0; }
  .module-rail { position: static; min-height: 0; }
  .hero-panel { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inspector {
    padding: 10px;
  }
  .detail-dialog { height: calc(100vh - 20px); }
  .detail-panel,
  .detail-panel[data-module="npcs"],
  .detail-panel[data-module="quests"],
  .detail-panel[data-module="skills"],
  .detail-panel[data-module="maps"] { grid-template-columns: 1fr; }
  .detail-panel[data-module="items"],
  .detail-panel[data-module="monsters"] { grid-template-columns: 1fr; grid-auto-rows: max-content; align-content: start; overflow: auto; }
  .detail-panel[data-module="items"] > *,
  .detail-panel[data-module="monsters"] > * { min-height: auto; }
  .detail-panel[data-module="items"] > .item-source-panel { grid-column: auto; }
  .monster-identity-panel,
  .monster-stats-panel,
  .monster-drops-panel,
  .monster-spawns-panel { height: auto; }
  .item-source-panel,
  .monster-drops-panel,
  .monster-spawns-panel { overflow: visible; }
  .monster-drops-panel,
  .monster-spawns-panel { grid-template-rows: auto auto; }
  .monster-quest-list { max-height: none; overflow: visible; }
  .spawn-groups { overflow: visible; }
}

@media (max-width: 520px) {
  .topbar { gap: 8px; }
  .brand { gap: 8px; }
  .brand strong { font-size: 12px; }
  .brand-mark { width: 38px; height: 38px; }
  .top-actions { gap: 6px; }
  .language-toggle button { padding: 0 4px; }
  .icon-button { width: 36px; height: 36px; }
  .rail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-card { min-height: 148px; }
  .result-card-quests { min-height: 92px; }
  .quest-npcs { grid-template-columns: 1fr; }
  .quest-npcs h3 { grid-column: 1; }
  .summary-grid { grid-template-columns: 1fr; }
  .detail-head { grid-template-columns: 1fr; }
}
