/* =====================================================================
   Clash Latvija — shared design system. ALL pages use these classes.
   Page templates should not carry their own <style>; add components here.

   Type:        Bricolage Grotesque (display, full Latvian / latin-ext) + Inter (UI, tabular numbers)
   Layout:      .wrap  .main  .grid-2 .grid-3 .grid-4 (responsive)  .stack (vertical gap)
   Headings:    .page-head > h1 + p.lead      .section-title (h2 with optional .more link)
   Cards:       .card  .card.pad  .card-head (> h3 with svg.i)  .card-link (whole card clickable)
   Stats:       .stats > .stat > .stat-value + .stat-label  (.stat-value.gold/.red/.green)
   Tables:      .table-wrap > table.table  (th.num / td.num right-aligned; tr.hl highlight)
                td.rank / .rank (rank number), .rank-1/.rank-2/.rank-3 medal colours, .rk = rank disc
   Identity:    .ident > img.badge (+ .badge.sm/.lg) + .ident-text > a.ident-name + .ident-sub
   Chips:       .chip  .chip.red .chip.gold .chip.green .chip.muted   .lv-chip (Latvian flag)
   Delta:       .delta.up / .delta.down / .delta.same   (CSS triangle + number)
   Icons:       svg.i > use[href="/static/icons.svg#name"]   (macro in icons.html)
   Charts:      .trend (from trend_chart() helper)  .trend-empty
   Forms:       form.filters > label.field > span + input/select ; .btn .btn.ghost .btn.gold .btn.sm
   Search:      form.search > input[type=search] + button.btn
   QR:          a[data-qr] opens a QR dialog on desktop (script in base.html)
   Misc:        .muted .small .tag .empty .pager .note .a-note
   ===================================================================== */

:root {
  --bg: #121015;
  --bg-2: #17141b;
  --card: #1c1820;
  --card-2: #252029;
  --card-3: #2f2934;
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .13);
  --text: #f6f1ef;
  --text-2: rgba(246, 241, 239, .66);
  --text-3: rgba(246, 241, 239, .44);
  --red: #d2434f;          /* Latvian carmine, brightened for dark bg */
  --red-deep: #9e3039;     /* flag carmine */
  --red-ink: #5a1a21;
  --gold: #f2c14e;
  --gold-2: #e0a92c;
  --silver: #cdd5e0;
  --bronze: #d6995f;
  --green: #4cc38a;
  --chart: #f2c14e;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
  --r-lg: 18px;
  --r: 14px;
  --r-sm: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .45em; font-family: var(--display); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 5.2vw, 46px); font-weight: 800; letter-spacing: -.025em; line-height: 1.05; }
h2 { font-size: 21px; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0 0 1em; }
b, strong { font-weight: 700; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 32px; padding-bottom: 72px; min-height: 70vh; }
.stack > * + * { margin-top: 28px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.grid-2 > *, .grid-3 > *, .grid-4 > *, .a-grid > * { min-width: 0; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } .main { padding-top: 22px; } }

/* ---------- icons ---------- */
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- header / footer ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(18, 16, 21, .88); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -.02em; flex: none; }
.brand:hover { color: var(--text); }
.brand b { color: var(--red); font-weight: 800; }
.brand-flag { width: 28px; height: 18px; border-radius: 3px; background: linear-gradient(var(--red-deep) 0 40%, #fff 40% 60%, var(--red-deep) 60%); box-shadow: 0 0 0 1px rgba(255,255,255,.14); }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { position: relative; padding: 9px 13px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--card); }
.nav a.on { color: var(--text); }
.nav a.on::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: 2px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--red) 0 40%, #fff 40% 60%, var(--red) 60%); }
.nav .s { display: none; }
.me { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line-2); font-weight: 650; font-size: 14px; max-width: 210px; flex: none; }
.me:hover { border-color: rgba(242, 193, 78, .5); color: var(--text); }
.me-th { background: var(--red-deep); color: #fff; border-radius: 8px; padding: 4px 7px; font-size: 11px; font-weight: 800; letter-spacing: .02em; flex: none; }
.me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-login { flex: none; }
@media (max-width: 760px) {
  .header-inner { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand me" "nav nav"; gap: 6px 10px; min-height: 0; padding-top: 10px; }
  .brand { grid-area: brand; font-size: 19px; }
  .me, .me-login { grid-area: me; }
  .me { max-width: 160px; }
  .nav { grid-area: nav; margin: 0 -16px; padding: 0 10px 6px; gap: 0; }
  .nav a { padding: 9px 11px 11px; font-size: 14px; }
  .nav a.on { background: none; }
  .nav a.on::after { left: 11px; right: 11px; bottom: 3px; }
  .nav .l { display: none; } .nav .s { display: inline; }
}
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 44px; color: var(--text-2); font-size: 13px; background: var(--bg-2); }
.site-footer .wrap { display: grid; gap: 4px; }
.site-footer p { margin: 0; max-width: 72ch; }
.site-footer .foot-brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-family: var(--display); font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.site-footer .foot-brand .brand-flag { width: 20px; height: 13px; }
.site-footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- headings ---------- */
.page-head { margin-bottom: 26px; }
.page-head h1 { margin-bottom: 10px; }
.page-head .lead { color: var(--text-2); font-size: 16.5px; max-width: 68ch; }
.page-head .lead b { color: var(--text); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 14px; }
.section-title .more { font: 600 13px var(--font); color: var(--text-2); letter-spacing: 0; }
a.more:hover, .section-title a.more:hover { color: var(--gold); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card.pad, .card .pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 20px; border-bottom: 1px solid var(--line); min-height: 56px; }
.card-head h2, .card-head h3 { margin: 0; min-width: 0; }
.card-head h3 .i, .card-head h2 .i { color: var(--gold); width: 18px; height: 18px; margin-right: 9px; vertical-align: -3px; }
.card-head .h-sub { color: var(--text-3); font-weight: 500; margin-left: 6px; white-space: nowrap; }
.card-head .more, .card-head > a { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.card-head > a:hover { color: var(--gold); }
.card-head > a .i { width: 14px; height: 14px; }
.card-link { display: block; transition: border-color .15s, background-color .15s; }
.card-link:hover { border-color: rgba(242, 193, 78, .4); background: #201b24; color: inherit; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 13px; min-width: 0; }
.stat-value { font: 750 26px/1.15 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-value.gold { color: var(--gold); } .stat-value.red { color: var(--red); } .stat-value.green { color: var(--green); }
.stat-label { color: var(--text-2); font-size: 13px; font-weight: 500; margin-top: 3px; }
.stat .small { margin-top: 4px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; color: var(--text-3); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg-2); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .022); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.num b { font-weight: 700; font-size: 15px; }
.table tr.hl td { background: rgba(242, 193, 78, .07); }
.table th .i { width: 14px; height: 14px; vertical-align: -2px; }
td.rank { width: 1%; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-1 { color: var(--gold) !important; } .rank-2 { color: var(--silver) !important; } .rank-3 { color: var(--bronze) !important; }
.rk { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 5px; border-radius: 9px; font: 700 13px var(--font); font-variant-numeric: tabular-nums; color: var(--text-2); }
.rank-1 .rk, .rk.rank-1 { background: rgba(242, 193, 78, .16); box-shadow: inset 0 0 0 1px rgba(242, 193, 78, .45); }
.rank-2 .rk, .rk.rank-2 { background: rgba(205, 213, 224, .12); box-shadow: inset 0 0 0 1px rgba(205, 213, 224, .35); }
.rank-3 .rk, .rk.rank-3 { background: rgba(214, 153, 95, .14); box-shadow: inset 0 0 0 1px rgba(214, 153, 95, .4); }
.table-note { color: var(--text-3); font-size: 12.5px; margin: 10px 2px 0; }

/* ---------- identity (badge + name) ---------- */
.ident { display: flex; align-items: center; gap: 11px; min-width: 0; }
.badge { width: 38px; height: 38px; object-fit: contain; flex: none; }
.badge.sm { width: 28px; height: 28px; } .badge.lg { width: 96px; height: 96px; }
.ident-text { min-width: 0; }
.ident-name { font-weight: 650; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ident-sub { color: var(--text-2); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.ident-sub:hover { color: var(--gold); }

/* ---------- chips / deltas ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--card-2); border: 1px solid var(--line); white-space: nowrap; line-height: 1.5; }
.chip .i { width: 13px; height: 13px; }
.chip.red { background: rgba(210, 67, 79, .15); color: #ffa3ab; border-color: rgba(210, 67, 79, .38); }
.chip.gold { background: rgba(242, 193, 78, .12); color: var(--gold); border-color: rgba(242, 193, 78, .32); }
.chip.green { background: rgba(76, 195, 138, .12); color: var(--green); border-color: rgba(76, 195, 138, .3); }
.chip.muted { color: var(--text-2); }
.lv-chip::before { content: ""; flex: none; width: 15px; height: 10px; border-radius: 2px; background: linear-gradient(var(--red-deep) 0 40%, #fff 40% 60%, var(--red-deep) 60%); box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--green); } .delta.down { color: #f0727c; }
.delta.up::before, .delta.down::before { content: ""; width: 8px; height: 6px; background: currentColor; flex: none; }
.delta.up::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.delta.down::before { clip-path: polygon(0 0, 100% 0, 50% 100%); }
.delta.same { color: var(--text-3); font-weight: 600; }

/* ---------- buttons / forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 17px; border-radius: 11px; border: 1px solid transparent; background: var(--red); color: #fff; font: 650 14px/1.3 var(--font); cursor: pointer; text-align: center; transition: background-color .15s, border-color .15s; }
.btn:hover { background: #e0525e; color: #fff; }
.btn .i { width: 17px; height: 17px; }
.btn.gold { background: var(--gold); color: #2a1a05; }
.btn.gold:hover { background: #ffd26a; color: #2a1a05; }
.btn.ghost { background: var(--card-2); color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { border-color: rgba(242, 193, 78, .5); color: var(--text); background: var(--card-3); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn[aria-current] { background: var(--red); border-color: var(--red); color: #fff; }
input, select { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; outline: none; min-width: 0; }
input::placeholder { color: var(--text-3); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a29da3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center / 15px; }
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 193, 78, .15); }
input[type=checkbox] { accent-color: var(--red); width: 17px; height: 17px; }
form.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
label.field.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); padding-bottom: 10px; cursor: pointer; }
form.search { display: flex; gap: 8px; }
form.search input { flex: 1; font-size: 16px; padding: 12px 14px 12px 42px; background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a29da3' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M20 20l-4.2-4.2'/%3E%3C/svg%3E") no-repeat 14px 50% / 18px; }
.prefix-input { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-2); overflow: hidden; }
.prefix-input:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 193, 78, .15); }
.prefix-input > span { display: grid; place-items: center; padding: 0 12px 0 14px; color: var(--text); font: 700 18px var(--font); background: var(--card-2); border-right: 1px solid var(--line-2); user-select: none; }
.prefix-input input { border: 0; border-radius: 0; flex: 1; background: transparent; box-shadow: none !important; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- notes / empty ---------- */
.muted { color: var(--text-2); } .small { font-size: 12.5px; }
.tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-3); letter-spacing: .02em; }
.result-win { color: var(--green); font-weight: 700; } .result-lose { color: #f0727c; font-weight: 700; } .result-tie { color: var(--text-2); font-weight: 700; }
.bar { height: 6px; border-radius: 6px; background: var(--card-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--red-deep), var(--red) 55%, var(--gold)); border-radius: 6px; }
.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty h2, .empty h3, .empty h1 { color: var(--text); }
.empty p { max-width: 56ch; margin-left: auto; margin-right: auto; }
.empty-code { font: 800 96px/1 var(--display); letter-spacing: -.04em; color: var(--red); margin-bottom: 8px; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 20px; }
.pager .btn .i { width: 15px; height: 15px; }
.note { padding: 12px 14px; border-radius: 12px; background: rgba(76, 195, 138, .1); border: 1px solid rgba(76, 195, 138, .32); color: var(--green); font-weight: 600; }
.alert { background: rgba(210, 67, 79, .13); border: 1px solid rgba(210, 67, 79, .4); color: #ffb3ba; padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.a-note { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; }
.a-note > .i { color: var(--gold); width: 20px; height: 20px; margin-top: 1px; }
.a-note.warn > .i { color: #f0a35c; }
.a-note b { color: var(--text); }

/* ---------- trend chart ---------- */
.trend { margin: 0; display: grid; gap: 10px; }
.trend-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.trend-now { font: 750 26px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.trend-now small { font: 600 13px var(--font); color: var(--text-2); letter-spacing: 0; }
.trend-head .delta { font-size: 13px; }
.trend-period { color: var(--text-3); font-size: 12.5px; }
.trend-plot { position: relative; height: 128px; padding-right: 66px; }
.trend-area { position: relative; height: 100%; }
.trend-area svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trend-grid { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.trend-line { fill: none; stroke: var(--chart); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trend-pt { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 1.75px var(--chart); }
.trend-pt.last { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; background: var(--chart); box-shadow: 0 0 0 3px var(--card), 0 0 0 5px rgba(242, 193, 78, .25); }
.trend-y span { position: absolute; right: 0; transform: translateY(-50%); font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.trend-x { position: relative; height: 16px; margin-right: 66px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.trend-x span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.trend-x span:first-child { transform: none; }
.trend-x span:last-child { transform: translateX(-100%); }
.trend-empty { display: flex; gap: 14px; align-items: flex-start; }
.trend-empty-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--card-2); border: 1px dashed var(--line-2); color: var(--gold); }
.trend-empty-ico .i { width: 20px; height: 20px; }
.trend-empty b { display: block; margin-bottom: 2px; }
.trend-empty p { margin: 0; color: var(--text-2); font-size: 14px; }
.trend-empty p b { display: inline; color: var(--text); margin: 0; }
.trend + .trend { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.trend-label { font-weight: 600; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }

/* ---------- home hero (flag panel) ---------- */
.hero { position: relative; border-radius: 24px; overflow: hidden; background: var(--red-deep); color: #fff; isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(900px 380px at 85% -10%, rgba(255, 255, 255, .12), transparent 60%), radial-gradient(600px 300px at 0% 120%, rgba(0, 0, 0, .25), transparent 70%); }
.hero-main { padding: 46px 44px 40px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; align-items: end; }
.hero h1 { font-size: clamp(36px, 6.4vw, 64px); margin: 18px 0 16px; color: #fff; max-width: 14ch; }
.hero .lead { color: rgba(255, 255, 255, .84); font-size: 17px; max-width: 54ch; margin: 0; }
.hero-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; background: rgba(0, 0, 0, .2); font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .9); }
.hero-chip::before { content: ""; width: 20px; height: 13px; border-radius: 3px; background: linear-gradient(#7d2029 0 40%, #fff 40% 60%, #7d2029 60%); box-shadow: 0 0 0 1px rgba(255,255,255,.35); }
.hero-search { background: rgba(28, 8, 12, .38); border: 1px solid rgba(255, 255, 255, .14); border-radius: 18px; padding: 18px; }
.hero-search label { display: block; font: 700 17px var(--display); margin-bottom: 10px; }
.hero-search form.search input { background-color: #fff; color: #1b1418; border-color: transparent; }
.hero-search form.search input::placeholder { color: #8a7f86; }
.hero-search form.search input:focus { box-shadow: 0 0 0 3px rgba(242, 193, 78, .55); }
.hero-search .btn { padding: 0 20px; font-size: 15px; }
.hero-search p { margin: 10px 0 0; font-size: 13px; color: rgba(255, 255, 255, .72); }
.hero-search .quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hero-search .quick a { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff; }
.hero-search .quick a:hover { background: rgba(255, 255, 255, .2); }
.hero-stripe { height: 14px; background: #fff; }
.hero-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; background: #8a2832; }
.hero-stats > div { padding: 18px 22px 20px; border-left: 1px solid rgba(255, 255, 255, .12); min-width: 0; }
.hero-stats > div:first-child { border-left: 0; }
.hero-stats dt { font-size: 13px; color: rgba(255, 255, 255, .72); font-weight: 500; order: 2; }
.hero-stats dd { margin: 0 0 2px; font: 750 28px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-stats dd.small-v { font-size: 20px; line-height: 31px; }
.hero-stats > div { display: flex; flex-direction: column; }
@media (max-width: 900px) {
  .hero-main { grid-template-columns: minmax(0, 1fr); padding: 34px 26px 28px; gap: 26px; }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-stats > div:nth-child(4) { border-left: 0; }
  .hero-stats > div:nth-child(n+4) { border-top: 1px solid rgba(255, 255, 255, .12); }
}
@media (max-width: 560px) {
  .hero { border-radius: 18px; margin: 0 -4px; }
  .hero-main { padding: 26px 18px 22px; }
  .hero h1 { margin: 14px 0 12px; }
  .hero .lead { font-size: 15.5px; }
  .hero-search { padding: 14px; border-radius: 14px; }
  .hero-stripe { height: 10px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats > div { padding: 14px 16px 15px; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .12); }
  .hero-stats > div:nth-child(-n+2) { border-top: 0; }
  .hero-stats > div:nth-child(even) { border-left: 1px solid rgba(255, 255, 255, .12); }
  .hero-stats > div:last-child { grid-column: 1 / -1; border-left: 0; }
  .hero-stats dd { font-size: 24px; }
}

/* ---------- lists (leaderboards) ---------- */
.a-list { list-style: none; margin: 0; padding: 4px 0; }
.a-list li { display: flex; align-items: center; gap: 12px; padding: 10px 20px; min-height: 58px; }
.a-list li + li { border-top: 1px solid var(--line); }
.a-list .rank { width: 30px; flex: none; text-align: center; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.a-list .ident { flex: 1; }
.a-list .val { margin-left: auto; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.a-list .val small { display: block; font-weight: 500; font-size: 12px; margin-top: 1px; }
.a-list.kv li { min-height: 48px; }
.a-list.kv li > span:first-child { color: var(--text-2); }

/* ---------- tabs ---------- */
.a-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 10px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; width: max-content; max-width: 100%; }
.a-tabs::-webkit-scrollbar { display: none; }
.a-tabs a { padding: 8px 15px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.a-tabs a:hover { color: var(--text); background: var(--card-2); }
.a-tabs a.on { background: var(--red); color: #fff; }
.a-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.a-toolbar > * { min-width: 0; }
.a-toolbar h2 { margin: 0 0 2px; }

/* ---------- misc components ---------- */
.a-th { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; padding: 2px 7px; border-radius: 8px; background: var(--card-3); font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.a-league { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; }
.a-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.a-unit { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 13px; }
.a-unit b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); margin-bottom: 1px; }
.a-unit .lvl { font: 750 18px var(--display); font-variant-numeric: tabular-nums; }
.a-unit.max { border-color: rgba(242, 193, 78, .4); background: linear-gradient(180deg, rgba(242, 193, 78, .08), transparent 70%), var(--card-2); }
.a-unit.max .lvl { color: var(--gold); }
.a-unit .eq { color: var(--text-2); font-size: 12px; margin-top: 4px; }
.a-prog { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; font-size: 14px; }
.a-prog .bar { grid-column: 1 / -1; margin-bottom: 9px; }
.a-feature { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.a-feature .ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(210, 67, 79, .14); color: #ff8f99; margin-bottom: 6px; }
.a-feature .ico .i { width: 21px; height: 21px; }
.a-feature h3 { margin: 0; }
.a-feature p { color: var(--text-2); margin: 0; font-size: 14px; }
.a-profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.a-profile-head .th-big { font: 800 38px/1 var(--display); color: var(--gold); text-align: center; background: var(--card-2); border: 1px solid rgba(242, 193, 78, .3); border-radius: 18px; padding: 14px 14px 10px; min-width: 88px; }
.a-profile-head .th-big small { display: block; font: 600 11.5px var(--font); color: var(--text-2); margin-top: 6px; }
.a-profile-head h1 { margin: 0; overflow-wrap: anywhere; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.show-sm-delta { display: none; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .show-sm-delta { display: block; margin-top: 3px; text-align: center; }
  .show-sm-delta .chip { padding: 0 5px; font-size: 10px; }
  .show-sm-delta .delta { font-size: 11px; }
  .table td, .table th { padding-left: 10px; padding-right: 10px; }
  .a-list li { padding: 10px 14px; }
  .card-head { padding: 13px 16px; }
  .card.pad, .card .pad { padding: 16px; }
  .table .lv-chip { display: none; }
  .a-list .lv-chip { font-size: 0; gap: 0; padding: 5px 6px; }
  .table .ident-name { white-space: normal; overflow-wrap: anywhere; }
  .table .ident-sub { max-width: 46vw; }
  .a-tabs { width: auto; }
}

/* ---------- clan pages ---------- */
.b-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.b-hero .badge.lg { width: 104px; height: 104px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .45)); }
.b-hero-text { flex: 1 1 260px; min-width: 0; }
.b-hero h1 { margin: 0 0 6px; overflow-wrap: anywhere; }
.b-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.b-hero .b-chips { margin-top: 12px; }
.b-hero-cta { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.b-desc { white-space: normal; overflow-wrap: anywhere; margin: 0; }
.b-ccard { height: 100%; }
.b-ccard .pad { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.b-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); }
.b-facts dt { font-size: 12px; color: var(--text-3); font-weight: 500; }
.b-facts dd { margin: 0; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.b-facts dd .i { width: 14px; height: 14px; color: var(--gold); }
.b-act { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.b-filters { gap: 12px 14px; }
.b-filters label.field { flex: 1 1 130px; min-width: 0; }
.b-filters label.field select, .b-filters label.field input:not([type=checkbox]) { width: 100%; }
.b-filters label.field.check { flex: 0 0 auto; }
.b-filters .b-actions { display: flex; gap: 8px; flex: 1 1 100%; flex-wrap: wrap; padding-top: 4px; }
.b-resbar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin: 26px 0 14px; }
.b-resbar h2 { margin: 0; }
.stars { display: inline-flex; align-items: center; gap: 5px; }
.stars .i { width: 14px; height: 14px; color: var(--gold); }

/* ---------- league ---------- */
.b-seasons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 22px; }
.b-rules { margin: 0; padding-left: 20px; }
.b-rules li + li { margin-top: 8px; }
.b-rules li::marker { color: var(--red); }
.b-derby { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; padding: 13px 20px; }
.b-derby + .b-derby { border-top: 1px solid var(--line); }
.b-derby .ident.right { flex-direction: row-reverse; text-align: right; }
.b-score { text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.b-score .small { display: block; font-weight: 500; }
.table td.b-pts { font-weight: 750; color: var(--gold); font-size: 15px; }
@media (max-width: 480px) { .b-derby { padding: 12px; gap: 6px; } .b-derby .badge.sm { display: none; } }

/* ---------- login / profile ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } }
.login form { display: flex; flex-direction: column; gap: 16px; }
.login input { font-size: 17px; padding: 13px 14px; }
.login .btn { padding: 13px; font-size: 15px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 14px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--red-deep); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.why { display: flex; gap: 12px; align-items: flex-start; }
.why > .i { color: var(--green); width: 20px; height: 20px; margin-top: 1px; }
.acc { display: flex; align-items: center; gap: 14px; padding: 14px 20px; flex-wrap: wrap; }
.acc + .acc { border-top: 1px solid var(--line); }
.acc .th { width: 50px; height: 50px; border-radius: 13px; background: var(--card-2); border: 1px solid var(--line-2); display: grid; place-items: center; font-weight: 750; font-size: 13px; flex: none; color: var(--gold); }
.acc .ident-text { flex: 1; min-width: 160px; }
.acc form { margin: 0; }
.soon h3 { display: flex; align-items: center; gap: 9px; }
.soon h3 .i { color: var(--gold); }
.soon .chip { margin-bottom: 10px; }
details.danger summary { cursor: pointer; color: var(--text-2); font-size: 13px; }

/* ---------- QR dialog ---------- */
.qr-dialog { border: 1px solid var(--line-2); border-radius: 20px; background: var(--card); color: var(--text); padding: 24px; width: min(360px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); text-align: center; }
.qr-dialog::backdrop { background: rgba(8, 6, 10, .7); backdrop-filter: blur(3px); }
.qr-dialog h2 { font-size: 20px; margin: 0 0 4px; }
.qr-dialog p { color: var(--text-2); font-size: 14px; margin: 0 0 16px; }
.qr-box { background: #fff; border-radius: 16px; padding: 14px; width: 232px; height: 232px; margin: 0 auto 16px; display: grid; place-items: center; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-link { display: block; font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; margin-bottom: 16px; text-decoration: underline; text-underline-offset: 2px; }
.qr-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--card-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.qr-close:hover { color: var(--text); background: var(--card-3); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* nested stats (inside a card) are tighter */
.card .stats { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.card .stat { background: var(--card-2); padding: 12px 14px; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .card .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stat-value { font-size: 23px; } }

/* ---------- upgrade planner (/planotajs) ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.p-h { display: flex; align-items: center; gap: 9px; font-size: 19px; }
.p-h .i { color: var(--gold); width: 19px; height: 19px; }
.p-link { color: var(--gold); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.p-error { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; }
.p-error .i { margin-top: 2px; }
.p-intro { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .p-intro { grid-template-columns: minmax(0, 1fr); } }
.p-aside > * + * { margin-top: 16px; }
.p-facts { display: grid; gap: 14px; font-size: 14px; }
.p-facts .why > .i { color: var(--gold); }
.p-form { display: flex; flex-direction: column; gap: 18px; }
.p-paste { display: flex; flex-direction: column; gap: 8px; }
.p-paste-label { font: 700 17px var(--display); }
.p-paste textarea { width: 100%; min-height: 210px; resize: vertical; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); background: var(--bg-2); border: 1px dashed rgba(242, 193, 78, .4); border-radius: var(--r); padding: 14px; outline: none; overflow-wrap: anywhere; }
.p-paste textarea:focus { border-style: solid; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 193, 78, .15); }
.p-paste textarea::placeholder { color: var(--text-3); }
.p-paste-hint { color: var(--text-3); font-size: 12.5px; }
.p-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.p-opts select, .p-opts input[type=time] { width: 100%; }
.p-opt-wide, .p-sleep, .p-checks { grid-column: 1 / -1; }
.p-sleep { border: 0; padding: 0; margin: 0; min-width: 0; }
.p-sleep legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; margin-bottom: 6px; }
.p-sleep-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.p-sleep-row .field > span { font-weight: 500; font-size: 12px; color: var(--text-3); }
.p-sleep input:disabled { opacity: .4; }
.p-checks { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.p-checks .field.check { padding-bottom: 0; }
.p-submit .btn { padding: 13px 22px; font-size: 15px; }
@media (max-width: 560px) {
  .p-opts { grid-template-columns: minmax(0, 1fr); }
  .p-sleep-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .p-sleep-row .check { grid-column: 1 / -1; padding-bottom: 0; }
  .p-submit .btn { width: 100%; }
}

/* result header */
.p-head { display: flex; flex-wrap: wrap; gap: 18px 24px; align-items: center; justify-content: space-between; padding: 20px 22px; margin-bottom: 16px; background: radial-gradient(700px 220px at 0% 0%, rgba(210, 67, 79, .16), transparent 70%), var(--card); }
.p-head-main { display: flex; gap: 18px; align-items: center; min-width: 0; }
.p-head .th-big { font: 800 38px/1 var(--display); color: var(--gold); text-align: center; background: var(--card-2); border: 1px solid rgba(242, 193, 78, .3); border-radius: 18px; padding: 14px 12px 10px; min-width: 84px; }
.p-head .th-big small { display: block; font: 600 11px var(--font); color: var(--text-2); margin-top: 6px; }
.p-head-text { min-width: 0; }
.p-head h1 { margin: 0; font-size: clamp(28px, 4.6vw, 40px); overflow-wrap: anywhere; }
.p-kicker { margin: 0 0 4px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.p-head .meta-row { margin-top: 10px; }
.p-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.p-head-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.p-exported { display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 14px; }
.p-exported .i { color: var(--green); width: 18px; height: 18px; }
.p-exported b { color: var(--text); }
.p-exported small { display: block; color: var(--text-3); font-size: 12px; }
.p-exported.stale .i, .p-exported.stale b { color: #f0a35c; }
@media (max-width: 640px) {
  .p-head { padding: 16px; }
  .p-head .th-big { min-width: 66px; font-size: 30px; padding: 11px 8px 8px; border-radius: 14px; }
  .p-head-side { align-items: stretch; width: 100%; }
  .p-head-btns .btn { flex: 1; }
  .p-head-btns .btn.gold { flex: 1 1 100%; }
}
.p-notes { display: grid; gap: 10px; margin-bottom: 22px; }
.p-notes:empty { display: none; }
.p-note { display: flex; gap: 9px; align-items: center; margin: 0; }

/* summary */
.p-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.p-stats .p-stat-hero { grid-column: span 2; background: linear-gradient(180deg, rgba(242, 193, 78, .09), transparent 80%), var(--card); border-color: rgba(242, 193, 78, .28); }
.p-stats .stat-value { font-size: 23px; white-space: nowrap; }
.p-stats .p-stat-hero .stat-value { font-size: 26px; }
@media (max-width: 640px) { .p-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .p-stats .stat-value { font-size: 20px; } .p-stats .p-stat-hero .stat-value { font-size: 22px; } }
.p-res { display: inline-block; width: .55em; height: .55em; border-radius: 50%; margin-right: .3em; vertical-align: .08em; flex: none; }
.p-res.gold { background: #f2c14e; box-shadow: 0 0 0 2px rgba(242, 193, 78, .22); }
.p-res.elixir { background: #e46fe0; box-shadow: 0 0 0 2px rgba(228, 111, 224, .22); }
.p-res.dark { background: #8a76d6; box-shadow: 0 0 0 2px rgba(138, 118, 214, .25); }
.p-res.shiny, .p-res.glowy, .p-res.starry { background: #7fc8e8; }

/* running + next steps */
.p-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .p-cols { grid-template-columns: minmax(0, 1fr); } }
.p-list { list-style: none; margin: 0; padding: 4px 0; }
.p-list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; }
.p-list li + li { border-top: 1px solid var(--line); }
.p-bn { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--line-2); font-weight: 750; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.p-li-main { flex: 1; min-width: 0; font-size: 14px; }
.p-li-main b { font-weight: 650; }
.p-li-sub { display: block; color: var(--text-3); font-size: 12.5px; }
.p-left { flex: none; font-weight: 750; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--gold); white-space: nowrap; }
.p-left.done { color: var(--green); }
.p-lvl { display: inline-flex; align-items: center; gap: 3px; color: var(--text-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-lvl span[aria-hidden] { color: var(--text-3); }
.chip.p-sc { padding: 0 7px; font-size: 11px; color: #9fd3ff; background: rgba(100, 170, 255, .1); border-color: rgba(100, 170, 255, .3); vertical-align: 1px; }
.p-day + .p-day { border-top: 1px solid var(--line); }
.p-day-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px 4px; }
.p-day-head b { font: 700 15px var(--display); }
.p-day-head span { color: var(--text-3); font-size: 12.5px; }
.p-steps { list-style: none; margin: 0; padding: 0 0 6px; }
.p-steps li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 18px; }
.p-steps li.sleep { background: linear-gradient(90deg, rgba(242, 193, 78, .07), transparent 70%); box-shadow: inset 3px 0 0 var(--gold); }
.p-time { font: 750 17px var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.p-time .chip { font-family: var(--font); }
.p-step-title { font-size: 14.5px; min-width: 0; }
.p-step-title b { font-weight: 650; }
.p-step-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--text-2); font-size: 12.5px; margin-top: 1px; }
.p-cost { display: inline-flex; align-items: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-sleepchip .i { width: 13px; height: 13px; }
.p-more { margin: 0; padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--text-2); }
.p-more a { display: inline-flex; align-items: center; gap: 4px; }
.p-more .i { width: 14px; height: 14px; }
.p-cat { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: .05em; background: var(--c, #8fa3bf); }
.p-cat.defense, .p-bar.defense { --c: #e05a66; }
.p-cat.traps, .p-bar.traps { --c: #ea8f4d; }
.p-cat.army, .p-bar.army { --c: #f2c14e; }
.p-cat.resources, .p-bar.resources { --c: #4cc38a; }
.p-cat.heroes, .p-bar.heroes { --c: #a98bf5; }
.p-cat.other, .p-bar.other { --c: #8fa3bf; }
.p-cat.running { background: repeating-linear-gradient(135deg, rgba(255,255,255,.4) 0 2px, rgba(255,255,255,.12) 2px 4px); }
.p-cat.sleepsw { background: rgba(120, 130, 220, .35); }
.p-cat.nowsw { width: 3px; border-radius: 2px; background: var(--red); }
@media (max-width: 560px) {
  .p-steps li { grid-template-columns: 48px minmax(0, 1fr); padding: 9px 14px; gap: 10px; }
  .p-time { font-size: 15px; }
  .p-sleepchip { grid-column: 2; justify-self: start; }
  .p-day-head { padding: 12px 14px 2px; }
  .p-list li { padding: 10px 14px; }
}

/* builder timeline */
.p-tl { overflow-x: auto; padding: 4px 0 6px; scrollbar-width: thin; }
.p-tl:focus-visible { outline-offset: -2px; }
.p-tl-in { min-width: 1040px; padding: 0 18px 0 0; }
.p-tl-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); height: 36px; }
.p-tl-lab { position: sticky; left: 0; z-index: 3; display: grid; place-items: center; background: var(--card); color: var(--text-2); font-weight: 700; font-size: 12px; border-right: 1px solid var(--line); }
.p-tl-track { position: relative; }
.p-tl-axis { height: 30px; }
.p-tl-axis .p-tl-lab { border-right-color: transparent; }
.p-tl-day { position: absolute; top: 8px; transform: translateX(6px); font-size: 11.5px; font-weight: 650; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-tl-day.first { left: 0; color: var(--text-3); }
.p-tl-body { position: relative; padding-bottom: 6px; }
.p-tl-grid { position: absolute; left: 52px; right: 0; top: -2px; bottom: 0; pointer-events: none; z-index: 0; }
.p-tl-sleep { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(120, 130, 220, .13) 0 6px, rgba(120, 130, 220, .07) 6px 12px); }
.p-tl-line { position: absolute; top: -28px; bottom: 0; width: 1px; background: var(--line-2); }
.p-tl-now { position: absolute; top: -6px; bottom: 0; width: 2px; margin-left: -1px; background: var(--red); z-index: 2; box-shadow: 0 0 0 3px rgba(210, 67, 79, .18); }
.p-tl-now::before { content: ""; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.p-tl-body .p-tl-row { position: relative; z-index: 1; }
.p-tl-body .p-tl-row + .p-tl-row .p-tl-track { border-top: 1px solid var(--line); }
.p-bar { position: absolute; top: 5px; bottom: 5px; display: flex; align-items: center; padding: 0 7px; border-radius: 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11.5px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--c, #8fa3bf) 26%, var(--card)); box-shadow: inset 3px 0 0 var(--c, #8fa3bf), 0 0 0 1px var(--card); cursor: default; }
.p-bar:hover { background: color-mix(in srgb, var(--c, #8fa3bf) 42%, var(--card)); }
.p-bar.sc { background-image: linear-gradient(90deg, transparent, rgba(100, 170, 255, .16)); }
.p-bar.running { --c: rgba(255, 255, 255, .55); color: var(--text-2); background: repeating-linear-gradient(135deg, rgba(255,255,255,.09) 0 5px, rgba(255,255,255,.04) 5px 10px), var(--card-2); }
.p-bar.narrow { padding: 0; }
.p-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 18px 16px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; }
.p-legend span { display: inline-flex; align-items: center; }
.p-legend .p-cat { width: 12px; height: 12px; }

/* side cards, queues, full list */
.p-side .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.p-side .stat-value { font-size: 20px; white-space: nowrap; }
.p-details { margin-top: 12px; }
.p-details summary { cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 600; }
.p-details summary:hover { color: var(--gold); }
.p-eq { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.p-eq li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: var(--card-2); font-size: 13px; }
.p-eq b { display: block; font-weight: 600; }
.p-eq small { color: var(--text-3); font-size: 11.5px; }
.p-eq-lvl { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.p-eq-lvl.max { color: var(--gold); }
.p-qsum { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 12px 18px; color: var(--text-2); font-size: 13px; border-bottom: 1px solid var(--line); }
.p-qsum b { color: var(--text); }
.p-q { margin: 0; padding: 4px 0; list-style: none; }
.p-q li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 70px; gap: 12px; align-items: center; padding: 8px 18px; font-size: 13.5px; }
.p-q li + li { border-top: 1px solid var(--line); }
.p-q-main b { font-weight: 600; }
.p-q-when { color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.p-q-dur { color: var(--text-2); font-size: 12.5px; white-space: nowrap; text-align: right; }
.p-q .p-cost { justify-content: flex-end; }
.p-qmore { margin: 0; border-top: 1px solid var(--line); }
.p-qmore > summary { padding: 10px 18px; }
@media (max-width: 560px) {
  .p-q li { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 14px; }
  .p-q-when { grid-column: 1; grid-row: 2; }
  .p-q-dur { grid-column: 2; grid-row: 2; }
}
.p-all > summary { cursor: pointer; list-style: none; border-bottom: 0; }
.p-all > summary::-webkit-details-marker { display: none; }
.p-all[open] > summary { border-bottom: 1px solid var(--line); }
.p-all .h-sub { display: inline-flex; align-items: center; gap: 6px; }
.p-chev { transition: transform .15s; }
.p-all[open] .p-chev { transform: rotate(90deg); }
.p-all-wrap { overflow-x: auto; }
.p-all .table th { background: transparent; }
.p-nowrap { white-space: nowrap; }
.p-moon { color: var(--gold); }
.p-moon .i { width: 14px; height: 14px; }
.p-warn > * + * { margin-top: 10px; }
.p-set-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.p-set-head .p-h { margin: 0; }
.p-hist { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 14px; }
.p-credit { color: var(--text-3); font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 16px; }
.p-credit p { margin: 0 0 6px; max-width: 90ch; }
.p-credit a { text-decoration: underline; text-underline-offset: 2px; }
.p-walls-note { margin: 0; }
/* 6 nav items: on narrow phones the brand is the home link */
@media (max-width: 430px) {
  .nav .nav-home:not(.on) { display: none; }
  .nav a { padding-left: 8px; padding-right: 8px; }
  .nav a.on::after { left: 8px; right: 8px; }
}

/* rankings: minor Builder Base links under the main tabs; main tabs fill the width on phones */
.a-subtabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 22px; font-size: 13px; color: var(--text-2); }
.a-subtabs span { font-weight: 600; margin-right: 2px; }
.a-subtabs a { padding: 4px 10px; border-radius: 8px; color: var(--text-2); font-weight: 600; border: 1px solid var(--line); }
.a-subtabs a:hover { color: var(--text); }
.a-subtabs a.on { color: #fff; background: var(--card-2); border-color: var(--red); }
@media (max-width: 720px) {
  .a-tabs { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; overflow: visible; }
  .a-tabs a { text-align: center; padding: 10px 4px; white-space: normal; line-height: 1.2; }
}
