:root {
  --bg: #0e0e12;
  --bg-2: #16161d;
  --bg-3: #1e1e28;
  --text: #f2f2f5;
  --muted: #a0a0ad;
  --accent: #ff66aa;
  --accent-2: #ff8fc0;
  --good: #63d18d;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* Quicksand (the osu!lazer typeface) has no Cyrillic; Comfortaa picks it up
     automatically because font fallback is resolved per glyph. */
  font-family: "Quicksand", "Comfortaa", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.accent { color: var(--accent); }
.error { color: var(--bad); margin-top: 16px; }
.muted { color: var(--muted); }
button { font-family: inherit; cursor: pointer; border: none; }

/* ---------- Login ---------- */
#login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1000px 500px at 60% -10%, #2a1a26, var(--bg));
}
.login-card {
  background: var(--bg-2); border: 1px solid #2a2a35; border-radius: 20px;
  padding: 52px 44px; text-align: center; max-width: 440px;
}
.login-card h1 { font-size: 44px; margin: 0 0 10px; letter-spacing: -1.5px; }
.login-card p { color: var(--muted); margin: 0 0 28px; line-height: 1.5; }
.btn-osu {
  display: inline-block; background: var(--accent); color: #1a0f16; font-weight: 700;
  text-decoration: none; padding: 15px 30px; border-radius: 999px;
  transition: background .2s, transform .08s;
}
.btn-osu:hover { background: var(--accent-2); transform: translateY(-1px); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; border-bottom: 1px solid #23232e;
  background: rgba(14,14,18,.9); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.brand { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.profile { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--bg-3); }
.username { font-weight: 700; font-size: 14px; }
.stats { font-size: 12px; color: var(--muted); }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid #2c2c38;
  padding: 9px 14px; border-radius: 999px; font-size: 13px;
}
.btn-ghost:hover { color: var(--text); border-color: #3a3a48; }
.btn-primary {
  background: var(--accent); color: #1a0f16; font-weight: 700;
  padding: 14px 32px; border-radius: 999px; font-size: 15px; transition: background .2s;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-primary:disabled { opacity: .4; cursor: default; }

/* ---------- Onboarding: genres ---------- */
.wizard { max-width: 780px; margin: 0 auto; padding: 48px 24px; text-align: center; }
.step-label {
  color: var(--accent); font-size: 12px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.wizard h2 { font-size: 34px; margin: 10px 0 8px; letter-spacing: -.5px; }
.wizard p { margin: 0 auto 32px; max-width: 480px; line-height: 1.5; }
.genre-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 32px;
}
.genre-chip {
  background: var(--bg-2); border: 2px solid #2a2a35; color: var(--text);
  padding: 20px 12px; border-radius: 14px; font-size: 15px; font-weight: 600;
  transition: all .15s;
}
.genre-chip:hover { border-color: #44445a; transform: translateY(-2px); }
.genre-chip.on {
  background: linear-gradient(160deg, #3d2030, #2a1a24);
  border-color: var(--accent); color: var(--accent-2);
}

/* ---------- Onboarding bar ---------- */
.onboard-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px 26px; background: var(--bg-2); border-bottom: 1px solid #23232e;
  flex-wrap: wrap;
}
.ob-text { font-size: 14px; color: var(--muted); margin-top: 2px; }
.ob-progress { display: flex; align-items: center; gap: 12px; flex: 1; max-width: 420px; }
.progress { flex: 1; height: 8px; background: #26262f; border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s;
}
.ob-count { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 46px; text-align: right; }

/* ---------- Filters ---------- */
.filters {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 26px; border-bottom: 1px solid #23232e; background: var(--bg-2);
}
.filter-group label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin-bottom: 6px;
}
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type=range] { width: 110px; accent-color: var(--accent); }
.range-label { font-size: 13px; font-weight: 700; min-width: 96px; text-align: center; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }
.mods-input {
  background: var(--bg-3); border: 1px solid #2c2c38; color: var(--text);
  padding: 10px 14px; border-radius: 999px; width: 150px; outline: none; font-size: 13px;
}
.mods-input:focus { border-color: var(--accent); }

/* ---------- Stage (big player) ---------- */
.stage { position: relative; min-height: calc(100vh - 150px); overflow: hidden; }
.stage-bg {
  position: absolute; inset: -60px; background-size: cover; background-position: center;
  filter: blur(60px) saturate(1.5); opacity: .32; transition: background-image .4s; z-index: 0;
}
.stage::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(14,14,18,.55), rgba(14,14,18,.92));
}
.stage-inner {
  position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center;
  padding: 36px 24px 48px; max-width: 620px; margin: 0 auto; text-align: center;
}
.art {
  width: 300px; height: 300px; object-fit: cover; border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6); background: var(--bg-3); margin-bottom: 26px;
}
.meta { width: 100%; }
.t-title {
  font-size: 27px; font-weight: 700; letter-spacing: -.5px; line-height: 1.25;
  margin-bottom: 6px; overflow-wrap: anywhere;
}
.t-artist { font-size: 17px; color: #d5d5e0; margin-bottom: 8px; overflow-wrap: anywhere; }
.t-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; overflow-wrap: anywhere; }
.badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.badge { font-size: 12px; background: #26262f; color: #cfcfd8; padding: 5px 12px; border-radius: 999px; }
.badge.stars { background: #3a2130; color: var(--accent-2); font-weight: 700; }
.badge.pp { background: #23303a; color: #7cc8e6; }
/* pp arrives a moment after the card; keep the slot visible but quiet. */
.badge.pp-loading { color: #5a7a8a; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.badge.genre { background: #2a2438; color: #b8a5e0; }

.seekrow { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 12px; }
.seek { flex: 1; accent-color: var(--accent); }
.time { font-size: 12px; color: var(--muted); min-width: 34px; font-variant-numeric: tabular-nums; }

.volrow { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.vol { width: 130px; accent-color: var(--accent); }
.vol-icon { font-size: 14px; }
.vol-label { font-size: 12px; color: var(--muted); min-width: 34px; }

.actions { display: flex; align-items: center; gap: 22px; margin-bottom: 20px; }
.big-btn {
  width: 74px; height: 74px; border-radius: 50%; font-size: 30px;
  background: var(--bg-2); border: 2px solid #2f2f3d; color: var(--text);
  display: grid; place-items: center; transition: transform .1s, background .18s, border-color .18s;
}
.big-btn:hover { transform: scale(1.08); }
.big-btn:active { transform: scale(.95); }
.big-btn svg { width: 30px; height: 30px; display: block; }
.big-btn.play {
  width: 62px; height: 62px;
  background: var(--accent); color: #1a0f16; border-color: transparent;
}
.big-btn.play svg { width: 24px; height: 24px; }
/* The heart fills in on hover, so "like" reads as an action, not just an outline. */
.big-btn.like:hover { background: #1e3226; border-color: var(--good); color: var(--good); }
.big-btn.like:hover svg { fill: var(--good); }
.big-btn.dislike:hover { background: #331e1e; border-color: var(--bad); color: var(--bad); }

.autoplay-row { justify-content: center; margin-bottom: 18px; user-select: none; }
.autoplay-row:hover { color: var(--text); }

.open-link {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
  border-bottom: 1px dashed #3a3a48; padding-bottom: 2px;
}
.open-link:hover { color: var(--accent-2); border-color: var(--accent-2); }
.hint { margin-top: 22px; font-size: 12px; color: #6f6f7d; }
.hint b { color: var(--muted); }

.stage-msg { padding: 100px 24px; text-align: center; color: var(--muted); font-size: 15px; }

/* ================= Profile ================= */
/* Data colours are their own roles - deliberately NOT the brand pink, which is
   too light for a mark on this surface and too close to the negative red.
   Validated against surface #16161d: CVD dE 19.2, normal-vision 29.0, >=3:1. */
.profile-page {
  --viz-pos: #3987e5;     /* liked / magnitude */
  --viz-neg: #e66767;     /* disliked */
  --viz-axis: #383835;
  --viz-grid: #2c2c2a;
  --viz-ink: #898781;
  max-width: 860px; margin: 0 auto; padding: 28px 24px 90px;
}

.taste-hero {
  background: linear-gradient(160deg, #2a1a26, var(--bg-2));
  border: 1px solid #2a2a35; border-radius: 18px;
  padding: 30px 28px; margin-bottom: 20px;
}
.hero-label {
  color: var(--accent); font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 10px;
}
.hero-line { font-size: 27px; font-weight: 700; letter-spacing: -.5px; line-height: 1.25; }
.hero-sub { color: var(--muted); font-size: 14px; margin-top: 10px; }

.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.tile {
  background: var(--bg-2); border: 1px solid #23232e;
  border-radius: 14px; padding: 18px;
}
.tile-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.tile-label {
  color: var(--muted); font-size: 12px; margin-top: 4px;
  text-transform: uppercase; letter-spacing: .5px;
}

.chart-card {
  background: var(--bg-2); border: 1px solid #23232e;
  border-radius: 14px; padding: 22px; margin: 0 0 16px;
}
.chart-title { font-size: 16px; font-weight: 700; }
.chart-note { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }

.legend { display: flex; gap: 16px; margin-bottom: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch.pos { background: var(--viz-pos); }
.swatch.neg { background: var(--viz-neg); }

.chart { display: flex; flex-direction: column; gap: 8px; }

/* --- single-series horizontal bars --- */
.row { display: grid; grid-template-columns: 92px 1fr 46px; gap: 12px; align-items: center; }
.row-label {
  font-size: 13px; color: #d5d5e0; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-track { background: var(--viz-grid); border-radius: 4px; height: 14px; }
.row-bar {
  height: 14px; background: var(--viz-pos);
  border-radius: 0 4px 4px 0;   /* rounded at the data end only */
  min-width: 3px; transition: width .35s ease;
}
.row-value {
  font-size: 12px; color: var(--viz-ink); font-variant-numeric: tabular-nums;
}

/* --- diverging bars (liked vs disliked around a zero line) --- */
.drow { display: grid; grid-template-columns: 92px 1fr 74px; gap: 12px; align-items: center; }
.dtrack { display: flex; align-items: center; }
.dside { display: flex; height: 14px; flex: 1; }
.dside.left { justify-content: flex-end; }
.dzero { width: 2px; height: 20px; background: var(--viz-axis); flex: none; }
.dbar { height: 14px; min-width: 3px; transition: width .35s ease; }
.dbar.neg { background: var(--viz-neg); border-radius: 4px 0 0 4px; }
.dbar.pos { background: var(--viz-pos); border-radius: 0 4px 4px 0; }
.row:hover .row-bar, .drow:hover .dbar { filter: brightness(1.15); }

/* --- recently liked --- */
.recent-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px;
}
.recent-item { text-decoration: none; color: inherit; }
.recent-item img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 10px; background: var(--bg-3); display: block;
}
.recent-title {
  font-size: 12px; font-weight: 600; margin-top: 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-sub { font-size: 11px; color: var(--muted); }
.recent-item:hover .recent-title { color: var(--accent-2); }

/* --- nav + donate --- */
.nav { display: flex; gap: 6px; margin-left: auto; margin-right: 16px; }
.nav-btn {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.on { background: var(--bg-3); color: var(--text); border-color: #2c2c38; }
.lang-btn {
  background: transparent; color: var(--muted); border: 1px solid #2c2c38;
  padding: 8px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: .5px; min-width: 42px;
}
.lang-btn:hover { color: var(--text); border-color: #3a3a48; }
.lang-btn-login {
  margin-top: 22px; display: inline-block;
}

.btn-donate {
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
  padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 700;
  text-decoration: none; white-space: nowrap; transition: background .2s, color .2s;
}
.btn-donate:hover { background: var(--accent); color: #1a0f16; }

@media (max-width: 700px) {
  .nav { margin-right: 8px; }
  .row, .drow { grid-template-columns: 74px 1fr 44px; }
  .hero-line { font-size: 21px; }
}

.spinner {
  display: inline-block; width: 16px; height: 16px; vertical-align: -3px;
  border: 2px solid rgba(255,255,255,.25); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.swipe-out { animation: swipeOut .22s ease forwards; }
@keyframes swipeOut { to { opacity: 0; transform: scale(.94); } }

@media (max-width: 560px) {
  .art { width: 220px; height: 220px; }
  .t-title { font-size: 22px; }
  .big-btn { width: 64px; height: 64px; font-size: 26px; }
  .actions { gap: 14px; }
  .topbar { padding: 12px 14px; }
  .profile .btn-ghost { display: none; }
}
