:root {
  --page: #faf7f5; --surface: #ffffff; --surface-2: #f2ece8; --border: #e3d9d3;
  --text: #2a2220; --text-muted: #77695f; --accent: #c4402f; --accent-fg: #ffffff;
  --radius: 10px;
  --font: "General Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cjk: "PingFang HK", "Noto Sans HK", "Microsoft JhengHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #171211; --surface: #211a19; --surface-2: #2d2422; --border: #3d3230;
    --text: #f1e9e6; --text-muted: #ab9d96; --accent: #ef6a55; --accent-fg: #1a0d0a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 400 16px/1.45 var(--font); overflow-x: hidden;
}
b, strong, h1, h2, h3 { font-weight: 600; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--text-muted); }
.pad { padding: 16px; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.cjk { font-family: var(--cjk), var(--font); }

/* header */
.top { padding: 12px 16px 8px; max-width: 1200px; margin: 0 auto; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); text-decoration: none; font-size: 14px; min-height: 32px; }
.back:hover { color: var(--text); }
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.top h1 { margin: 2px 0 0; font-size: 22px; line-height: 1.25; }
.top h1 .cjk { font-size: 24px; }
.sub { margin: 2px 0 0; font-size: 14px; color: var(--text-muted); }

/* ? help */
.q {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 4px;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface);
  color: var(--text-muted); font-size: 11px; line-height: 1; padding: 0; vertical-align: middle;
}
.q:hover, .q:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.tip {
  position: fixed; z-index: 100; max-width: min(280px, calc(100vw - 16px)); padding: 8px 10px;
  background: #ffffff; color: #2a2220; border: 1px solid #d9cdc6; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 13px; line-height: 1.4; pointer-events: none;
}
.tip[hidden] { display: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius); font-weight: 400;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .seg button:focus-visible, .pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[aria-pressed="true"], .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn[disabled] { opacity: .45; cursor: default; }

/* layout */
.song { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; max-width: 1200px; margin: 0 auto; padding: 0 16px 24px; }
.player-col { position: sticky; top: 0; z-index: 5; background: var(--page); padding: 8px 0; margin: 0 -16px; padding-inline: 16px; }
.player-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.perr { margin: 8px 0 0; font-size: 14px; color: var(--accent); }
@media (min-width: 800px) {
  .song { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .player-col { align-self: start; top: 12px; margin: 0; padding: 0; background: none; }
}

/* controls */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.controls .grp { display: inline-flex; align-items: center; gap: 4px; }
.controls .lbl { font-size: 13px; color: var(--text-muted); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { min-height: 40px; min-width: 40px; padding: 0 10px; border: 0; border-right: 1px solid var(--border); background: none; font-size: 14px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.hint { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); min-height: 1.4em; }

/* layers */
.layers { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.pill { min-height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 14px; }
.pill[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pill[aria-disabled="true"] { cursor: not-allowed; }

/* lyrics */
.empty { margin: 8px 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; font-size: 15px; }
.section { margin: 18px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.line {
  position: relative; padding: 8px 10px 8px 12px; margin: 2px 0; border-radius: var(--radius);
  border-left: 3px solid transparent; cursor: pointer; scroll-margin-top: 40vh;
}
.line:hover { background: var(--surface); }
.line.active { background: var(--surface-2); border-left-color: var(--accent); }
.line.untimed .main { opacity: .62; }
.toks { display: block; line-height: 1.2; }
.tok { display: inline-block; text-align: center; vertical-align: top; margin: 0 1px 4px; padding: 0 1px; white-space: pre; border: 0; background: none; }
.tok .ch { display: block; font-family: var(--cjk), var(--font); font-size: 24px; line-height: 1.25; }
.tok .rd { display: block; font-size: 12px; line-height: 1.3; min-height: 1.3em; color: var(--text-muted); }
.tok.ov .rd { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 2px; }
.hide-pron .rd { visibility: hidden; }
.hide-orig .ch { display: none; }
.hide-orig .tok .rd { font-size: 18px; color: var(--text); }
.eng { margin: 2px 0 0; font-size: 15px; color: var(--text-muted); overflow-wrap: anywhere; }
.hide-eng .eng { display: none; }
.meta { display: inline-flex; gap: 8px; align-items: center; margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.badge { display: inline-block; padding: 0 6px; border: 1px solid var(--border); border-radius: 999px; font-size: 11px; line-height: 1.6; color: var(--text-muted); }
.meta .time { font-family: ui-monospace, Menlo, monospace; font-size: 11px; line-height: 1.6; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); cursor: help; }
.meta .time:hover, .meta .time:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.clock { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: var(--text-muted); min-width: 5.5ch; font-variant-numeric: tabular-nums; }
.timing { line-height: 2; }
.mini { min-height: 26px; padding: 0 8px; margin: 0 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 12px; vertical-align: middle; }
.mini:hover { background: var(--surface-2); }
.mini.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* add a song (local tool only) */
.list h2 { font-size: 18px; margin: 28px 0 6px; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.row input { flex: 1 1 200px; }
input[type="text"], select { min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
input[type="text"]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* song list */
.list { max-width: 640px; margin: 0 auto; padding: 8px 16px 32px; }
.list h1 { font-size: 26px; margin: 16px 0 4px; }
.list a.song-link { display: block; padding: 12px 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.list a.song-link:hover .t { color: var(--accent); }
.list .t { font-size: 20px; }
.list code, .empty code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }

.sung { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.sung .lbl { font-size: 13px; color: var(--muted, inherit); }
.wide { width: 100%; box-sizing: border-box; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.linkbtn { border: 0; background: none; color: var(--accent); font-size: 13px; padding: 4px 0 8px; text-decoration: underline; }
.others { padding-left: 14px; border-left: 2px solid var(--border); }

/* ---- home: karaoke-style catalogue ---- */
.list { max-width: 720px; }
.home h1 { font-size: 28px; margin: 14px 0 2px; letter-spacing: -0.01em; }
.home .tag { margin: 0 0 14px; color: var(--text-muted); font-size: 15px; }
input.search { width: 100%; min-height: 48px; padding: 0 16px 0 44px; border-radius: 24px; font-size: 16px; -webkit-appearance: none; appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2377695f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 14px 50% / 20px no-repeat; }
.tabs { display: flex; gap: 4px; margin: 12px 0 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; background: none; font-size: 15px; color: var(--text-muted); }
.tabs button[aria-pressed="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.note-line { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }
.view { padding-bottom: 8px; }
.view h2 { font-size: 15px; margin: 18px 0 6px; color: var(--text-muted); font-weight: 600; }
.count { margin: 10px 0 2px; font-size: 13px; color: var(--text-muted); }
.letter { position: sticky; top: 0; z-index: 2; margin: 0; padding: 6px 2px; font-size: 13px; color: var(--accent); background: var(--page); border-bottom: 1px solid var(--border); }

.row-song { display: flex; align-items: center; gap: 12px; padding: 10px 2px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); min-height: 72px; }
.row-song:hover .ttl { color: var(--accent); }
.row-song.busy { opacity: .6; pointer-events: none; }
.rank { flex: none; width: 24px; text-align: center; font-size: 15px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rank.top { color: var(--accent); font-weight: 700; font-size: 18px; }
.thumb { flex: none; width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ttl { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub2 { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mid .meta { display: block;  font-size: 12px; color: var(--text-muted); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { flex: none; min-width: 58px; text-align: center; padding: 6px 10px; border-radius: 16px; border: 1px solid var(--border); font-size: 13px; color: var(--text-muted); background: var(--surface); }
.status.ready { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.linkbtn { border: 0; background: none; color: var(--text-muted); font-size: 12px; padding: 2px 0 6px 66px; text-decoration: underline; }
.others { padding-left: 24px; }
.others .row-song { min-height: 60px; }
.btn.more { width: 100%; margin: 14px 0; }

.avatar { position: relative; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--surface-2); color: var(--accent); font-size: 20px; font-weight: 600; }
.avatar.big { width: 76px; height: 76px; font-size: 30px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 10px; margin: 16px 0; }
.tiles.small { margin: 8px 0; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--text); text-decoration: none; }
.tile:hover .nm { color: var(--accent); }
.tile.off { opacity: .55; }
.tile .nm { font-size: 15px; font-weight: 600; }
.tile .ct { font-size: 12px; color: var(--text-muted); }
.artist-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 4px; }
.artist-name { font-size: 24px; font-weight: 600; }
.back-btn { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; border: 0; background: none; color: var(--text-muted); font-size: 14px; min-height: 32px; padding: 0; }
.sortbar { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; }
.sortbar .lbl { font-size: 13px; color: var(--text-muted); }

/* favourites: the star on rows and on the song page */
.row-wrap { position: relative; }
.row-wrap .row-song { padding-right: 44px; }
.star { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; color: var(--text-muted); }
.star.on { color: var(--accent); }
.star.big { position: static; transform: none; flex: none; }
.favs { margin-top: 4px; }
.favs h2 { font-size: 15px; margin: 14px 0 0; color: var(--text); }
.favs h2 .muted { font-size: 13px; font-weight: 400; }
