:root {
  --bg: #15110b;
  --bg-alt: #1c1610;
  --panel: #221b13;
  --panel-alt: #2a2115;
  --line: #3d3120;
  --gold: #dcae4c;
  --gold-soft: #b4903f;
  --text: #f1e8d4;
  --muted: #a9997a;
  --green: #7fbf6e;
  --red: #cf6b5c;
  --amber: #e0a542;
  --focus: #f2c869;
  --radius: 10px;
  --radius-sm: 6px;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 8% -10%, #2a2013 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1a2318 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.45;
}

a { color: var(--gold); }

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

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

/* ---------- header ---------- */

header {
  border-bottom: 2px solid var(--line);
  background: linear-gradient(180deg, var(--bg-alt), transparent);
  padding: 2rem 1.5rem 1.6rem;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.2rem;
}

header h1 {
  margin: 0 0 .4rem;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  color: var(--gold);
  text-shadow: 0 2px 0 #0007;
}

.rune-strip {
  display: flex;
  gap: .35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rune-strip img {
  width: 26px;
  height: 26px;
  opacity: .8;
  filter: drop-shadow(0 1px 1px #0009);
}

/* ---------- layout ---------- */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.4rem 1.2rem 3rem;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.2rem;
  align-items: start;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  position: sticky;
  top: 1rem;
}

@media (max-width: 980px) {
  main { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: 0 6px 18px #0005;
}

.panel h2 {
  margin: 0 0 .15rem;
  font-family: var(--serif);
  font-size: 1.08rem;
  color: var(--gold);
  display: flex;
  align-items: baseline;
  gap: .4rem;
}

.panel h2 .count {
  font-size: .72rem;
  color: var(--muted);
  font-family: var(--sans);
  font-weight: 400;
}

.collapse-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: .1rem .45rem;
  border-radius: 999px;
  font-size: .8rem;
  line-height: 1.4;
  cursor: pointer;
}
.collapse-toggle:hover { color: var(--gold); border-color: var(--gold-soft); }

.panel-body.collapsed { display: none; }

.subtext {
  margin: .2rem 0 .8rem;
  color: var(--muted);
  font-size: .82rem;
}

/* ---------- toolbars / inputs ---------- */

.toolbar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: .7rem;
}

input[type="search"], select, button, input[type="text"] {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .4rem .6rem;
  font-size: .84rem;
  font-family: inherit;
}

input[type="search"] { flex: 1 1 140px; min-width: 110px; }

label { display: flex; align-items: center; gap: .5rem; font-size: .85rem; cursor: pointer; }

input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.link-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  align-self: flex-start;
  cursor: pointer;
}
.link-btn:hover { color: var(--red); border-color: var(--red); }

/* ---------- lists ---------- */

.list-fieldset, fieldset.category {
  border: 0;
  margin: 0;
  padding: 0;
}

fieldset.category {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 1rem;
}
fieldset.category:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

fieldset.category legend {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 1.02rem;
  padding: 0;
  margin-bottom: .5rem;
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: .4rem;
}
fieldset.category legend .count { font-family: var(--sans); font-size: .72rem; color: var(--muted); font-weight: 400; }

.category-body.collapsed { display: none; }

.row-option-wrap {
  display: flex;
  align-items: stretch;
  gap: .4rem;
}
.row-option-wrap .row-option { flex: 1 1 auto; min-width: 0; }

.item-hide-btn {
  flex-shrink: 0;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0 .5rem;
  font-size: .95rem;
  cursor: pointer;
  line-height: 1;
}
.item-hide-btn:hover { color: var(--red); border-color: var(--red); }

.hidden-items { margin-top: .6rem; border-top: 1px dashed var(--line); padding-top: .5rem; }
.hidden-items-toggle {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: .78rem;
  cursor: pointer;
  padding: .2rem 0;
}
.hidden-items-toggle:hover { color: var(--gold-soft); }
.hidden-items-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .4rem;
  max-height: 220px;
  overflow-y: auto;
}
.hidden-items-list.collapsed { display: none; }
.hidden-row { opacity: .75; cursor: default; }
.item-restore-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: var(--panel-alt);
  border: 1px solid var(--gold-soft);
  color: var(--gold-soft);
  border-radius: var(--radius-sm);
  padding: .2rem .55rem;
  font-size: .74rem;
  cursor: pointer;
}
.item-restore-btn:hover { color: var(--gold); border-color: var(--gold); }

.scroll-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 340px;
  overflow-y: auto;
  padding-right: .2rem;
}

.item-list { max-height: 380px; }

.row-option {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.row-option:hover { border-color: var(--gold-soft); }
.row-option.selected {
  border-color: var(--gold);
  background: #2f2515;
  box-shadow: inset 0 0 0 1px var(--gold);
}

.row-option-name {
  flex: 1 1 auto;
  font-size: .86rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-msg {
  color: var(--muted);
  font-size: .82rem;
  font-style: italic;
  margin: .4rem 0;
}

/* ---------- icons ---------- */

.icon-wrap {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #150f08;
  border: 1px solid var(--line);
  overflow: hidden;
}
.icon-wrap img { width: 100%; height: 100%; object-fit: contain; }
.icon-fallback {
  display: none;
  width: 100%; height: 100%;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--gold-soft);
  font-size: .95rem;
}
.icon-wrap.none-icon {
  display: flex;
  color: var(--muted);
  font-size: 1.1rem;
}

/* ---------- runes ---------- */

.rune-list {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  margin-left: auto;
  flex-shrink: 0;
}
.rune-chip {
  position: relative;
  width: 22px; height: 22px;
  display: inline-flex;
}
.rune-chip img { width: 100%; height: 100%; }
.rune-chip.dim img { opacity: .45; }
.rune-n {
  position: absolute;
  bottom: -3px; right: -3px;
  background: var(--gold);
  color: #201803;
  font-size: .58rem;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 6px;
  font-weight: 700;
}
.no-runes { margin-left: auto; font-size: .74rem; color: var(--muted); font-style: italic; }

.rune-counter-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.rune-counter {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .55rem;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  font-size: .8rem;
}
.rune-counter img { width: 20px; height: 20px; }
.rune-counter[data-status="ok"] { border-color: var(--green); color: var(--green); }
.rune-counter[data-status="missing"] { border-color: var(--red); color: var(--red); }

.rune-chip-row {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
  width: 100%;
}
.rune-chip-btn {
  padding: .3rem;
  line-height: 0;
  border-radius: 999px;
  cursor: pointer;
}
.rune-chip-btn img { width: 18px; height: 18px; display: block; }
.rune-chip-btn.active { border-color: var(--gold); background: #2f2515; box-shadow: inset 0 0 0 1px var(--gold); }

/* ---------- equipment ---------- */

.equipment-panel { min-width: 0; }
.equipment-toolbar { margin-bottom: 1.1rem; }
.category-toolbar { margin-bottom: .6rem; }

/* ---------- offering ---------- */

.selected-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
  margin-bottom: .9rem;
}
.offer-card {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem;
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  border: 1px solid var(--line);
  flex-wrap: wrap;
}
.offer-card.empty { opacity: .6; }
.offer-card-label {
  flex-basis: 100%;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.offer-card-name { font-size: .82rem; }
.offer-card .muted { color: var(--muted); font-style: italic; }

/* ---------- result ---------- */

.results-list { display: flex; flex-direction: column; gap: .5rem; }
.result {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .6rem .7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-alt);
}
.result.ok { border-color: var(--green); }
.result.no { opacity: .7; }
.result-status {
  font-size: 1.1rem;
  line-height: 1.2;
}
.result.ok .result-status { color: var(--green); }
.result.no .result-status { color: var(--red); }
.result-body { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 0; }
.result-name { font-size: .88rem; font-weight: 600; }
.result-detail { font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.result-detail.ok-text { color: var(--green); }

.results-warn-heading {
  font-size: .78rem;
  color: var(--amber);
  margin: .7rem 0 .1rem;
}
.result.warn { border-color: var(--amber); background: #2c2213; }
.result.warn .result-status { color: var(--amber); }
.result-detail.warn-text { color: var(--amber); }

/* ---------- tooltip ---------- */

.location-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 240px;
  background: #100b06;
  color: var(--text);
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius-sm);
  padding: .4rem .6rem;
  font-size: .78rem;
  line-height: 1.35;
  box-shadow: 0 8px 20px #000a;
  pointer-events: none;
}

.location-tooltip.loot-tooltip {
  max-width: 260px;
  padding: .55rem .65rem;
}
.loot-tooltip-title {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--gold-soft);
  font-size: .78rem;
  margin-bottom: .35rem;
}
.loot-tooltip-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.loot-tooltip-item {
  display: flex;
  align-items: center;
  gap: .45rem;
}
.loot-tooltip-item .icon-wrap {
  width: 24px; height: 24px;
  border-radius: 4px;
}
.loot-tooltip-item .icon-fallback { font-size: .75rem; }
.loot-tooltip-name {
  font-size: .78rem;
  line-height: 1.3;
}
.loot-tooltip-empty {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  font-style: italic;
}

/* ---------- footer ---------- */

footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.2rem 3rem;
  color: var(--muted);
  font-size: .76rem;
}
