:root {
  --bg: #0f1218;
  --panel: #171c25;
  --panel-2: #1e2430;
  --line: #2a3242;
  --text: #e6e9ef;
  --muted: #8b94a7;
  --accent: #f5b942;
  --accent-2: #5ec8f2;
  --good: #59d18a;
  --bad: #f06a6a;
  --r-common: #9aa3b2;
  --r-rare: #4fa3ff;
  --r-epic: #b46cff;
  --r-legendary: #ffb233;
  --r-mythic: #ff5577;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
a { color: var(--accent-2); }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 20px; background: rgba(15,18,24,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.brand { text-decoration: none; font-weight: 800; letter-spacing: .3px; font-size: 17px; color: var(--accent); }
.brand span { color: var(--text); font-weight: 500; }
#search { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
#search input[name=huntId] { flex: 1; min-width: 200px; max-width: 320px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
#search button { padding: 8px 16px; background: var(--accent); color: #1a1406; font-weight: 700; border: 0; border-radius: 8px; cursor: pointer; }
#search button:disabled { opacity: .6; cursor: wait; }

main { max-width: 1200px; margin: 0 auto; padding: 20px; }
.intro { max-width: 640px; margin: 60px auto; text-align: center; }
.intro h1 { margin-bottom: 8px; }
.muted { color: var(--muted); }
.state { text-align: center; padding: 60px 0; color: var(--muted); }
.error { background: rgba(240,106,106,.08); border: 1px solid rgba(240,106,106,.4); color: #ffc9c9; padding: 14px 16px; border-radius: var(--radius); }
.warn { background: rgba(245,185,66,.08); border: 1px solid rgba(245,185,66,.35); color: #ffe2a8; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }

.hero-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.hero-head h1 { margin: 0; font-size: 28px; word-break: break-word; }
.idline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--muted); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); }
.pill.guild { color: var(--good); }
.meta { text-align: right; color: var(--muted); font-size: 12px; }
.meta b { color: var(--text); font-weight: 600; }
.copy { cursor: pointer; border: 0; background: none; color: var(--muted); padding: 0 4px; }
.copy:hover { color: var(--text); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 14px; cursor: pointer; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.grid { display: grid; gap: 12px; }
.tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.tile .v { font-size: 22px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile.trophy .v { color: var(--accent); }
.tile.crystal .v { color: var(--accent-2); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 15px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; cursor: default; }
th.sortable { cursor: pointer; }
td.num, th.num { text-align: right; }
td.dim { color: var(--muted); }
.tablewrap { overflow-x: auto; }

.items { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.item { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--r-common); border-radius: 8px; padding: 10px 12px; }
.item .slot { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.item .name { font-weight: 700; margin: 2px 0; }
.item .sub { font-size: 12px; color: var(--muted); }
.r-Common { border-left-color: var(--r-common) !important; } .t-Common { color: var(--r-common); }
.r-Rare { border-left-color: var(--r-rare) !important; } .t-Rare { color: var(--r-rare); }
.r-Epic { border-left-color: var(--r-epic) !important; } .t-Epic { color: var(--r-epic); }
.r-Legendary { border-left-color: var(--r-legendary) !important; } .t-Legendary { color: var(--r-legendary); }
.r-Mythic { border-left-color: var(--r-mythic) !important; } .t-Mythic { color: var(--r-mythic); }

.heroes { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.hcard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.hcard.locked { opacity: .45; }
.hcard .n { font-weight: 700; }
.hcard .l { color: var(--accent); font-weight: 800; float: right; }
.hcard .s { color: var(--muted); font-size: 12px; margin-top: 4px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; }

pre.json { background: #0b0e13; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow: auto; max-height: 70vh; font-size: 12px; line-height: 1.5; }
.json .k { color: #9cdcfe; } .json .s { color: #ce9178; } .json .n { color: #b5cea8; } .json .b { color: #569cd6; }
.endpoints { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.endpoints a { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--panel-2); padding: 4px 8px; border-radius: 6px; text-decoration: none; border: 1px solid var(--line); }

@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  main { padding: 16px; }
  #search { justify-content: stretch; }
  #search input[name=huntId] { max-width: none; }
  .meta { text-align: left; }
  .tile .v { font-size: 19px; }
}

/* ---- visual polish ---- */
body { background:
  radial-gradient(1200px 500px at 10% -10%, rgba(245,185,66,.08), transparent 60%),
  radial-gradient(900px 500px at 100% 0%, rgba(94,200,242,.07), transparent 60%),
  var(--bg); background-attachment: fixed; min-height: 100vh; }
.small { font-size: 12px; }
.center { justify-content: center; }
.intro-badge { font-size: 46px; width: 84px; height: 84px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 22px; background: linear-gradient(145deg, #2a2210, #171c25); border: 1px solid rgba(245,185,66,.35); box-shadow: 0 10px 40px rgba(245,185,66,.12); }
.intro .endpoints { margin-top: 14px; }

.spinner { width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 22px; border-radius: 14px; margin-bottom: 16px;
  background: linear-gradient(120deg, rgba(245,185,66,.14), rgba(30,36,48,.9) 40%, rgba(94,200,242,.10));
  border: 1px solid rgba(245,185,66,.25); box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.banner-main { display: flex; gap: 16px; align-items: center; min-width: 0; }
.banner h1 { margin: 0; font-size: 30px; line-height: 1.15; word-break: break-word; }
.avatar { flex: none; width: 68px; height: 68px; border-radius: 18px; display: grid; place-items: center; font-size: 30px; font-weight: 900; color: #1a1406;
  background: linear-gradient(145deg, #ffd27a, #e09b1c); box-shadow: 0 6px 24px rgba(245,185,66,.35), inset 0 -3px 0 rgba(0,0,0,.15); }
.meta { display: grid; gap: 3px; align-content: center; }
.pill.bad { color: var(--bad); border-color: rgba(240,106,106,.4); }

.tile { position: relative; overflow: hidden; transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-2px); border-color: #3a4458; }
.tile .ic { margin-right: 6px; }
.tile .v small { font-size: 14px; color: var(--muted); font-weight: 600; }
.tile.trophy { background: linear-gradient(160deg, rgba(245,185,66,.10), var(--panel) 60%); }
.tile.crystal { background: linear-gradient(160deg, rgba(94,200,242,.12), var(--panel) 60%); }
.tile.power .v { color: #ff8f6b; }

.dungeons { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.dcard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.dhead { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.dic { font-size: 20px; }
.dprimary { font-size: 26px; font-weight: 800; margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
.dprimary small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 6px; text-transform: uppercase; letter-spacing: .3px; }
.drest { display: grid; gap: 3px; font-size: 13px; }
.drest div { display: flex; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: 3px; }
.drest span { color: var(--muted); }

.currencies { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.cur-group { margin: 16px 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.cur-group:first-of-type { margin-top: 4px; }
.cur { display: flex; justify-content: space-between; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.cur span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.item { transition: transform .15s; }
.item:hover { transform: translateY(-2px); }
.r-Mythic { box-shadow: 0 0 0 1px rgba(255,85,119,.15), 0 6px 22px rgba(255,85,119,.10); }
.r-Legendary { box-shadow: 0 6px 22px rgba(255,178,51,.08); }
tbody tr:hover { background: rgba(255,255,255,.025); }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); text-transform: none; letter-spacing: 0; }
.hcard { transition: border-color .15s; }
.hcard:hover { border-color: #3a4458; }

@media (max-width: 640px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile .k { font-size: 11px; }
  .banner { padding: 16px; }
  .banner h1 { font-size: 22px; }
  .avatar { width: 52px; height: 52px; font-size: 24px; border-radius: 14px; }
  #search input[name=huntId] { min-width: 0; flex: 1 1 140px; }
}

/* ---- activity timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-day { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 14px 0 6px; }
.tl-day:first-child { padding-top: 0; }
.tl-item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.tl-ic { flex: none; width: 24px; text-align: center; font-size: 16px; line-height: 1.3; }
.tl-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tl-time { flex: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
.up { color: var(--good); font-weight: 700; }
.down { color: var(--bad); font-weight: 700; }

/* ---- API docs ---- */
.docs { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.docs li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.docs li > span { color: var(--muted); font-size: 12.5px; }
.docs a, .docs code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--panel-2); padding: 4px 8px; border-radius: 6px; text-decoration: none; border: 1px solid var(--line); overflow-wrap: anywhere; }
.verb { color: var(--accent); font-weight: 700; }
.panel h2.mt { margin-top: 18px; }
.linkbtn { background: var(--panel-2); color: var(--accent-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 12px; text-transform: none; letter-spacing: 0; }
.linkbtn:hover { border-color: #3a4458; }

@media (max-width: 640px) {
  .tl-item { flex-wrap: wrap; }
  .tl-time { order: -1; width: 100%; padding-left: 36px; margin-bottom: -4px; }
  .meta { grid-template-columns: 1fr 1fr; gap: 3px 12px; }
}

/* ---- header nav ---- */
.topnav { display: flex; gap: 4px; margin-right: auto; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 8px; border: 1px solid transparent; }
.topnav a:hover { color: var(--text); background: var(--panel); }
.topnav a.active { color: var(--text); background: var(--panel-2); border-color: var(--line); }

/* ---- API docs page ---- */
.docs-page { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.docs-toc { position: sticky; top: 76px; }
.docs-toc nav { display: grid; gap: 2px; border-left: 1px solid var(--line); }
.docs-toc a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 5px 12px; margin-left: -1px; border-left: 2px solid transparent; }
.docs-toc a:hover { color: var(--text); border-left-color: var(--accent); }
.docs-body { min-width: 0; max-width: 860px; }
.docs-body h1 { margin: 0 0 8px; font-size: 30px; }
.docs-body h2 { margin: 40px 0 10px; font-size: 20px; padding-top: 8px; border-top: 1px solid var(--line); scroll-margin-top: 80px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.docs-body h3 { margin: 22px 0 6px; font-size: 15px; color: var(--accent-2); }
.docs-body p { margin: 8px 0; }
.docs-body .lead { color: var(--muted); font-size: 15px; }
.docs-body a { color: var(--accent-2); }
.callout { margin: 16px 0; padding: 12px 14px; border-radius: 10px; background: linear-gradient(120deg, rgba(245,185,66,.10), var(--panel)); border: 1px solid rgba(245,185,66,.3); font-size: 13px; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--good); border: 1px solid rgba(89,209,138,.4); border-radius: 999px; padding: 2px 8px; }
pre.code { position: relative; margin: 10px 0; background: #0b0e13; border: 1px solid var(--line); border-radius: 8px; padding: 40px 14px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
pre.code code { background: none; padding: 0; font-size: inherit; white-space: pre; color: #d6dbe4; }
pre.code::before { content: attr(data-lang); position: absolute; left: 14px; top: 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
pre.code .copycode { position: absolute; top: 8px; right: 8px; font-size: 12px; }
.docs-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.docs-table th, .docs-table td { white-space: normal; vertical-align: top; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.docs-table td:first-child { white-space: nowrap; }
.docs-table code { white-space: nowrap; }
.docs-list { padding-left: 20px; }
.docs-list li { margin: 6px 0; }

@media (max-width: 860px) {
  .docs-page { grid-template-columns: 1fr; gap: 12px; }
  .docs-toc { position: static; }
  .docs-toc nav { display: flex; flex-wrap: wrap; gap: 6px; border-left: 0; }
  .docs-toc a { border: 1px solid var(--line); border-radius: 999px; margin: 0; padding: 4px 10px; }
  .docs-table td:first-child, .docs-table code { white-space: normal; word-break: break-word; }
  .topnav { margin-right: 0; }
}

.intro-dev { margin-top: 28px; }
.intro-dev a { color: var(--accent-2); }
.intro-search { display: flex; gap: 8px; max-width: 520px; margin: 22px auto 0; }
.intro-search input { flex: 1; min-width: 0; padding: 14px 16px; font-size: 16px; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 10px; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
.intro-search input::placeholder { text-transform: none; font-family: system-ui, sans-serif; color: var(--muted); }
.intro-search input:focus { outline: none; border-color: rgba(245,185,66,.6); box-shadow: 0 0 0 3px rgba(245,185,66,.15); }
.intro-search button { padding: 0 22px; background: var(--accent); color: #1a1406; font-weight: 800; font-size: 15px; border: 0; border-radius: 10px; cursor: pointer; }
.intro-search button:hover { filter: brightness(1.08); }
@media (max-width: 480px) { .intro-search { flex-direction: column; } .intro-search button { padding: 12px; } }
.home #search { display: none; }
#search input[name=huntId]::placeholder { text-transform: none; font-family: system-ui, sans-serif; color: var(--muted); }
#search input[name=huntId]:focus { outline: none; border-color: rgba(245,185,66,.6); box-shadow: 0 0 0 3px rgba(245,185,66,.15); }
.progress-lines { margin: 4px 0 0; padding-left: 18px; }
.progress-lines li { margin: 2px 0; }

/* event type cards in API docs */
.event-docs { display: grid; gap: 12px; margin-top: 12px; }
.event-doc { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 14px 4px; min-width: 0; }
.event-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.event-head code { font-size: 14px; font-weight: 700; color: var(--accent); background: none; padding: 0; }
.event-head .when { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.event-head .when.now { color: var(--good); border-color: rgba(89,209,138,.4); }
.event-head .when.hourly { color: var(--accent-2); border-color: rgba(94,200,242,.4); }
.event-doc p { margin: 6px 0 4px; color: var(--muted); }
.event-doc pre.code { margin: 8px 0 10px; }
