:root {
  color-scheme: dark;
  --bg: #14151b;
  --surface: #1c1e26;
  --surface-2: #242632;
  --border: #303342;
  --text: #f3f1f8;
  --muted: #a7a9bd;
  --accent: #c4b4ff;
  --accent-deep: #7d68cd;
  --mint: #a7e8d0;
  --error: #ffb7bd;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.skip { position: absolute; z-index: 3; left: 1rem; top: -5rem; padding: 8px; background: var(--bg); }
.skip:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.page { width: min(1192px, calc(100% - 72px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--border); background: #171820; }
.masthead-content { min-height: 68px; display: flex; align-items: center; gap: 42px; }
.brand { display: inline-flex; gap: 5px; align-items: center; font-weight: 750; letter-spacing: -.025em; text-decoration: none; white-space: nowrap; }
.brand > span:last-child { color: var(--muted); font-weight: 500; }
.brand-mark { display: inline-flex; align-items: center; gap: 3px; width: 32px; height: 32px; padding: 7px; margin-right: 5px; border-radius: 9px; background: var(--accent); }
.brand-mark i { width: 3px; height: 9px; border-radius: 4px; background: #24203c; }
.brand-mark i:nth-child(2) { height: 16px; }
.brand-mark i:nth-child(3) { height: 12px; }
.brand-mark i:nth-child(4) { height: 6px; }
nav { display: flex; gap: 23px; margin-right: auto; color: var(--muted); font-size: .88rem; }
nav a { text-decoration: none; }
nav a:hover, nav a:focus-visible { color: var(--text); }
.button, .icon-button { min-height: 40px; padding: 7px 14px; border: 1px solid transparent; border-radius: 9px; font-size: .86rem; font-weight: 650; }
.button-outline, .icon-button { color: var(--text); border-color: var(--border); background: var(--surface-2); }
.button-outline:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: #343749; }
.button-primary { color: #24203b; background: var(--accent); }
.button-primary:hover { background: #d3c7ff; }
.icon-button { min-width: 40px; padding: 0 8px; font-size: 1.35rem; line-height: 1; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 44px 0 24px; }
.eyebrow { margin: 0 0 9px; font-size: .77rem; font-weight: 650; color: var(--mint); }
.eyebrow span { display: inline-block; vertical-align: middle; width: 6px; height: 6px; margin-right: 6px; border-radius: 100%; background: var(--mint); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 5vw, 3.75rem); line-height: 1.06; letter-spacing: -.048em; font-weight: 720; }
h2 { font-size: 1.19rem; letter-spacing: -.026em; line-height: 1.22; font-weight: 680; }
.intro .muted { margin-top: 11px; }
.muted { color: var(--muted); font-size: .86rem; }
.switch { display: flex; width: fit-content; flex-shrink: 0; align-items: center; gap: 3px; padding: 4px; background: #191b23; border: 1px solid var(--border); border-radius: 10px; }
.switch button { border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 7px 11px; font-size: .82rem; font-weight: 650; white-space: nowrap; }
.switch button[aria-pressed="true"] { color: var(--text); background: #38344d; }
.switch button:hover { color: var(--text); }
.stats { margin: 0 0 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat, .panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.stat { padding: 16px 19px 15px; }
.stat dt { color: var(--muted); font-size: .83rem; }
.stat dd { margin: 3px 0 0; color: var(--text); font-size: clamp(1.45rem, 3vw, 2.35rem); font-weight: 660; line-height: 1.23; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.stat:first-child dd { color: var(--accent); }
.report-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.activity, .genres { align-self: stretch; }
.panel { padding: 20px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel h2 + .muted { margin-top: 5px; }
.compact button { padding: 5px 8px; font-size: .77rem; }
.chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); column-gap: 5px; margin-top: 21px; }
.chart-month { background: none; border: 0; padding: 0; color: var(--muted); min-width: 0; font-size: .69rem; text-align: center; }
.chart-column { display: flex; align-items: flex-end; justify-content: center; height: 141px; border-bottom: 1px solid var(--border); background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), #303342 25%); }
.bar { width: min(70%, 36px); max-height: 100%; border-radius: 5px 5px 0 0; background: linear-gradient(0deg, #705abc, #a18aeb); }
.chart-month[aria-pressed="true"] .bar, .chart-month:hover .bar { background: linear-gradient(0deg, #8e76e2, #d5c8ff); }
.chart-month[aria-pressed="true"] .month-label { color: var(--accent); }
.month-label { display: block; min-height: 22px; white-space: nowrap; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; }
.chart-detail { color: var(--muted); font-size: .82rem; min-height: 22px; margin-top: 5px; }
.chart-detail strong { color: var(--text); }
.rankings { display: grid; gap: 10px; padding: 0; margin: 15px 0 0; list-style: none; }
.rank-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .84rem; }
.rank-row strong { color: var(--text); font-weight: 590; overflow-wrap: anywhere; }
.rank-row small { color: var(--muted); font-size: .77rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rankings progress { display: block; width: 100%; height: 5px; margin-top: 4px; border: 0; border-radius: 8px; overflow: hidden; appearance: none; background: #313345; }
.rankings ::-webkit-progress-bar { background: #313345; }
.rankings ::-webkit-progress-value { background: var(--accent-deep); border-radius: 8px; }
.rankings ::-moz-progress-bar { background: var(--accent-deep); }
.artist-list li { padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.artist-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.search, select, input[type="file"] { color: var(--text); border: 1px solid var(--border); border-radius: 8px; background: #181a21; padding: 8px 10px; min-height: 40px; }
.search { width: min(100%, 235px); font-size: .82rem; }
.search::placeholder { color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 13px 0 0; }
table { width: 100%; border-collapse: collapse; table-layout: auto; text-align: left; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--border); font-size: .82rem; }
th { color: var(--muted); font-weight: 590; }
th:first-child, td:first-child { width: 33px; padding-left: 0; }
th:last-child, td:last-child { text-align: right; white-space: nowrap; padding-right: 0; }
td strong { display: block; font-size: .86rem; font-weight: 620; overflow-wrap: anywhere; }
td .muted { font-size: .76rem; overflow-wrap: anywhere; }
td a { color: var(--accent); }
.check { accent-color: var(--accent); width: 15px; height: 15px; margin: 0 3px; vertical-align: middle; }
.library-footer, .pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.library-footer { margin-top: 14px; }
.pagination span { min-width: 24px; text-align: center; font-size: .84rem; color: var(--muted); }
.empty { padding: 30px; border-style: dashed; }
.empty p { margin: 8px 0 17px; }
.notice { padding: 10px 12px; margin-bottom: 16px; background: var(--surface-2); border-radius: 8px; }
.error { color: var(--error); }
.footer { display: flex; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 30px; margin-bottom: 20px; padding-top: 13px; font-size: .75rem; color: var(--muted); }
dialog { width: min(465px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 25px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
dialog::backdrop { background: #090a10bb; }
dialog h2 { padding-right: 38px; }
.dialog-close { position: absolute; top: 13px; right: 13px; }
#import-form { display: grid; gap: 9px; margin-top: 15px; }
#import-form > label { font-size: .85rem; }
#import-form > button { justify-self: start; margin-top: 5px; }
#import-results { margin-top: 12px; overflow-wrap: anywhere; font-size: .85rem; }
.consent, #playlist-result { margin-top: 12px; font-size: .85rem; color: var(--muted); }
.consent input { accent-color: var(--accent); }
.consent label { display: block; margin-top: 6px; }

@media (max-width: 850px) {
  .page { width: min(100% - 40px, 1192px); }
  .report-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 570px) {
  .page { width: calc(100% - 28px); }
  .masthead-content { gap: 8px; min-height: 60px; justify-content: space-between; }
  nav { display: none; }
  .intro { flex-direction: column; align-items: start; gap: 14px; padding: 27px 0 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat, .panel { padding: 13px; }
  .panel-head { align-items: start; flex-wrap: wrap; }
  .chart { column-gap: 1px; }
  .month-label { font-size: .62rem; }
  th, td { padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.account-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.account-form { display: grid; gap: 9px; margin-top: 15px; }
.account-form label { font-size: .85rem; }
.account-form button { justify-self: start; }
.account-form .field { width: 100%; color: var(--text); border: 1px solid var(--border); border-radius: 8px; background: #181a21; padding: 8px 10px; min-height: 40px; }
.account-form [role="alert"]:empty { display: none; }
.live-activity { margin-bottom: 18px; }
.live-activity .rankings { margin-top: 8px; }
@media (max-width: 570px) {
  .masthead-content:has(#logout:not([hidden])) { flex-wrap: wrap; padding-block: 9px; }
  .masthead-content:has(#logout:not([hidden])) .account-actions { justify-content: flex-start; }
}
