* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  background: #000;
  color: #fff;
  font-family: 'Quicksand', sans-serif;
  text-align: center;
}

.wrap {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: rgba(48, 53, 70, 0.5);
  box-shadow: inset 0 0 100px rgba(0,0,0,.5);
  transition: background 3s ease, box-shadow 3s ease;
}

header {
  display: flex;
  flex-direction: column;
  padding: 20px 30px;
  background: rgba(0,0,0,.3);
  gap: 8px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h2,
.brand-text {
  font-size: 1.875rem;
  line-height: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.brand a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
}

#avatar {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  display: none;
  flex-shrink: 0;
}

.socials {
  display: flex;
  gap: 10px;
  align-items: center;
}

.profile-location {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #8b949e;
}

.profile-location svg {
  flex-shrink: 0;
}

.profile-lead {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 880px;
  position: relative;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 24px;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-lead:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.18),
    0 24px 50px rgba(0,0,0,0.1);
}

.profile-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 1;
}

.profile-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #f0f6fc;
  line-height: 1.2;
}

.profile-desc {
  font-size: 14px;
  color: #8b949e;
}

.profile-bio {
  color: #e1e4e8;
}

.profile-stats {
  color: #8b949e;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #8b949e;
  margin-left: 0;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 80px;
}

.readme-box {
  width: 100%;
  max-width: 880px;
  position: relative;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 40px;
  overflow-x: auto;
  word-break: break-word;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  content-visibility: auto;
  contain-intrinsic-size: 800px;
}

.readme-box:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.18),
    0 24px 50px rgba(0,0,0,0.1);
}

#readme {
  width: 100%;
  max-width: 800px;
  text-align: left;
  color: #e1e4e8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: auto;
  word-break: break-word;
}

#readme h1, #readme h2, #readme h3, #readme h4 {
  border-bottom: 1px solid #21262d;
  padding-bottom: .3em;
  margin: 24px 0 16px;
  font-weight: 600;
  color: #f0f6fc;
}

#readme h1 { font-size: 2em; }
#readme h2 { font-size: 1.5em; }
#readme h3 { font-size: 1.25em; }

#readme a {
  color: #58a6ff;
  text-decoration: none;
}

#readme a:hover {
  text-decoration: underline;
}

#readme p {
  margin: 0 0 16px;
}

#readme code {
  background: #161b22;
  padding: .2em .4em;
  border-radius: 6px;
  font-size: 85%;
}

#readme pre {
  background: #161b22;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0 0 16px;
}

#readme pre code {
  background: none;
  padding: 0;
}

#readme ul, #readme ol {
  padding-left: 2em;
  margin: 0 0 16px;
}

#readme li {
  margin: 0 0 4px;
}

#readme blockquote {
  margin: 0 0 16px;
  padding: 0 1em;
  color: #8b949e;
  border-left: .25em solid #30363d;
}

#readme hr {
  border: none;
  border-top: 1px solid #21262d;
  margin: 24px 0;
}

#readme img {
  max-width: 100%;
}

#readme table {
  border-collapse: collapse;
  margin: 0 0 16px;
  width: 100%;
}

#readme th, #readme td {
  border: 1px solid #30363d;
  padding: 6px 13px;
}

#readme th {
  font-weight: 600;
  background: #161b22;
}

.repos-box {
  width: 100%;
  max-width: 880px;
  text-align: left;
  color: #e1e4e8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  margin-top: 24px;
  content-visibility: auto;
  contain-intrinsic-size: 600px;
}

.repos-box h2 {
  font-size: 1.5em;
  font-weight: 600;
  color: #f0f6fc;
  margin: 0 0 20px;
}

.repos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.repos-header h2 {
  margin: 0;
}

.repos-filters {
  display: flex;
  gap: 8px;
}

.filter-select {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 4px 24px 4px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.filter-select:hover {
  border-color: #8b949e;
}

.filter-select:focus {
  outline: none;
  border-color: #58a6ff;
}

.repos-box .repo {
  position: relative;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid #30363d;
  border-radius: 10px;
  margin-bottom: 12px;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.repos-box .repo:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.18),
    0 24px 50px rgba(0,0,0,0.1);
}

.repos-box .repo:last-child {
  margin-bottom: 0;
}

.repos-box .repo-inner {
  padding: 20px 24px;
}

.repos-box .repo-name {
  color: #58a6ff;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
}

.repos-box .repo-name:hover {
  text-decoration: underline;
}

.repos-box .repo-homepage {
  display: block;
  color: #8b949e;
  font-size: 13px;
  text-decoration: none;
  margin: 2px 0;
}

.repos-box .repo-homepage:hover {
  color: #58a6ff;
  text-decoration: underline;
}

.repos-box .repo-desc {
  margin: 6px 0 10px;
  color: #8b949e;
  font-size: 14px;
}

.repos-box .repo-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #8b949e;
  flex-wrap: wrap;
}

.repos-box .tech-stack {
  display: flex;
  align-items: center;
  gap: 4px;
}

.repos-box .tech-stack-summary {
  position: relative;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.repos-box .tech-stack-summary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.18),
    0 24px 50px rgba(0,0,0,0.1);
}

.repos-box .tech-stack-header {
  font-size: 14px;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.repos-box .tech-stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.repos-box .tech-stack-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 10px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 4px;
  font-size: 13px;
  color: #e1e4e8;
}

.repos-box .tech-stack-count {
  color: #8b949e;
  font-size: 11px;
}

.repos-box .lang-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.repo-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 10px;
}

.repo-topic {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  color: #58a6ff;
  background: rgba(88,166,255,.1);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: 12px;
}

.repo-stats-summary {
  font-size: 13px;
  color: #8b949e;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #30363d;
}

footer {
  padding: 30px;
  color: rgba(255,255,255,.5);
  background: rgba(0,0,0,.3);
}

footer a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
}

.socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border-radius: 8px;
  background: #2a2f40;
  transition: .2s;
  outline: none;
}

.socials a svg {
  width: 25px;
  height: 25px;
  fill: #fff;
}

.socials a:hover {
  transform: scale(1.1);
}

.socials a[aria-label="Instagram"]:hover {
  background: #cc39a4;
}

.socials a[aria-label="Twitter"]:hover {
  background: #03a9f4;
}

.socials a[aria-label="GitHub"]:hover {
  background: #000;
}

.socials a[aria-label="Discord"]:hover {
  background: #8c9eff;
}

.socials a[aria-label="Steam"]:hover {
  background: #2a475e;
}

.socials a[aria-label="YouTube"]:hover {
  background: #ff0000;
}

/* Hero page (index.html) */
.hero-overlay {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background: rgba(48, 53, 70, 0.5);
  box-shadow: inset 0 0 100px rgba(0,0,0,.5);
  transition: background 3s ease, box-shadow 3s ease;
}

body:not(.night) .hero-overlay {
  background: rgba(20, 25, 40, 0.75);
  box-shadow: inset 0 0 150px rgba(0,0,0,.7);
}

body.night .wrap,
body.night .hero-overlay {
  background: transparent;
  box-shadow: none;
}

body.night .profile-lead,
body.night .readme-box,
body.night .repos-box .repo,
body.night .repos-box .tech-stack-summary {
  background: transparent;
}

body.night .stats-page .np-mini-inner {
  background: rgba(13, 17, 23, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  object-fit: cover;
  margin-bottom: 24px;
  display: none;
}

.hero-name {
  font-size: 2.5rem;
  font-weight: 700;
  color: #f0f6fc;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero-bio {
  font-size: 1.05rem;
  color: #8b949e;
  max-width: 480px;
  margin-bottom: 32px;
  line-height: 1.6;
}

.hero .socials {
  margin-bottom: 40px;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: #2a2f40;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.25s;
  cursor: pointer;
}

.hero-btn svg {
  display: block;
}

.hero-btn:hover {
  background: #000;
  border-color: #8b949e;
  transform: translateY(-2px);
}

.hero-btn .btn-arrow {
  display: flex;
  align-items: center;
  transition: transform 0.25s;
}

.hero-btn:hover .btn-arrow {
  transform: translateX(4px);
}

.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Back link — expanding arrow */
.brand .back-link {
  display: inline-flex;
  align-items: center;
  width: 45px;
  height: 45px;
  border-radius: 8px;
  background: #2a2f40;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: width 0.4s, background 0.4s;
}

.brand .back-link svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0 12.5px;
}

.brand .back-link .back-text {
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s 0.1s;
  padding-right: 14px;
}

.brand .back-link:hover {
  width: 140px;
  background: #000;
  border: 0.5px solid #fff;
}

.brand .back-link:hover .back-text {
  opacity: 1;
}

/* Now Playing — Mini Indicator */
.np-mini {
  margin-top: 20px;
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: translateY(8px);
}

.np-mini.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.np-mini-inner {
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 1px solid rgba(48, 54, 61, 0.6);
  border-radius: 16px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.np-mini-inner.with-bg {
  background-size: cover;
  background-position: center;
  border: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.np-mini-inner.with-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 0;
  border-radius: inherit;
}

.np-mini-inner.with-bg > * {
  position: relative;
  z-index: 1;
}

.np-mini:hover .np-mini-inner {
  transform: scale(1.05);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.5);
}

.np-mini.expanded:hover .np-mini-inner {
  transform: none;
}

/* ── Main row (loader + body + cover) ── */
.np-mini-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px 14px 20px;
}

.loader {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.bar {
  display: inline-block;
  width: 3px;
  height: 20px;
  background-color: rgba(30, 215, 96, .5);
  border-radius: 10px;
  animation: scale-up4 1s linear infinite;
}

.bar:nth-child(2) {
  height: 35px;
  margin: 0 5px;
  animation-delay: .25s;
}

.bar:nth-child(3) {
  animation-delay: .5s;
}

@keyframes scale-up4 {
  20% {
    background-color: #1ed760;
    transform: scaleY(1.5);
  }
  40% {
    transform: scaleY(1);
  }
}

.np-mini-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.np-mini-body-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.np-mini-source {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #1ed760;
  line-height: 1.2;
}

.np-mini-recent-label {
  color: #8b949e;
  font-size: 10px;
  display: none;
  line-height: 1.2;
}

.np-mini-recent-label.visible {
  display: inline;
}

.np-mini-expand {
  margin-left: auto;
  background: none;
  border: none;
  color: #484f58;
  cursor: pointer;
  padding: 0;
  display: none;
  line-height: 1;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.np-mini-expand.visible {
  display: flex;
  align-items: center;
}

.np-mini-expand:hover {
  color: #f0f6fc;
}

.np-mini-expand svg {
  transition: transform 0.25s ease;
  display: block;
}

.np-mini-expand[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.np-mini-track {
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
  color: #8b949e;
  line-height: 1.3;
}

.np-mini-title {
  color: #f0f6fc;
  text-decoration: none;
  font-weight: 500;
}

.np-mini-title:hover {
  color: #58a6ff;
  text-decoration: underline;
}

.np-mini-sep {
  margin: 0 5px;
  color: #484f58;
}

.np-mini-artist {
  color: #8b949e;
}

.np-mini-cover {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.with-bg .np-mini-cover {
  box-shadow: 0 2px 16px rgba(30, 215, 96, 0.15);
}

/* ── Collapsible Recent Tracks ── */
.np-mini-recent {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.np-mini-recent.expanded {
  max-height: 600px;
}

.np-mini-recent-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 20px 14px;
}

.np-mini-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.3);
  transition: background 0.2s ease;
  text-decoration: none;
  min-width: 0;
}

.np-mini-recent-item:hover {
  background: rgba(13, 17, 23, 0.55);
}

.np-mini-recent-item-cover {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}

.np-mini-recent-item-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.np-mini-recent-item-title {
  font-size: 13px;
  font-weight: 500;
  color: #f0f6fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-mini-recent-item-artist {
  font-size: 11px;
  color: #8b949e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-mini-recent-item-time {
  font-size: 11px;
  color: #484f58;
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .np-mini-main {
    padding: 10px 18px 10px 14px;
    gap: 10px;
  }
  .np-mini-track {
    max-width: 200px;
    font-size: 15px;
  }
  .np-mini-cover {
    width: 40px;
    height: 40px;
  }
  .np-mini-source {
    font-size: 9px;
  }
  .np-mini-recent-label {
    font-size: 9px;
  }
  .np-mini-recent-inner {
    padding: 0 14px 10px;
  }
  .np-mini-recent-item {
    padding: 5px 8px;
    gap: 8px;
  }
  .np-mini-recent-item-cover {
    width: 28px;
    height: 28px;
  }
  .np-mini-recent-item-title {
    font-size: 12px;
  }
  .np-mini-recent-item-artist {
    font-size: 10px;
  }
}

/* ── Stats Page ── */
.stats-page {
  width: 100%;
  max-width: 1100px;
  align-self: center;
  text-align: left;
}

.stats-head {
  width: 100%;
  text-align: center;
  margin-bottom: 24px;
}

.stats-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #f0f6fc;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

/* ⓘ drilldown info icon + tooltip */
.stats-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 6px;
}

.stats-info-icon {
  font-size: 14px;
  color: #8b949e;
  cursor: help;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, color .2s;
  line-height: 1;
}

.stats-info-icon--visible {
  opacity: 1;
  pointer-events: auto;
}

.stats-info-icon:hover {
  color: #f0f6fc;
}

.stats-info-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
  z-index: 100;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.stats-info-icon:hover + .stats-info-tooltip,
.stats-info-tooltip:hover,
.stats-info-tooltip--open {
  opacity: 1;
  visibility: visible;
}

.stats-info-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stats-info-label {
  font-size: 12px;
  color: #8b949e;
  white-space: nowrap;
}

.stats-info-bar {
  width: 100%;
  height: 6px;
  background: #21262d;
  border-radius: 3px;
  overflow: hidden;
}

.stats-info-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #58a6ff, #1f6feb);
  border-radius: 3px;
  transition: width .4s ease;
}

.stats-info-pct {
  font-size: 13px;
  font-weight: 600;
  color: #58a6ff;
}

.stats-info-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(22, 27, 34, 0.95);
  border-left: 1px solid #30363d;
  border-top: 1px solid #30363d;
}

.stats-subtitle {
  font-size: 13px;
  color: #e1e4e8;
}

/* ── Period Tabs ── */
.period-tabs {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  padding: 16px;
  background: rgba(13, 17, 23, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
}

.period-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #8b949e;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  transition: none;
}

.period-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f0f6fc;
}

.period-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 700;
}

#stats-content {
  width: 100%;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.stats-content--exiting {
  opacity: 0;
  transform: translateY(10px);
}

/* ── Loading ── */
.stats-loading {
  text-align: center;
  padding: 60px 20px;
  color: #8b949e;
}

.stats-loader {
  width: 70px;
  height: 35px;
  position: relative;
  overflow: hidden;
  margin: 0 auto 14px;
}

.stats-loader::before {
  content: "";
  width: 70px;
  height: 70px;
  position: absolute;
  left: 0;
  top: 0;
  border: 5px solid #0000;
  border-color: #fff #fff #0000 #0000;
  border-radius: 50%;
  box-sizing: border-box;
  animation: rotate_5131 3s ease-in-out infinite;
  transform: rotate(-200deg);
}

@keyframes rotate_5131 {
  0% { border-width: 10px; }
  25% { border-width: 3px; }
  50% { transform: rotate(115deg); border-width: 10px; }
  75% { border-width: 3px; }
  100% { border-width: 10px; }
}

.stats-service-error {
  background: #1c1f26;
  border: 1px solid #f85149;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #f85149;
  font-size: 14px;
  line-height: 1.5;
}

.stats-error-text {
  color: #f85149;
  font-size: 14px;
  margin-top: 8px;
}

.stats-hint {
  font-size: 14px;
  margin-top: 12px;
  color: #484f58;
}

.stats-retry-btn {
  margin-top: 16px;
  padding: 10px 24px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e1e4e8;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.stats-retry-btn:hover {
  background: #30363d;
  border-color: #8b949e;
}

/* ── Summary Cards ── */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-summary-card {
  background: rgba(13, 17, 23, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 12px;
  padding: 20px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-summary-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.18),
    0 24px 50px rgba(0,0,0,0.1);
}

.stat-summary-card:only-child {
  grid-column: 1 / -1;
}

.stat-summary-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #f0f6fc;
  letter-spacing: -0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat-summary-label {
  font-size: 11px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* ── Sections ── */
.stats-section {
  background: rgba(13, 17, 23, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  content-visibility: auto;
  contain-intrinsic-size: 400px;
}

.stats-section:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.18),
    0 24px 50px rgba(0,0,0,0.1);
}

.stats-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.stats-section-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: #f0f6fc;
}

.section-summary {
  margin-bottom: 12px;
}

.stats-section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Side-by-side columns ── */
.stats-cols {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
}

@media (min-width: 640px) {
  .stats-cols {
    flex-direction: row;
    gap: 24px;
    align-items: flex-start;
  }
}

.stats-col {
  flex: 1;
  min-width: 0;
}

/* ── Source Badge ── */
.source-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.source-badge--spotify {
  background: #1db954;
  color: #000;
}

.source-badge--lastfm {
  background: #d51007;
  color: #fff;
}

/* ── Featured #1 Card ── */
.stat-card-featured {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(13, 17, 23, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid #ffd700;
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
  transition: background 0.25s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s, border-color 0.25s;
}

.stat-card-featured:hover {
  background: rgba(13, 17, 23, 0.6);
  transform: scale(1.01) translateY(-1px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.18),
    0 24px 50px rgba(0,0,0,0.1),
    0 0 0 1px rgba(255, 215, 0, 0.3);
}

.stat-card-featured .stat-rank {
  font-size: 20px;
  font-weight: 900;
  color: #ffd700;
  min-width: 30px;
  position: relative;
}

.stat-card-featured .stat-card-img {
  width: 60px;
  height: 60px;
}

.stat-card-featured .stat-card-img--round {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.stat-card-featured .stat-card-title {
  font-size: 16px;
  font-weight: 700;
}

.stat-card-featured .stat-card-artist {
  font-size: 13px;
}

.stat-card-featured .stat-card-meta {
  font-size: 13px;
  color: #ffd700;
}

.stat-card-featured .stat-bar {
  height: 4px;
  margin-top: 6px;
}

/* ── Connected Constellation Grid ── */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  isolation: isolate;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.stats-grid .stat-card,
.stats-grid .stat-card-featured {
  position: relative;
  z-index: 1;
  transition: flex 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Entry snap animation */
@keyframes card-snap-in {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    filter: blur(6px);
  }
  50% {
    transform: scale(1.02) translateY(-2px);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

.stats-grid .stat-card.grid-entering {
  animation: card-snap-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(var(--i, 0) * 0.045s);
}

/* Grid connection pattern */
.stats-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(30, 167, 253, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(48, 54, 61, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 54, 61, 0.08) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 24px 24px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  transition: opacity 0.6s ease;
  animation: grid-pulse 8s ease-in-out infinite;
}

.stats-grid:hover::before {
  opacity: 1;
}

@keyframes grid-pulse {
  0%, 100% { opacity: 0.4; }
  33% { opacity: 0.7; }
  66% { opacity: 0.5; }
}

/* Visual bridge between featured card and grid */
.stat-card-featured + .stats-grid {
  border-top: 1px solid rgba(48, 54, 61, 0.12);
  padding-top: 8px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(13, 17, 23, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 10px;
  border: 1px solid transparent;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
  transition: background 0.2s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s, border-color 0.2s, opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card:hover {
  background: rgba(22, 27, 34, 0.8);
  transform: scale(1.02) translateY(-2px);
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.18),
    0 24px 50px rgba(0,0,0,0.1),
    0 0 0 1px rgba(30, 167, 253, 0.12);
  border-color: rgba(30, 167, 253, 0.2);
}

.stat-rank {
  font-size: 14px;
  font-weight: 800;
  color: #484f58;
  min-width: 24px;
  text-align: right;
  flex-shrink: 0;
}

.stat-card:nth-child(1) .stat-rank { color: #ffd700; }
.stat-card:nth-child(2) .stat-rank { color: #c0c0c0; }
.stat-card:nth-child(3) .stat-rank { color: #cd7f32; }

.stat-card-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #21262d;
}

.stat-card-img--round {
  border-radius: 50%;
}

.stat-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.stat-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #f0f6fc;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card-title:hover {
  color: #58a6ff;
  text-decoration: underline;
}

.stat-card-artist {
  font-size: 12px;
  color: #8b949e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card-meta {
  font-size: 11px;
  color: #484f58;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── Stat Bar ── */
.stat-bar {
  width: 100%;
  height: 3px;
  background: #21262d;
  border-radius: 3px;
  margin-top: 3px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1ea7fd, #58a6ff);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.stat-bar-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12));
  border-radius: 3px;
  pointer-events: none;
}

/* ── Popularity Bar ── */
.stat-popularity {
  width: 100%;
  height: 3px;
  background: #21262d;
  border-radius: 3px;
  margin-top: 3px;
  overflow: hidden;
}

.stat-popularity-fill {
  height: 100%;
  background: linear-gradient(90deg, #1db954, #1ed760);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ── Recent History ── */
.stats-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #30363d;
  border-radius: 8px;
  transition: border-color 0.2s, background 0.2s;
}

.stat-recent-item:hover {
  border-color: #8b949e;
  background: rgba(22, 27, 34, 0.7);
}

.stat-recent-img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #21262d;
}

.stat-recent-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.stat-recent-title {
  font-size: 14px;
  color: #f0f6fc;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-recent-title:hover {
  color: #58a6ff;
  text-decoration: underline;
}

.stat-recent-artist {
  font-size: 12px;
  color: #8b949e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-recent-time {
  font-size: 11px;
  color: #484f58;
  flex-shrink: 0;
  font-weight: 500;
}

/* ── Genre Distribution ── */
.genre-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.genre-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #30363d;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.genre-item:hover {
  border-color: #8b949e;
}

.genre-name {
  font-size: 13px;
  color: #f0f6fc;
  min-width: 80px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.genre-bar-bg {
  flex: 1;
  height: 8px;
  background: #21262d;
  border-radius: 4px;
  overflow: hidden;
}

.genre-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1db954, #1ed760);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.genre-count {
  font-size: 12px;
  color: #8b949e;
  font-weight: 600;
  min-width: 24px;
  text-align: right;
}

/* ── Hourly Listening Chart ── */
.hm-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 12px 4px 0;
  height: 160px;
  background: rgba(13, 17, 23, 0.3);
  border: 1px solid rgba(48, 54, 61, 0.4);
  border-radius: 8px;
  overflow: hidden;
}

.stats-section > .stats-section-header ~ .stats-section-header {
  margin-top: 16px;
}

.stats-section > .hm-chart,
.stats-section > .cloud-wrap {
  margin-bottom: 16px;
}

.stats-section > .hm-chart:last-child,
.stats-section > .cloud-wrap:last-child {
  margin-bottom: 0;
}

.hm-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 18px;
  justify-content: flex-end;
  height: 100%;
}

.hm-bar {
  width: 100%;
  max-width: 24px;
  border-radius: 3px 3px 0 0;
  background: #26a641;
  min-height: 2px;
  transition: height 0.2s, background 0.2s;
}

.hm-bar-wrap:hover .hm-bar {
  background: #39d353;
}

.hm-label {
  font-size: 11px;
  color: #8b949e;
  margin-top: 4px;
  line-height: 1;
}

/* ── Tag Cloud ── */
.cloud-wrap {
  position: relative;
  width: 100%;
  min-height: 240px;
  margin: 16px auto;
}

.cloud {
  position: absolute;
  width: 80%;
  height: 52%;
  top: 56%;
  left: 10%;
  background: #fff;
  border-radius: 100px;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.2)) drop-shadow(0 0 4px rgba(0,0,0,0.06));
  box-shadow:
    0 1px 1px rgba(0,0,0,0.12),
    0 3px 6px rgba(0,0,0,0.10),
    0 8px 20px rgba(0,0,0,0.08),
    0 18px 40px rgba(0,0,0,0.04);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
  z-index: -1;
}

.cloud-bump {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  width: 52%;
  height: 190%;
  top: -106%;
  left: 24%;
  z-index: -1;
}

.cloud::before {
  width: 44%;
  height: 160%;
  top: -84%;
  right: 8%;
}

.cloud::after {
  width: 32%;
  height: 110%;
  top: -60%;
  left: 8%;
}

.cloud .shadow {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 76%;
  height: 12px;
  background: rgba(0,0,0,0.25);
  border-radius: 50%;
  filter: blur(8px);
  z-index: -1;
}

.cloud-tags {
  position: absolute;
  top: 58%;
  left: 14%;
  right: 14%;
  bottom: 6%;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  gap: 6px 10px;
  z-index: 1;
}

.tag-item {
  color: #1f2937;
  text-decoration: none;
  transition: color 0.2s, transform 0.15s;
  display: inline-block;
  line-height: 1.4;
}

.tag-item:hover {
  color: #111827;
  transform: translateY(-1px);
}

/* ── Collapsible sections ── */
.collapsed {
  display: none;
}

/* Stagger delay via --i for buttery smooth toggle animations */
.stats-grid .stat-card {
  transition-delay: calc(var(--i, 0) * 0.04s);
}

.stats-grid .stat-card:hover {
  transition-delay: 0s;
}

.stats-grid .showing {
  opacity: 0;
  transform: translateY(14px) scale(0.93);
}

.stats-grid .hiding {
  opacity: 0;
  transform: translateY(-10px) scale(0.93);
  pointer-events: none;
}

/* ── Toggle Button ── */
.stats-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: transparent;
  border: 1px dashed #30363d;
  border-radius: 8px;
  color: #8b949e;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.stats-toggle-btn:hover {
  color: #f0f6fc;
  border-color: #8b949e;
  background: rgba(255, 255, 255, 0.03);
}

.stats-toggle-btn::after {
  content: '▾';
  font-size: 10px;
  transition: transform 0.2s;
}

.stats-toggle-btn:hover::after {
  transform: translateY(1px);
}

.stats-toggle-btn[aria-expanded="true"]::after {
  content: '▴';
}

.stats-toggle-btn[aria-expanded="true"]:hover::after {
  transform: translateY(-1px);
}

/* ── Empty State ── */
.stats-empty {
  text-align: center;
  padding: 60px 20px;
  color: #8b949e;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #30363d;
  border-radius: 12px;
}

/* ═══════════════════════════════════════════
   MOBILE-FIRST BREAKPOINTS
   ═══════════════════════════════════════════ */

/* < 480px — phone */
@media (max-width: 479px) {
  .stats-section {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 10px;
  }

  .stats-section-header {
    margin-bottom: 10px;
  }

  .stat-card-featured {
    padding: 10px 12px;
    gap: 10px;
  }

  .stat-card-featured .stat-card-img,
  .stat-card-featured .stat-card-img--round {
    width: 48px;
    height: 48px;
  }

  .stat-card-featured .stat-rank {
    font-size: 16px;
    min-width: 24px;
  }

  .stat-card-featured .stat-card-title {
    font-size: 14px;
  }

  .stat-card {
    padding: 8px 10px;
    gap: 8px;
  }

  .stat-card-img {
    width: 36px;
    height: 36px;
  }

  .stat-rank {
    font-size: 12px;
    min-width: 20px;
  }

  .stat-card-title {
    font-size: 13px;
  }

  .stat-card-artist {
    font-size: 11px;
  }

  .stats-grid {
    gap: 4px;
  }

  .cloud-wrap {
    min-height: 160px;
  }

  .cloud-tags {
    top: 20%;
    left: 8%;
    right: 8%;
    bottom: 8%;
    gap: 3px 6px;
    align-content: center;
  }

  .tag-item {
    font-size: 0.7rem !important;
  }

}

/* ≥ 480px — small tablets */
@media (min-width: 480px) {
  .stats-summary {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }

  .stat-summary-card:nth-child(n+3),
  .stat-summary-card:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .stats-grid {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .stats-grid .stat-card {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }
  .stats-grid .stat-card--expanded {
    flex: 1 1 100%;
  }

  .stat-summary-card {
    padding: 22px 14px;
  }
}

/* ≥ 640px — tablets */
@media (min-width: 640px) {
  .stats-head {
    margin-bottom: 28px;
  }

  .stats-title {
    font-size: 1.8rem;
    letter-spacing: -0.4px;
  }

  .stats-subtitle {
    font-size: 14px;
  }

  .period-tabs {
    gap: 8px;
    margin-bottom: 32px;
  }

  .period-tab {
    padding: 10px 22px;
    font-size: 14px;
    flex: none;
  }

  .stats-loading {
    padding: 70px 20px;
  }

  .stat-summary-value {
    font-size: 1.8rem;
  }

  .stat-summary-label {
    font-size: 12px;
  }

  .stats-section {
    padding: 16px;
    margin-bottom: 16px;
  }

  .stats-section-header h2 {
    font-size: 19px;
  }

  .stat-card-featured {
    gap: 18px;
    padding: 18px 20px;
  }

  .stat-card-featured .stat-rank {
    font-size: 24px;
    min-width: 36px;
  }

  .stat-card-featured .stat-card-img,
  .stat-card-featured .stat-card-img--round {
    width: 80px;
    height: 80px;
  }

  .stat-card-featured .stat-card-title {
    font-size: 19px;
  }

  .stat-card {
    gap: 14px;
    padding: 11px 14px;
  }

  .stat-rank {
    font-size: 15px;
    min-width: 28px;
  }

  .stat-card-img {
    width: 50px;
    height: 50px;
  }

  .stat-card-title {
    font-size: 15px;
  }

  .stat-recent-item {
    gap: 12px;
    padding: 9px 14px;
  }

  .stat-recent-img {
    width: 44px;
    height: 44px;
  }

  .stat-recent-title {
    font-size: 15px;
  }

  .stats-empty {
    padding: 70px 20px;
  }

  .cloud-wrap {
    min-height: 260px;
  }

}

/* ≥ 900px — desktop */
@media (min-width: 900px) {
  main {
    padding: 40px 20px 80px;
  }

  .stats-head {
    margin-bottom: 40px;
  }

  .stats-title {
    font-size: 2.8rem;
    letter-spacing: -0.5px;
  }

  .stats-subtitle {
    font-size: 16px;
  }

  .period-tabs {
    gap: 10px;
    margin-bottom: 40px;
  }

  .period-tab {
    padding: 12px 28px;
    font-size: 14px;
  }

  .stats-loading {
    padding: 80px 20px;
  }

  .stats-summary {
    gap: 16px;
    margin-bottom: 20px;
  }

  .stat-summary-card {
    padding: 28px 20px;
    gap: 6px;
  }

  .stat-summary-value {
    font-size: 2.2rem;
    letter-spacing: -0.5px;
  }

  .stat-summary-label {
    font-size: 13px;
    letter-spacing: 1px;
  }

  .stats-section {
    padding: 20px;
    margin-bottom: 20px;
  }

  .stats-section-header {
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  .stats-section-header h2 {
    font-size: 20px;
  }

  .stat-card-featured {
    gap: 24px;
    padding: 20px 24px;
    border-radius: 14px;
    margin-bottom: 10px;
  }

  .stat-card-featured .stat-rank {
    font-size: 28px;
    min-width: 40px;
  }

  .stat-card-featured .stat-card-img,
  .stat-card-featured .stat-card-img--round {
    width: 96px;
    height: 96px;
  }

  .stat-card-featured .stat-card-title {
    font-size: 22px;
  }

  .stat-card-featured .stat-card-artist {
    font-size: 15px;
  }

  .stat-card-featured .stat-card-meta {
    font-size: 14px;
  }

  .stat-card-featured .stat-bar {
    height: 5px;
    margin-top: 8px;
  }

  .stats-grid {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }
  .stats-grid .stat-card {
    flex: 1 1 calc(33.33% - 6px);
    min-width: 0;
  }
  .stats-grid .stat-card--expanded {
    flex: 1 1 100%;
  }

  .stat-card {
    gap: 16px;
    padding: 12px 16px;
  }

  .stat-rank {
    font-size: 16px;
    min-width: 32px;
  }

  .stat-card-img {
    width: 56px;
    height: 56px;
  }

  .stat-card-title {
    font-size: 15px;
  }

  .stat-card-artist {
    font-size: 13px;
  }

  .stat-card-meta {
    font-size: 12px;
  }

  .stat-bar {
    height: 4px;
    margin-top: 4px;
  }

  .stat-popularity {
    height: 4px;
    margin-top: 4px;
  }

  .stat-recent-item {
    gap: 14px;
    padding: 10px 16px;
  }

  .stat-recent-img {
    width: 48px;
    height: 48px;
  }

  .stat-recent-title {
    font-size: 15px;
  }

  .stat-recent-artist {
    font-size: 13px;
  }

  .stat-recent-time {
    font-size: 12px;
  }

  .stats-empty {
    padding: 80px 20px;
  }

  .stat-recent-item:hover {
    transform: translateX(3px);
  }

  .genre-item:hover {
    transform: translateX(2px);
  }

  .cloud-wrap {
    min-height: 280px;
  }

}

@media (max-width: 767px) {
  .header-top {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .profile-lead {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-detail {
    align-items: center;
  }

  main {
    padding-top: 24px;
  }

  .hero-name {
    font-size: 1.8rem;
  }

  .hero-avatar {
    width: 96px;
    height: 96px;
  }
}

/* ── Callout Highlight ── */
/* ── Artist Drill-Down ── */
.stat-card--expandable,
.stat-card-featured--expandable {
  cursor: pointer;
  flex-wrap: wrap;
}

.stat-card-row {
  display: flex;
  align-items: center;
  gap: inherit;
  flex: 1 1 100%;
  min-width: 0;
}

.stat-card-expand {
  margin-left: auto;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 23, 0.4);
  border-radius: 6px;
  color: #484f58;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.3s ease, background 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  line-height: 1;
  padding: 0;
  transform: scale(1);
  will-change: transform, background, color;
}

.stat-card-expand:hover {
  background: rgba(13, 17, 23, 0.6);
  color: #8b949e;
  transform: scale(1.08);
}

.stat-card-expand:active {
  transform: scale(0.93);
}

.stat-card--expandable:hover .stat-card-expand,
.stat-card-featured--expandable:hover .stat-card-expand {
  color: #8b949e;
}

.stat-card--expanded .stat-card-expand {
  transform: rotate(180deg) scale(1.15);
  background: rgba(30, 167, 253, 0.15);
  color: #58a6ff;
  box-shadow: 0 0 12px rgba(30, 167, 253, 0.3);
}

.stat-drilldown {
  display: none;
  flex-direction: column;
  background: rgba(13, 17, 23, 0.5);
  border-radius: 8px;
  flex: 1 1 100%;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: opacity, transform, max-height;
  pointer-events: none;
}

.stat-drilldown.open {
  display: flex;
  max-height: 2000px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Drill-Down States ── */
.stat-drilldown-error {
  padding: 12px;
  text-align: center;
  color: #f85149;
  font-size: 12px;
}

.stat-drilldown-empty {
  padding: 12px;
  text-align: center;
  color: #484f58;
  font-size: 12px;
}

/* ── Artist Info Drill-Down ── */
.stat-drilldown-loading {
  padding: 20px 12px;
  text-align: center;
  color: #484f58;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.stat-drilldown-loading::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #58a6ff;
  animation: drilldown-load 1.6s ease-in-out infinite;
  box-shadow:
    8px 0 0 -1px #58a6ff,
    16px 0 0 -1px #58a6ff,
    24px 0 0 -1px #58a6ff;
  will-change: transform, opacity;
}

@keyframes drilldown-load {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.stat-drilldown-artist {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: drilldown-content-enter 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s both;
}

@keyframes drilldown-content-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-drilldown-bio {
  font-size: 12px;
  color: #8b949e;
  line-height: 1.7;
  margin: 0;
  padding: 0;
}

.stat-drilldown-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 2px;
}

.stat-drilldown-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 10px;
  color: #8b949e;
  background: rgba(13, 17, 23, 0.5);
  border: 1px solid #30363d;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: lowercase;
  transition: border-color 0.15s, color 0.15s;
}

.stat-drilldown-tag:hover {
  border-color: #8b949e;
  color: #e1e4e8;
}

.stat-drilldown-similar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 6px 2px 0;
  border-top: 1px solid #21262d;
}

.stat-drilldown-similar-label {
  color: #484f58;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat-drilldown-similar-name {
  color: #58a6ff;
  text-decoration: none;
  font-size: 12px;
  transition: color 0.15s;
}

.stat-drilldown-similar-name:hover {
  color: #79c0ff;
  text-decoration: underline;
}

.stat-drilldown-similar-name:not(:last-child)::after {
  content: ',';
  color: #484f58;
  margin-left: 1px;
}

.stat-drilldown-track-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 4px;
}

.stat-drilldown-meta-stat {
  color: #8b949e;
  font-variant-numeric: tabular-nums;
}

.stat-card-title-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.stat-card-title-row > .stat-card-title {
  min-width: 0;
}

.stat-card-artist-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.stat-flag-wrap {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 18px;
  min-height: 14px;
  line-height: 0;
}

.stat-flag-icon {
  display: block;
  width: auto;
  height: 1em;
  max-height: 14px;
  border-radius: 2px;
  box-shadow: 0 0 1px rgba(0,0,0,0.4);
}

.stat-flag-icon--error {
  display: none;
}

.stat-drilldown-tracks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0 0;
  border-top: 1px solid #21262d;
}

.stat-drilldown-track {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  color: #8b949e;
  text-decoration: none;
  font-size: 12px;
  transition: background 0.15s;
}

.stat-drilldown-track:hover {
  background: rgba(13, 17, 23, 0.4);
  color: #f0f6fc;
}

.stat-drilldown-track-idx {
  color: #484f58;
  font-variant-numeric: tabular-nums;
  min-width: 16px;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.stat-drilldown-track-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-drilldown-track-dur {
  color: #484f58;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .stat-drilldown-artist {
    gap: 14px;
  }

  .stat-drilldown-bio {
    font-size: 13px;
  }
}

.stats-page .np-recent {
  margin-bottom: 28px;
}

/* ── Stats page Now Playing ── */
.stats-page .np-mini {
  margin: 0 auto 28px;
  display: flex;
}

.stats-page .np-mini-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: rgba(13, 17, 23, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 3px 6px rgba(0,0,0,0.25),
    0 8px 20px rgba(0,0,0,0.15),
    0 18px 40px rgba(0,0,0,0.08);
}

.stats-page .np-mini-main {
  padding: 26px 60px 26px 36px;
  gap: 28px;
}

.stats-page .np-mini-cover {
  width: 90px;
  height: 90px;
}

.stats-page .np-mini-inner.with-bg {
  background-size: cover;
  background-position: center;
  background-color: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.stats-page .np-mini-recent-inner {
  padding: 0 36px 20px;
}

@media (max-width: 520px) {
  .stats-page .np-mini-main {
    padding: 14px 24px 14px 18px;
    gap: 16px;
  }
  .stats-page .np-mini-cover {
    width: 56px;
    height: 56px;
  }
  .stats-page .np-mini-recent-inner {
    padding: 0 18px 14px;
  }
}

@media (max-width: 380px) {
  .stats-page .np-mini-main {
    padding: 12px 14px 12px 12px;
    gap: 10px;
  }
  .stats-page .np-mini-cover {
    width: 40px;
    height: 40px;
  }
  .stats-page .np-mini-track {
    font-size: 13px;
  }
  .stats-page .np-mini-source {
    font-size: 10px;
  }
  .stats-page .np-mini-recent-inner {
    padding: 0 12px 12px;
  }
}

.daynight-toggle {
  position: fixed;
  bottom: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  z-index: 100;
  cursor: pointer;
}

.daynight-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-track {
  width: 110px;
  height: 50px;
  background: #fff;
  border-radius: 9999px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: background 0.3s;
}

#daynight-toggle:checked ~ .toggle-track {
  background: #71717a;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  width: 40px;
  height: 40px;
  background: linear-gradient(to right, #f97316, #facc15);
  border-radius: 9999px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: all 0.3s;
}

#daynight-toggle:checked ~ .toggle-track::after {
  left: 105px;
  transform: translateX(-100%);
  background: #18181b;
}

.daynight-toggle:active .toggle-track::after {
  width: 50px;
}

.toggle-icon {
  position: absolute;
  width: 24px;
  height: 24px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.toggle-sun {
  left: 13px;
  fill: #fff;
}

#daynight-toggle:checked ~ .toggle-sun {
  opacity: 0.6;
}

.toggle-moon {
  right: 13px;
  fill: #000;
  opacity: 0.6;
}

#daynight-toggle:checked ~ .toggle-moon {
  fill: #fff;
  opacity: 0.7;
}

/* ── Back to Top ── */
.back-to-top {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 99;
  width: 45px;
  height: 45px;
  border-radius: 8px;
  background: #2a2f40;
  border: 1px solid #30363d;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, width 0.3s, border-radius 0.3s, background 0.3s, border-color 0.3s;
  overflow: hidden;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top svg {
  width: 16px;
  transition: transform 0.3s, opacity 0.3s;
}

.back-to-top:hover {
  width: 120px;
  border-radius: 8px;
  background: #000;
  border-color: #8b949e;
}

.back-to-top:hover svg {
  transform: translateY(-200%);
  opacity: 0;
}

.back-to-top::before {
  position: absolute;
  content: "Back to Top";
  color: #fff;
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  font-size: 0;
  opacity: 0;
  transition: font-size 0.3s, opacity 0.3s;
  white-space: nowrap;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.back-to-top:hover::before {
  font-size: 13px;
  opacity: 1;
}
