/* Haxball Radar v2: shared design tokens and components for the /v2/ pages. */
:root {
  --bg: #05070a;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #eef1f6;
  --text-2: #a9b4c6;
  --text-3: #8d99ad;
  --accent: #d946ef;
  --accent-ink: #12021a;
  --accent-soft: #f0b8f8;
  --gold: #f2c14e;
  --gold-hi: #fff2c4;
  --gold-lo: #b8891e;
  --live: #34d399;
  --live-soft: #8ff0c8;
  --diamond: #b9f2ff;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: Inter, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@view-transition { navigation: auto; }

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent-soft); }
a:hover { color: #fff; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; border-radius: 6px; }

/* ---------- backdrop ---------- */
.backdrop { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.backdrop .glow { position: absolute; border-radius: 50%; }
.backdrop .g1 { left: -12%; top: -260px; width: 900px; height: 900px; background: radial-gradient(circle, rgba(217, 70, 239, .16), transparent 65%); animation: drift 16s ease-in-out infinite; }
.backdrop .g2 { right: -18%; top: 280px; width: 1000px; height: 1000px; background: radial-gradient(circle, rgba(52, 211, 153, .10), transparent 65%); animation: drift2 20s ease-in-out infinite; }
.backdrop .grid { position: absolute; inset: 0 0 auto 0; height: 1000px; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 64px 64px; opacity: .45; mask-image: linear-gradient(#000, transparent); -webkit-mask-image: linear-gradient(#000, transparent); }
.page { position: relative; z-index: 1; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 40; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); background: rgba(5, 7, 10, .65); border-bottom: 1px solid var(--line); }
.top nav { max-width: 1320px; margin: 0 auto; padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 0 12px rgba(217, 70, 239, .35)); }
.hubs { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.hubs a { color: #b7c0cf; text-decoration: none; padding: 10px 15px; border-radius: 10px; font-weight: 600; font-size: 14px; transition: color .2s, background-color .2s; }
.hubs a:hover { color: #fff; background: var(--surface-2); }
.hubs a[aria-current="page"] { color: #fff; background: rgba(217, 70, 239, .16); box-shadow: inset 0 0 0 1px rgba(217, 70, 239, .35); }
.top .spacer { flex: 1 1 auto; }
.search { position: relative; flex: 0 1 300px; min-width: 200px; }
.search input { width: 100%; height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 500 14px var(--body); }
.search ul { position: absolute; left: 0; right: 0; top: 50px; margin: 0; padding: 6px; list-style: none; border-radius: 14px; background: #0c0f16; border: 1px solid var(--line-2); box-shadow: 0 30px 60px rgba(0, 0, 0, .6); max-height: 360px; overflow: auto; }
.search li a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
.search li a:hover, .search li a:focus { background: var(--surface-2); }
.search li span { font-family: var(--mono); color: var(--text-3); font-size: 12px; }
.beta { font: 700 11px var(--mono); letter-spacing: 1.5px; color: var(--live-soft); padding: 5px 9px; border-radius: 999px; border: 1px solid rgba(52, 211, 153, .3); background: rgba(52, 211, 153, .08); }

/* ---------- layout ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.section { padding: 88px 0 0; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font: 700 12px var(--mono); letter-spacing: 3px; text-transform: uppercase; }
.eyebrow.gold { color: var(--gold); }
.eyebrow.live { color: var(--live-soft); }
.h1 { margin: 0; font: 900 clamp(56px, 9vw, 112px)/.86 var(--display); letter-spacing: -1px; text-transform: uppercase; }
.h2 { margin: 0; font: 900 clamp(40px, 5vw, 64px)/.9 var(--display); text-transform: uppercase; }
.h3 { margin: 0; font: 800 30px/1 var(--display); text-transform: uppercase; }
.lede { color: var(--text-2); font-size: 19px; line-height: 1.6; max-width: 560px; }
.row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.panel { padding: 30px; border-radius: 22px; background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01)); border: 1px solid var(--line); }
.muted { color: var(--text-2); }
.mono { font-family: var(--mono); }

/* ---------- buttons ---------- */
.btn { height: 52px; display: inline-flex; align-items: center; gap: 10px; padding: 0 24px; border-radius: 14px; font: 800 15px var(--body); text-decoration: none; border: 0; cursor: pointer; transition: transform .2s, box-shadow .3s, background-color .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); box-shadow: 0 12px 30px rgba(217, 70, 239, .35); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); font-weight: 600; }
.btn-ghost:hover { color: #fff; }
.btn-gold { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 45%, var(--gold-lo)); color: #1a1205; }
.btn-gold:hover { color: #1a1205; box-shadow: 0 12px 30px rgba(242, 193, 78, .3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); width: max-content; max-width: 100%; }
.chips button { height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: transparent; color: #c3cbd8; font: 700 14px var(--body); cursor: pointer; transition: background-color .2s, color .2s; }
.chips button[aria-pressed="true"] { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 45%, var(--gold-lo)); color: #1a1205; }

/* ---------- player card ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 24px; }
.card { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 18px; color: #fff; text-decoration: none; transform: perspective(900px); transition: transform .45s var(--ease), box-shadow .45s; box-shadow: 0 0 0 1px var(--line); background: #111723; animation: rise .8s var(--ease) both; }
.card:hover { color: #fff; transform: perspective(900px) translateY(-10px) rotateX(6deg) rotateY(-4deg); box-shadow: 0 30px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(242, 193, 78, .6); }
.card .face { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.card img.photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, transparent 32%, rgba(0, 0, 0, .94) 100%); }
.card .initial { position: absolute; inset: 0 0 30% 0; display: flex; align-items: center; justify-content: center; font: 900 110px var(--display); color: rgba(255, 255, 255, .12); background: radial-gradient(circle at 50% 40%, #1d2433, #0b0e14 70%); }
.card .ovr { position: absolute; left: 14px; top: 8px; font: 900 44px/1 var(--display); }
.card .pos { position: absolute; left: 15px; top: 52px; font: 700 11px var(--mono); color: var(--gold); }
.card .tag { position: absolute; right: 12px; top: 12px; padding: 3px 8px; border-radius: 6px; font: 900 11px var(--body); letter-spacing: 1px; }
.card .name { position: absolute; left: 8px; right: 8px; bottom: 36px; text-align: center; font: 900 23px/1.1 var(--display); letter-spacing: 1.5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { position: absolute; left: 0; right: 0; bottom: 13px; text-align: center; font: 500 11px var(--mono); color: var(--text-2); }
.card .sheen { position: absolute; top: -10%; bottom: -10%; width: 45%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent); transform: translateX(-150%) skewX(-18deg); }
.card:hover .sheen { animation: shimmer 1.1s ease-out; }
.card.icon { padding: 3px; background: transparent; box-shadow: 0 24px 50px rgba(0, 0, 0, .55); }
.card.icon .ring { position: absolute; inset: 0; border-radius: inherit; background: conic-gradient(from var(--ang), var(--gold), var(--gold-hi), var(--gold-lo), var(--gold), #7a5a12, var(--gold)); animation: spinb 5s linear infinite; }
.card.icon .face { inset: 3px; border-radius: 15px; background: #120f08; }
.card.icon .foil { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 20%, rgba(255, 214, 120, .26) 32%, rgba(173, 120, 255, .2) 42%, rgba(120, 230, 255, .2) 52%, transparent 64%); background-size: 200% 200%; mix-blend-mode: screen; animation: foil 6s linear infinite; }
.card.icon .tag { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 45%, var(--gold-lo)); color: #1a1205; }
.card .seasons { position: absolute; left: 12px; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); text-align: center; font: 500 11px var(--mono); color: #e8d7a8; }
.card.has-seasons .name { bottom: 44px; }
.card.has-seasons .rule { position: absolute; left: 16px; right: 16px; bottom: 33px; height: 1px; background: rgba(242, 193, 78, .4); }
.tier-tots .tag { background: #c026d3; color: #fff; }
.tier-diamond .tag { background: var(--diamond); color: #04212b; }
.tier-gold .tag { background: #f0c040; color: #1a1205; }
.tier-silver .tag { background: #d9dee6; color: #1b1f26; }
.tier-bronze .tag { background: #c08a57; color: #1b1007; }

/* ---------- ticker ---------- */
.ticker { border-block: 1px solid var(--line); background: rgba(255, 255, 255, .015); overflow: hidden; }
.ticker .track { display: flex; width: max-content; padding: 16px 0; animation: marquee 45s linear infinite; }
.ticker:hover .track { animation-play-state: paused; }
.ticker a { display: inline-flex; align-items: baseline; gap: 10px; padding: 0 26px; border-right: 1px solid var(--line); white-space: nowrap; color: var(--text); text-decoration: none; }
.ticker b { font: 800 22px var(--display); }
.ticker span { font: 700 19px var(--display); letter-spacing: 1px; text-transform: uppercase; }
.ticker small { font: 500 12px var(--mono); color: var(--text-3); }
.up { color: var(--live) !important; }
.down { color: #fb7185 !important; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 28px; min-height: 230px; border-radius: var(--radius); background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01)); border: 1px solid var(--line); color: var(--text); text-decoration: none; overflow: hidden; transition: transform .35s var(--ease), border-color .35s, background-color .35s; }
.tile:hover { color: var(--text); transform: translateY(-6px); border-color: #4b3a6b; background-color: #0f1320; }
.tile .halo { position: absolute; right: -60px; top: -60px; width: 180px; height: 180px; border-radius: 50%; }
.tile .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tile .mark { width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: #07090d; }
.tile .pill { padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); color: #c3cbd8; font-size: 12px; font-weight: 600; }
.tile .title { font: 800 30px/1 var(--display); text-transform: uppercase; }
.tile p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.55; flex: 1 1 auto; }
.tile .go { color: var(--accent-soft); font-weight: 700; font-size: 14px; }
.tile .go i { display: inline-block; font-style: normal; transition: transform .35s; }
.tile:hover .go i { transform: translateX(6px); }

/* ---------- radar ---------- */
.radar { position: relative; width: 560px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; }
.radar .disc { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(16, 40, 31, .9) 0%, transparent 70%); }
.radar .ring { position: absolute; border-radius: 50%; border: 1px solid rgba(52, 211, 153, .16); }
.radar .axis { position: absolute; background: rgba(52, 211, 153, .12); }
.radar .sweep { position: absolute; inset: 2%; border-radius: 50%; background: conic-gradient(from 0deg, rgba(52, 211, 153, .42), rgba(52, 211, 153, .06) 50deg, transparent 90deg); animation: sweep 5s linear infinite; }
.radar .blip { position: absolute; width: 10px; height: 10px; }
.radar .blip::before, .radar .blip::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--c); }
.radar .blip::before { animation: ping 2.6s ease-out infinite; animation-delay: var(--d); }
.radar .fan { position: absolute; left: 50%; top: 50%; width: 170px; }
.radar .fan.main { width: 222px; z-index: 2; }
.radar .fan .card { animation: none; }
.f1 { animation: float1 6s ease-in-out infinite; }
.f2 { animation: float2 7s ease-in-out infinite .4s; opacity: .92; }
.f3 { animation: float3 6.5s ease-in-out infinite .9s; opacity: .92; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, auto)); max-width: 640px; border-top: 1px solid var(--line); margin: 48px 0 0; }
.stats div { padding: 18px 22px 0 0; }
.stats dd { margin: 0; font: 800 44px/1 var(--display); }
.stats dt { margin-top: 6px; color: var(--text-3); font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.live-pill { display: inline-flex; align-items: center; gap: 12px; padding: 8px 16px 8px 10px; border-radius: 999px; background: rgba(52, 211, 153, .08); border: 1px solid rgba(52, 211, 153, .25); color: var(--live-soft); font: 700 12px var(--mono); letter-spacing: 2px; }
.live-pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--live); animation: livepulse 2s ease-in-out infinite; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #7e22ce, var(--accent), var(--accent-soft)); transform-origin: left; animation: growx 1.2s var(--ease) both .2s; }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.feed li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); animation: rise .6s var(--ease) both; }
.feed b { font: 800 22px var(--display); min-width: 52px; text-align: center; }
.feed a { color: var(--text); text-decoration: none; font-weight: 600; }

/* ---------- footer ---------- */
.foot { margin-top: 96px; border-top: 1px solid var(--line); }
.foot .wrap { padding-block: 40px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; color: var(--text-3); font-size: 14px; }
.foot img { width: 48px; height: 48px; object-fit: contain; vertical-align: middle; margin-right: 10px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 22px; }
.foot a { text-decoration: none; }

.reveal { animation: rise .9s var(--ease) both; }
.d1 { animation-delay: .08s; } .d2 { animation-delay: .18s; } .d3 { animation-delay: .3s; } .d4 { animation-delay: .44s; } .d5 { animation-delay: .6s; }

@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes ping { 0% { transform: scale(.5); opacity: .95; } 100% { transform: scale(3); opacity: 0; } }
@keyframes rise { from { transform: translateY(26px); opacity: 0; filter: blur(5px); } to { transform: none; opacity: 1; filter: none; } }
@keyframes float1 { 0%, 100% { transform: translate(-50%, -50%) rotate(-3deg); } 50% { transform: translate(-50%, calc(-50% - 14px)) rotate(-1deg); } }
@keyframes float2 { 0%, 100% { transform: translate(-118%, -42%) rotate(-14deg); } 50% { transform: translate(-118%, calc(-42% - 10px)) rotate(-12deg); } }
@keyframes float3 { 0%, 100% { transform: translate(18%, -42%) rotate(11deg); } 50% { transform: translate(18%, calc(-42% - 12px)) rotate(9deg); } }
@keyframes foil { to { background-position: 200% 200%; } }
@keyframes spinb { to { --ang: 360deg; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes drift { 50% { transform: translate(60px, 30px); } }
@keyframes drift2 { 50% { transform: translate(-80px, 40px); } }
@keyframes shimmer { to { transform: translateX(250%) skewX(-18deg); } }
@keyframes livepulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .45); } 50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } }
@keyframes growx { from { transform: scaleX(0); } }

@media (max-width: 720px) {
  .top nav { padding: 10px 16px; gap: 10px; }
  .hubs { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .search { order: 2; flex: 1 1 160px; }
  .wrap { padding: 0 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .radar .fan { width: 120px; } .radar .fan.main { width: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---------- motion layer ---------- */
.progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 60; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, #7e22ce, var(--accent), var(--gold)); pointer-events: none; }
.spot { position: fixed; left: 0; top: 0; width: 620px; height: 620px; margin: -310px 0 0 -310px; border-radius: 50%; background: radial-gradient(circle, rgba(217, 70, 239, .13), rgba(52, 211, 153, .05) 45%, transparent 68%); pointer-events: none; z-index: 0; will-change: transform; }
.mo { opacity: 0; }
.mo.in { opacity: 1; animation: moin .75s var(--ease) both; animation-delay: var(--mo, 0s); }
@keyframes moin { from { opacity: 0; translate: 0 22px; scale: .985; } to { opacity: 1; translate: 0 0; scale: 1; } }
.pct.mo .bar > i { animation-play-state: paused; }
.pct.mo.in .bar > i { animation-play-state: running; animation-delay: calc(var(--mo, 0s) + .15s); }
.bar > i { position: relative; overflow: hidden; }
.bar > i::after, .track i::after, .race-row .t i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); transform: translateX(-100%); animation: flow 2.8s ease-in-out infinite; }
.track i, .race-row .t i { position: relative; overflow: hidden; }
@keyframes flow { 60%, 100% { transform: translateX(100%); } }
.card:hover { transform: perspective(900px) translateY(-10px) rotateX(var(--rx, 6deg)) rotateY(var(--ry, -4deg)); transition: transform .12s linear, box-shadow .45s; }
.card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 255, 255, .28), transparent 55%); mix-blend-mode: screen; }
.card:hover::after { opacity: 1; }
.btn { position: relative; overflow: hidden; }
.btn::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: 0; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); transform: translateX(-160%) skewX(-18deg); pointer-events: none; }
.btn:hover::after { transition: transform .7s var(--ease); transform: translateX(320%) skewX(-18deg); }
.hubs a { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--mono); fill: var(--text-2); font-size: 12px; }
.chart .val { font-family: var(--display); font-weight: 800; font-size: 20px; fill: var(--text); }
.legend-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 10px; font-size: 14px; font-weight: 600; }
.legend-row i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 7px; vertical-align: -1px; }
.chart-wrap { max-width: 560px; margin: 0 auto; }
.dist { display: flex; align-items: flex-end; gap: 4px; height: 170px; }
.dist div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.dist i { display: block; border-radius: 5px 5px 2px 2px; height: var(--h); transform-origin: bottom; animation: growy 1s var(--ease) both; animation-delay: var(--d); animation-play-state: paused; transition: filter .2s; }
.dist.in i { animation-play-state: running; }
.dist div:hover i { filter: brightness(1.35); }
.dist-axis { display: flex; justify-content: space-between; margin-top: 8px; font: 500 12px var(--mono); color: var(--text-3); }
@keyframes growy { from { transform: scaleY(0); } }
@media (prefers-reduced-motion: reduce) { .mo { opacity: 1; } .spot, .progress { display: none; } }
