/* ==========================================================================
   ImmortalPicks — dark, glassy, gold-accented UI
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #07080c;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef0f5;
  --muted: #8a91a3;
  --faint: #5d6476;
  --gold: #e7c27d;
  --gold-2: #c8963e;
  --hot: #34d399;
  --good: #a3e635;
  --meh: #fbbf24;
  --err: #f87171;
  --font: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --gutter: clamp(16px, 3.2vw, 44px);
  --radius: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Per-role accent colours */
.pos5 { --accent: #2dd4bf; }
.pos4 { --accent: #60a5fa; }
.pos2 { --accent: #a78bfa; }
.pos1 { --accent: #f5b84b; }
.pos3 { --accent: #fb7185; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--gold); }
button, select, input { font: inherit; color: inherit; }

/* ---------- ambient background ---------- */
.glow { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.glow span {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.22;
  animation: drift 26s ease-in-out infinite alternate;
}
.glow span:nth-child(1) { width: 46vw; height: 46vw; left: -12vw; top: -18vw; background: #c8963e; }
.glow span:nth-child(2) { width: 38vw; height: 38vw; right: -10vw; top: 6vh; background: #7c3aed; opacity: 0.14; animation-duration: 32s; }
.glow span:nth-child(3) { width: 40vw; height: 40vw; left: 30vw; bottom: -26vw; background: #0ea5e9; opacity: 0.1; animation-duration: 38s; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vw, 3vh, 0) scale(1.12); }
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  background: linear-gradient(180deg, rgba(7, 8, 12, 0.85), rgba(7, 8, 12, 0.55));
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 18px; letter-spacing: 0.01em; }
.brand b {
  font-weight: 700;
  background: linear-gradient(90deg, #f6dfa4, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo { width: 28px; height: 28px; transition: transform 0.6s var(--ease); }
.brand:hover .logo { transform: rotate(60deg); }

.live {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px; white-space: nowrap;
}
.live i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--hot); }
.live i::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--hot);
  animation: ping 2s var(--ease) infinite;
}
.live.stale i, .live.stale i::after { background: var(--meh); }
@keyframes ping { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(3); opacity: 0; } }

/* ---------- intro ---------- */
.intro { padding: clamp(22px, 4vw, 40px) var(--gutter) 0; animation: fade-up 0.7s var(--ease) both; }
h1 {
  margin: 0; max-width: 22ch;
  font-size: clamp(26px, 3.6vw, 42px); font-weight: 300; line-height: 1.1; letter-spacing: -0.02em;
}
h1 em {
  font-style: normal; font-weight: 500;
  background: linear-gradient(90deg, #f6dfa4, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { margin: 12px 0 0; max-width: 60ch; color: var(--muted); font-size: clamp(14px, 1.3vw, 16px); line-height: 1.5; animation: fade-up 0.7s 0.05s var(--ease) both; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; min-height: 28px; }
.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px;
  animation: fade-up 0.5s var(--ease) both;
}
.chip:nth-child(2) { animation-delay: 40ms; } .chip:nth-child(3) { animation-delay: 80ms; }
.chip:nth-child(4) { animation-delay: 120ms; } .chip:nth-child(5) { animation-delay: 160ms; }
.chip.gold { color: #1a1408; background: linear-gradient(90deg, #f6dfa4, var(--gold-2)); border-color: transparent; font-weight: 700; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px;
  margin: 22px var(--gutter) 0; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fade-up 0.7s 0.08s var(--ease) both;
}
.ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.ctl > span { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.ctl output { color: var(--gold); letter-spacing: 0; font-variant-numeric: tabular-nums; }

.ctl select {
  appearance: none; -webkit-appearance: none;
  height: 40px; min-width: 150px; padding: 0 38px 0 14px;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23e7c27d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  color: var(--text); font-size: 14px; letter-spacing: 0; text-transform: none; cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.ctl select:hover { border-color: rgba(231, 194, 125, 0.5); background-color: rgba(255, 255, 255, 0.07); }
.ctl select option, .ctl select optgroup { background: #12141b; color: var(--text); }
.ctl select:focus-visible, .tabs button:focus-visible, .slider input:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(231, 194, 125, 0.35);
}

/* custom range slider */
.slider input {
  --pct: 40%;
  appearance: none; -webkit-appearance: none; width: 170px; height: 40px; margin: 0; background: transparent; cursor: pointer;
}
.slider input::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold) var(--pct), rgba(255, 255, 255, 0.12) var(--pct));
}
.slider input::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); }
.slider input::-moz-range-progress { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.slider input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: #fff; border: 4px solid var(--gold); box-shadow: 0 2px 10px rgba(231, 194, 125, 0.5);
  transition: transform 0.2s var(--ease);
}
.slider input::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 4px solid var(--gold);
  box-shadow: 0 2px 10px rgba(231, 194, 125, 0.5);
}
.slider input:active::-webkit-slider-thumb { transform: scale(1.2); }

/* ---------- role tabs (narrow screens) ---------- */
.tabs {
  position: sticky; top: 59px; z-index: 9;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin-top: 14px; padding: 10px var(--gutter);
  background: rgba(7, 8, 12, 0.7);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto; height: 34px; padding: 0 15px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 13.5px;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.2s var(--ease);
}
.tabs button:active { transform: scale(0.96); }
.tabs button.active {
  color: #1a1408; font-weight: 700; border-color: transparent;
  background: linear-gradient(90deg, #f6dfa4, var(--gold-2));
}

/* ---------- main ---------- */
main { padding: 18px var(--gutter) 8px; }

.status {
  margin-bottom: 16px; padding: 13px 16px; border-radius: 14px; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  animation: fade-up 0.4s var(--ease) both;
}
.status.info { border-color: rgba(231, 194, 125, 0.4); color: #f6e7c4; background: rgba(231, 194, 125, 0.07); }
.status.warn { border-color: rgba(251, 191, 36, 0.35); color: #fde7b0; background: rgba(251, 191, 36, 0.06); }
.status.error { border-color: rgba(248, 113, 113, 0.4); color: var(--text); background: rgba(248, 113, 113, 0.07); }
.status code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }

.roles { display: grid; gap: 14px; grid-template-columns: 1fr; transition: opacity 0.3s; }
body.busy .roles:not(:has(.skeleton)) { opacity: 0.45; }

/* ---------- role card ---------- */
.role {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background:
    radial-gradient(120% 60% at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.8);
  transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.role::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.8;
}
.role[hidden] { display: none; }
@media (hover: hover) {
  .role:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 26px 50px -24px color-mix(in srgb, var(--accent) 35%, transparent);
  }
}

.role > header { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 16px 16px 12px; }
.pos {
  grid-row: 1 / 3; align-self: center;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.role h2 { margin: 0; font-size: 17px; font-weight: 500; letter-spacing: -0.005em; line-height: 1.25; }
.role .games { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.empty { margin: 0; padding: 18px 16px 22px; color: var(--muted); font-size: 13px; }

/* ---------- featured #1 ---------- */
.feature {
  position: relative; height: 150px; margin: 0 10px; overflow: hidden; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, #0c0e14), #0c0e14 70%);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.feature .art {
  position: absolute; right: -14%; bottom: -6px; height: 112%; width: auto; max-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
  transition: transform 0.6s var(--ease);
}
.feature .art.fallback { height: 100%; bottom: 0; right: -20%; opacity: 0.8; }
.feature::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8, 9, 13, 0.92) 0%, rgba(8, 9, 13, 0.55) 55%, transparent 100%); }
@media (hover: hover) { .role:hover .feature .art { transform: scale(1.06) translateX(-4px); } }

.f-body { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 12px 14px; }
.badge {
  align-self: flex-start; margin-bottom: auto; padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #1a1408; background: linear-gradient(90deg, #f6dfa4, var(--gold-2));
}
.feature .f-name { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.f-wr { margin-top: 2px; font-size: 30px; font-weight: 300; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.f-wr small { font-size: 16px; margin-left: 1px; opacity: 0.8; }
.feature.hot .f-wr { color: var(--hot); } .feature.good .f-wr { color: var(--good); } .feature.meh .f-wr { color: var(--meh); }
.feature .bar { width: 62%; margin-top: 8px; }
.f-stats { display: flex; flex-wrap: nowrap; gap: 6px; margin-top: 6px; color: rgba(238, 240, 245, 0.7); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.f-stats span + span::before { content: "·"; margin-right: 6px; opacity: 0.5; }

/* ---------- rows #2–#5 ---------- */
.role ol { flex: 1; list-style: none; margin: 0; padding: 8px 10px 12px; }
.role li {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 12px;
  transition: background 0.25s, transform 0.25s var(--ease);
}
@media (hover: hover) { .role li:hover { background: var(--surface-2); transform: translateX(2px); } }
.role li + li::before { content: ""; position: absolute; left: 8px; right: 8px; top: 0; height: 1px; background: var(--border); }
.role li:hover::before, .role li:hover + li::before { opacity: 0; }

.rank { width: 14px; flex-shrink: 0; text-align: center; color: var(--faint); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.thumb { display: block; flex-shrink: 0; width: 56px; height: 32px; object-fit: cover; border-radius: 8px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--border); }

.info { flex: 1; min-width: 0; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 20px; }
/* Names stay on one line; app.js shrinks the font of long names until they fit. */
.name { flex: 1; min-width: 0; font-weight: 500; font-size: 14.5px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feature .f-name { flex: none; line-height: 1.2; }
.wr { font-weight: 700; font-size: 14.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
li.hot .wr { color: var(--hot); } li.good .wr { color: var(--good); } li.meh .wr { color: var(--meh); }

.bar { position: relative; height: 4px; margin-top: 6px; overflow: hidden; border-radius: 4px; background: rgba(255, 255, 255, 0.07); }
.bar span { position: absolute; top: 0; height: 100%; border-radius: 4px; }
.bar .fill { left: 0; }
.bar .ci { opacity: 0.3; }
.bar .half { width: 1px; background: rgba(255, 255, 255, 0.45); }
.hot .bar .fill, .hot .bar .ci { background: linear-gradient(90deg, #059669, var(--hot)); }
.good .bar .fill, .good .bar .ci { background: linear-gradient(90deg, #65a30d, var(--good)); }
.meh .bar .fill, .meh .bar .ci { background: linear-gradient(90deg, #d97706, var(--meh)); }

.stats { display: flex; justify-content: space-between; gap: 6px; margin-top: 5px; color: var(--muted); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats .sg { display: flex; gap: 6px; min-width: 0; overflow: hidden; }
.stats .sg span + span::before { content: "·"; margin-right: 6px; opacity: 0.5; }
.stats i { font-style: normal; }
.pm { color: var(--faint); }

footer { padding: 26px var(--gutter) max(30px, env(safe-area-inset-bottom)); color: var(--faint); font-size: 11.5px; text-align: center; }

/* ---------- buy me a coffee ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bmc-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px;
  border-radius: 999px; background: #ffdd00; color: #111; text-decoration: none;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 6px 18px -8px rgba(255, 221, 0, 0.6);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.bmc-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -8px rgba(255, 221, 0, 0.75); }
.bmc-btn:active { transform: scale(0.97); }
.bmc-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 221, 0, 0.45); }
.bmc-btn svg { flex-shrink: 0; }
.bmc-btn.lg { height: 44px; padding: 0 20px; font-size: 15px; margin-top: 4px; }

.support {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  max-width: 820px; margin: 28px auto 0; padding: 22px 26px;
  border-radius: var(--radius); border: 1px solid rgba(231, 194, 125, 0.22);
  background:
    radial-gradient(80% 140% at 100% 50%, rgba(255, 221, 0, 0.08), transparent 60%),
    radial-gradient(60% 120% at 0% 0%, rgba(231, 194, 125, 0.1), transparent 60%),
    var(--surface);
  animation: fade-up 0.7s 0.3s var(--ease) both;
}
.support h2 { margin: 0 0 6px; font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.support p { margin: 0 0 14px; max-width: 52ch; color: var(--muted); font-size: 14px; }
.support-qr { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.support-qr img {
  display: block; width: 128px; height: 128px; padding: 8px; border-radius: 14px; background: #fff;
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.8);
  transition: transform 0.35s var(--ease);
}
.support-qr img:hover { transform: scale(1.04) rotate(-1deg); }
.support-qr figcaption { color: var(--faint); font-size: 11.5px; }

@media (max-width: 639px) {
  /* Phones: icon-only header button; no QR (you can't scan your own screen). */
  .bmc-btn:not(.lg) { width: 32px; padding: 0; justify-content: center; }
  .bmc-btn:not(.lg) span { display: none; }
  .support { padding: 18px; }
  .support-qr { display: none; }
  .bmc-btn.lg { width: 100%; justify-content: center; }
}

/* ---------- clickable cards ---------- */
.role [data-hero] { cursor: pointer; }
.role [data-hero]:focus-visible { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent); }
.role > header { cursor: pointer; }
.more {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 0 10px 10px; height: 36px; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px; font-weight: 500;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.more svg { transition: transform 0.25s var(--ease); }
.more:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.more:hover svg { transform: translateX(3px); }
.more:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(231, 194, 125, 0.35); }

/* ---------- details sheet (dialog) ---------- */
.sheet {
  /* The dialog itself fills the viewport (no transform), so the fixed tooltip
     positions against the viewport; only the inner panel animates. */
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 24px; border: 0; background: transparent; color: var(--text);
  display: none; align-items: center; justify-content: center;
}
.sheet[open] { display: flex; }
.sheet::backdrop { background: rgba(3, 4, 7, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet[open]::backdrop { animation: fade 0.25s ease both; }
body.sheet-open { overflow: hidden; }

.sheet-panel {
  position: relative; display: flex; flex-direction: column;
  width: min(760px, 100%); max-height: min(88vh, 900px); overflow: hidden;
  background: linear-gradient(180deg, #14161e, #0e1016);
  border: 1px solid var(--border-strong); border-radius: 20px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
  animation: pop 0.35s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sheet-crumb { flex: 1; color: var(--muted); font-size: 12.5px; letter-spacing: 0.02em; }
.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn[hidden] { display: none; }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(231, 194, 125, 0.35); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 18px 20px 24px; }

/* role ranking */
.rl-head { display: flex; align-items: center; gap: 12px; }
.rl-head h2, .hd-text h2 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.rl-head p, .hd-text p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; gap: 4px; margin-top: 16px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.seg button {
  height: 32px; padding: 0 14px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.seg button[aria-pressed="true"] { background: linear-gradient(90deg, #f6dfa4, var(--gold-2)); color: #1a1408; font-weight: 700; }
.seg button:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(231, 194, 125, 0.5); }
.rl-note { margin: 10px 0 4px; color: var(--faint); font-size: 12px; }
.rl-cols, .rl-row {
  display: grid; grid-template-columns: 22px 48px minmax(0, 1fr) 92px 70px 56px; align-items: center; gap: 10px;
}
.rl-cols { padding: 8px 10px 6px; color: var(--faint); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.rl-cols span:first-child { grid-column: 1 / 4; }
.rl-cols span:not(:first-child) { text-align: right; }
.rl-cols .c-games { font-size: inherit; color: inherit; }
.rl-list { list-style: none; margin: 0; padding: 0; }
.rl-list li { animation: slide-in 0.35s var(--ease) both; }
.rl-list li { animation-delay: calc(min(var(--n, 0), 20) * 20ms); }
.rl-row {
  width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; cursor: pointer; text-align: left;
  background: transparent; color: var(--text); font-size: 14px;
  transition: background 0.2s;
}
.rl-row:hover { background: var(--surface-2); }
.rl-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(231, 194, 125, 0.5); }
.rl-rank { color: var(--faint); font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.rl-row img { width: 48px; height: 27px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.rl-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-wr { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; font-variant-numeric: tabular-nums; }
.rl-wr small { color: var(--faint); font-size: 11px; }
.rl-row.hot .rl-wr b { color: var(--hot); } .rl-row.good .rl-wr b { color: var(--good); } .rl-row.meh .rl-wr b { color: var(--meh); }
.c-games, .rl-pick { text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* hero detail */
.hd-banner {
  position: relative; overflow: hidden; height: 150px; border-radius: 16px; margin-bottom: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, #0c0e14), #0c0e14 70%);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.hd-banner .art {
  position: absolute; right: -4%; bottom: -8px; height: 118%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 40%); mask-image: linear-gradient(90deg, transparent 0%, #000 40%);
  animation: art-in 0.7s var(--ease) both;
}
.hd-banner .art.fallback { height: 100%; bottom: 0; }
.hd-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8, 9, 13, 0.9), rgba(8, 9, 13, 0.4) 60%, transparent); }
.hd-text { position: absolute; z-index: 1; left: 18px; bottom: 16px; right: 40%; }
.hd-text .pos { width: auto; height: 24px; padding: 0 8px; margin-bottom: 8px; font-size: 10.5px; display: inline-grid; }
.hd-text h2 { font-size: 26px; font-weight: 700; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
}
.t-label { color: var(--muted); font-size: 12px; }
.t-value { font-size: 24px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
.t-sub { color: var(--faint); font-size: 11.5px; line-height: 1.35; }
.hero-tile.hot .t-value { color: var(--hot); } .hero-tile.good .t-value { color: var(--good); } .hero-tile.meh .t-value { color: var(--meh); }

.hd-sec { margin-top: 22px; }
.hd-sec h3 { margin: 0; font-size: 15px; font-weight: 500; }
.hd-sec .sub { margin: 2px 0 10px; color: var(--faint); font-size: 12px; }
.chart { position: relative; min-height: 40px; }
.chart-loading {
  height: 190px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.07) 50%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
.chart-loading.short { height: 120px; }

/* chart marks — colours validated for the dark surface (dataviz validator) */
.viz { display: block; width: 100%; height: auto; overflow: visible; }
.viz .grid { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.viz .axis-base { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; }
.viz .tick, .viz .xlab { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .xlab.cur { fill: var(--text); font-weight: 700; }
.viz .val { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .val.cur { fill: var(--text); font-weight: 700; }
.viz .up { fill: #0f9f6e; }
.viz .down { fill: #d97706; }
.viz .bar-g { transition: opacity 0.2s; }
.viz .bar-g.low { opacity: 0.4; }
.viz .bar-g.hover path { filter: brightness(1.25); }
.viz .bar-g.cur path { stroke: var(--text); stroke-width: 1.5; paint-order: stroke; }
.viz .hit { fill: transparent; cursor: crosshair; outline: none; }
.viz .hit:focus-visible { stroke: rgba(231, 194, 125, 0.6); stroke-width: 1; }
.viz .line { fill: none; stroke: #b8862f; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .dot { fill: #b8862f; stroke: #12141b; stroke-width: 2; }
.viz .dot.partial { fill: #12141b; stroke: #b8862f; }
.viz .dot.focus { fill: var(--text); stroke: #12141b; }
.viz .cross { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; }
svg.viz:focus-visible { outline: 2px solid rgba(231, 194, 125, 0.5); outline-offset: 4px; border-radius: 6px; }

.tbl { margin-top: 6px; color: var(--muted); font-size: 12px; }
.tbl summary { cursor: pointer; color: var(--faint); width: max-content; }
.tbl summary:hover { color: var(--muted); }
.tbl table { width: 100%; margin-top: 8px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--border); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--faint); font-weight: 500; }

/* roles played */
.rp { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rp li { display: grid; grid-template-columns: 170px minmax(0, 1fr) 44px 86px; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; }
.rp li.cur { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); }
.rp-role { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp li.cur .rp-role { color: var(--text); font-weight: 500; }
.rp-meter { height: 8px; border-radius: 4px; background: rgba(184, 134, 47, 0.18); overflow: hidden; }
.rp-meter span { display: block; height: 100%; border-radius: 4px; background: #b8862f; transform-origin: left; animation: grow 0.8s var(--ease) both; }
.rp-share, .rp-wr { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.rp-wr small { color: var(--faint); }
.rp-note { margin: 8px 0 0; color: var(--faint); font-size: 12px; }

/* tooltip */
.tip {
  position: fixed; z-index: 10; pointer-events: none; min-width: 120px;
  padding: 8px 10px; border-radius: 10px;
  background: #1b1e28; border: 1px solid var(--border-strong); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8);
  font-size: 12px;
}
.tip div { display: flex; align-items: baseline; gap: 8px; }
.tip b { color: var(--text); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tip span { color: var(--muted); }

@media (max-width: 639px) {
  .sheet { padding: 0; align-items: flex-end; }
  .sheet-panel { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; animation-name: sheet-up; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sheet-body { padding: 14px 14px max(22px, env(safe-area-inset-bottom)); }
  .rl-cols, .rl-row { grid-template-columns: 20px 40px minmax(0, 1fr) 84px 48px; gap: 8px; }
  .rl-row img { width: 40px; height: 22px; }
  .c-games { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-banner { height: 130px; }
  .hd-text { right: 30%; }
  .rp li { grid-template-columns: minmax(0, 1fr) 70px 38px 64px; gap: 8px; }
  .rp-role { font-size: 12px; }
}

/* ---------- animations ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes art-in { from { opacity: 0; transform: translateX(24px) scale(1.04); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }

.roles.animate .role { animation: rise 0.7s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
.roles.animate .feature .art { animation: art-in 0.9s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 120ms); }
.roles.animate .role li { animation: slide-in 0.5s var(--ease) both; animation-delay: calc(var(--i) * 70ms + var(--r) * 55ms + 120ms); }
.roles.animate .bar .fill, .roles.animate .bar .ci {
  transform-origin: left center; animation: grow 1s var(--ease) both;
  animation-delay: calc(var(--i) * 70ms + var(--r, 0) * 55ms + 220ms);
}

/* skeleton loading */
.skeleton .sk {
  display: block; border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
.skeleton .pos.sk { border: 0; }
.skeleton .line-lg { height: 14px; width: 60%; align-self: center; }
.skeleton .feature.sk { border: 0; }
.skeleton li { gap: 12px; }
.skeleton .thumb.sk { box-shadow: none; }
.skeleton li .line { flex: 1; height: 12px; }

/* ---------- phones ---------- */
@media (max-width: 639px) {
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; padding: 12px; }
  .ctl select { width: 100%; min-width: 0; padding: 0 28px 0 11px; font-size: 13.5px; background-position: right 10px center; }
  .slider input { width: 100%; }
  .live { font-size: 11.5px; padding: 0 10px; }
  .brand { font-size: 16px; }
}

/* ---------- tablets: 2 columns ---------- */
@media (min-width: 640px) {
  .roles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roles[data-single="true"] { grid-template-columns: minmax(0, 640px); }
}
@media (min-width: 640px) and (max-width: 959px) {
  /* 5 cards in 2 columns: the last card spans the full row so no empty slot is left. */
  .roles[data-single="false"] .role:last-child { grid-column: 1 / -1; }
}

/* ---------- small laptops: 3 on top, 2 wider below ---------- */
@media (min-width: 960px) {
  .tabs { display: none; }
  .roles { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 6px; }
  .roles .role { grid-column: span 2; }
  .roles .role:nth-child(n + 4) { grid-column: span 3; }
}

/* ---------- desktops: all 5 roles side by side ---------- */
@media (min-width: 1200px) {
  .roles { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
  .roles .role, .roles .role:nth-child(n + 4) { grid-column: auto; }
  .role > header { padding: 14px 12px 10px; }
  .pos { width: 40px; height: 40px; }
  .feature { margin: 0 8px; }
  .role ol { padding: 6px 6px 10px; }
  .role li { gap: 8px; padding: 9px 6px; }
  .thumb { width: 46px; height: 26px; }
  .name { font-size: 13.5px; }
  .wr { font-size: 13.5px; }
}
@media (min-width: 1200px) and (max-width: 1499px) {
  .stats i { display: none; }
}
@media (min-width: 1200px) and (max-width: 1379px) {
  /* Narrowest 5-column widths: drop row thumbnails so long names stay readable. */
  .role li .thumb { display: none; }
}
@media (min-width: 1500px) {
  .thumb { width: 56px; height: 32px; }
  .name, .wr { font-size: 14.5px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
