@import url("https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;500;700;800&display=swap");

:root {
  --bg: #f7f5fb;
  --surface: #ffffff;
  --surface-2: #f0ecf7;
  --text: #1f1b29;
  --muted: #706a7e;
  --faint: #a49fb0;
  --border: #e4dfee;
  --accent: #d6336c;
  --accent-text: #ffffff;
  --accent-soft: #fce8ef;
  --ok: #2b8a3e;
  --warn: #d9480f;
  --danger: #c92a2a;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(31 27 41 / 0.05), 0 2px 8px rgb(31 27 41 / 0.04);
  --font: "M PLUS Rounded 1c", system-ui, -apple-system, "Segoe UI", "Hiragino Maru Gothic ProN", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131019; --surface: #1c1824; --surface-2: #262030; --text: #f2eff7; --muted: #a8a1b6; --faint: #6f687c;
    --border: #2f2839; --accent: #f06595; --accent-text: #1a0f15; --accent-soft: #3a1c2a; --ok: #69db7c;
    --warn: #ffa94d; --danger: #ff8787; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131019; --surface: #1c1824; --surface-2: #262030; --text: #f2eff7; --muted: #a8a1b6; --faint: #6f687c;
  --border: #2f2839; --accent: #f06595; --accent-text: #1a0f15; --accent-soft: #3a1c2a; --ok: #69db7c;
  --warn: #ffa94d; --danger: #ff8787; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* buttons are inline-flex, which would otherwise beat hidden */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 680px; margin: 0 auto; padding: 20px 16px 72px; }
main.wide { max-width: 1180px; }

/* type */
h1 { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin: 2px 0 0; letter-spacing: -0.01em; }
h2 {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin: 28px 4px 10px;
}
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.headline { font-size: 1.45rem; font-weight: 800; line-height: 1.25; margin: 2px 0 10px; }
.num-text { font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.plain { color: inherit; }

/* layout */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }
header.top { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
header.top > div { flex: 1; min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
.card.flush { padding: 4px 16px; }
.card.hero { border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: linear-gradient(160deg, var(--accent-soft), var(--surface) 65%); }

/* song block: title + subtitle line */
.song { min-width: 0; }
.song .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song .s { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song.big .t { font-size: 1.1rem; white-space: normal; }
.song.big .s { white-space: normal; }

/* controls */
button, .btn {
  font: inherit; font-weight: 700; font-size: .9rem; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); padding: 8px 14px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
button:hover:not(:disabled), .btn:hover { background: var(--surface-2); text-decoration: none; }
button:disabled { opacity: .45; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, black); }
button.danger { color: var(--danger); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover:not(:disabled) { background: var(--surface-2); }
button.icon { padding: 0; width: 36px; min-height: 36px; }
button.icon.invisible { visibility: hidden; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round; }
.toolbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }

input, select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 8px 12px; min-height: 42px; min-width: 0;
}
input::placeholder { color: var(--faint); }
input:focus-visible, button:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
form.inline { display: flex; gap: 8px; }
form.inline input { flex: 1; }
.hint { color: var(--muted); font-size: .85rem; margin: 8px 4px 0; }

/* lists */
ol.list, ul.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .main { flex: 1; min-width: 0; }
.list .side { text-align: right; flex: none; font-size: .85rem; color: var(--muted); }
.list .side b { color: var(--text); font-weight: 700; }
.list .actions { display: flex; gap: 2px; flex: none; }
.pos {
  width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--surface-2); display: grid;
  place-items: center; font-size: .78rem; font-weight: 800; color: var(--muted);
}
li.mine .pos { background: var(--accent); color: var(--accent-text); }
li.mine .who { color: var(--accent); }
.who { font-weight: 800; }
.empty { color: var(--muted); padding: 14px 0; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; padding: 2px 8px;
  border-radius: 99px; background: var(--surface-2); color: var(--muted); vertical-align: 2px; white-space: nowrap;
}
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.ok { color: var(--ok); }
.tag.warn { color: var(--warn); }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .85rem; color: var(--accent); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.paused { color: var(--muted); }

.toasts { position: fixed; left: 16px; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50;
  justify-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; max-width: 520px;
  font-weight: 500; box-shadow: 0 6px 24px rgb(0 0 0 / .2); }
.toast.error { background: var(--danger); color: #fff; }

.update-banner {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60; display: flex; gap: 12px;
  align-items: center; background: var(--text); color: var(--bg); padding: 8px 8px 8px 16px; border-radius: 14px;
  font-weight: 700; box-shadow: 0 6px 24px rgb(0 0 0 / .25); white-space: nowrap;
}
.warn-box { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  color: var(--text); font-size: .9rem; }

/* dialogs (lyrics picker) */
dialog { border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(720px, calc(100vw - 32px));
  max-height: min(86vh, 900px); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog .body { padding: 18px; overflow: auto; max-height: min(86vh, 900px); }
dialog textarea { width: 100%; min-height: 110px; font: inherit; font-size: .85rem; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 12px; }
.stepper { display: flex; gap: 0; }
.stepper button { flex: 1; border-radius: 0; padding: 8px 6px; margin-left: -1px; }
.stepper button:first-child { border-radius: 11px 0 0 11px; margin-left: 0; }
.stepper button:last-child { border-radius: 0 11px 11px 0; }
.setting { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 6px 0; }
