/* ==========================================================================
   Rankr 2 – modern, accessible (WCAG 2.1 AA), light & dark mode.
   Brand colors come from --brand / --brand-2 (set per toplist theme).
   ========================================================================== */

:root {
  --brand: #1d4ed8;
  --brand-2: #6d28d9;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --ok: #15803d; --ok-bg: #ecfdf3;
  --warn: #a16207; --warn-bg: #fefce8;
  --bad: #b91c1c; --bad-bg: #fef2f2;
  --info: #1d4ed8; --info-bg: #eff6ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --focus: 0 0 0 3px var(--surface), 0 0 0 5px var(--brand);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #17223a;
    --text: #e5e9f2;
    --muted: #a3afc2;
    --line: #23314d;
    --line-strong: #33456a;
    --ok: #4ade80; --ok-bg: #0f2a1b;
    --warn: #facc15; --warn-bg: #2a240b;
    --bad: #f87171; --bad-bg: #2c1214;
    --info: #93c5fd; --info-bg: #0f1d38;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

/* Colors derived from the brand color – recalculated wherever a theme sets --brand */
:root, body, [style*="--brand"] { --link: var(--brand); --brand-soft: color-mix(in srgb, var(--brand) 9%, var(--surface)); }
@media (prefers-color-scheme: dark) {
  :root, body, [style*="--brand"] { --link: color-mix(in srgb, var(--brand) 40%, #ffffff); --brand-soft: color-mix(in srgb, var(--brand) 22%, var(--surface)); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--text); background: var(--bg); text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.02em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.6rem); font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; }
.h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25rem; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 28px; padding-bottom: 48px; min-height: 55vh; }
.main:focus { outline: none; }
.muted { color: var(--muted); }
.hint { display: block; font-size: .875rem; color: var(--muted); margin-top: 4px; }
.center { text-align: center; }
.req { color: var(--bad); }

/* ---------- Notice bar ---------- */
.notice { font-size: .95rem; padding: 10px 0; border-bottom: 1px solid var(--line); }
.notice .wrap { display: flex; gap: 10px; align-items: center; }
.notice-info { background: var(--info-bg); color: var(--info); }
.notice-success { background: var(--ok-bg); color: var(--ok); }
.notice-warning { background: var(--warn-bg); color: var(--warn); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 35%, transparent); }
.brand-mark .icon { fill: #fff; stroke: none; }
.site-nav { display: flex; align-items: center; gap: 16px; flex: 1; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.site-nav a, .link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; }
.site-nav a:hover, .link-btn:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--link); background: var(--brand-soft); }
.site-nav .btn { color: #fff; }
.nav-user { margin-left: auto; }
.link-btn { background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.nav-search { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding-left: 14px; }
.nav-search input { border: 0 !important; background: transparent !important; box-shadow: none !important; width: 190px; min-height: 40px; padding: 0 !important; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--line); }
.nav-toggle { display: none; margin-left: auto; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; place-items: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; background: var(--brand); color: #fff; font: 600 .95rem/1 var(--font); text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn:hover { background: color-mix(in srgb, var(--brand) 88%, #000); text-decoration: none; transform: translateY(-1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.btn-lg { min-height: 54px; padding: 0 30px; font-size: 1.05rem; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-light { background: #fff; color: #0f172a; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.btn-light:hover { background: #f1f5f9; }
.btn-danger { background: #b91c1c; box-shadow: none; }
.btn-danger:hover { background: #991b1b; }
.btn-success { background: #15803d; box-shadow: none; }
.btn-success:hover { background: #166534; }
.btn-block { width: 100%; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2, .card-head h3 { margin: 0; }
.soft { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 18%, var(--line)); }
.empty-state { text-align: center; padding: 48px 24px; }
.big-emoji { font-size: 3rem; line-height: 1; margin-bottom: 12px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; }
.layout-left { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-bottom: 24px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 36px 0 16px; }
.section-title h2 { margin: 0; }
.stack > * + * { margin-top: 12px; }

/* ---------- Breadcrumbs ---------- */
.crumbs ol { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px; font-size: .9rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.crumbs a { color: var(--muted); }

/* ---------- Flash messages ---------- */
.flash { border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 20px; border: 1px solid; font-weight: 500; }
.flash ul { margin: 6px 0 0; }
.flash:focus { outline: none; box-shadow: var(--focus); }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.flash-error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.flash-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: clamp(28px, 5vw, 56px); margin-bottom: 28px; color: #fff; background: radial-gradient(1200px 400px at 110% -20%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: var(--shadow-lg); }
.hero h1 { color: #fff; max-width: 18ch; }
.hero p { font-size: 1.1rem; max-width: 56ch; opacity: .95; }
.hero ul { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.hero li { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.hero-deco { position: absolute; right: -40px; bottom: -40px; width: 260px; height: 260px; opacity: .14; color: #fff; }

/* ---------- Pills & chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.pill-brand { background: var(--brand-soft); color: var(--link); border-color: transparent; }
.pill-light { background: rgba(255, 255, 255, .2); color: #fff; border-color: rgba(255, 255, 255, .35); }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.chips a:hover, .chips a[aria-current="page"] { border-color: var(--brand); color: var(--link); background: var(--brand-soft); }
.chips .count { color: var(--muted); font-weight: 500; font-size: .8rem; }

/* ---------- Ranking ---------- */
.ranking { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; }
.rank-card { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.rank-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.rank-row:target .rank-card, .rank-row.is-target .rank-card { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.rank-pos { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rank-badge { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; font-weight: 800; font-size: 1.3rem; color: var(--link); background: var(--brand-soft); font-variant-numeric: tabular-nums; }
.top1 .rank-badge { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #451a03; }
.top2 .rank-badge { background: linear-gradient(135deg, #f1f5f9, #94a3b8); color: #1e293b; }
.top3 .rank-badge { background: linear-gradient(135deg, #fed7aa, #c2410c); color: #fff; }
.trend { font-size: .75rem; font-weight: 700; line-height: 1; }
.trend.up { color: var(--ok); }
.trend.down { color: var(--bad); }
.trend.same { color: var(--muted); }
.trend.new { background: var(--brand); color: #fff; border-radius: 999px; padding: 3px 8px; text-transform: uppercase; letter-spacing: .04em; font-size: .65rem; }
.rank-title { margin: 0 0 4px; font-size: 1.1rem; }
.rank-title a { color: var(--text); text-decoration: none; }
.rank-title a:hover { color: var(--link); text-decoration: underline; }
.rank-desc { margin: 0 0 6px; color: var(--muted); font-size: .95rem; }
.rank-actions { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .9rem; }
.rank-actions a { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; font-weight: 600; text-decoration: none; }
.rank-actions a:hover { text-decoration: underline; }
.banner-link { display: block; margin-bottom: 10px; }
.banner { display: block; max-width: min(100%, 468px); max-height: 60px; width: auto; border-radius: 6px; }
.rank-stats { display: flex; gap: 8px; margin: 0; }
.rank-stats div { min-width: 72px; text-align: center; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.rank-stats dt { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rank-stats dd { margin: 0; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rank-ad { list-style: none; }

/* ---------- Toplist cards ---------- */
.list-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.list-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.list-card:focus-within { box-shadow: var(--focus); }
.list-card-top { padding: 18px 18px 16px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.list-card-top h3 { margin: 6px 0 2px; font-size: 1.1rem; }
.list-card-top p { margin: 0; font-size: .85rem; opacity: .92; }
.list-card-top .pill { margin-bottom: 4px; }
.stretched { color: #fff; text-decoration: none; }
.stretched::after { content: ""; position: absolute; inset: 0; }
.stretched:focus-visible { box-shadow: none; }
.list-card-body { flex: 1; margin: 0; padding: 14px 18px; color: var(--muted); font-size: .92rem; }
.list-card-stats { display: flex; justify-content: space-between; margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); font-weight: 600; }
.list-card-stats span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Stat tiles ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 0 0 24px; }
.stat-tiles div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card .stat-tiles div { background: var(--surface-2); border-color: transparent; }
.stat-tiles dt { font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-tiles dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- Mini lists ---------- */
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .dot { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.mini-list .grow { flex: 1; min-width: 0; }
.mini-list .grow a { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list small { color: var(--muted); }

/* ---------- Steps ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step; }
.steps li { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 20px 72px; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 20px; top: 20px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--brand-soft); color: var(--link); font-weight: 800; }
.steps strong { display: block; margin-bottom: 2px; }

/* ---------- Forms ---------- */
.form { max-width: 640px; }
.field { margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { display: block; font-weight: 650; margin-bottom: 6px; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
textarea.code { font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 160px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
input[readonly], textarea[readonly] { background: var(--surface-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500 !important; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.hp { position: absolute !important; left: -9999px !important; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.panel { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 18px 20px 4px; margin: 8px 0 20px; background: var(--surface-2); }
.panel legend { font-weight: 700; padding: 0 8px; }
.captcha-q { display: inline-block; padding: 8px 14px; margin-right: 10px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--link); font-weight: 800; }
.captcha-row { display: flex; align-items: center; }
.captcha-row input { max-width: 120px; }
.theme-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-picker label { cursor: pointer; }
.theme-picker input { position: absolute; opacity: 0; }
.theme-picker span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; color: #fff; font-weight: 700; font-size: .9rem; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 3px solid transparent; }
.theme-picker input:checked + span { border-color: var(--text); }
.theme-picker input:checked + span::before { content: "✓ "; white-space: pre; }
.theme-picker input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.table .actions .btn { margin: 2px; }
.table small { color: var(--muted); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; color: var(--muted); font-weight: 650; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--link); border-bottom-color: var(--brand); }

/* ---------- Pagination ---------- */
.pager ul { list-style: none; padding: 0; margin: 24px 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.pager a, .pager span { display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 650; text-decoration: none; }
.pager a:hover { border-color: var(--brand); color: var(--link); }
.pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .gap { border: 0; background: none; min-width: 20px; }

/* ---------- Vote page ---------- */
.vote-box { max-width: 680px; margin: 0 auto 24px; text-align: center; padding: clamp(24px, 5vw, 44px); }
.vote-target { background: var(--surface-2); border-radius: var(--radius); padding: 20px; margin: 20px 0; }
.vote-target .banner { margin: 0 auto 10px; }
.vote-btn { min-height: 64px; padding: 0 44px; font-size: 1.2rem; }
.cooldown { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 28px; border-radius: var(--radius); background: var(--brand-soft); }
.cooldown strong { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--link); }

/* ---------- Codes ---------- */
.code-block { margin-bottom: 18px; }
.code-block label { display: block; font-weight: 650; margin-bottom: 6px; }
.code-row { display: flex; gap: 8px; align-items: flex-start; }
.code-row textarea, .code-row input { font: .82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 46px; }
.code-row textarea { min-height: 70px; }
.code-preview { margin-top: 8px; display: flex; align-items: center; gap: 10px; }

/* ---------- Chart ---------- */
.chart { margin: 0; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 18px 0 26px; border-bottom: 1px solid var(--line-strong); }
.bars > div { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.bar { display: block; min-height: 3px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); }
.bar-val { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); opacity: 0; transition: opacity .15s; }
.bars > div:hover .bar-val { opacity: 1; }
.bar-day { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: .72rem; color: var(--muted); }

/* ---------- Ads ---------- */
.ad[hidden] { display: none !important; }
.ad { position: relative; margin: 0 0 24px; padding: 22px 12px 12px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ad-label { position: absolute; top: 4px; left: 0; right: 0; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ad-body img { display: inline-block; max-width: 100%; height: auto; border-radius: 6px; }
.ad-body iframe { max-width: 100%; }
.main > .ad-header { margin-top: -8px; }
.ad-mobile_sticky { display: none; }
.ad-close { position: absolute; top: 2px; right: 4px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; border-radius: 8px; }
.ad-close:hover { background: var(--surface-2); }

/* ---------- Text pages ---------- */
.prose { max-width: 75ch; }
.prose h2 { margin-top: 1.6em; }

/* ---------- Stand-alone toplist ---------- */
body.standalone { min-height: 100vh; display: flex; flex-direction: column; }
body.standalone .main { flex: 1; }
.lh-hero {
  position: relative; color: #fff; overflow: hidden;
  background:
    radial-gradient(600px 300px at 12% 110%, rgba(255, 255, 255, .14), transparent 70%),
    radial-gradient(700px 380px at 95% -10%, rgba(255, 255, 255, .22), transparent 65%),
    linear-gradient(125deg, var(--brand) 0%, var(--brand-2) 100%);
}
.lh-hero::before { content: ""; position: absolute; inset: 0; opacity: .14; background-image: radial-gradient(rgba(255, 255, 255, .9) 1px, transparent 1.4px); background-size: 22px 22px; mask-image: linear-gradient(180deg, #000, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); pointer-events: none; }
.has-image .lh-hero { background: linear-gradient(180deg, rgba(2, 6, 23, .35), rgba(2, 6, 23, .78)), var(--hero-img) center / cover no-repeat, var(--brand); }
.has-image .lh-hero::before { display: none; }
.lh-inner { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; flex-wrap: wrap; padding-top: clamp(40px, 7vw, 88px); padding-bottom: clamp(36px, 6vw, 72px); }
.lh-compact .lh-inner { padding-top: 28px; padding-bottom: 28px; align-items: center; }
.lh-text { max-width: 760px; }
.lh-logo img { display: block; height: 56px; width: auto; margin-bottom: 14px; border-radius: 12px; }
.lh-kicker { display: inline-block; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28); font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lh-compact .lh-kicker, .lh-compact .lh-sub, .lh-compact .lh-logo { display: none; }
.lh-title { margin: 0; font-size: clamp(2.1rem, 1.3rem + 3.8vw, 3.9rem); font-weight: 850; line-height: 1.04; letter-spacing: -.04em; text-wrap: balance; }
.lh-compact .lh-title { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem); }
.lh-title a { color: #fff; text-decoration: none; }
.lh-sub { margin: 14px 0 0; font-size: clamp(1.05rem, 1rem + .4vw, 1.3rem); opacity: .95; max-width: 60ch; }
.lh-stats { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.lh-stats li { padding: 8px 16px; border-radius: 12px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-size: .9rem; }
.lh-stats strong { font-size: 1.15rem; font-weight: 800; margin-right: 2px; font-variant-numeric: tabular-nums; }
.lh-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lh-compact .lh-actions .btn { min-height: 44px; padding: 0 18px; font-size: .95rem; }
.btn-glass { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .45); box-shadow: none; backdrop-filter: blur(6px); }
.btn-glass:hover { background: rgba(255, 255, 255, .24); }
.lnav { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.lnav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lnav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.lnav a, .lnav .link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 52px; padding: 0 12px; color: var(--muted); font-weight: 650; text-decoration: none; border-bottom: 3px solid transparent; border-radius: 0; }
.lnav a:hover, .lnav .link-btn:hover { color: var(--text); background: none; }
.lnav a[aria-current="page"] { color: var(--link); border-bottom-color: var(--brand); }
.list-lead { font-size: 1.1rem; color: var(--muted); max-width: 75ch; margin: 0 0 24px; }
.news { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px; }
.list-meta { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: .92rem; }
.list-meta li { display: inline-flex; align-items: center; gap: 6px; }

/* Avatars */
.avatar { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 14px; font-weight: 800; font-size: 1.25rem; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 70% 42%), hsl(calc(var(--h) + 40) 70% 34%)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.avatar-lg { width: 72px; height: 72px; border-radius: 20px; font-size: 1.9rem; }

/* Sponsored */
.sponsored { margin: 0 0 28px; padding: 18px; border-radius: 20px; background: linear-gradient(135deg, color-mix(in srgb, #f59e0b 14%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--line)); }
.sponsored-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.sponsored-head h2 { margin: 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); display: inline-flex; gap: 6px; align-items: center; }
.sponsored-head a { font-size: .9rem; font-weight: 600; }
.sponsored-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.sp-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.sp-main { flex: 1; min-width: 0; }
.sp-main h3 { margin: 0; font-size: 1rem; }
.sp-main h3 a { color: var(--text); text-decoration: none; }
.sp-main h3 a:hover { text-decoration: underline; }
.sp-main p { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.sponsored-empty { margin: 0 0 20px; font-weight: 600; }
.sponsored-empty a { display: inline-flex; gap: 6px; align-items: center; }

/* Filter */
.list-tools { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.filter { display: flex; align-items: center; gap: 8px; width: min(100%, 340px); padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--muted); }
.filter:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.filter input { border: 0 !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; min-height: 44px; }

/* Podium */
.podium { list-style: none; padding: 0; margin: 0 0 28px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: end; }
.podium-card { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.podium-card.p1 { order: 2; padding-top: 40px; padding-bottom: 30px; border-color: color-mix(in srgb, #f59e0b 55%, var(--line)); box-shadow: 0 16px 40px color-mix(in srgb, #f59e0b 22%, transparent); background: linear-gradient(180deg, color-mix(in srgb, #f59e0b 12%, var(--surface)), var(--surface) 60%); }
.podium-card.p2 { order: 1; }
.podium-card.p3 { order: 3; }
.medal { position: absolute; top: -18px; font-size: 2.1rem; line-height: 1; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18)); }
.podium-card .trend { margin-top: 8px; }
.podium-card h3 { margin: 10px 0 4px; font-size: 1.15rem; }
.podium-card h3 a { color: var(--text); text-decoration: none; }
.podium-card h3 a:hover { color: var(--link); text-decoration: underline; }
.podium-desc { margin: 4px 0 0; font-size: .9rem; color: var(--muted); }
.podium-votes { margin: 12px 0 14px; color: var(--muted); font-size: .9rem; }
.podium-votes strong { display: block; font-size: 1.9rem; color: var(--text); font-weight: 850; line-height: 1.1; font-variant-numeric: tabular-nums; }
.podium-actions, .row-actions { display: flex; align-items: center; gap: 6px; }
.icon-link { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); background: var(--surface); }
.icon-link:hover { color: var(--link); border-color: var(--brand); }

/* Rows */
.rows { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.row-card { display: grid; grid-template-columns: 56px 48px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.row-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); transform: translateY(-1px); }
.row-rank { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.row-num { font-size: 1.35rem; font-weight: 850; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-main h3 { margin: 0; font-size: 1.05rem; }
.row-main h3 a { color: var(--text); text-decoration: none; }
.row-main h3 a:hover { color: var(--link); text-decoration: underline; }
.row-main p { margin: 3px 0 0; color: var(--muted); font-size: .92rem; }
.row-main .banner-link { margin: 8px 0 0; }
.votebar { height: 6px; margin-top: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.votebar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.row-side { display: flex; align-items: center; gap: 16px; }
.row-votes { margin: 0; text-align: right; line-height: 1.15; }
.row-votes strong { display: block; font-size: 1.35rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.row-votes span, .row-votes small { color: var(--muted); font-size: .8rem; }
.row-votes small { display: block; }
.row-ad { list-style: none; }
.is-highlight { border: 2px solid transparent !important; background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(135deg, var(--brand), #f59e0b) border-box !important; }
.rk-item[hidden] { display: none !important; }
.rk-item:target, .rk-item.is-target { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 30%, transparent); }
.list-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 28px; margin: 12px 0 0; color: var(--muted); font-size: .92rem; }
.list-foot p { margin: 0; display: inline-flex; gap: 6px; align-items: center; }

/* Interstitial */
.interstitial { max-width: 760px; margin: 0 auto 24px; text-align: center; padding: clamp(24px, 5vw, 48px); }
.interstitial .ad { margin: 24px 0; }
.int-count { font-size: 1.05rem; color: var(--muted); }
.int-count strong { color: var(--text); font-variant-numeric: tabular-nums; }

.lfoot { padding: 28px 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; text-align: center; }
.lfoot-text { margin: 0 0 8px; font-weight: 650; color: var(--text); }
.lfoot-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.lfoot-links a { color: var(--muted); }

/* Pricing & checkout */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 0 0 24px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.plan.best { border: 2px solid var(--brand); }
.plan .pill { align-self: flex-start; }
.plan h3 { margin: 0; }
.plan .price { font-size: 2rem; font-weight: 850; letter-spacing: -.03em; margin: 0; }
.plan .price small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.plan ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.plan form { margin-top: auto; }
.compare td:not(:first-child), .compare th:not(:first-child) { text-align: center; }
.yes { color: var(--ok); font-weight: 800; }
.no { color: var(--muted); }
.paypal-btn { background: #ffc439; color: #111827; box-shadow: none; }
.paypal-btn:hover { background: #f2b629; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.radio-cards label { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; }
.radio-cards label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-cards input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.radio-cards strong { display: block; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 44px 0 0; font-size: .95rem; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-brand { font-weight: 800; font-size: 1.2rem; color: var(--text); margin-bottom: 6px; }
.footer-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text); margin-bottom: 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--link); }
.social { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 18px; padding-bottom: 24px; font-size: .85rem; }
.footer-bottom p { margin: 0; }

/* ---------- Admin ---------- */
.admin-nav ul { list-style: none; padding: 0; margin: 0; }
.admin-nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--text); font-weight: 600; text-decoration: none; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--link); }
.admin-nav .pill { margin-left: auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.toolbar .field { margin: 0; flex: 1; min-width: 180px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.slot-help { font-size: .85rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .layout, .layout-left { grid-template-columns: minmax(0, 1fr); }
  .nav-search input { width: 140px; }
}
@media (max-width: 860px) {
  .nav-toggle { display: grid; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 20px 20px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); }
  .site-nav.open { display: flex; }
  .site-nav ul { flex-direction: column; align-items: stretch; }
  .nav-user { margin-left: 0; border-top: 1px solid var(--line); padding-top: 8px !important; }
  .nav-search input { width: 100%; }
  .header-inner { position: relative; }
  .steps { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .main { padding-top: 20px; }
  .card { padding: 18px; }
  .grid2 { grid-template-columns: 1fr; }
  .rank-card { grid-template-columns: 56px minmax(0, 1fr); padding: 14px; gap: 12px; }
  .rank-badge { width: 44px; height: 44px; font-size: 1.1rem; border-radius: 13px; }
  .rank-stats { grid-column: 2; }
  .rank-stats div { min-width: 0; padding: 4px 10px; display: flex; gap: 6px; align-items: baseline; }
  .rank-stats dd { font-size: 1rem; }
  .code-row { flex-direction: column; align-items: stretch; }
  .ad-dev-desktop { display: none !important; }
  .ad-mobile_sticky { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0; border-radius: 0; border-width: 1px 0 0; box-shadow: 0 -6px 18px rgba(0, 0, 0, .12); }
  body:has(.ad-mobile_sticky:not([hidden])) { padding-bottom: 110px; }
  .lnav a, .lnav .link-btn { padding: 0 8px; font-size: .9rem; }
  .podium { grid-template-columns: 1fr; }
  .podium-card.p1, .podium-card.p2, .podium-card.p3 { order: 0; }
  .podium-card { flex-direction: row; flex-wrap: wrap; text-align: left; align-items: center; gap: 4px 14px; padding: 22px 16px 16px; }
  .podium-card .avatar-lg { width: 56px; height: 56px; font-size: 1.5rem; }
  .podium-card h3 { margin: 0; flex: 1; min-width: 50%; }
  .podium-desc, .podium-votes { flex-basis: 100%; margin: 0; }
  .podium-votes strong { display: inline; font-size: 1.2rem; }
  .medal { top: -14px; left: 14px; font-size: 1.7rem; }
  .row-card { grid-template-columns: 40px 40px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .row-card .avatar { width: 40px; height: 40px; font-size: 1rem; border-radius: 12px; }
  .row-side { grid-column: 1 / -1; justify-content: space-between; }
  .row-votes { text-align: left; display: flex; gap: 6px; align-items: baseline; }
  .row-votes strong { display: inline; font-size: 1.1rem; }
  .row-votes small { display: inline; }
  .list-tools { justify-content: stretch; }
  .filter { width: 100%; }
  .lh-actions { width: 100%; }
  .lh-actions .btn { flex: 1; }
  .table-wrap .table { min-width: 620px; }
}
@media (min-width: 641px) {
  .ad-dev-mobile { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .pill, .rank-badge { border: 1px solid CanvasText; }
}
@media print {
  .site-header, .site-footer, .lnav, .ad, .skip-link, .notice { display: none !important; }
  body { background: #fff; color: #000; }
}
