/* Clan dashboard — dark, gold-accented, mobile first. */
:root {
    --bg: #0a0b0d;
    --panel: #14161a;
    --panel-2: #1b1e24;
    --panel-3: #23272f;
    --border: #2a2f38;
    --text: #ecebe6;
    --muted: #9ba1ab;
    --faint: #6b717b;
    --gold: #fde068;
    --gold-deep: #e8b923;
    --gold-ink: #2a2105;
    --good: #4cc38a;
    --warn: #f0ad4e;
    --bad: #ff6b6b;
    --link: #8ec5ff;
    --bar: #e8b923;
    --bar-dim: #3a3424;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
    --font-display: 'Lilita One', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    background-image: radial-gradient(1200px 500px at 50% -200px, rgba(232, 185, 35, 0.08), transparent 70%);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.45;
    min-height: 100vh;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
.num, td.num, .tile-value { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ header & nav */
.site-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(10, 11, 13, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px 0; }
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.brand-badge { width: 40px; height: 40px; flex: none; }
.brand-badge img { width: 100%; height: 100%; object-fit: contain; }
.brand-badge .shield {
    width: 40px; height: 40px; display: grid; place-items: center;
    background: linear-gradient(160deg, var(--gold), var(--gold-deep));
    color: var(--gold-ink); font-family: var(--font-display); font-size: 20px;
    clip-path: polygon(50% 0, 100% 15%, 100% 60%, 50% 100%, 0 60%, 0 15%);
}
.brand-text { min-width: 0; }
.brand-name { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.5px; color: var(--gold); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { color: var(--muted); font-size: 12.5px; }
.sync-pill { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.15); }
.sync-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.15); }
.sync-dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15); }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-top: 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap;
    border-bottom: 2px solid transparent; text-decoration: none;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--gold); border-bottom-color: var(--gold); }

main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 48px; }

.banner { border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.banner.warn { border-color: rgba(240, 173, 78, 0.4); background: rgba(240, 173, 78, 0.08); }
.banner.bad { border-color: rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.08); }

/* ------------------------------------------------------------------ layout */
.page-title { font-family: var(--font-display); font-size: 26px; letter-spacing: 0.5px; color: var(--gold); margin: 4px 0 14px; line-height: 1.15; }
.page-title small { display: block; font-family: var(--font-body); font-size: 13px; color: var(--muted); letter-spacing: 0; margin-top: 4px; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.cols-2 { grid-template-columns: 1fr; }
.cols-3 { grid-template-columns: 1fr; }
@media (min-width: 760px) {
    .cols-2 { grid-template-columns: 1fr 1fr; }
    .cols-3 { grid-template-columns: repeat(3, 1fr); }
    .span-2 { grid-column: span 2; }
}
.stack > * + * { margin-top: 14px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title { font-family: var(--font-display); font-size: 17px; letter-spacing: 0.4px; color: var(--gold); margin: 0; }
.card-sub { color: var(--muted); font-size: 12.5px; }
.card-link { font-size: 13px; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ------------------------------------------------------------------ tiles */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.tile-value { font-family: var(--font-display); font-size: 28px; line-height: 1.15; margin-top: 2px; color: var(--text); letter-spacing: 0.3px; }
.tile-value .of { font-family: var(--font-body); font-size: 14px; color: var(--muted); font-weight: 500; }
.tile-note { color: var(--faint); font-size: 12px; margin-top: 2px; }
.tile.good .tile-value { color: var(--good); }
.tile.bad .tile-value { color: var(--bad); }
.tile.gold .tile-value { color: var(--gold); }

/* ------------------------------------------------------------------ clan hero */
.clan-hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.clan-hero .facts { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text); white-space: nowrap; }
.chip.muted { color: var(--muted); }
.chip.good { border-color: rgba(76, 195, 138, 0.35); color: var(--good); }
.chip.warn { border-color: rgba(240, 173, 78, 0.4); color: var(--warn); }
.chip.bad { border-color: rgba(255, 107, 107, 0.4); color: var(--bad); }
.chip.gold { border-color: rgba(253, 224, 104, 0.35); color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------ war */
.war-score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; text-align: center; }
.war-side-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.war-side-sub { color: var(--muted); font-size: 12px; }
.war-stars { font-family: var(--font-display); font-size: 34px; color: var(--gold); line-height: 1.1; }
.war-pct { color: var(--muted); font-size: 13px; }
.war-vs { color: var(--faint); font-family: var(--font-display); font-size: 16px; }
.war-meta { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.progress { height: 6px; background: var(--panel-3); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); border-radius: 999px; }
.subhead { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; margin: 16px 0 8px; }

.results { display: flex; gap: 4px; flex-wrap: wrap; }
.result { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 12px; cursor: default; }
.result.win { background: rgba(76, 195, 138, 0.16); color: var(--good); }
.result.lose { background: rgba(255, 107, 107, 0.14); color: var(--bad); }
.result.tie { background: var(--panel-3); color: var(--muted); }
.result.live { background: rgba(253, 224, 104, 0.12); color: var(--gold); }

.war-list { display: grid; gap: 8px; }
.war-row {
    display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center;
    padding: 10px 12px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid transparent; color: var(--text);
}
a.war-row:hover { border-color: var(--border); text-decoration: none; background: var(--panel-3); }
.war-row .name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.war-row .when { display: block; color: var(--muted); font-size: 12.5px; }
.war-row .score { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.war-row .score b { color: var(--gold); }
.war-row .score .pct { color: var(--muted); font-size: 12.5px; }

.stars { color: var(--gold); letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #3b3f47; }

.attack-list { display: grid; gap: 6px; }
.lineup-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel-2); }
.lineup-row.pending { box-shadow: inset 3px 0 0 var(--warn); }
.lineup-row.missed { box-shadow: inset 3px 0 0 var(--bad); }
.pos { color: var(--faint); font-weight: 700; font-size: 13px; text-align: center; }
.lineup-row .who-sub { display: block; }
.lineup-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lineup-attacks { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; font-size: 13px; }
.lineup-attacks .vs { color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------ tables */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.search {
    flex: 1 1 220px; min-width: 0; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--panel); color: var(--text); font: inherit; outline: none;
}
.search:focus { border-color: var(--gold-deep); }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.seg button.on { background: var(--panel-3); color: var(--gold); }
select.select { padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; vertical-align: middle; }
table.data th:first-child, table.data td:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); z-index: 1; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; background: var(--panel); position: sticky; top: 0; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
table.data th.sorted { color: var(--gold); }
table.data th.sorted::after { content: ' ▾'; }
table.data th.sorted.asc::after { content: ' ▴'; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--panel-2); }
table.data td.left, table.data th.left { text-align: left; }
table.data .muted { color: var(--muted); }
.who { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.who-text { min-width: 0; }
.who-name { font-weight: 600; color: var(--text); display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
a.who-name:hover { color: var(--gold); text-decoration: none; }
.list .who-name, .feed .who-name, .war-list .who-name { display: inline; }
.who-sub { font-size: 12px; color: var(--muted); }
.th-badge { flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--panel-3); border: 1px solid var(--border); display: grid; place-items: center; font-family: var(--font-display); font-size: 14px; color: var(--gold); }
.role { font-size: 12px; color: var(--muted); }
.role.leader, .role.coLeader { color: var(--gold); }
.was-role { color: var(--warn); font-size: 11.5px; }
.ok { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.dim { color: var(--faint); }

/* 14-day activity strip in tables / 30-day on player page */
.days { display: inline-flex; gap: 2px; vertical-align: middle; }
.days i { width: 6px; height: 14px; border-radius: 2px; background: var(--panel-3); display: block; }
.days i.on { background: var(--good); }
.days.big { gap: 3px; flex-wrap: nowrap; width: 100%; }
.days.big i { flex: 1; height: 28px; border-radius: 4px; min-width: 0; }

.ratio { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--faint); font-size: 11px; font-family: var(--font-body); }
.chart .bar { fill: var(--bar); }
.chart .bar.dim { fill: var(--bar-dim); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { fill: var(--gold); }
.chart .line { fill: none; stroke: var(--gold-deep); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: rgba(232, 185, 35, 0.1); }
.chart .dot { fill: var(--gold); stroke: var(--panel); stroke-width: 2; }
.chart-wrap { position: relative; }
.tooltip {
    position: absolute; pointer-events: none; background: #0d0f12; border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 9px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 5;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.tooltip b { color: var(--gold); }

/* ------------------------------------------------------------------ lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .r { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank { display: inline-block; width: 20px; color: var(--faint); font-weight: 700; font-size: 13px; }
.feed li { justify-content: flex-start; }
.feed .icon { width: 26px; height: 26px; flex: none; border-radius: 7px; display: grid; place-items: center; font-size: 13px; background: var(--panel-2); }
.feed .text { flex: 1; min-width: 0; font-size: 14px; }
.feed .time { color: var(--faint); font-size: 12px; white-space: nowrap; }


.player-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.player-head .th-badge { width: 52px; height: 52px; font-size: 22px; border-radius: 12px; }
.player-name { font-family: var(--font-display); font-size: 28px; color: var(--gold); line-height: 1.1; letter-spacing: 0.4px; word-break: break-word; }

.back { display: inline-block; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.loader { color: var(--muted); padding: 40px 0; text-align: center; }
.error-box { padding: 24px; text-align: center; color: var(--bad); }
footer.site-footer { max-width: 1180px; margin: 0 auto; padding: 0 16px 32px; color: var(--faint); font-size: 12px; }

@media (max-width: 520px) {
    body { font-size: 14.5px; }
    .page-title { font-size: 23px; }
    .tile-value { font-size: 24px; }
    .card { padding: 14px; }
    .war-stars { font-size: 28px; }
    table.data th, table.data td { padding: 9px 10px; }
    .sync-pill .label { display: none; }
    .tabs a { padding: 10px 10px; }
}

/* ------------------------------------------------------------------ hero equipment */
.gear-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .gear-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .gear-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.gear-hero { background: var(--panel-2); border-radius: var(--radius-sm); padding: 12px; min-width: 0; }
.gear-hero-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gear-hero-name { font-family: var(--font-display); color: var(--gold); font-size: 15px; letter-spacing: 0.3px; }
.track { display: block; height: 6px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.track > span { display: block; height: 100%; background: var(--gold-deep); border-radius: 999px; }
.track > span.max { background: var(--good); }
.hero-track { margin: 6px 0 10px; height: 5px; }
.gear-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gear-list li { display: grid; grid-template-columns: minmax(0, 1fr) 64px 40px; gap: 8px; align-items: center; font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.gear-list li.equipped { background: rgba(253, 224, 104, 0.07); box-shadow: inset 2px 0 0 var(--gold); }
.gear-list .num { text-align: right; }
.gear-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 5px; border-radius: 4px; vertical-align: 1px; letter-spacing: 0.3px; }
.tag.epic { background: rgba(190, 140, 255, 0.16); color: #c9a6ff; }
.tag.on { background: rgba(253, 224, 104, 0.14); color: var(--gold); }
.tag.none { background: var(--panel-3); color: var(--muted); font-weight: 600; }
.gear-list li.missing .gear-name { color: var(--faint); }
.gear-list li.missing .tag.epic { opacity: 0.55; }
.gear-hero.locked { background: transparent; border: 1px dashed var(--border); }
.gear-hero.locked .gear-hero-name { color: var(--muted); }
.gear-hero.locked .gear-hero-head { margin-bottom: 8px; }
.gear-hero.locked .gear-name { color: var(--faint); }
