@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=Space+Mono:wght@400;700&display=swap');

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

:root {
  --bg:           #0D0D0D;
  --surface:      #181818;
  --surface-2:    #222222;
  --surface-h:    #2a2a2a;
  --green:        #1DB954;
  --green-dim:    rgba(29,185,84,.12);
  --green-glow:   rgba(29,185,84,.25);
  --text:         #FFFFFF;
  --muted:        #A7A7A7;
  --faint:        #525252;
  --border:       rgba(255,255,255,.07);
  --radius:       12px;
  --pad:          22px;
  --sidebar-w:    270px;
}

html { font-size:16px; scroll-behavior:smooth; height:100%; }
body {
  background:var(--bg); color:var(--text);
  font-family:'DM Sans',sans-serif;
  height:100vh; overflow:hidden;
  display:flex; flex-direction:column;
  -webkit-font-smoothing:antialiased;
}
body::before {
  content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  opacity:.4;
}

/* ── Header ─────────────────────────────────────── */
.header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px var(--pad) 0; position:relative; z-index:1;
}
.profile-brand { display:flex; align-items:center; gap:13px; }
.profile-avatar {
  width:40px; height:40px; border-radius:50%; flex-shrink:0;
  background:linear-gradient(135deg,var(--green) 0%,#0e8035 100%);
  display:flex; align-items:center; justify-content:center;
  font-family:'Space Mono',monospace; font-size:.68rem; font-weight:700; color:#000;
  box-shadow:0 0 18px var(--green-glow);
}
.profile-name-wrap { display:flex; flex-direction:column; gap:1px; }
.profile-name { font-family:'Bebas Neue',sans-serif; font-size:1.2rem; letter-spacing:.06em; line-height:1; }
.profile-sub  { font-size:.65rem; color:var(--faint); letter-spacing:.08em; text-transform:uppercase; }
.header-right { display:flex; align-items:center; gap:10px; }
.powered-by { display:flex; align-items:center; gap:5px; font-size:.68rem; color:var(--faint); }

/* ── Live badge ──────────────────────────────────── */
.live-badge {
  display:flex; align-items:center; gap:6px;
  font-family:'Space Mono',monospace; font-size:.6rem; letter-spacing:.12em;
  color:var(--faint); padding:5px 11px; border:1px solid var(--border); border-radius:999px;
  transition:color .3s,border-color .3s;
}
.live-badge.active { color:var(--green); border-color:rgba(29,185,84,.3); }
.live-badge.paused { color:var(--muted); border-color:rgba(255,255,255,.15); }
.live-dot { width:6px; height:6px; border-radius:50%; background:var(--faint); flex-shrink:0; transition:background .3s; }
.live-badge.active .live-dot { background:var(--green); box-shadow:0 0 5px var(--green); animation:pulse 2s infinite; }
.live-badge.paused .live-dot { background:var(--muted); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Now Playing ─────────────────────────────────── */
.full-width-wrap { padding:12px var(--pad) 0; position:relative; z-index:1; }

.now-playing-inner {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); overflow:hidden;
  min-height:72px; display:flex; align-items:center;
}
.np-placeholder { padding:16px; color:var(--faint); font-size:.8rem; width:100%; text-align:center; }
.np-card { display:flex; align-items:center; gap:12px; padding:12px 16px; width:100%; animation:fadeUp .35s both; }
.np-art { width:48px; height:48px; border-radius:7px; object-fit:cover; flex-shrink:0; box-shadow:0 4px 20px rgba(0,0,0,.6); }
.np-art-placeholder { width:48px; height:48px; border-radius:7px; background:var(--surface-2); flex-shrink:0; display:flex; align-items:center; justify-content:center; color:var(--faint); font-size:1.15rem; }
.np-info { flex:1; min-width:0; }
.np-label { font-family:'Space Mono',monospace; font-size:.56rem; letter-spacing:.16em; color:var(--green); margin-bottom:3px; }
.np-track  { font-size:.94rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.np-artist { font-size:.74rem; color:var(--muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.np-progress-wrap { margin-top:7px; display:flex; align-items:center; gap:7px; }
.np-progress-bar { flex:1; height:3px; background:var(--surface-2); border-radius:99px; overflow:hidden; }
.np-progress-fill { height:100%; background:var(--green); border-radius:99px; transition:width .5s linear; }
.np-time { font-family:'Space Mono',monospace; font-size:.58rem; color:var(--faint); white-space:nowrap; }
.np-album { font-size:.68rem; color:var(--faint); text-align:right; min-width:100px; max-width:150px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex-shrink:0; }

/* ── Stats bar ───────────────────────────────────── */
.stats-bar { display:flex; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.stat-chip { flex:1; display:flex; flex-direction:column; align-items:center; gap:1px; padding:9px 6px; }
.stat-divider { width:1px; background:var(--border); margin:10px 0; }
.stat-value { font-family:'Bebas Neue',sans-serif; font-size:1.45rem; letter-spacing:.02em; color:var(--green); line-height:1; }
.stat-label { font-size:.6rem; color:var(--faint); text-transform:uppercase; letter-spacing:.1em; text-align:center; }

/* ── Page layout ─────────────────────────────────── */
.page-layout {
  display:flex; gap:14px;
  padding:12px var(--pad) 12px;
  position:relative; z-index:1;
  align-items:stretch;
  flex:1; min-height:0; overflow:hidden;
}
.main-col { flex:1; min-width:0; display:grid; grid-template-rows:repeat(2, minmax(0, 1fr)); gap:12px; min-height:0; overflow:hidden; }

/* ── Sections inside main ────────────────────────── */
.panel-section { display:flex; flex-direction:column; gap:8px; }

.two-col-grid {
  display:grid; grid-template-columns:1fr 1fr; gap:12px;
  align-items:stretch; min-height:0; overflow:hidden;
}
.two-col-grid .panel-section { height:100%; min-height:0; overflow:hidden; }
.two-col-grid .panel { flex:1; display:flex; flex-direction:column; min-height:0; overflow:hidden; }
.two-col-grid .item-list { flex:1; overflow-y:auto; max-height:none; scrollbar-width:thin; scrollbar-color:var(--surface-2) transparent; }
.two-col-grid .item-list::-webkit-scrollbar { width:3px; }
.two-col-grid .item-list::-webkit-scrollbar-thumb { background:var(--surface-2); border-radius:99px; }
.two-col-grid .genre-grid { overflow-y:auto; max-height:none; flex:1; min-height:0; }

.section-hd {
  display:flex; align-items:flex-start; justify-content:space-between;
  flex-wrap:wrap; gap:6px;
}
.section-title { font-family:'Bebas Neue',sans-serif; font-size:1.1rem; letter-spacing:.05em; line-height:1; }
.section-sub   { font-size:.64rem; color:var(--faint); margin-top:1px; }

/* ── Panel ───────────────────────────────────────── */
.panel { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }

/* ── Filters ─────────────────────────────────────── */
.filters { display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.filter-btn {
  padding:3px 10px; border-radius:999px; border:1px solid var(--border);
  background:transparent; color:var(--muted);
  font-family:'DM Sans',sans-serif; font-size:.68rem; font-weight:500;
  cursor:pointer; transition:all .2s; white-space:nowrap;
}
.filter-btn:hover { background:var(--surface-2); color:var(--text); border-color:rgba(255,255,255,.15); }
.filter-btn.active { background:var(--green); border-color:var(--green); color:#000; font-weight:700; }

/* ── Item list ───────────────────────────────────── */
.item-list { list-style:none; }
.item {
  display:flex; align-items:center; gap:12px;
  padding:8px 14px; border-bottom:1px solid var(--border);
  transition:background .15s; animation:fadeUp .4s both;
}
.item:last-child { border-bottom:none; }
.item:hover { background:var(--surface-h); }

.item:nth-child(1)  { animation-delay:.03s; }
.item:nth-child(2)  { animation-delay:.06s; }
.item:nth-child(3)  { animation-delay:.09s; }
.item:nth-child(4)  { animation-delay:.12s; }
.item:nth-child(5)  { animation-delay:.15s; }
.item:nth-child(6)  { animation-delay:.18s; }
.item:nth-child(7)  { animation-delay:.21s; }
.item:nth-child(8)  { animation-delay:.24s; }
.item:nth-child(9)  { animation-delay:.27s; }
.item:nth-child(10) { animation-delay:.30s; }

.item-rank { font-family:'Space Mono',monospace; font-size:.62rem; font-weight:700; color:var(--faint); width:14px; text-align:right; flex-shrink:0; }
.item:nth-child(1) .item-rank { color:var(--green); }
.item:nth-child(2) .item-rank { color:#B0B0B0; }
.item:nth-child(3) .item-rank { color:#CD7F32; }

.item-img { width:34px; height:34px; border-radius:5px; object-fit:cover; background:var(--surface-2); flex-shrink:0; }
.item-img.circle { border-radius:50%; }
.item-img-placeholder { width:34px; height:34px; border-radius:5px; background:var(--surface-2); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:.58rem; font-weight:700; color:var(--faint); }
.item-img-placeholder.circle { border-radius:50%; }

.item-info { flex:1; min-width:0; }
.item-name { font-size:.76rem; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.item-sub  { font-size:.65rem; color:var(--muted); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.item-bar-wrap { width:42px; flex-shrink:0; }
.item-bar-track { height:3px; background:var(--surface-2); border-radius:99px; overflow:hidden; }
.item-bar-fill { height:100%; background:var(--green); border-radius:99px; width:0; transition:width .7s cubic-bezier(.22,1,.36,1); }
.item-pop { font-family:'Space Mono',monospace; font-size:.58rem; color:var(--faint); margin-top:3px; text-align:right; }

.new-tag { font-family:'Space Mono',monospace; font-size:.52rem; font-weight:700; letter-spacing:.1em; color:var(--green); background:var(--green-dim); padding:2px 7px; border-radius:99px; flex-shrink:0; }

/* ── Genres ──────────────────────────────────────── */
.genre-grid { display:flex; flex-direction:column; gap:9px; padding:16px 20px; }
.genre-row { display:flex; align-items:center; gap:10px; animation:fadeUp .4s both; }
.genre-rank { font-family:'Space Mono',monospace; font-size:.6rem; color:var(--faint); width:16px; text-align:right; flex-shrink:0; }
.genre-name { font-size:.78rem; font-weight:500; text-transform:capitalize; width:130px; flex-shrink:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.era-label  { font-family:'Bebas Neue',sans-serif; font-size:.95rem; letter-spacing:.04em; width:80px; }
.genre-bar-wrap { flex:1; }
.genre-bar-track { height:3px; background:var(--surface-2); border-radius:99px; overflow:hidden; }
.genre-bar-fill { height:100%; background:linear-gradient(90deg,var(--green),#18e05a); border-radius:99px; width:0; transition:width .8s cubic-bezier(.22,1,.36,1); }
.genre-count { font-family:'Space Mono',monospace; font-size:.58rem; color:var(--faint); width:30px; text-align:right; flex-shrink:0; }

/* ── Peak hours ──────────────────────────────────── */
.hours-panel { padding:18px 18px 8px; }
.hours-chart { display:flex; align-items:flex-end; gap:2px; height:72px; }
.hour-bar-wrap { flex:1; height:100%; display:flex; align-items:flex-end; cursor:default; }
.hour-bar { width:100%; min-height:2px; border-radius:3px 3px 0 0; background:var(--green); opacity:.25; transition:opacity .2s; }
.hour-bar-wrap:hover .hour-bar { opacity:.7; }
.hours-labels { position:relative; height:18px; margin-top:3px; }
.hour-label { position:absolute; transform:translateX(-50%); font-family:'Space Mono',monospace; font-size:.52rem; color:var(--faint); }

/* ── Personality ─────────────────────────────────── */
.personality-tags { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:12px; }
.personality-tag {
  font-size:.75rem; font-weight:600; padding:5px 12px;
  border-radius:999px; border:1px solid; letter-spacing:.02em;
}
.personality-desc { font-size:.78rem; color:var(--muted); line-height:1.5; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar-col {
  width:var(--sidebar-w); flex-shrink:0;
  height:100%;
  display:flex; flex-direction:column; gap:14px;
  overflow:hidden;
}

.sidebar-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); overflow:hidden;
  display:flex; flex-direction:column;
}
.sidebar-log-card { flex:1; min-height:0; }

.sidebar-hd {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px 8px; border-bottom:1px solid var(--border);
  flex-shrink:0;
}
.sidebar-title { font-family:'Bebas Neue',sans-serif; font-size:1.05rem; letter-spacing:.05em; }
.sidebar-badge { font-family:'Space Mono',monospace; font-size:.58rem; color:var(--faint); }

.sidebar-threshold-note {
  display:flex; align-items:center; gap:6px;
  padding:6px 14px 5px; border-bottom:1px solid var(--border);
  font-size:.62rem; color:var(--faint); background:var(--surface-2);
  flex-shrink:0;
}
.threshold-icon { font-size:.75rem; }

/* ── Log list (sidebar) ──────────────────────────── */
.log-list {
  list-style:none; overflow-y:auto; flex:1;
  scrollbar-width:thin; scrollbar-color:var(--surface-2) transparent;
}
.log-list::-webkit-scrollbar { width:3px; }
.log-list::-webkit-scrollbar-thumb { background:var(--surface-2); border-radius:99px; }

.log-item {
  display:flex; align-items:center; gap:10px;
  padding:8px 12px; border-bottom:1px solid var(--border);
  transition:background .15s;
}
.log-item:last-child { border-bottom:none; }
.log-item:hover { background:var(--surface-h); }
.log-item.is-new { animation:slideIn .4s cubic-bezier(.22,1,.36,1); }
.log-item.log-removing { animation:slideOut .3s forwards; }

@keyframes slideIn { from{opacity:0;transform:translateY(-12px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideOut { to{opacity:0;transform:translateY(-8px);max-height:0;padding:0;margin:0} }

.log-art    { width:28px; height:28px; border-radius:4px; object-fit:cover; flex-shrink:0; background:var(--surface-2); }
.log-art-ph { width:28px; height:28px; border-radius:4px; background:var(--surface-2); flex-shrink:0; }
.log-info { flex:1; min-width:0; }
.log-name   { font-size:.72rem; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.log-artist { font-size:.62rem; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.log-time { font-family:'Space Mono',monospace; font-size:.56rem; color:var(--faint); flex-shrink:0; }
.log-now-tag { font-family:'Space Mono',monospace; font-size:.52rem; font-weight:700; letter-spacing:.08em; color:#000; background:var(--green); padding:2px 7px; border-radius:99px; flex-shrink:0; }
.log-empty { padding:20px 16px; text-align:center; font-size:.78rem; color:var(--faint); }

/* ── Repeat plays (sidebar) ──────────────────────── */
.repeat-list { list-style:none; max-height:260px; overflow-y:auto; scrollbar-width:thin; scrollbar-color:var(--surface-2) transparent; }
.repeat-list::-webkit-scrollbar { width:3px; }
.repeat-list::-webkit-scrollbar-thumb { background:var(--surface-2); border-radius:99px; }
.repeat-item {
  display:flex; align-items:center; gap:9px;
  padding:7px 12px; border-bottom:1px solid var(--border);
  transition:background .15s;
}
.repeat-item:last-child { border-bottom:none; }
.repeat-item:hover { background:var(--surface-h); }
.repeat-art    { width:24px; height:24px; border-radius:3px; object-fit:cover; flex-shrink:0; background:var(--surface-2); }
.repeat-art-ph { width:24px; height:24px; border-radius:3px; background:var(--surface-2); flex-shrink:0; }
.repeat-info { flex:1; min-width:0; }
.repeat-name   { font-size:.69rem; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.repeat-artist { font-size:.6rem; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.repeat-count  { font-family:'Space Mono',monospace; font-size:.62rem; color:var(--green); font-weight:700; flex-shrink:0; }
.repeat-empty  { padding:14px 16px; font-size:.72rem; color:var(--faint); text-align:center; }

/* ── Obscurity score ─────────────────────────────── */
.obscurity-wrap { padding:20px; display:flex; flex-direction:column; gap:14px; }
.obscurity-meter { position:relative; height:8px; background:var(--surface-2); border-radius:99px; overflow:hidden; }
.obscurity-fill { height:100%; border-radius:99px; width:0; transition:width 1s cubic-bezier(.22,1,.36,1); }
.obscurity-labels { display:flex; justify-content:space-between; font-family:'Space Mono',monospace; font-size:.55rem; color:var(--faint); }
.obscurity-score-big { font-family:'Bebas Neue',sans-serif; font-size:2.8rem; letter-spacing:.02em; line-height:1; }
.obscurity-tag { font-size:.72rem; color:var(--muted); margin-top:2px; }
.obscurity-row { display:flex; align-items:flex-end; gap:12px; }

/* ── Skeleton ────────────────────────────────────── */
@keyframes shimmer { 0%{background-position:-400px 0} 100%{background-position:400px 0} }
.skeleton {
  background:linear-gradient(90deg,var(--surface-2) 25%,#2d2d2d 50%,var(--surface-2) 75%);
  background-size:800px 100%; animation:shimmer 1.4s infinite; border-radius:4px;
}
.skeleton-item { display:flex; align-items:center; gap:12px; padding:10px 20px; border-bottom:1px solid var(--border); }
.skeleton-num  { width:16px; height:11px; }
.skeleton-img  { width:40px; height:40px; border-radius:5px; flex-shrink:0; }
.skeleton-text { flex:1; display:flex; flex-direction:column; gap:5px; }
.skeleton-line { height:10px; }
.skeleton-line.w-70 { width:70%; }
.skeleton-line.w-45 { width:45%; }
.skeleton-bar  { width:52px; height:3px; border-radius:99px; flex-shrink:0; }

/* ── Error ───────────────────────────────────────── */
.error-msg { padding:24px 20px; text-align:center; color:var(--faint); font-size:.82rem; }
.error-msg strong { display:block; color:#ff6b6b; margin-bottom:5px; }

/* ── Login ───────────────────────────────────────── */
.login-screen {
  min-height:100vh; display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:24px; padding:40px; position:relative; z-index:1;
}
.login-logo { display:flex; flex-direction:column; align-items:center; gap:14px; }
.login-title { font-family:'Bebas Neue',sans-serif; font-size:clamp(2rem,6vw,3.5rem); letter-spacing:.05em; text-align:center; line-height:1.05; }
.login-title span { color:var(--green); }
.login-desc { font-size:.88rem; color:var(--muted); text-align:center; max-width:360px; line-height:1.6; }
.login-desc code { background:var(--surface-2); padding:2px 6px; border-radius:4px; font-size:.78rem; }

/* ── Animations ──────────────────────────────────── */
@keyframes fadeUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* ── Responsive ──────────────────────────────────── */
@media (max-width:1100px) {
  :root { --sidebar-w: 260px; }
  html, body { height:auto; overflow:auto; }
  .page-layout { flex:none; overflow:visible; padding-bottom:40px; align-items:flex-start; }
  .main-col { grid-template-rows:unset; height:auto; overflow:visible; gap:18px; }
  .two-col-grid { grid-template-columns:1fr; min-height:unset; overflow:visible; gap:18px; }
  .two-col-grid .panel-section, .two-col-grid .panel { min-height:unset; overflow:visible; }
  .two-col-grid .item-list { max-height:380px; }
  .two-col-grid .genre-grid { max-height:380px; flex:none; }
  .sidebar-col { height:auto; position:sticky; top:20px; max-height:calc(100vh - 40px); }
  .sidebar-log-card { max-height:65vh; }
}
@media (max-width:800px) {
  :root { --pad: 14px; }
  .page-layout { flex-direction:column; }
  .sidebar-col { width:100%; height:auto; position:static; max-height:none; }
  .sidebar-log-card { max-height:340px; }
  .np-album, .powered-by { display:none; }
}
