:root{
    --bg:#0b0f19; --card:#121826; --text:#e6e8f0; --muted:#9aa4b2; --accent:#6ee7ff; --ring:#263043;
    --won:#22c55e; --place:#eab308; --sidebar:#0e1422; --chip:#0b1220;
    --toolbar-grad-a:rgba(11,15,25,.98); --toolbar-grad-b:rgba(11,15,25,.92);
    --toolbar-border:rgba(38,48,67,.6);
}
[data-theme="arcade"]{
    --bg:#070a13; --card:#0f1627; --text:#f0f7ff; --muted:#9ab0c8; --accent:#5ef0ff; --ring:#26344a;
    --won:#21d17a; --place:#f6d32d; --sidebar:#0a1222; --chip:#0a1424;
    --toolbar-grad-a:rgba(7,10,19,.98); --toolbar-grad-b:rgba(7,10,19,.92); --toolbar-border:rgba(38,52,74,.6);
}
[data-theme="runic"]{
    --bg:#f5efe6; --card:#fff8ee; --text:#2b241a; --muted:#7a6a55; --accent:#b07d2b; --ring:#d8c8b0;
    --won:#2f8f5b; --place:#c28b20; --sidebar:#f1e4d3; --chip:#efe2d1;
    --toolbar-grad-a:rgba(245,239,230,.98); --toolbar-grad-b:rgba(245,239,230,.92); --toolbar-border:rgba(216,200,176,.9);
}
[data-theme="freljord"]{
    --bg:#e9f1f7; --card:#f7fbff; --text:#1b2a3a; --muted:#5e7288; --accent:#3aa0d8; --ring:#c9d9e6;
    --won:#1f8f6e; --place:#d09a2c; --sidebar:#eef4f9; --chip:#e7eef5;
    --toolbar-grad-a:rgba(233,241,247,.98); --toolbar-grad-b:rgba(233,241,247,.92); --toolbar-border:rgba(201,217,230,.9);
}
[data-theme="zaun"]{
    --bg:#0a0e0b; --card:#101613; --text:#d7f3da; --muted:#7f9b87; --accent:#6ee36b; --ring:#223428;
    --won:#38c172; --place:#e4d54c; --sidebar:#0c1210; --chip:#0f1714;
    --toolbar-grad-a:rgba(10,14,11,.98); --toolbar-grad-b:rgba(10,14,11,.92); --toolbar-border:rgba(34,52,40,.6);
}
[data-theme="piltover"]{
    --bg:#0f1f24; --card:#162a30; --text:#eef6f4; --muted:#9db3ad; --accent:#d4a35c; --ring:#2d4446;
    --won:#2fbf7a; --place:#d9b15b; --sidebar:#122227; --chip:#13262b;
    --toolbar-grad-a:rgba(15,31,36,.98); --toolbar-grad-b:rgba(15,31,36,.92); --toolbar-border:rgba(45,68,70,.6);
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font:16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif}

.wrap{max-width:1200px;margin:0 auto;padding:18px 16px}

/* Title (non-sticky) */
.titlebar{position:relative;}
h1{font-size:clamp(20px,2.4vw,28px);margin:0 0 10px;font-weight:700}

/* Sticky toolbar (+ fixed fallback via .fixed) */
.toolbar-wrap{
    position:sticky; top:0; z-index:7;
    background:linear-gradient(180deg, var(--toolbar-grad-a), var(--toolbar-grad-b) 60%, transparent);
    backdrop-filter:saturate(1.1) blur(6px);
    border-bottom:1px solid var(--toolbar-border);
}
.toolbar-wrap.fixed{ position:fixed; left:0; right:0; top:0; } /* JS fallback */
#toolbar-spacer{height:0;} /* grows when fixed */

.toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;padding:12px 16px;max-width:1200px;margin:0 auto}

/* Unified buttons */
.btn{
    display:inline-flex;align-items:center;justify-content:center;
    border:1px solid var(--ring);background:var(--card);color:var(--text);
    padding:8px 12px;border-radius:12px;cursor:pointer;
    transition:transform .06s ease,border-color .2s ease,background .2s ease;
    line-height:1; min-height:34px;
}
.btn:hover{border-color:var(--accent)}
.btn:active{transform:translateY(1px)}
.btn[disabled]{opacity:.45;cursor:not-allowed}

/* Icon-only buttons */
.btn.icon{width:38px; min-width:38px; height:34px; padding:0;}
.btn.icon svg{width:18px;height:18px;display:block}

input[type="search"]{
    border:1px solid var(--ring);background:var(--card);color:var(--text);
    padding:8px 12px;border-radius:12px;min-width:220px;height:34px
}
#status{font-size:13px;color:var(--muted)}
.counter{margin-left:auto;font-weight:600;color:#a7f3d0;border:1px solid var(--ring);background:var(--chip);padding:6px 10px;border-radius:10px}

/* Layout: sidebar + content */
.container{max-width:1200px;margin:12px auto;display:grid;grid-template-columns:260px 1fr;gap:16px;padding:0 16px}
@media (max-width: 880px){
    .container{grid-template-columns:1fr}
    .sidebar{order:2}
}
.sidebar{background:var(--sidebar);border:1px solid var(--ring);border-radius:14px;padding:14px;position:sticky;top:84px;height:max-content}
.side-title{font-size:14px;color:var(--muted);margin:0 0 8px}
.filter{display:flex;align-items:center;gap:8px;padding:8px;border:1px solid var(--ring);border-radius:10px;background:rgba(18,24,38,.6);margin-bottom:8px;cursor:pointer}
.filter:hover{border-color:var(--accent)}
.filter input{width:14px;height:14px}
.count-badge{margin-left:auto;font-size:12px;color:var(--muted);background:var(--chip);border:1px solid var(--ring);border-radius:8px;padding:2px 6px}

/* Force 7 columns (with responsive fallback on small screens) */
.grid{display:grid;grid-template-columns:repeat(7,1fr);gap:14px}
@media (max-width: 1200px){
    .grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr))}
}

.champ{position:relative;background:var(--card);border:1px solid var(--ring);border-radius:14px;overflow:hidden;display:flex;flex-direction:column}
.imgwrap{width:100%;aspect-ratio:1/1;overflow:hidden;cursor:pointer}
.imgwrap img{width:100%;height:100%;object-fit:cover;display:block;transition:filter .2s ease, opacity .2s ease}
.name{padding:8px 10px 0;font-size:13px;color:var(--muted);text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Gray out when Won */
.champ.status-won .imgwrap img{filter:grayscale(100%) contrast(90%) brightness(70%);opacity:.55}

/* Status pill */
.pill{position:absolute;top:6px;left:6px;display:flex;align-items:center;gap:6px}
.tag{font-size:11px;line-height:1;padding:4px 6px;border-radius:7px;border:1px solid var(--ring);background:rgba(18,24,38,.7);color:var(--muted)}
.tag[data-kind="won"]{color:#062e12;background:rgba(34,197,94,.9);border-color:#208a4a}
.tag[data-kind="24"]{color:#2b2303;background:rgba(234,179,8,.92);border-color:#9a7a05}

/* Options row */
.options{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;align-items:center;padding:8px;border-top:1px solid var(--ring);background:linear-gradient(180deg, rgba(18,24,38,.6), rgba(18,24,38,.2))}
.opt{display:inline-flex;align-items:center;gap:6px;padding:6px 8px;border:1px solid var(--ring);background:rgba(18,24,38,.7);border-radius:10px;font-size:12px;cursor:pointer;user-select:none;color:inherit;text-decoration:none}
.opt:hover{border-color:var(--accent)}
/* Hidden radio for a11y; visuals use .active class */
.opt input{position:absolute;opacity:0;width:1px;height:1px;pointer-events:none;margin:0}
.opt .box{width:14px;height:14px;border:1px solid var(--ring);border-radius:4px;display:inline-grid;place-items:center}
.opt.active .box{border-color:var(--accent)}
.opt.active .box::after{content:'✓';font-size:12px;line-height:1}

.empty{color:var(--muted);text-align:center;padding:40px 10px}
footer{padding:24px 0;color:var(--muted)}

.theme-switcher{display:inline-flex;align-items:center;gap:8px;border:1px solid var(--ring);background:var(--card);border-radius:12px;padding:6px 8px;height:34px}
.theme-label{font-size:12px;color:var(--muted)}
.theme-select{
    background:transparent;color:var(--text);border:none;outline:none;font-size:13px;
    padding:0 18px 0 4px;appearance:none;cursor:pointer;
}
.theme-switcher{position:relative}
.theme-switcher::after{
    content:"▾"; position:absolute; right:8px; top:50%; transform:translateY(-50%);
    font-size:11px; color:var(--muted); pointer-events:none;
}
[data-theme="runic"] .counter{color:#2f8f5b;background:rgba(255,248,238,.9)}
[data-theme="freljord"] .counter{color:#1f6f9f;background:rgba(247,251,255,.9)}
[data-theme="zaun"] .counter{color:#6ee36b;background:rgba(16,22,19,.9)}
[data-theme="piltover"] .counter{color:#d4a35c;background:rgba(22,42,48,.9)}
