:root {
  /* Singa green #17E87A (from Singa's own share image) */
  --bg: #f5f7f5;
  --surface: #ffffff;
  --surface-2: #ebefec;
  --text: #0e1410;
  --muted: #5d665f;
  --border: #dde3de;
  --accent: #17e87a;        /* fills */
  --accent-text: #04170b;   /* text on accent fills */
  --accent-ink: #067a3c;    /* accent used as text/lines on light bg */
  --tag: #eef1ee;
  --tag-text: #3d4540;
  --warn: #b42318;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0b0a;
    --surface: #131514;
    --surface-2: #1c1f1d;
    --text: #eaf0eb;
    --muted: #8f9a92;
    --border: #252a26;
    --accent: #17e87a;
    --accent-text: #04170b;
    --accent-ink: #17e87a;
    --tag: #1f2420;
    --tag-text: #c3cdc6;
    --warn: #ff8a80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans JP", sans-serif;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
code { font-size: .92em; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-inner { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
h1 span { color: var(--accent-ink); }
.views { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.views a {
  color: var(--muted); text-decoration: none; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
}
.views a:hover { color: var(--text); background: var(--surface-2); }
.views a[aria-current="page"] { color: var(--accent-text); background: var(--accent); }
.views small { font-weight: 500; opacity: .8; }
.controls { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.seg button, .icon-btn, .adv-btn {
  font: inherit; font-weight: 600; font-size: 13px; color: var(--muted);
  background: none; border: 0; border-radius: 6px; padding: 5px 12px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.icon-btn { font-size: 17px; padding: 3px 9px; background: var(--surface-2); border-radius: 8px; }
.icon-btn:hover, .seg button:hover, .adv-btn:hover { color: var(--text); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* advanced mode */
.adv-btn { background: var(--surface-2); border-radius: 8px; }
.adv-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent-ink); }
.adv-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin: 6px 0 12px; display: grid; gap: 10px; font-size: 13px;
}
.adv-row { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; }
.adv-row input[type="search"] { flex: 1 1 200px; min-width: 0; }
.adv-panel input[type="search"], .adv-panel select {
  font: inherit; color: var(--text); background: var(--bg); color-scheme: light dark;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
.adv-panel .ghost { font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 4px; }
.adv-panel .ghost:hover { color: var(--text); }
.checks label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.checks input { accent-color: var(--accent-ink); }
.new-row { color: var(--text); }
.new-row:has(#new-info:empty) { display: none; }
.hint { margin: 0; color: var(--muted); font-size: 12px; }
.views .badge {
  margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text); vertical-align: 1px;
}
.views a[aria-current="page"] .badge { background: var(--accent-text); color: var(--accent); }

/* status */
.status { color: var(--muted); font-size: 13px; margin: 14px 0 6px; min-height: 1.45em; }
.topup { white-space: nowrap; }
.error {
  color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-radius: 8px; padding: 10px 14px; margin: 8px 0;
}
.link { font: inherit; color: inherit; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }
.placeholder { color: var(--muted); padding: 48px 0; text-align: center; }

/* load back to a date */
.bulk, .bulk-progress, .bulk-result {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; margin: 6px 0 10px;
}
.bulk label { color: var(--muted); }
.bulk input, .bulk button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px;
}
.bulk input { color-scheme: light dark; }
.bulk button { font-weight: 600; cursor: pointer; background: var(--surface-2); }
.bulk button:hover { border-color: var(--accent-ink); }
.bulk button.ghost { background: none; color: var(--muted); }
.bulk :disabled { opacity: .5; cursor: not-allowed; }
.bulk button.ghost:hover { color: var(--text); }
.bulk-progress { color: var(--text); }
.bulk-result {
  display: block; padding: 8px 12px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.bulk-result.bad { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
[hidden] { display: none !important; }

/* groups */
.group { margin: 18px 0 26px; scroll-margin-top: calc(var(--head-h, 58px) + 8px); }
.group-head {
  position: sticky; top: var(--head-h, 58px); z-index: 5;
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 -16px 8px; padding: 8px 16px;
  font-size: 15px; font-weight: 700;
  background: var(--bg);
}
.count {
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border-radius: 999px; padding: 1px 8px;
}
.list {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; box-shadow: var(--shadow);
}

/* song row */
.song {
  position: relative;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 8px 14px; color: inherit;
}
/* The title link covers the whole row; the cover button sits above it. */
.song-link { color: inherit; text-decoration: none; display: block; }
.song-link::after { content: ""; position: absolute; inset: 0; }
.song-link:focus-visible { outline: none; }
.song:has(.song-link:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: -2px; }
.song + .song { border-top: 1px solid var(--border); }
.song:hover { background: var(--surface-2); }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: block; }
.thumb-box {
  position: relative; z-index: 1; display: block; padding: 0; border: 0; background: none;
  border-radius: 6px; font: inherit; color: inherit; pointer-events: none;
}
.play-icon { display: none; }
body.adv button.thumb-box { pointer-events: auto; cursor: pointer; }
body.adv .play-icon {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 6px;
  background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .15s;
}
body.adv .play-icon::before {
  content: ""; width: 0; height: 0; margin-left: 3px;
  border-left: 12px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent;
}
body.adv .thumb-box:hover .play-icon, body.adv .thumb-box:focus-visible .play-icon,
body.adv .song.playing .play-icon { opacity: 1; }
body.adv .song.playing .play-icon { background: color-mix(in srgb, var(--accent) 70%, rgba(0,0,0,.4)); }
body.adv .song.playing .play-icon::before {
  margin: 0; width: 4px; height: 14px; border: 0;
  box-shadow: -4px 0 0 #04170b, 4px 0 0 #04170b; background: transparent;
}
.song.preview-failed .thumb-box { outline: 2px solid var(--warn); outline-offset: 1px; }
.thumb-empty { display: grid; place-items: center; color: var(--muted); }
.body { min-width: 0; }
.title, .orig, .artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title { font-weight: 600; }
.orig { font-size: 13px; color: var(--text); opacity: .75; }
.artist { font-size: 13px; color: var(--muted); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 300px; }
.tag {
  font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap;
  padding: 4px 7px; border-radius: 5px; background: var(--tag); color: var(--tag-text);
}
.tag.lang { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-ink); }
.tag.explicit { color: var(--warn); }
.tag.new { background: var(--accent); color: var(--accent-text); }
.song:not(.is-new) .tag.new { display: none; }
.tag.nopl { color: var(--warn); }
.tag.maybe { font-style: italic; }
body.adv .song.is-new { box-shadow: inset 3px 0 0 var(--accent); }
body:not(.adv) .adv-only { display: none !important; }
.tag.dur { font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  /* The header wraps to several rows on phones; let it scroll away. */
  .top { position: static; }
  .group-head { top: 0; }
  .group { scroll-margin-top: 8px; }
  .top-inner { padding-top: 10px; padding-bottom: 10px; }
  .controls { margin-left: auto; }
  .views { order: 3; flex-basis: 100%; }
  .views a { padding: 5px 11px; }
  .song { grid-template-columns: 40px minmax(0, 1fr); }
  .thumb { width: 40px; height: 40px; }
  .tags { grid-column: 2; justify-content: flex-start; max-width: none; }
  .tag.genre, .tag.year { display: none; }
}

/* load more */
.more-wrap { text-align: center; margin: 8px 0 28px; }
.more {
  font: inherit; font-weight: 600; color: var(--accent-text); background: var(--accent);
  border: 0; border-radius: 999px; padding: 10px 26px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.more:disabled { opacity: .7; cursor: progress; }
.end { text-align: center; color: var(--muted); }
.spinner {
  display: inline-block; width: 12px; height: 12px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

.foot { color: var(--muted); font-size: 12px; padding-top: 12px; padding-bottom: 32px; border-top: 1px solid var(--border); }
