:root {
  color-scheme: dark;
  --bg: #0d100f;
  --bg-soft: #121613;
  --panel: #171c19;
  --panel-raised: #1c231f;
  --panel-hover: #222a25;
  --line: #313a33;
  --line-soft: #252d28;
  --ink: #eee8dc;
  --muted: #9ea79f;
  --faint: #6f7a71;
  --gold: #d4b363;
  --gold-bright: #f0d58a;
  --gold-wash: rgba(212, 179, 99, 0.12);
  --ruby: #b9554f;
  --ruby-wash: rgba(185, 85, 79, 0.13);
  --green: #77a784;
  --blue: #719eb1;
  --purple: #9c82b8;
  --radius: 14px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% -10%, rgba(212, 179, 99, 0.1), transparent 30rem),
    radial-gradient(circle at 92% 18%, rgba(132, 68, 60, 0.1), transparent 34rem),
    linear-gradient(180deg, #101410 0, var(--bg) 28rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px);
  background-size: 31px 31px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

button, input { font: inherit; }
button { color: inherit; }
a { color: var(--gold-bright); }

.skip-link {
  position: fixed;
  z-index: 99;
  top: 8px;
  left: 8px;
  padding: 9px 13px;
  color: #17140b;
  background: var(--gold-bright);
  border-radius: 8px;
  transform: translateY(-140%);
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
}

.brand-lockup, .header-meta, .dialog-heading, .detail-title-row,
.source-heading, .entry-main, .entry-tail, .detail-actions {
  display: flex;
  align-items: center;
}

.brand-lockup { gap: 14px; }
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--gold-bright);
  border: 1px solid rgba(212, 179, 99, .48);
  background: linear-gradient(145deg, rgba(212,179,99,.16), rgba(212,179,99,.03));
  box-shadow: inset 0 0 0 4px rgba(0,0,0,.14);
  transform: rotate(45deg);
}
.brand-mark::first-letter { transform: rotate(-45deg); }

.eyebrow {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -.015em;
}
h1 { margin-bottom: 0; font-size: clamp(25px, 3vw, 35px); line-height: 1; }
h2 { font-size: 28px; line-height: 1.15; }
h3 { font-size: 18px; }

.header-meta { gap: 12px; }
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.status-dot::before {
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(119, 167, 132, .1);
}
.status-dot.is-error::before { background: var(--ruby); }

.ghost-button, .icon-button, .copy-button, .text-button, .load-more {
  border: 0;
  cursor: pointer;
}
.ghost-button {
  padding: 9px 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
}
.ghost-button:hover { border-color: var(--gold); background: var(--gold-wash); }

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 25px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(23, 28, 25, .72);
  backdrop-filter: blur(12px);
}
.stat {
  padding: 16px 20px;
  border-right: 1px solid var(--line-soft);
}
.stat:last-child { border-right: 0; }
.stat strong { display: block; font: 600 24px/1 Georgia, serif; color: var(--gold-bright); }
.stat span { color: var(--muted); font-size: 12px; }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 18px;
  color: #d8d0bf;
  border: 1px solid rgba(212, 179, 99, .2);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(90deg, rgba(212, 179, 99, .08), rgba(212,179,99,.025));
  font-size: 12px;
}
.notice strong { margin-right: 5px; color: var(--gold-bright); }
.notice-icon { color: var(--gold); font-size: 18px; line-height: 1.1; }

.section-tabs {
  display: flex;
  gap: 6px;
  margin: 22px 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex: 0 0 auto;
  padding: 10px 15px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.tab small { color: var(--faint); font-size: 11px; }
.tab:hover { color: var(--ink); background: rgba(255,255,255,.025); }
.tab.is-active {
  color: var(--gold-bright);
  border-color: rgba(212,179,99,.2);
  background: var(--gold-wash);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 38%) minmax(0, 1fr);
  min-height: 690px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(18, 22, 19, .86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.workspace.is-about { grid-template-columns: 1fr; }
.workspace.is-about .catalog-panel { display: none; }

.catalog-panel {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(12, 15, 13, .38);
}
.catalog-tools { position: sticky; top: 0; z-index: 3; }
.search-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  transition: border-color .18s, box-shadow .18s;
}
.search-box:focus-within {
  border-color: rgba(212, 179, 99, .65);
  box-shadow: 0 0 0 3px rgba(212,179,99,.08);
}
.search-box input {
  width: 100%;
  padding: 12px 0;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
}
.search-box input::placeholder { color: var(--faint); }
.search-icon { color: var(--gold); font-size: 21px; line-height: 1; }
kbd {
  padding: 1px 6px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #111512;
  font: 10px ui-monospace, monospace;
}

.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.filter-chip {
  padding: 6px 10px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255,255,255,.018);
  cursor: pointer;
  font-size: 11px;
}
.filter-chip:hover { border-color: var(--line); color: var(--ink); }
.filter-chip.is-active {
  color: var(--gold-bright);
  border-color: rgba(212,179,99,.3);
  background: var(--gold-wash);
}

.results-heading {
  display: flex;
  justify-content: space-between;
  min-height: 35px;
  padding: 14px 2px 6px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.text-button { padding: 0; color: var(--gold); background: transparent; font-size: inherit; }
.text-button:hover { color: var(--gold-bright); }

.catalog { display: grid; gap: 6px; }
.catalog-card {
  width: 100%;
  padding: 12px 13px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.catalog-card:hover { background: var(--panel-hover); transform: translateX(2px); }
.catalog-card.is-active {
  border-color: rgba(212,179,99,.3);
  background: linear-gradient(90deg, rgba(212,179,99,.13), rgba(212,179,99,.035));
}
.catalog-card-top, .catalog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.catalog-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}
.catalog-card-meta { margin-top: 5px; color: var(--faint); font-size: 11px; }
.catalog-card-meta span:last-child { text-align: right; }
.source-count {
  flex: 0 0 auto;
  padding: 2px 7px;
  color: var(--gold-bright);
  border-radius: 999px;
  background: var(--gold-wash);
  font-size: 10px;
  font-weight: 800;
}
.source-count.is-empty { color: var(--faint); background: rgba(255,255,255,.035); }
mark { color: inherit; background: rgba(240,213,138,.24); border-radius: 2px; }

.load-more {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  color: var(--gold-bright);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}
.load-more:hover { border-color: var(--gold); }

.detail-panel {
  min-width: 0;
  padding: clamp(22px, 4vw, 44px);
  background:
    linear-gradient(135deg, rgba(255,255,255,.012), transparent 45%),
    var(--panel);
}
.empty-state {
  display: grid;
  min-height: 530px;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.empty-state > span { color: var(--gold); font-size: 34px; }
.empty-state h2 { margin: 14px 0 7px; color: var(--ink); }
.empty-state p { max-width: 380px; }

.detail-head { padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.detail-title-row { justify-content: space-between; gap: 18px; align-items: flex-start; }
.detail-title-row h2 { margin-bottom: 7px; }
.detail-subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.detail-actions { gap: 8px; }
.copy-button {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.02);
  font-size: 11px;
}
.copy-button:hover { color: var(--gold-bright); border-color: rgba(212,179,99,.45); }
.detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}
.summary-pill {
  padding: 6px 10px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(0,0,0,.08);
  font-size: 11px;
}
.summary-pill strong { color: var(--ink); }

.detail-section { margin-top: 27px; }
.section-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.section-kicker::after { flex: 1; height: 1px; content: ""; background: var(--line-soft); }
.source-list, .drop-list { display: grid; gap: 9px; }
.source-card, .drop-entry, .info-card {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(12, 15, 13, .28);
}
.source-card { cursor: pointer; transition: border-color .15s, background .15s; }
.source-card:hover { border-color: rgba(212,179,99,.35); background: var(--gold-wash); }
.source-heading { justify-content: space-between; gap: 14px; align-items: flex-start; }
.source-heading strong { font-size: 13px; }
.source-heading small { display: block; margin-top: 2px; color: var(--faint); }
.source-facts { display: flex; flex-wrap: wrap; gap: 6px 13px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.source-facts b { color: var(--ink); font-weight: 650; }

.type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font: 750 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
  opacity: .9;
}
.type-drop { color: var(--green); }
.type-limit { color: var(--blue); }
.type-kill { color: var(--ruby); }
.type-normal { color: var(--gold); }
.type-pct { color: var(--purple); }
.type-quest, .type-special { color: #c58664; }
.type-attr { color: var(--faint); }

.group-block { margin-top: 20px; }
.group-block:first-child { margin-top: 0; }
.group-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 8px;
}
.group-heading h3 { margin: 0 0 2px; }
.group-heading p { margin: 0; color: var(--faint); font-size: 11px; }
.drop-entry { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.drop-entry-button { width: 100%; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.drop-entry-button:hover { border-color: rgba(212,179,99,.35); background: var(--gold-wash); }
.entry-main { min-width: 0; gap: 10px; }
.entry-icon {
  display: grid;
  flex: 0 0 33px;
  width: 33px;
  height: 33px;
  place-items: center;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(212,179,99,.05);
  font: 600 13px Georgia, serif;
}
.entry-main strong { display: block; overflow-wrap: anywhere; font-size: 12px; }
.entry-main small { color: var(--faint); }
.entry-tail { flex: 0 0 auto; gap: 8px; text-align: right; }
.chance { color: var(--gold-bright); font-size: 12px; font-weight: 750; }
.chance small { display: block; color: var(--faint); font-size: 9px; font-weight: 500; }
.qty { color: var(--muted); font-size: 11px; }

.empty-inline {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 11px;
}
.warning-inline {
  padding: 11px 13px;
  color: #d9cbb0;
  border-left: 3px solid var(--gold);
  background: var(--gold-wash);
  font-size: 12px;
}

.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.info-card h3 { margin-bottom: 7px; }
.info-card p, .info-card li { color: var(--muted); font-size: 12px; }
.info-card p:last-child { margin-bottom: 0; }
.info-card ul { margin: 8px 0 0; padding-left: 18px; }
.diagnostic-list { display: grid; gap: 8px; }
.diagnostic-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.diagnostic-row:last-child { border-bottom: 0; }
.diagnostic-row strong { color: var(--ink); }

dialog {
  width: min(680px, calc(100% - 28px));
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-raised);
  box-shadow: 0 30px 100px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(5,7,6,.72); backdrop-filter: blur(4px); }
dialog form { padding: 24px; }
.dialog-heading { justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin-bottom: 0; }
.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--muted);
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  font-size: 23px;
}
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.legend-grid > div { padding: 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.legend-grid p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.dialog-note { margin: 18px 0 0; color: var(--faint); font-size: 11px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  padding: 10px 14px;
  color: #15120b;
  border-radius: 9px;
  background: var(--gold-bright);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

*:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

@media (max-width: 920px) {
  .page-shell { width: min(100% - 24px, 760px); padding-top: 18px; }
  .site-header { align-items: flex-start; }
  .header-meta { flex-direction: column; align-items: flex-end; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .workspace { grid-template-columns: 1fr; }
  .catalog-panel { border-right: 0; }
  .detail-panel { border-top: 1px solid var(--line); }
  .empty-state { min-height: 320px; }
}

@media (max-width: 580px) {
  .page-shell { width: 100%; padding: 14px 10px 28px; }
  .site-header { padding: 0 5px; }
  .brand-mark { width: 37px; height: 37px; }
  .header-meta .status-dot { display: none; }
  .ghost-button { padding: 7px 9px; font-size: 11px; }
  .stats-strip { margin-top: 18px; }
  .stat { padding: 12px 14px; }
  .stat strong { font-size: 20px; }
  .notice span:last-child { display: block; margin-top: 2px; }
  .section-tabs { margin-top: 14px; }
  .tab { padding: 8px 10px; }
  .workspace { border-radius: 14px; }
  .catalog-panel, .detail-panel { padding: 13px; }
  .detail-panel { padding-top: 24px; }
  .detail-title-row { flex-direction: column; }
  .about-grid, .legend-grid { grid-template-columns: 1fr; }
  .drop-entry { align-items: flex-start; }
  .entry-tail { flex-direction: column; align-items: flex-end; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
