:root {
  --bg: #111;
  --text: #e0e0e0;
  --text-sub: #aaa;
  --text-muted: #888;
  --text-dim: #777;
  --text-faint: #666;
  --text-faintest: #555;
  --text-ghost: #444;
  --border: #2a2a2a;
  --accent: #f0a500;
}

html.light {
  --bg: #fff;
  --text: #111;
  --text-sub: #555;
  --text-muted: #888;
  --text-dim: #999;
  --text-faint: #aaa;
  --text-faintest: #bbb;
  --text-ghost: #ccc;
  --border: #e8e8e8;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.6;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 36px 24px 60px;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.name { 
  font-weight: bold; 
  color: var(--accent);
}

.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s;
}

.theme-toggle:hover { color: var(--text); }

.section { margin-bottom: 24px; }

.section-label {
  color: var(--accent);
  font-weight: bold;
  margin-bottom: 8px;
}

/* Sticky filter row */
.filter-sticky {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  padding: 8px 0 4px;
  padding-top: max(8px, env(safe-area-inset-top));
}

/* Now playing — inline in filter row */
#now-playing {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  flex-shrink: 0;
}

#now-playing.visible { display: flex; }

#np-title {
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

#np-toggle {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

#np-toggle:hover { text-decoration: underline; }

/* Section toggle */
.section-toggle {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

#lucky-btn { margin-left: auto; }

.toggle-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s;
}

.toggle-btn:hover  { color: var(--text); }
.toggle-btn.active { color: var(--accent); text-decoration: underline; }

/* Filter row */
.filter-cats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 4px;
}

.filter-label { color: var(--text-ghost); font-size: 11px; }

.filter-cat {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s;
}

.filter-cat:hover        { color: var(--text); }
.filter-cat.open         { color: var(--text); }
.filter-cat.active       { color: var(--accent); text-decoration: underline; }

/* Sub-row */
.filter-sub {
  display: none;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 12px;
}

.filter-sub.visible { display: flex; }

.filter-sub-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s;
}

.filter-sub-btn:hover  { color: var(--text); }
.filter-sub-btn.active { color: var(--accent); text-decoration: underline; }

/* Credits */
.credit { margin-bottom: 12px; transition: background 0.4s, padding 0.4s, margin 0.4s, border-radius 0.4s; }
.credit.hidden { display: none; }
.credit.playing {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  padding: 6px 8px;
  margin: 0 -8px 12px;
  border-radius: 6px;
}

.credit.lucky-active { transition: none !important; }
.credit.lucky-active.playing { background: transparent; }

@keyframes lucky-flash {
  0%   { background: transparent; }
  25%  { background: color-mix(in srgb, var(--accent) 15%, transparent); }
  100% { background: transparent; }
}
.lucky-highlight { animation: lucky-flash 1.2s ease-out; }

.credit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.credit-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.platform-icon {
  display: inline-flex;
  align-items: center;
  opacity: 0.65;
  transition: opacity 0.15s;
  text-decoration: none;
}

.platform-icon img {
  width: 14px;
  height: 14px;
  display: block;
}

.platform-icon:hover { opacity: 1; }

.credit-date { color: var(--text-muted); }

.credit-sub  { color: var(--text-sub); padding-left: 12px; }

.credit-tags {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  padding-left: 12px;
  font-size: 11px;
  color: var(--text-faintest);
}

.audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  height: 22px;
}

.ap-play {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  width: 32px;
  text-align: left;
  transition: color 0.15s;
}

.ap-play:hover { color: var(--text); }
.ap-play.active { color: var(--accent); }

.ap-bar {
  flex: 1;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.ap-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  height: 2px;
  width: 100%;
  background: var(--border);
}

.ap-progress {
  height: 2px;
  background: var(--text);
  width: 0%;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.ap-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 30px;
  text-align: right;
}

.plain-list { line-height: 1.9; }
.plain-list a { display: block; }
