:root {
  --bg: #0f1218;
  --card: #171c25;
  --line: #262d3a;
  --text: #e4e8ef;
  --muted: #8b95a7;
  --accent: #6aa8ff;
  --bad: #ff6b6b;
  --warn: #f0b04a;
  --info: #6aa8ff;
  --common: #c9ced6;
  --rare: #4fc06a;
  --legend: #4b9cff;
  --unique: #e2a93b;
  --special: #c77dff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header.site nav, main, footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

h1 { font-size: 1.4rem; margin: 8px 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.muted { color: var(--muted); }
.error { color: var(--bad); }

.search { display: flex; gap: 8px; flex-wrap: wrap; }
.search input { flex: 1 1 200px; }
input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
}
button { cursor: pointer; background: #22406e; border-color: #2f5590; }
button:hover { background: #2a4f88; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.profile { display: flex; gap: 16px; align-items: flex-start; }
.portrait { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; }
.profile h2 { font-size: 1.5rem; margin: 0; }
.profile p { margin: 2px 0 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 24px; margin: 0; }
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 0; font-size: 1.1rem; font-weight: 600; }

.findings, .boards, .picks, .plain { list-style: none; margin: 0; padding: 0; }
.findings li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.findings li:first-child { border-top: 0; }
.sev {
  flex: none;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 1px 6px;
  min-width: 64px;
  text-align: center;
}
.sev.bad { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.sev.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.sev.info { background: color-mix(in srgb, var(--info) 20%, transparent); color: var(--info); }

.gear { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.slot {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 60px;
}
.slot img { width: 40px; height: 40px; flex: none; }
.slot.flagged { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.slot.empty { border-style: dashed; }
.slot .muted { font-size: 0.8rem; }

.grade { font-weight: 600; }
.grade-common { color: var(--common); }
.grade-rare { color: var(--rare); }
.grade-legend { color: var(--legend); }
.grade-unique { color: var(--unique); }
.grade-special { color: var(--special); }

.boards li { display: grid; grid-template-columns: 90px 1fr 120px; gap: 12px; align-items: center; padding: 4px 0; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }

.picks li { margin-bottom: 6px; }
.picks button { width: 100%; text-align: left; background: var(--bg); border-color: var(--line); }

footer { font-size: 0.8rem; }

@media (max-width: 520px) {
  .profile { flex-direction: column; }
  .boards li { grid-template-columns: 70px 1fr; }
  .boards li .muted { grid-column: 2; }
}

.stones { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.stone {
  font-size: 0.72rem;
  line-height: 1.3;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.stone.empty { color: var(--warn); border-style: dashed; }
.stone.god { font-weight: 600; }
.subskills { margin-top: 2px; }
.slot { align-items: flex-start; }

.top-hint { font-size: 0.75rem; margin-top: 2px; }
.table-wrap { overflow-x: auto; }
.players { width: 100%; border-collapse: collapse; }
.players th, .players td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.players th { color: var(--muted); font-weight: 500; font-size: 0.85rem; border-top: 0; }
.players .num { text-align: right; }
a { color: var(--accent); }
.credit { font-size: 0.8rem; margin: 10px 0 0; }

.boards.deity li { grid-template-columns: 150px 1fr 260px; }
.bar.stacked { position: relative; display: flex; overflow: visible; }
.bar.stacked .other { background: var(--accent); }
.bar.stacked .arcana { background: var(--special); }
.bar .marker, .legend .marker {
  position: absolute; top: -3px; width: 2px; height: 14px; background: var(--warn);
}
.legend { font-size: 0.8rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.legend .key { display: inline-block; width: 12px; height: 8px; border-radius: 2px; }
.legend .key.other { background: var(--accent); }
.legend .key.arcana { background: var(--special); }
.legend .marker { position: static; display: inline-block; height: 12px; }
@media (max-width: 520px) {
  .boards.deity li { grid-template-columns: 110px 1fr; }
}

/* ---------- site chrome ---------- */
header.site { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
header.site nav { display: flex; align-items: center; gap: 16px; padding: 10px 16px; margin: 0 auto; flex-wrap: wrap; }
.brand { font-weight: 700; margin-right: 8px; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }
nav a[aria-current="page"] { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.spacer { flex: 1; }
.me { display: inline-flex; align-items: center; gap: 8px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; }
a.discord { background: #5865f2; color: #fff; border-radius: 6px; padding: 6px 12px; text-decoration: none; font-weight: 600; }
a.discord:hover { background: #4752c4; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.page-head { margin-bottom: 16px; }
.small { font-size: 0.8rem; }
.empty { text-align: center; padding: 40px; }

/* ---------- trackers ---------- */
.tracker-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.tracker-head h1 { margin: 0; }
.prog { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 10px; }
.prog .bar { flex: 1; }
.prog b, .cat b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sync { font-size: 0.85rem; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 16px; }
.controls input[type=search] { flex: 1 1 220px; max-width: 340px; }
.tg { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--card); }
.seg button.on { background: var(--accent); color: #08101f; }
.cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 24px; margin: 12px 0; }
.cat { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; display: block; }
.bar > span { display: block; height: 100%; background: var(--done, #3ecf8e); }
.boards .bar > span, .bar.stacked > span { background: var(--accent); }

.world { margin: 0 0 22px; }
.world > h2 { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.fac { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; font-weight: 600; }
.fac.Elyos { color: #7cc4ff; } .fac.Asmodian { color: #ff8a8a; } .fac.Abyss { color: #c5a3ff; } .fac.Instance, .fac.None { color: var(--muted); }
.count { color: var(--muted); font-weight: 500; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.region-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.region-card.complete { border-color: rgba(62, 207, 142, .5); }
.region-card.complete .count { color: #3ecf8e; }
.region-card > h3 { margin: 0; padding: 9px 12px; font-size: 0.95rem; display: flex; justify-content: space-between; background: color-mix(in srgb, var(--line) 40%, var(--card)); cursor: pointer; }
.region-card.collapsed .rows { display: none; }
.pet { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--line); }
.rows .pet:first-child { border-top: 0; }
.pet.done { opacity: .5; } .pet.done .nm a { text-decoration: line-through; }
.pet input, .list input { width: 18px; height: 18px; accent-color: #3ecf8e; cursor: pointer; flex: none; }
.pet img { width: 36px; height: 36px; border-radius: 8px; background: var(--line); flex: none; object-fit: cover; }
.info { flex: 1; min-width: 0; }
.nm { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nm a { color: inherit; text-decoration: none; } .nm a:hover { color: var(--accent); }
.sub { color: var(--muted); font-size: 0.8rem; }
.gen { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; font-weight: 700; color: #0f1115; }
.gen.feral { background: #e07a5f; } .gen.intellect { background: #6aa9ff; } .gen.nature { background: #5fbf6a; } .gen.trans { background: #b48ef0; } .gen.special { background: #e6b450; }
.approx { font-size: 10px; color: var(--warn); border: 1px solid var(--warn); border-radius: 4px; padding: 0 5px; }
.locs { display: none; margin: 6px 0 2px; font-size: 0.8rem; color: var(--muted); }
.pet.open .locs { display: block; }
.locs div { display: flex; gap: 6px; }
.locs .w { min-width: 110px; color: var(--text); }
.locs .n { margin-left: auto; font-variant-numeric: tabular-nums; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table.list th, table.list td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap; }
table.list th.sorted::after { content: " ▲"; } table.list th.sorted.desc::after { content: " ▼"; }
table.list tr.done td { opacity: .5; }
table.list td img { width: 30px; height: 30px; border-radius: 6px; vertical-align: middle; background: var(--line); }
table.list a { color: inherit; text-decoration: none; } table.list a:hover { text-decoration: underline; }
table.titles td:nth-child(2) { min-width: 200px; }
.grade-epic { color: var(--legend); }
@media (max-width: 600px) { .regions { grid-template-columns: 1fr; } .controls input[type=search] { max-width: none; } .cat { grid-template-columns: 80px 1fr auto; } }
table.list a.grade-common { color: var(--common); } table.list a.grade-rare { color: var(--rare); }
table.list a.grade-legend, table.list a.grade-epic { color: var(--legend); } table.list a.grade-unique { color: var(--unique); }
table.list a.grade-special { color: var(--special); }

/* ---------- map ---------- */
.world-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.world-tile { display: flex; flex-direction: column; gap: 6px; padding: 8px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.world-tile:hover { border-color: var(--accent); background: var(--card); }
.world-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--line); }
.world-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: flex; justify-content: center; align-items: flex-start; padding: 24px 16px; overflow-y: auto; }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; width: min(1200px, 100%); }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; display: flex; gap: 10px; align-items: center; }
.panel-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; padding: 16px; }
.world-map { width: 100%; border-radius: 8px; position: sticky; top: 16px; }
.zones { display: flex; flex-direction: column; gap: 8px; }
.zone { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.zone > h3 { margin: 0; padding: 8px 12px; font-size: 0.95rem; display: flex; justify-content: space-between; cursor: pointer; }
.zone .count.complete { color: #3ecf8e; }
@media (max-width: 800px) { .panel-body { grid-template-columns: 1fr; } .world-map { position: static; } }
