:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1d21;
  --muted: #6b6f78;
  --line: #e2e4e9;
  --accent: #5865f2;
  --accent-text: #ffffff;
  --danger: #d83c3e;
  --chip: #eef0f3;
  --chip-on: #5865f2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b;
    --card: #222328;
    --text: #e9eaee;
    --muted: #a1a5ae;
    --line: #34363d;
    --accent: #7983f5;
    --accent-text: #0f1015;
    --danger: #f06a6c;
    --chip: #2e3037;
    --chip-on: #7983f5;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 700; white-space: nowrap; }
.top select { flex: 1; min-width: 0; max-width: 360px; }
.me { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.me img { border-radius: 50%; }
.me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12em; }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.center { text-align: center; }
h1, h2, h3 { margin: 0 0 8px; }
h2 { font-size: 20px; overflow-wrap: anywhere; }
h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.right { margin-left: auto; display: flex; gap: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { font-size: 13px; color: var(--muted); }
.status {
  background: var(--chip);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 16px;
}
.note { color: var(--danger); }
button, .button, select, input[type="text"] {
  font: inherit;
  color: var(--text);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
}
button, .button { cursor: pointer; text-decoration: none; display: inline-block; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.danger { color: var(--danger); }
.ghost { background: transparent; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row input[type="text"] { flex: 1; min-width: 0; }
.now { display: flex; gap: 16px; }
.thumb { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; flex: none; }
.nowbody { flex: 1; min-width: 0; }
.progress { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-variant-numeric: tabular-nums; font-size: 13px; }
.progress input { flex: 1; }
.controls { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.controls button { font-size: 18px; padding: 6px 14px; }
.info { margin-top: 8px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border-radius: 999px; font-size: 13px; }
.chips button.on { background: var(--chip-on); color: var(--accent-text); border-color: var(--chip-on); }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.list li:first-child { border-top: 0; }
.queue { counter-reset: q; }
.queue li::before { counter-increment: q; content: counter(q); color: var(--muted); width: 2em; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.item { flex: 1; min-width: 0; }
.item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops { display: flex; gap: 4px; flex: none; }
.ops button { padding: 4px 8px; font-size: 13px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  max-width: calc(100% - 32px);
  z-index: 10;
}
@media (max-width: 560px) {
  .now { flex-direction: column; }
  /* 6つの操作ボタンを1段に並べる */
  .controls { flex-wrap: nowrap; }
  .controls button { flex: 1 1 0; min-width: 0; padding: 6px 0; }
  /* 曲名の入力は1段を丸ごと使う */
  #addForm input[type="text"] { flex: 1 1 100%; }
  .thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .ops button { padding: 4px 6px; }
  .brand { display: none; }
}
