/* Tanoshi Space — minimal monochrome rankings. No external fonts or assets (strict CSP). */
:root {
  --bg: #08080a;
  --s1: #0f0f12;
  --s2: #15151a;
  --s3: #1c1c22;
  --line: #1f1f25;
  --line2: #2b2b33;
  --text: #f4f4f5;
  --text2: #a1a1aa;
  --muted: #5d5d66;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --radius: 14px;
  --font: "Inter", "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { color-scheme: dark; scrollbar-color: #2b2b33 transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Slow drifting light behind the page */
body::before {
  content: ""; position: fixed; inset: -20% -10% auto; height: 70vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 50% at 30% 30%, rgb(255 255 255 / .055), transparent 70%),
    radial-gradient(35% 45% at 75% 20%, rgb(255 255 255 / .04), transparent 70%);
  animation: drift 26s ease-in-out infinite alternate;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgb(255 255 255 / .05) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000, transparent 60%);
}
@keyframes drift { from { transform: translate3d(-4%, 0, 0) scale(1); } to { transform: translate3d(4%, 3%, 0) scale(1.08); } }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: rgb(255 255 255 / .22); }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgb(8 8 10 / .72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav__inner { max-width: 1040px; margin: 0 auto; height: 60px; display: flex; align-items: center; gap: 32px; padding: 0 24px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.02em; }
.logo__mark { width: 22px; height: 22px; color: var(--text); transition: transform .6s var(--ease); }
.logo:hover .logo__mark { transform: rotate(180deg); }
.nav__links { display: flex; gap: 22px; }
.nav__link { position: relative; color: var(--text2); font-weight: 500; padding: 6px 0; transition: color .2s; }
.nav__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--text);
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.nav__link:hover, .nav__link.is-active { color: var(--text); }
.nav__link.is-active::after, .nav__link:hover::after { transform: scaleX(1); }
.lang { margin-left: auto; position: relative; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line2); border-radius: 999px; }
.lang__pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 999px; background: var(--text);
  transition: transform .35s var(--ease), width .35s var(--ease);
}
.lang button {
  position: relative; z-index: 1; border: 0; background: transparent; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; transition: color .25s; text-transform: lowercase;
}
.lang button:hover { color: var(--text); }
.lang button.is-active { color: var(--bg); }

/* ---------- Layout ---------- */
.page { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px 64px; }
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer__inner { max-width: 1040px; margin: 0 auto; padding: 20px 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer__links { display: flex; gap: 18px; }
.footer__links a { transition: color .2s; }
.footer__links a:hover { color: var(--text); }
.noscript { text-align: center; color: var(--muted); }

.view { animation: view-in .55s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

/* ---------- Rankings hero ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 56px 0 28px; }
.hero__title { margin: 0; font-size: 56px; line-height: 1; font-weight: 650; letter-spacing: -.045em; }
.hero__stats { display: flex; gap: 36px; }
.hstat { text-align: right; }
.hstat__value { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.hstat__label { font-size: 12px; color: var(--muted); }
.hstat--live .hstat__label::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%;
  background: var(--text); vertical-align: 1px; animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgb(255 255 255 / .5); } 50% { opacity: .5; box-shadow: 0 0 0 5px rgb(255 255 255 / 0); } }

/* ---------- Search ---------- */
.search { position: relative; display: block; max-width: 340px; margin-bottom: 18px; }
.search svg { position: absolute; left: 0; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); transition: color .2s; }
.search input {
  width: 100%; height: 40px; border: 0; border-bottom: 1px solid var(--line2); background: transparent;
  color: var(--text); padding: 0 0 0 26px; font: inherit; font-size: 15px; outline: none; border-radius: 0;
  transition: border-color .25s;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search input:focus { border-color: var(--text); }
.search:focus-within svg { color: var(--text); }
.search input::placeholder { color: var(--muted); }

/* ---------- Rankings list ---------- */
.board { border-top: 1px solid var(--line); }
.board__head, .row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 96px 110px; align-items: center; gap: 12px; padding: 0 14px;
}
.board__head { height: 38px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
.board__head span:nth-child(n+3), .row > :nth-child(n+3) { text-align: right; }
.row {
  --mx: 50%;
  position: relative; height: 58px; border-bottom: 1px solid var(--line); cursor: pointer;
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms);
  transition: background .25s;
}
.row::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; background: var(--text);
  transform: scaleY(0); transition: transform .3s var(--ease);
}
.row:hover { background: radial-gradient(260px 80px at var(--mx) 50%, rgb(255 255 255 / .06), transparent 70%), var(--s1); }
.row:hover::before { transform: scaleY(1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.row__rank { color: var(--muted); font-weight: 600; }
.row__rank.is-top { color: var(--text); }
.row__user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row__name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform .3s var(--ease); }
.row:hover .row__name { transform: translateX(3px); }
.row__num { color: var(--text2); }
.row__num.is-zero { color: var(--muted); }
.row__pp { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.row__pp small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 2px; }

.clan {
  flex: none; font-size: 11px; font-weight: 600; padding: 1px 7px; border: 1px solid var(--line2); border-radius: 6px;
  color: var(--text2); white-space: nowrap;
}

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 28px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 8px; display: inline-grid; place-items: center;
  border-radius: 10px; font-weight: 600; color: var(--text2); transition: background .2s, color .2s;
}
.pager a:hover { background: var(--s2); color: var(--text); }
.pager .is-current { background: var(--text); color: var(--bg); }
.pager .is-disabled { opacity: .25; }
.pager .pager__gap { min-width: 16px; padding: 0; color: var(--muted); }

/* ---------- Avatar ---------- */
.avatar {
  --a: 135deg;
  display: inline-grid; place-items: center; flex: none; font-weight: 650; color: var(--text); text-transform: uppercase; line-height: 1;
  background: linear-gradient(var(--a), #2c2c33, #0d0d10);
  border: 1px solid var(--line2);
  transition: transform .35s var(--ease), border-color .3s;
}
.avatar--sm { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.row:hover .avatar--sm { transform: scale(1.08); border-color: #44444d; }
.avatar--lg { width: 104px; height: 104px; border-radius: 26px; font-size: 44px; box-shadow: 0 20px 60px rgb(0 0 0 / .6); }

/* ---------- Profile ---------- */
.ph { display: flex; align-items: center; gap: 28px; padding: 56px 0 36px; flex-wrap: wrap; }
.ph .avatar--lg { animation: pop .7s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.ph__id { min-width: 0; flex: 1; }
.ph__name { margin: 0; font-size: 44px; line-height: 1.05; font-weight: 650; letter-spacing: -.04em; word-break: break-all; }
.ph__clan { margin-top: 10px; }
.ph__metrics { display: flex; gap: 44px; }
.metric__value { font-size: 40px; font-weight: 300; line-height: 1; letter-spacing: -.03em; }
.metric__value small { font-size: 16px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.metric__label { font-size: 12px; color: var(--muted); margin-top: 8px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: 18px 0 18px 18px; border-left: 1px solid var(--line); animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat__value { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.stat__value small { color: var(--muted); font-weight: 500; font-size: 14px; }
.stat__label { font-size: 12px; color: var(--muted); }

.progress { padding: 26px 0 8px; }
.progress__top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.progress__top strong { color: var(--text); font-size: 14px; font-weight: 600; }
.bar { height: 2px; background: var(--line2); overflow: hidden; border-radius: 2px; }
.bar > i {
  display: block; height: 100%; width: var(--w, 0%); background: var(--text); border-radius: inherit;
  transform-origin: left; animation: grow 1.2s var(--ease) both .25s;
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.cats { display: flex; gap: 24px; margin-top: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.cats b { color: var(--text2); font-weight: 600; }

.sec { margin-top: 44px; }
.sec__title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.sec__title span { color: var(--text2); letter-spacing: 0; }

/* Plays */
.plays { border-top: 1px solid var(--line); }
.play {
  --mx: 50%;
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 104px; align-items: center; gap: 14px;
  min-height: 62px; padding: 8px 14px; border-bottom: 1px solid var(--line);
  animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms);
  transition: background .25s;
}
.play::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 2px; background: var(--text);
  transform: scaleY(0); transition: transform .3s var(--ease);
}
.play:hover { background: radial-gradient(260px 80px at var(--mx) 50%, rgb(255 255 255 / .05), transparent 70%), var(--s1); }
.play:hover::before { transform: scaleY(1); }
.play__idx { color: var(--muted); font-weight: 600; font-size: 13px; }
.play__main { min-width: 0; }
.play__title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play__meta { display: flex; flex-wrap: wrap; gap: 0 14px; font-size: 12px; color: var(--muted); }
.play__meta .is-first { color: var(--text2); }
.play__mods { display: flex; gap: 4px; }
.mod {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; letter-spacing: .04em; line-height: 1.3;
  border: 1px solid var(--line2); color: var(--text2); cursor: help;
}
.mod--sd { background: var(--text); color: var(--bg); border-color: var(--text); }
.mod--pf { border-color: #6b6b75; color: var(--text); }
.play__pp { text-align: right; }
.play__ppv { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.play__ppv small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 1px; }
.play__ppw { font-size: 11px; color: var(--muted); }

.more { display: flex; justify-content: center; margin-top: 18px; }
.btn {
  border: 1px solid var(--line2); cursor: pointer; border-radius: 999px; padding: 8px 20px; font-weight: 600; font-size: 13px;
  background: transparent; color: var(--text); transition: background .25s, color .25s, border-color .25s, transform .25s var(--ease);
}
.btn:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn:active { transform: scale(.97); }

/* ---------- States ---------- */
.state { padding: 120px 20px; text-align: center; color: var(--muted); }
.state__title { color: var(--text); font-size: 28px; font-weight: 650; letter-spacing: -.03em; margin: 0 0 18px; }
.empty { padding: 48px 10px; text-align: center; color: var(--muted); border-bottom: 1px solid var(--line); }

.skel { display: grid; grid-template-columns: 56px minmax(0, 1fr) 110px; align-items: center; gap: 12px; height: 58px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.skel i { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--s2) 0%, var(--s3) 40%, var(--s2) 80%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.skel i:nth-child(1) { width: 24px; }
.skel i:nth-child(2) { width: min(220px, 60%); }
.skel i:nth-child(3) { width: 60px; justify-self: end; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav__inner { gap: 18px; padding: 0 16px; }
  .page { padding: 0 16px 48px; }
  .hero { padding: 36px 0 22px; }
  .hero__title { font-size: 40px; }
  .hero__stats { gap: 22px; width: 100%; }
  .hstat { text-align: left; }
  .board__head, .row { grid-template-columns: 38px minmax(0, 1fr) 84px; padding: 0 6px; }
  .hide-sm { display: none; }
  .ph { padding: 36px 0 26px; gap: 18px; }
  .avatar--lg { width: 80px; height: 80px; font-size: 34px; border-radius: 22px; }
  .ph__name { font-size: 32px; }
  .ph__metrics { width: 100%; gap: 36px; }
  .metric__value { font-size: 32px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .play { grid-template-columns: 28px minmax(0, 1fr) 80px; padding: 8px 6px; gap: 10px; }
  .play__mods { grid-column: 2; grid-row: 2; margin-top: -4px; }
  .play__mods:empty { display: none; }
  .play__pp { grid-column: 3; grid-row: 1 / span 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* Language switch re-renders without replaying entrance animations */
.no-anim .view, .no-anim .row, .no-anim .play, .no-anim .stat, .no-anim .bar > i, .no-anim .avatar--lg { animation: none; }
