/* First.fm — layout modelled on Last.fm's structure, with an original purple accent.
   No Last.fm assets, logos, images or branding are used. */
:root {
  --page-bg: #111111;
  --masthead-bg: #000000;
  --surface: #ffffff;
  --ink: #222222;
  --muted: #767676;
  --line: #e6e6e6;
  --soft: #f7f7f7;
  --link: #005399;
  --purple: #8b2fd8;
  --purple-dark: #6b1fb0;
  --purple-soft: #f5edff;
  --danger: #c62828;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font: 14px/1.5 Barlow, "Open Sans", "Lucida Grande", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 10px; line-height: 1.25; color: var(--ink); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p { margin: 0 0 12px; }
small { font-size: 12px; }
code, pre { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
code { background: var(--soft); padding: 1px 4px; border-radius: 2px; }
pre { background: #1b1b1b; color: #eaeaea; border: 1px solid #333; padding: 12px; overflow-x: auto; border-radius: 3px; }
pre code { background: none; color: inherit; padding: 0; }
.muted { color: var(--muted); }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.error-text { color: var(--danger); }

.container { width: min(1000px, calc(100% - 30px)); margin: 0 auto; }

/* ----------------------------------------------------------- masthead --- */
.masthead { background: var(--masthead-bg); color: #fff; height: 48px; }
.masthead-inner { height: 48px; display: flex; align-items: center; gap: 14px; }
.masthead-logo { display: flex; align-items: center; }
.masthead-logo a { display: flex; align-items: center; height: 48px; }
.masthead-logo img {
  display: block; height: 28px; width: auto; max-width: 180px;
  object-fit: contain;
}
.masthead-logo a:hover img { opacity: .85; }
.masthead-nav { display: flex; align-items: center; gap: 2px; }
.masthead-nav a, .masthead-account a, .masthead-account button {
  color: #ddd;
  font-size: 13px;
  padding: 6px 9px;
  white-space: nowrap;
}
.masthead-nav a:hover, .masthead-account a:hover, .masthead-account button:hover { color: #fff; text-decoration: none; }
.masthead-nav a.active { color: var(--purple); font-weight: 700; }
.masthead-search { display: flex; margin-left: auto; height: 34px; }
.masthead-search input {
  width: 210px; height: 34px; border: 0; border-radius: 3px 0 0 3px;
  background: #2b2b2b; color: #fff; padding: 0 10px; font-size: 13px; outline: none;
}
.masthead-search input::placeholder { color: #aaa; }
.masthead-search input:focus { background: #333; }
.masthead-search button {
  width: 72px; height: 34px; border: 0; border-radius: 0 3px 3px 0;
  background: var(--purple); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
}
.masthead-search button:hover { background: var(--purple-dark); }
.masthead-account { display: flex; align-items: center; gap: 2px; }
.masthead-account .signup { color: var(--purple); font-weight: 700; }
.masthead-account form { display: inline; }
.masthead-account button { background: none; border: 0; cursor: pointer; font: inherit; }

/* -------------------------------------------------------- main surface --- */
.main-content { background: var(--surface); min-height: 620px; padding: 48px 0 0; }
.page-content { padding: 18px 0 48px; }
.row { display: flex; gap: 26px; align-items: flex-start; }
.col-main { flex: 1; min-width: 0; }
.col-sidebar { width: 280px; flex: none; }
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 12px; }

/* ------------------------------------------------------- profile header --- */
.header {
  background: var(--surface);
  margin: -48px 0 0;
  padding: 20px 0 0;
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; gap: 18px; align-items: flex-start; }
.header-avatar {
  width: 120px; height: 120px; flex: none;
  background: linear-gradient(135deg, #d9c2f5, #b48ae4);
  color: #4b2478; display: grid; place-items: center;
  font-size: 48px; font-weight: 700; border: 1px solid #cbb2e8;
}
.header-info { padding-top: 4px; }
.header-title { margin: 0 0 4px; font-size: 26px; }
.header-title a { color: var(--ink); }
.header-title small { font-weight: 400; color: var(--muted); font-size: 15px; }
.header-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 0 4px; }
.header-stats div { min-width: 72px; }
.header-stats strong { display: block; font-size: 19px; color: var(--purple); }
.header-stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.header-bio { max-width: 620px; margin: 8px 0 0; color: #444; }
.secondary-nav { border-top: 1px solid var(--line); margin-top: 16px; }
.secondary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.secondary-nav li { margin-bottom: -1px; }
.secondary-nav a {
  display: block; padding: 11px 12px; color: var(--ink); font-weight: 700; font-size: 13px;
  border-bottom: 3px solid transparent;
}
.secondary-nav a:hover { text-decoration: none; border-bottom-color: #d9c2f5; }
.secondary-nav li.active a { border-bottom-color: var(--purple); color: var(--purple); }

/* ----------------------------------------------------------- chartlist --- */
.chartlist { width: 100%; border-collapse: collapse; }
.chartlist tr { height: 62px; border-bottom: 1px solid var(--line); }
.chartlist tr:hover { background: var(--soft); }
.chartlist td { padding: 7px 8px; vertical-align: middle; }
.chartlist .cell-image { width: 46px; padding-right: 0; }
.chartlist .cell-rank { width: 30px; color: var(--muted); font-weight: 700; text-align: right; }
.chartlist .cell-main { width: auto; }
.chartlist .cell-right { text-align: right; color: var(--muted); white-space: nowrap; font-size: 12px; }
.chartlist .name { font-weight: 700; font-size: 14px; display: block; }
.chartlist .sub { color: var(--muted); font-size: 12px; display: block; }
.chartlist .cover {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: #e8dcf5; color: #6b3fa0; font-weight: 700; font-size: 16px; border: 1px solid #d8c6ec;
}
.simple-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.simple-table th {
  text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; padding: 8px; border-bottom: 1px solid var(--line);
}
.simple-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.simple-table tr:hover td { background: var(--soft); }
.simple-table td.rank { color: var(--muted); font-weight: 700; width: 34px; }
.simple-table td.right, .simple-table th.right { text-align: right; white-space: nowrap; }

/* -------------------------------------------------------------- blocks --- */
.pill { display: inline-block; padding: 1px 7px; border-radius: 2px; background: var(--purple-soft); color: var(--purple-dark); font-size: 11px; font-weight: 700; }
.pill.off { background: #eee; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 13px; border: 1px solid #ccc; border-radius: 3px; background: #f7f7f7;
  color: var(--ink); font: 700 13px/1.2 inherit; cursor: pointer;
}
.btn:hover { background: #eee; text-decoration: none; }
.btn-primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-dark); color: #fff; }
.btn-danger { background: #fff; border-color: #e0b4b4; color: var(--danger); }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-xs { padding: 3px 7px; font-size: 11px; }
.btn-block { width: 100%; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.button-row form { margin: 0; }

.module { border: 1px solid var(--line); padding: 16px; margin-bottom: 20px; background: #fff; }
.module h2 { margin-top: 0; }
.module.flush { padding: 0; }
.module.flush > h2 { padding: 14px 16px 0; }
.notice { background: var(--purple-soft); border-left: 4px solid var(--purple); padding: 12px 14px; margin: 0 0 20px; }
.notice p:last-child { margin-bottom: 0; }
.flash { padding: 10px 12px; border-left: 4px solid var(--purple); background: var(--purple-soft); margin-bottom: 16px; }
.flash-error { border-left-color: var(--danger); background: #fff0f0; color: #8b1c1c; }
.flash-success { border-left-color: #2e9e5b; background: #eef9f1; color: #1d6b3c; }
.new-key code { display: block; margin-top: 8px; padding: 8px; word-break: break-all; background: #fff; }
.empty-state { padding: 28px 12px; text-align: center; color: var(--muted); }
.empty-state.big { padding: 80px 12px; }
.empty-state.big h1 { font-size: 64px; color: var(--purple); }

/* --------------------------------------------------------------- forms --- */
.stack-form { display: flex; flex-direction: column; gap: 7px; }
.stack-form label, .form-label { font-weight: 700; font-size: 12.5px; margin-top: 6px; }
input, textarea, select {
  width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 3px;
  background: #fff; color: var(--ink); font: 14px/1.4 inherit; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--purple); box-shadow: 0 0 0 2px rgba(139,47,216,.12); }
input[type="file"] { padding: 7px; background: var(--soft); }
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.filter-bar label { font-weight: 700; font-size: 12px; margin: 0; }
.filter-bar select, .filter-bar input[type="search"] { width: auto; min-width: 150px; }
.tabs { display: flex; gap: 3px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 11px; font-weight: 700; font-size: 12.5px; color: #444; border-bottom: 3px solid transparent; }
.tabs a.active { color: var(--purple); border-bottom-color: var(--purple); }
.tabs a:hover { text-decoration: none; border-bottom-color: #d9c2f5; }
.detail-list { display: grid; grid-template-columns: 120px 1fr; gap: 5px 10px; margin: 12px 0 0; font-size: 13px; }
.detail-list dt { color: var(--muted); }
.steps { padding-left: 20px; color: #444; }
.steps li { margin-bottom: 6px; }
.danger-zone { border-top: 1px solid #f0d5d5; padding-top: 12px; margin-top: 18px; }

/* ---------------------------------------------------------------- home --- */
.home-intro { border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 24px; }
.home-intro h1 { font-size: 30px; margin-bottom: 6px; }
.home-intro h1 .accent { color: var(--purple); }
.home-intro p { max-width: 720px; color: #444; font-size: 15px; }
.home-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.stat-strip { display: flex; gap: 0; border: 1px solid var(--line); margin-bottom: 26px; }
.stat-strip div { flex: 1; padding: 14px; border-right: 1px solid var(--line); text-align: center; }
.stat-strip div:last-child { border-right: 0; }
.stat-strip strong { display: block; font-size: 21px; color: var(--purple); }
.stat-strip span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature-grid h3 { color: var(--purple); }
.feature-grid p { color: #555; margin: 0; }

/* --------------------------------------------------------------- auth --- */
.auth-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; max-width: 900px; margin: 24px auto; }
.auth-layout .module { margin-bottom: 0; }
.auth-aside { background: var(--purple-soft); border-color: #e2ccfa; }
.auth-aside h2 { color: var(--purple-dark); }

/* --------------------------------------------------------------- docs --- */
.docs-layout { display: flex; gap: 26px; align-items: flex-start; }
.docs-nav { width: 190px; flex: none; position: sticky; top: 16px; border: 1px solid var(--line); padding: 12px; }
.docs-nav strong { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.docs-nav a { display: block; font-size: 13px; padding: 4px 0; }
.docs-body { flex: 1; min-width: 0; }
.docs-section { margin-bottom: 24px; scroll-margin-top: 16px; }
.method { display: inline-block; min-width: 46px; text-align: center; padding: 1px 5px; border-radius: 2px; font-size: 10px; font-weight: 700; }
.method.get { background: #e7f4ea; color: #237a3d; }
.method.post { background: var(--purple-soft); color: var(--purple-dark); }
.method.del { background: #fdeaea; color: var(--danger); }
.legal-body { max-width: 820px; line-height: 1.7; }
.legal-body h2 { margin-top: 24px; color: var(--purple-dark); }
.legal-body ul { padding-left: 20px; }

/* ------------------------------------------------------------ pagination --- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* --------------------------------------------------------------- footer --- */
.footer { background: #111; color: #fff; padding: 30px 0 22px; margin-top: 0; }
.footer-top { display: flex; gap: 30px; flex-wrap: wrap; padding-bottom: 24px; }
.footer-col { min-width: 150px; flex: 1; }
.footer-heading { color: #fff; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 10px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 5px; }
.footer-links a { color: #bbb; font-size: 12.5px; }
.footer-links a:hover { color: var(--purple); text-decoration: none; }
.footer-bottom { border-top: 1px solid #333; padding-top: 14px; color: #888; font-size: 11.5px; }

@media (max-width: 860px) {
  .masthead-nav { display: none; }
  .row, .auth-layout, .docs-layout, .feature-grid { flex-direction: column; display: flex; }
  .col-sidebar, .docs-nav { width: 100%; position: static; }
  .masthead-search input { width: 140px; }
}
@media (max-width: 560px) {
  .masthead-search { display: none; }
  .header-avatar { width: 80px; height: 80px; font-size: 32px; }
  .header-stats { gap: 10px; }
  .stat-strip { flex-wrap: wrap; }
  .stat-strip div { min-width: 50%; border-bottom: 1px solid var(--line); }
}

/* ------------------------------------------------------- live importer --- */
[hidden] { display: none !important; }

.import-progress {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #e2ccfa;
  background: linear-gradient(180deg, #fbf7ff 0%, #fff 100%);
  border-radius: 3px;
}
.import-progress-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.import-progress-head .pill { flex: none; min-width: 48px; text-align: center; }

.loader {
  width: 30px; height: 30px; flex: none;
  border: 3px solid #e6d4f7;
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.import-progress.is-done .loader {
  border-color: #bfe6cd;
  border-top-color: #2e9e5b;
  animation-duration: 1.8s;
}
.import-progress.is-error .loader {
  border-color: #f4cccc;
  border-top-color: var(--danger);
  animation: none;
}

.progress-track {
  height: 9px;
  background: #ece3f6;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.progress-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--purple-dark), var(--purple), #b96bff);
  background-size: 200% 100%;
  transition: width .45s ease;
  animation: flow 2s linear infinite;
}
@keyframes flow { to { background-position: -200% 0; } }
.import-progress.is-done .progress-fill { background: #2e9e5b; animation: none; }
.import-progress.is-error .progress-fill { background: var(--danger); animation: none; }

.import-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.import-progress-grid div {
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 2px;
}
.import-progress-grid span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.import-progress-grid strong { font-size: 14px; color: var(--purple-dark); }

.import-current {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 10px;
  background: #1e1e1e;
  color: #fff;
  border-radius: 2px;
  min-height: 36px;
  overflow: hidden;
}
.import-current .muted { color: #aaa; }
.import-current strong {
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.equalizer { display: flex; align-items: flex-end; gap: 2px; height: 14px; flex: none; }
.equalizer i {
  display: block; width: 3px; height: 4px; background: #b96bff;
  animation: bounce .7s ease-in-out infinite alternate;
}
.equalizer i:nth-child(2) { animation-delay: .18s; }
.equalizer i:nth-child(3) { animation-delay: .36s; }
.equalizer i:nth-child(4) { animation-delay: .12s; }
@keyframes bounce { from { height: 3px; } to { height: 14px; } }
.import-progress.is-done .equalizer i,
.import-progress.is-error .equalizer i { animation: none; height: 4px; }

.import-progress-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px;
}
.import-progress-foot small { max-width: 620px; }

.btn .btn-spinner {
  display: none;
  width: 12px; height: 12px; margin-left: 7px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}
.btn.loading { opacity: .75; pointer-events: none; }
.btn.loading .btn-spinner { display: inline-block; }

@media (max-width: 620px) {
  .import-progress-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-progress-foot { flex-direction: column; align-items: flex-start; }
}

/* ---------------------------------------------------------- music pages --- */
.cover-img {
  width: 40px; height: 40px; display: block; object-fit: cover;
  border: 1px solid #d8c6ec; background: var(--purple-soft);
}
.cover-img.cover-hero {
  width: 120px; height: 120px; border: 1px solid #cbb2e8;
}
.cover-img.cover-album { width: 100%; height: 100%; }
.simple-table .cover-img, .simple-table .cover { width: 24px; height: 24px; display: inline-block; vertical-align: -7px; margin-right: 6px; font-size: 11px; }
.simple-table .cover { display: inline-grid; place-items: center; }

.music-header .music-artwork { width: 120px; height: 120px; flex: none; }
.music-header .music-artwork .cover {
  width: 120px; height: 120px; display: grid; place-items: center;
  background: linear-gradient(135deg, #d9c2f5, #b48ae4);
  color: #4b2478; font-size: 48px; font-weight: 700; border: 1px solid #cbb2e8;
}
.eyebrow {
  margin: 0 0 2px; color: var(--purple-dark); font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
.music-bio { color: #444; line-height: 1.7; }
.music-list .cell-action { width: 44px; text-align: right; white-space: nowrap; }
.track-actions { display: inline-flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 28px; height: 28px; padding: 0; display: inline-grid; place-items: center;
  border: 1px solid #d8c6ec; border-radius: 50%; background: #fff;
  color: var(--purple-dark); font-size: 13px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: var(--purple-soft); text-decoration: none; }
.icon-btn.loved { background: var(--purple); border-color: var(--purple); color: #fff; }
.icon-btn.playing { animation: pulse .8s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.btn.love-btn.loved { background: var(--purple-soft); border-color: var(--purple); color: var(--purple-dark); }

.album-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.album-card {
  display: flex; flex-direction: column; gap: 4px; color: var(--ink);
  padding: 8px; border: 1px solid var(--line); background: #fff;
}
.album-card:hover { border-color: var(--purple); text-decoration: none; }
.album-card .cover-img, .album-card .cover {
  width: 100%; aspect-ratio: 1; height: auto; display: grid; place-items: center;
  font-size: 40px; font-weight: 700; color: #6b3fa0; background: #e8dcf5;
}
.album-card-name { font-weight: 700; font-size: 13px; line-height: 1.3; }
.album-card .muted { font-size: 11px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }

@media (max-width: 860px) {
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .music-header .header-inner { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .music-header .music-artwork, .music-header .music-artwork .cover-hero, .music-header .music-artwork .cover {
    width: 80px; height: 80px; font-size: 32px;
  }
  .album-grid { grid-template-columns: 1fr 1fr; }
}

/* Conversion popup */
.convert-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.convert-btn { padding: 4px 9px; font-size: 12px; }
.convert-overlay {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: rgba(10, 6, 16, .72); padding: 18px;
}
.convert-overlay[hidden] { display: none; }
.convert-dialog {
  width: min(440px, 100%); padding: 22px; background: #fff; border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.convert-dialog h2 { margin: 0 0 8px; font-size: 20px; }
.convert-title { margin: 0 0 16px; color: #666; font-size: 13px; word-break: break-word; }
.convert-progress { height: 10px; background: #ece3f5; border-radius: 999px; overflow: hidden; }
.convert-progress > span {
  display: block; height: 100%; width: 0; background: var(--purple); transition: width .2s ease;
}
.convert-progress.indeterminate > span { width: 35%; animation: convert-slide 1.1s ease-in-out infinite; }
@keyframes convert-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.convert-status { margin: 12px 0 0; font-size: 13px; color: #444; min-height: 18px; }
.convert-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@media (prefers-reduced-motion: reduce) {
  .convert-progress.indeterminate > span { animation: none; width: 100%; opacity: .6; }
}
