:root {
    --bg: #0b0e14; --bg2: #10141d; --card: #141a26; --card2: #19212f; --line: #232c3f;
    --text: #e8ecf5; --muted: #8d97ad;
    --vb: #4cb4ff; --vb2: #22d3ee; --boss: #c9a7ff;
    --accent: #7c8cff; --accent2: #22d3ee;
    --glow-a: 124, 140, 255; --glow-b: 34, 211, 238; /* rgb triplets: hero glows, retinted per venture event */
    --r-uncommon: #6fd16f; --r-rare: #58a6ff; --r-epic: #c58bff; --r-legendary: #ff8c3a; --r-mythic: #f4c430;
    --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 130px; }
body {
    overflow-x: clip;
    margin: 0; color: var(--text);
    background-color: var(--bg); background-image: var(--bg-art, none); background-attachment: fixed; background-repeat: no-repeat;
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11, 14, 20, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 54px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .2px; color: var(--text); text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--vb2)); box-shadow: 0 0 14px rgba(124, 140, 255, .5); }
.brand-logo { height: 38px; width: auto; display: block; }

/* hero */
.hero {
    padding: 44px 0 26px;
    background:
        radial-gradient(900px 340px at 12% -10%, rgba(var(--glow-a), .28), transparent 60%),
        radial-gradient(700px 300px at 92% 0%, rgba(var(--glow-b), .18), transparent 60%),
        linear-gradient(var(--bg2), var(--bg));
    border-bottom: 1px solid var(--line);
}
.hero-sm { padding: 30px 0 20px; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--accent2); }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; letter-spacing: -.02em; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 10px 0 0; max-width: 60ch; color: #b6bfd3; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.stat { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); font-size: .85rem; }
.stat b { font-variant-numeric: tabular-nums; }
.stat-vb { border-color: rgba(76, 180, 255, .5); background: rgba(76, 180, 255, .12); color: #bfe3ff; }
.reset-note { margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
.reset-note strong { color: #b6bfd3; }

.notice { margin: 18px 0 0; padding: 10px 14px; border-radius: 10px; background: #3a2c08; border: 1px solid #8a6414; color: #ffd98a; }

/* V-Bucks banner */
.vb-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin: 22px 0 6px; padding: 16px 20px;
    border-radius: var(--radius); border: 1px solid rgba(244, 196, 48, .55);
    background: linear-gradient(120deg, rgba(76, 180, 255, .18), rgba(34, 211, 238, .06));
    box-shadow: 0 0 28px rgba(244, 196, 48, .12);
}
.vb-none { border-color: var(--line); background: var(--card); box-shadow: none; color: var(--muted); }
.vb-total { display: flex; flex-direction: column; }
.vb-total b { font-size: 2rem; line-height: 1; color: var(--r-mythic); font-variant-numeric: tabular-nums; }
.vb-total span { font-size: .8rem; color: #9cc8ea; text-transform: uppercase; letter-spacing: .08em; }
.vb-banner ul { margin: 0; padding-left: 18px; flex: 1 1 280px; }
.vb-banner li { padding: 1px 0; }
.vb-banner strong { color: var(--r-mythic); }

/* toolbar */
.appbar { position: sticky; top: 0; z-index: 20; background: rgba(11, 14, 20, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 10px 0; }
.filters, .zonenav { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip, .zlink {
    border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 6px 14px;
    font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.fchip:hover, .zlink:hover { color: var(--text); border-color: #34415c; }
.fchip.is-active { color: #fff; border-color: transparent; background: linear-gradient(90deg, var(--accent), var(--vb2)); }
.fchip:focus-visible, .zlink:focus-visible, summary:focus-visible { outline: 2px solid var(--vb2); outline-offset: 2px; }

/* zones: accent colours */
.zone { --zc: #94a3b8; margin-top: 22px; }
.zone { scroll-margin-top: 130px; }
.z-stonewood { --zc: #4ade80; }
.z-plankerton { --zc: #facc15; }
.z-canny-valley { --zc: #f87171; }
.z-twine-peaks { --zc: #fb923c; }
.z-ventures { --zc: var(--accent); } /* follows the live season (body[data-event]) */
.zlink { border-left: 3px solid var(--zc, #94a3b8); }
/* grid so every zone lines up: name | alert count | PL range (right) | arrow */
.zone-head { display: grid; grid-template-columns: 19rem 7rem 1fr 1.5rem; align-items: center; gap: 0 10px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--zc); }
.zone-head .count { grid-column: 2; }
.zone-head .range { grid-column: 3; justify-self: end; }
/* main zones are collapsible <details>; the summary row is the heading */
details.zone > summary.zone-head { cursor: pointer; list-style: none; }
details.zone > summary.zone-head::-webkit-details-marker { display: none; }
details.zone > summary.zone-head::after { content: "\25B8"; grid-column: 4; justify-self: end; color: var(--muted); font-size: 1.1rem; }
details.zone:not([open]) > summary.zone-head { margin-bottom: 0; }
details.zone[open] > summary.zone-head::after { content: "\25BE"; }
details.zone > summary.zone-head:focus-visible { outline: 2px solid var(--vb2); outline-offset: 4px; }
.zone-head h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.01em; }
.count { color: var(--muted); font-size: .85rem; font-weight: 500; }
.range { padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; color: var(--zc); border: 1px solid var(--zc); }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
    display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius);
    background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: #34415c; box-shadow: 0 8px 22px rgba(0, 0, 0, .35); }
.card.is-vbucks { border-color: rgba(76, 180, 255, .7); box-shadow: 0 0 0 1px rgba(76, 180, 255, .35) inset, 0 0 22px rgba(76, 180, 255, .14); }
.card-head { display: flex; align-items: center; gap: 12px; }
.tile { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; background: #0d121b; border: 1px solid var(--line); }
.tile:empty { opacity: .35; }
.tile img { width: 36px; height: 36px; }
.titles { min-width: 0; flex: 1; }
.card h3 { margin: 0; font-size: 1.02rem; line-height: 1.25; }
.where { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.pl { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 48px; padding: 4px 8px; border-radius: 10px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); line-height: 1.1; }
.pl span { font-size: .6rem; font-weight: 800; letter-spacing: .12em; color: var(--muted); }
.pl b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid var(--line); }
.pill img { width: 12px; height: 12px; }
.pill-vb { color: #bfe3ff; background: rgba(76, 180, 255, .16); border-color: rgba(76, 180, 255, .5); }
.pill-boss { color: var(--boss); background: rgba(201, 167, 255, .12); border-color: rgba(201, 167, 255, .4); }
.pill-group { color: #9fe0c0; background: rgba(74, 222, 128, .1); border-color: rgba(74, 222, 128, .35); }

.rewards { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip { padding: 3px 9px; border-radius: 8px; font-size: .8rem; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: #cfd6e6; }
.chip-icon { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.chip b { font-variant-numeric: tabular-nums; margin-right: 2px; }
.chip-vb .chip-icon { filter: drop-shadow(0 0 1px rgba(6, 18, 31, .7)); } /* coin is light blue on a light chip: give it an edge */
.chip-vb { color: #06121f; font-weight: 700; background: linear-gradient(90deg, var(--vb), var(--vb2)); border-color: transparent; }
.r-uncommon { color: var(--r-uncommon); border-color: rgba(111, 209, 111, .35); }
.r-rare { color: var(--r-rare); border-color: rgba(88, 166, 255, .35); }
.r-epic { color: var(--r-epic); border-color: rgba(197, 139, 255, .4); }
.r-legendary { color: var(--r-legendary); border-color: rgba(255, 140, 58, .45); background: rgba(255, 140, 58, .08); }
.r-mythic { color: var(--r-mythic); border-color: rgba(244, 196, 48, .45); }

/* collapsible event zones */
.empty { margin: 40px 0; text-align: center; color: var(--muted); }

.foot { margin-top: 56px; padding: 26px 16px 36px; text-align: center; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
    .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .card, .fchip, .zlink { transition: none; }
    .card:hover { transform: none; }
}

/* panels: history + summary */
.panel { margin-top: 20px; padding: 14px 16px; border-radius: var(--radius); background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); }
/* breathing room after the last zone row, like the gap between the summary and the first zone */
.panel.history { margin-top: 32px; }
.panel-title { margin: 0 0 10px; font-size: 1.05rem; font-weight: 700; }
.panel-note { margin: 10px 0 0; font-size: .78rem; color: var(--muted); }
.hist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.hist { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.hist span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hist b { font-size: 1.5rem; line-height: 1.2; color: var(--vb); font-variant-numeric: tabular-nums; }
.hist b.hv-pos { color: var(--r-mythic); }
.hist b.hv-zero { color: #f87171; }
.hist b.hv-none { color: var(--muted); }
.hist small { font-size: .72rem; color: var(--muted); }
.summary summary { cursor: pointer; list-style-position: inside; }
/* collapsed panel: no gap under the title, so the text sits centred in the box */
.summary:not([open]) .panel-title { margin-bottom: 0; }
.table-wrap { overflow-x: auto; }
.sumtable { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.sumtable th, .sumtable td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sumtable thead th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; background: var(--card); }
.sumtable th:first-child, .sumtable tbody th { text-align: left; font-weight: 600; }
.sumtable td.h0 { color: #596277; }
.sumtable td.h1 { background: rgba(124, 140, 255, .08); }
.sumtable td.h2 { background: rgba(124, 140, 255, .16); }
.sumtable td.h3 { background: rgba(124, 140, 255, .26); }
.sumtable td.h4 { background: rgba(124, 140, 255, .38); color: #fff; font-weight: 700; }
.sumtable td.tot { font-weight: 800; color: var(--text); }
.sumtable .row-vbucks th, .sumtable .row-vbucks td.tot { color: var(--vb); }

/* extended filters */
/* nowrap: a wrapping column container sizes its rows to their full content width, which made the chip rows overflow the page */
.toolbar { flex-direction: column; flex-wrap: nowrap; gap: 8px; }
.toolbar-row, .filters, .zonenav { min-width: 0; }
.toolbar-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.fchip-more { border-style: dashed; }
/* chevron so the button reads as expandable; flips while the panel is open */
.fchip-more::after { content: " \25BE"; }
.fchip-more[aria-expanded="true"]::after { content: " \25B4"; }
.fchip-more[aria-expanded="true"] { color: var(--text); border-color: var(--accent); }
.panel-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.filterpanel { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; padding: 10px 0 4px; border-top: 1px solid var(--line); }
.fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flabel { min-width: 64px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.fr-mythic { color: var(--r-mythic); } .fr-legendary { color: var(--r-legendary); } .fr-epic { color: var(--r-epic); }
.fr-rare { color: var(--r-rare); } .fr-uncommon { color: var(--r-uncommon); }
.fchip.is-active.fr-mythic, .fchip.is-active.fr-legendary, .fchip.is-active.fr-epic, .fchip.is-active.fr-rare, .fchip.is-active.fr-uncommon { color: #fff; }
.fchip-reset { align-self: flex-start; }

.rowbtn { font: inherit; font-weight: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.rowbtn:hover { text-decoration: underline; }
.rowbtn:focus-visible { outline: 2px solid var(--vb2); outline-offset: 2px; }
.sumtable tr.is-active th, .sumtable tr.is-active td { box-shadow: inset 0 0 0 9999px rgba(250, 204, 21, .10); }
.itemnote { margin: 8px 0 0; font-size: .88rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.itemnote[hidden] { display: none; }

/* Venture season themes, keyed off the live event zone (body[data-event]): tinted base, retinted hero glows, and two big
   page-wide glows behind everything (fixed, so they stay put while scrolling). */
body[data-event] { --bg-art: radial-gradient(1300px 760px at 0% 0%, rgba(var(--glow-a), .34), transparent 65%), radial-gradient(1300px 760px at 100% 0%, rgba(var(--glow-b), .28), transparent 65%), radial-gradient(1400px 500px at 50% 115%, rgba(var(--glow-a), .16), transparent 70%); }
/* The hero's own opaque gradient would box off the page glows with a hard edge; in a season let them show through. */
body[data-event] .hero { background: none; border-bottom-color: transparent; }
body[data-event="hexsylvania"] { --bg: #0f0916; --bg2: #160d20; --accent: #b57bff; --accent2: #ff9a3c; --glow-a: 150, 70, 230; --glow-b: 255, 125, 30; }
body[data-event="frozen-fjords"] { --bg: #07101a; --bg2: #0b1826; --accent: #7cc8ff; --accent2: #b6f0ff; --glow-a: 90, 190, 255; --glow-b: 120, 150, 255; }
body[data-event="flannel-falls"] { --bg: #140a0d; --bg2: #1d0f13; --accent: #ff8f8f; --accent2: #ffd36e; --glow-a: 225, 55, 65; --glow-b: 250, 200, 80; }
body[data-event="scurvy-shoals"] { --bg: #07131a; --bg2: #0b1d27; --accent: #4fd1c5; --accent2: #ffd97a; --glow-a: 35, 185, 175; --glow-b: 240, 195, 95; }
body[data-event="blasted-badlands"] { --bg: #150f08; --bg2: #20160b; --accent: #ffa94d; --accent2: #ffd27a; --glow-a: 240, 135, 45; --glow-b: 205, 165, 95; }

/* back-to-top button, shown after scrolling down a screen or so */
.totop {
    position: fixed; right: 16px; bottom: 16px; z-index: 25; width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 1.25rem; line-height: 1;
    cursor: pointer; box-shadow: 0 4px 16px rgba(0, 0, 0, .45);
}
.totop:hover { border-color: var(--accent); }
.totop:focus-visible { outline: 2px solid var(--vb2); outline-offset: 2px; }
.totop[hidden] { display: none; }

/* Ventures level rewards: button in the zone row + modal */
.zone-name { grid-column: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.lvl-btn {
    border: 1px solid var(--zc); background: transparent; color: var(--zc); border-radius: 999px; padding: 2px 10px;
    font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.lvl-btn:hover { background: rgba(255, 255, 255, .06); }
.lvl-btn:focus-visible, .lvl-close:focus-visible { outline: 2px solid var(--vb2); outline-offset: 2px; }
.lvl-short { display: none; }
.lvl-dialog {
    width: min(560px, calc(100vw - 24px)); max-height: 86vh; padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.lvl-dialog[open] { display: flex; flex-direction: column; }
.lvl-dialog::backdrop { background: rgba(5, 6, 10, .7); }
.lvl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; margin: 0; }
.lvl-head h2 { margin: 0; font-size: 1.15rem; }
.lvl-close { border: 0; background: none; color: var(--muted); font-size: 1.8rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.lvl-close:hover { color: var(--text); }
.lvl-note { margin: 0; padding: 0 16px 10px; font-size: .8rem; color: var(--muted); }
.lvl-scroll { overflow: auto; padding: 0 16px 16px; }
.lvl-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lvl-table th { position: sticky; top: 0; background: var(--card); text-align: left; padding: 6px 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lvl-table td { padding: 7px 8px; border-top: 1px solid var(--line); font-size: .9rem; }
.lvl-table td:first-child { font-weight: 700; color: var(--zc, var(--accent)); text-align: center; width: 3.2rem; }
.lvl-table th:first-child { text-align: center; }
.lvl-table td:nth-child(2) { color: var(--muted); }
.lvl-reward { display: flex; align-items: center; gap: 10px; }
.lvl-icon { flex: 0 0 28px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.lvl-icon img { display: block; width: 28px; height: 28px; object-fit: contain; }
