:root {
  --bg: #121110;
  --surface: #1c1a18;
  --surface-2: #26231f;
  --border: #37322b;
  --text: #f1ebe2;
  --muted: #a89f92;
  --accent: #e0a13a;
  --accent-2: #c2562f;
  --bar: linear-gradient(90deg, #c2562f, #e0a13a);
  --ok: #6fbf73;
  --warn: #e0a13a;
  --bad: #e06a5a;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: Cinzel, Georgia, serif; letter-spacing: .02em; margin: 0; }
h3 { font-size: 1rem; color: var(--muted); margin: 28px 0 12px; text-transform: uppercase; letter-spacing: .1em; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; padding-top: 48px; }

/* Hero */
.hero {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(224,161,58,.18), transparent 60%),
    radial-gradient(ellipse at 90% 10%, rgba(194,86,47,.18), transparent 55%),
    var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 28px;
}
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .18em; font-size: .75rem; font-weight: 600; margin: 0 0 6px; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 3rem); font-weight: 800; line-height: 1.1; }
.brand { display: flex; align-items: center; gap: 18px; }
.brand-logo { width: clamp(64px, 14vw, 104px); height: auto; flex-shrink: 0; filter: drop-shadow(0 4px 14px rgba(0,0,0,.45)); }

.event-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; }
.event-bar select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font: inherit; font-weight: 600; max-width: 100%;
}
.event-bar select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.event-dates { color: var(--muted); font-size: .85rem; }
.event-dates .live { color: var(--ok); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.kpis.small { margin-top: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; min-width: 0; }
.kpi-value { font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: .8rem; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-top: 20px; }
.tabs button {
  background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600;
  padding: 10px 14px; border-bottom: 2px solid transparent; cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.panel { padding: 20px 0 8px; }
.toolbar { margin-bottom: 14px; }
input[type="search"], input[type="text"], input[type="password"] {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Bar list */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bar-row {
  display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
  position: relative; overflow: hidden;
}
.bar-row .fill { position: absolute; inset: 0 auto 0 0; background: var(--bar); opacity: .16; }
.bar-row > * { position: relative; }
.bar-rank { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.bar-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-row.top .bar-rank { color: var(--accent); font-weight: 700; }

/* Monster icon grid */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 8px 10px;
  min-width: 0;
}
.tile.top { border-color: var(--accent); background: linear-gradient(180deg, rgba(224,161,58,.12), var(--surface) 60%); }
.tile-rank { position: absolute; top: 6px; left: 8px; color: var(--muted); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile.top .tile-rank { color: var(--accent); }
.tile-img { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; }
.tile-img img { width: 100%; height: 100%; object-fit: contain; }
.tile-img.noicon { background: var(--surface-2); }
.tile-img.noicon img { display: none; }
.tile-img.noicon::after { content: attr(data-initial); font-family: Cinzel, serif; font-weight: 800; font-size: 1.8rem; color: var(--muted); }
.tile-name {
  font-weight: 600; font-size: .85rem; line-height: 1.25; width: 100%; min-height: 2.5em;
  display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere;
}
.tile-count { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.tile-tags { color: var(--accent); font-size: .72rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.legend { color: var(--muted); font-size: .8rem; margin: -4px 0 12px; }
.grid > li { display: flex; min-width: 0; }
a.tile { flex: 1; color: inherit; text-decoration: none; cursor: pointer; }
a.tile:hover, a.tile:focus-visible { border-color: var(--accent); background: var(--surface-2); }
.tile.none { opacity: .45; }
.tile.none .tile-img img { filter: grayscale(1); }

/* Leaderboard */
.leaderboard { display: grid; gap: 8px; }
.lb-row {
  display: grid; grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; color: inherit; text-decoration: none; width: 100%; text-align: left; font: inherit;
}
.lb-row:hover, .lb-row:focus-visible { border-color: var(--accent); background: var(--surface-2); }
.lb-rank { font-family: Cinzel, serif; font-weight: 800; font-size: 1.2rem; color: var(--muted); text-align: center; }
.lb-row:nth-child(1) .lb-rank { color: #f0c24b; }
.lb-row:nth-child(2) .lb-rank { color: #cfd4da; }
.lb-row:nth-child(3) .lb-rank { color: #d08a4f; }
.lb-name { font-weight: 700; font-size: 1.05rem; }
.lb-top { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-total { text-align: right; }
.lb-total strong { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.lb-total span { color: var(--muted); font-size: .75rem; }

/* Detail */
.back { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; margin-bottom: 12px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.detail-head h2 { font-size: 1.8rem; }

.monster-head { display: flex; align-items: center; gap: 16px; }
.monster-head h2 { font-size: 1.8rem; }
.tile-img.big { width: 96px; height: 96px; flex-shrink: 0; }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.variant { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.variant span { color: var(--muted); font-size: .85rem; }
.variant strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.variant.plain strong { color: var(--muted); }
.variants[hidden] { display: none; }
.variant .form-name { display: flex; align-items: center; gap: 8px; color: var(--text); }
.variant .form-name img { width: 28px; height: 28px; flex: none; }
.variant:has(.form-name) { align-items: center; }
.legend code { font-size: .8rem; }

.sessions { display: grid; gap: 8px; }
.session { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.session-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.session-head span { color: var(--muted); font-weight: 500; font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.chip b { color: var(--accent); }

.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.foot { color: var(--muted); font-size: .8rem; padding-top: 24px; padding-bottom: 32px; }
.legal { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); font-size: .72rem; line-height: 1.45; opacity: .85; }
.legal p { margin: 0 0 6px; }
.privacy { margin-top: 12px; font-size: .85rem; color: var(--muted); }
.privacy summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.privacy ul { margin: 8px 0 0; padding-left: 18px; }
.privacy li { margin-bottom: 4px; }
.privacy b { color: var(--text); font-weight: 600; }

/* Admin */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 16px 0; }
.card h2 { font-size: 1.15rem; margin-bottom: 8px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.btn {
  background: var(--accent); color: #1a1208; border: 0; border-radius: 10px; padding: 10px 16px;
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn.ghost { background: none; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: none; color: var(--bad); border: 1px solid var(--border); padding: 6px 10px; }
.btn:disabled { opacity: .6; cursor: wait; }
.msg { margin-top: 10px; font-size: .9rem; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.status { font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.status.enabled { color: var(--ok); }
.status.pending { color: var(--warn); }
.status.bad { color: var(--bad); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* My hunts (streamer sign-in) */
.signin-link { display: inline-block; margin-top: 14px; font-size: .85rem; font-weight: 600; }
.small { font-size: .85rem; }
a.btn { display: inline-block; text-decoration: none; }
.back.inline { margin: 0; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; color: var(--muted); font-size: .85rem; flex: 1; }
.form input[type="number"] {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font: inherit;
}
.form .checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.form .checks label { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: .95rem; flex: none; }
.form .checks[hidden], .form label[hidden] { display: none; }
.form select {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font: inherit;
}
.form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form .btn { justify-self: start; }

@media (max-width: 520px) {
  .kpis { gap: 8px; }
  .kpi { padding: 10px; }
  .row { flex-direction: column; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .tile-img { width: 60px; height: 60px; }
}
