@font-face { font-family: "Mulish"; font-weight: 600; src: url("/static/fonts/Mulish_600SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Mulish"; font-weight: 800; src: url("/static/fonts/Mulish_800ExtraBold.ttf") format("truetype"); font-display: swap; }

:root {
  --hue: 333;
  --bg: hsl(var(--hue) 5% 11%);
  --surface: hsl(var(--hue) 5% 17%);
  --surface-2: hsl(var(--hue) 5% 22%);
  --line: hsl(var(--hue) 5% 29%);
  --muted: hsl(var(--hue) 6% 63%);
  --text: hsl(var(--hue) 30% 92%);
  --text-strong: #fff;
  --accent: hsl(var(--hue) 100% 70%);
  --accent-ink: hsl(var(--hue) 40% 12%);
  --good: #7fe3a1;
  --bad: #ff7d8d;
  --radius: 12px;
  --font: "Mulish", system-ui, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: hsl(var(--hue) 30% 97%); --surface: #fff; --surface-2: hsl(var(--hue) 25% 93%);
    --line: hsl(var(--hue) 20% 85%); --muted: hsl(var(--hue) 10% 40%); --text: hsl(var(--hue) 20% 15%);
    --text-strong: #000; --accent: hsl(var(--hue) 75% 42%); --accent-ink: #fff; --good: #137a3c; --bad: #b3263a;
  }
}

* { box-sizing: border-box; }
html { scrollbar-width: thin; scrollbar-color: var(--line) var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 600 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 800; color: var(--text-strong); line-height: 1.2; }
.container { max-width: 980px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 24px; padding-bottom: 56px; }

/* header (after osu! web: full-width dropdown band, user menu with the player's banner) */
.site-header { position: sticky; top: 0; z-index: 30; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60' viewBox='0 0 120 60'%3E%3Cpath d='M0 60L30 0l30 60zM60 60l30-60 30 60z' fill='%23fff' fill-opacity='.035'/%3E%3C/svg%3E") center top, linear-gradient(var(--surface-2), var(--surface)); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: stretch; gap: 22px; height: 60px; }
.logo-mark { align-self: center; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--text-strong); font-size: 20px; flex: none; }
.logo-mark:hover { text-decoration: none; background: var(--surface-2); }
.nav { display: flex; align-items: stretch; flex: 1; }
.nav-item { display: flex; align-items: center; padding: 0 14px; color: var(--text); font-weight: 800; font-size: 14px; }
.nav-item:hover, .nav-dropdown:hover > .nav-item, .nav-dropdown:focus-within > .nav-item { color: var(--accent); text-decoration: none; }
.nav-item[aria-current="page"] { color: var(--accent); }
.nav-dropdown { position: relative; display: flex; }
.dd-band { position: fixed; left: 0; right: 0; top: 60px; height: 112px; background: rgba(12,12,12,.86); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .14s, transform .14s, visibility .14s; }
.dd-list { position: absolute; left: 0; top: 100%; z-index: 1; display: flex; flex-direction: column; padding: 12px 0 14px; min-width: 160px; opacity: 0; visibility: hidden; transition: opacity .14s, visibility .14s; }
.nav-dropdown:hover .dd-band, .nav-dropdown:focus-within .dd-band, .nav-dropdown:hover .dd-list, .nav-dropdown:focus-within .dd-list { opacity: 1; visibility: visible; transform: none; }
.dd-list a { padding: 5px 14px; color: #fff; font-size: 13px; font-weight: 800; white-space: nowrap; }
.dd-list a:hover { color: var(--accent); text-decoration: none; }
.nav-end { align-self: center; display: flex; align-items: center; gap: 10px; }
.hpill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--bg); color: var(--text-strong); font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.hpill:hover { text-decoration: none; color: var(--accent); }
.hpill i { font-style: normal; }
.nav-login { padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); font-weight: 800; }
.nav-login:hover { border-color: var(--accent); text-decoration: none; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; display: block; border-radius: 50%; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; display: block; border: 2px solid transparent; }
.usermenu[open] summary img, .usermenu summary:hover img { border-color: var(--accent); }
.usermenu-pop { position: absolute; right: 0; top: calc(100% + 12px); width: 190px; background: #1b1b1b; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.usermenu-head { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 12px 12px; color: #fff; background: linear-gradient(135deg, hsl(var(--hue) 35% 26%), hsl(var(--hue) 20% 14%)) center/cover; position: relative; text-align: center; overflow-wrap: anywhere; }
.usermenu-head::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.usermenu-head > * { position: relative; }
.usermenu-list { padding: 6px 0 8px; }
.usermenu-list a, .usermenu-list button { display: block; width: 100%; text-align: left; padding: 8px 18px; color: #fff; background: none; border: 0; font: 700 13px var(--font); cursor: pointer; }
.usermenu-list a:hover, .usermenu-list button:hover { background: rgba(255,255,255,.07); color: var(--accent); text-decoration: none; }

/* cards & blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card + .card, .grid + .card, .card + .grid { margin-top: 16px; }
.card h2 { font-size: 15px; margin-bottom: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat b { display: block; font-size: 26px; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.good { color: var(--good); } .bad { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }

.btn { display: inline-block; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 800; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.has-tip { position: relative; cursor: help; display: inline-block; }
.has-tip .tip { position: absolute; left: 50%; z-index: 5; padding: 6px 12px; border-radius: 8px; background: #121212; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.45); opacity: 0; visibility: hidden; transition: opacity .12s, visibility .12s; pointer-events: none; transform: translateX(-50%); }
.has-tip .tip.start { left: 0; transform: none; }
.has-tip .tip.start::after { left: 22px; margin-left: 0; }
.has-tip .tip b { font-weight: 800; color: #fff; }
.has-tip .tip::after { content: ""; position: absolute; left: 50%; margin-left: -5px; border: 5px solid transparent; }
.has-tip .tip.bottom { top: calc(100% + 8px); }
.has-tip .tip.bottom::after { bottom: 100%; border-bottom-color: #121212; }
.has-tip .tip.top { bottom: calc(100% + 8px); }
.has-tip .tip.top::after { top: 100%; border-top-color: #121212; }
.has-tip:hover .tip, .has-tip:focus .tip, .has-tip:focus-within .tip { opacity: 1; visibility: visible; }

/* hero */
.hero { padding: 48px 0 32px; text-align: center; }
.hero h1 { font-size: clamp(30px, 6vw, 46px); }
.hero p { color: var(--muted); max-width: 520px; margin: 12px auto 24px; }

/* leaderboard */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; }
td { padding: 9px 10px; border-top: 1px solid var(--line); }
td.r, th.r { text-align: right; }
.who { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex: none; }
.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tabs a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tabs a:hover { text-decoration: none; border-color: var(--accent); }
.pager { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 16px; }

/* profile (layout after osu! web) */
.bars { display: grid; gap: 10px; }
.bars .row { display: grid; grid-template-columns: 130px 1fr 70px; gap: 10px; align-items: center; }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.about { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
svg.chart { width: 100%; height: 150px; display: block; }
svg.chart .grid-line { stroke: var(--line); stroke-width: 1; }
svg.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
svg.chart .dot { fill: var(--accent); }
svg.chart text { fill: var(--muted); font: 600 11px var(--font); }
.games li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.games { list-style: none; margin: 0; padding: 0; }
.games li:first-child { border-top: 0; }
.games .when { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }

/* login & settings */
.narrow { max-width: 520px; margin: 40px auto; }
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.status { min-height: 20px; font-size: 13px; margin-top: 6px; }
.preview { display: flex; gap: 14px; align-items: center; }
.preview img.avatar { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.preview img.banner-prev { width: 200px; height: 80px; border-radius: 10px; object-fit: cover; }

@media (max-width: 640px) {
  .profile-head { flex-direction: column; align-items: flex-start; }
  .banner { height: 120px; }
  .bars .row { grid-template-columns: 90px 1fr 50px; }
  .hide-sm { display: none; }
}

/* ── osu!-style profile ─────────────────────────────────────────────────── */
.osu { background: var(--surface); border-radius: var(--radius); overflow: clip; border: 1px solid var(--line); }
.osu-title { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--surface-2); font-weight: 800; font-size: 18px; color: var(--text-strong); }
.p-banner { position: relative; height: 200px; background: linear-gradient(135deg, hsl(var(--hue) 35% 26%), hsl(var(--hue) 20% 14%)) center/cover; }
.fab { position: absolute; right: 14px; bottom: 14px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; }
.fab:hover { background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.fab.small { position: static; margin-left: auto; width: 30px; height: 30px; background: var(--surface-2); color: var(--text); }
.p-head { position: relative; z-index: 1; display: flex; gap: 20px; align-items: center; padding: 14px 20px; background: var(--surface-2); }
.p-head .avatar { width: 132px; height: 132px; border-radius: 22px; object-fit: cover; margin-top: -56px; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.35); flex: none; }
.who-block { min-width: 0; }
.p-head h1 { font-size: 26px; font-weight: 600; overflow-wrap: anywhere; }
.sub { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; margin-top: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; padding: 1px 10px; border-radius: 6px; background: var(--surface); color: var(--text); }
.p-stats { display: grid; grid-template-columns: 1fr 280px; gap: 18px; padding: 18px 20px; background: var(--surface); }
.cap { display: block; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.rank-big { font-size: 34px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.15; }
.spark { width: 100%; height: 92px; display: block; margin-top: 10px; }
.spark .base { stroke: var(--line); stroke-width: 1; }
.spark .ln { fill: none; stroke: var(--text-strong); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-dates { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }
.spark-empty { padding: 28px 0; font-size: 13px; }
.p-right { margin: 0; align-self: start; background: var(--surface-2); border-radius: 10px; padding: 12px 16px; font-size: 12px; }
.p-right > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.p-right dt { color: var(--text); } .p-right dd { margin: 0; color: var(--text-strong); font-weight: 800; text-align: right; }
.p-bar { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 14px 20px; background: var(--surface-2); flex-wrap: wrap; }
.lvl { display: flex; align-items: center; gap: 10px; }
.lvl-bar { position: relative; width: 190px; height: 5px; border-radius: 99px; background: var(--line); margin-bottom: 14px; }
.lvl-bar i { display: block; height: 100%; border-radius: 99px; background: var(--text-strong); }
.lvl-bar em { position: absolute; right: 0; top: 9px; font-style: normal; font-size: 11px; color: var(--text); }
.hex { width: 46px; height: 50px; color: var(--text-strong); flex: none; }
.hex text { fill: currentColor; font: 800 17px var(--font); }
.p-info { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 12px 20px; font-size: 12px; color: var(--text); background: var(--surface); }
.p-info b { color: var(--text-strong); }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.p-nav { position: sticky; top: 60px; z-index: 6; display: flex; gap: 20px; padding: 10px 20px 0; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.p-nav a { padding: 6px 0 8px; color: var(--muted); font-size: 13px; border-bottom: 2px solid transparent; }
.p-nav a:hover { color: var(--text-strong); text-decoration: none; }
.p-nav a.on { color: var(--text-strong); font-weight: 800; border-bottom-color: var(--accent); }
.p-content { padding: 0 20px 28px; background: var(--surface); }
.p-section { padding-top: 22px; scroll-margin-top: 112px; }
.p-section + .p-section { margin-top: 10px; border-top: 1px solid var(--line); }
.sec-title { font-size: 15px; display: inline-block; padding-bottom: 4px; border-bottom: 2px solid var(--text-strong); margin-bottom: 14px; }
.sub-title { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 0 0 12px; }
.sub-title::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--text); }
.chart-scroll { overflow-x: auto; margin: 0 -4px; }
.hist { width: 100%; min-width: 620px; height: auto; display: block; }
.hist .gl { stroke: var(--bg); stroke-width: 1; }
.hist .ln { fill: none; stroke: var(--text-strong); stroke-width: 2; stroke-linejoin: round; }
.hist text { fill: var(--muted); font: 800 12px var(--font); }
.scrub { position: relative; outline: none; cursor: crosshair; }
.scrub:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: 6px; }
.spark-wrap { margin-top: 10px; touch-action: pan-y; }
.spark-wrap .spark { margin-top: 0; }
.hist-wrap { min-width: 620px; }
.sc-line, .sc-dot, .sc-tip { position: absolute; pointer-events: none; opacity: 0; transition: opacity .1s; }
.scrub.on .sc-line, .scrub.on .sc-dot, .scrub.on .sc-tip { opacity: 1; }
.sc-line { width: 2px; margin-left: -1px; background: var(--text-strong); }
.sc-dot { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--surface); border: 3px solid var(--text-strong); box-sizing: border-box; }
.sc-tip { top: -6px; left: 4%; z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: rgba(12,12,12,.92); color: #fff; font-size: 12px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.sc-tip.at-right { left: auto; right: 4%; }
.hist-wrap .sc-tip { top: 4px; }
.sc-tip b { font-weight: 800; }
.sc-tip span { color: rgba(255,255,255,.75); }

@media (max-width: 560px) {
  .hpill { display: none; }
  .site-header .container { gap: 10px; }
  .nav-item { padding: 0 10px; }
}

@media (max-width: 760px) {
  .p-stats { grid-template-columns: 1fr; }
  .p-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .p-head .avatar { margin-top: -64px; }
  .p-banner { height: 150px; }
  .p-bar { justify-content: center; }
  .rank-big { font-size: 28px; }
  .bars .row { grid-template-columns: 100px 1fr 50px; }
}
