:root {
  --navy: #1f3a5f;
  --green: #2e7d32;
  --red: #c62828;
  --gold: #e8c46a;
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1b1b1f;
  --muted: #5f6368;
  --border: #d0d4da;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  background: var(--bg);
  color: var(--text);
  max-width: 640px;
  margin-inline: auto;
}

h1 { font-size: 24px; margin: 0 0 12px; color: var(--navy); }
h2 { font-size: 20px; margin: 24px 0 8px; }
h3 { margin: 0 0 8px; }

header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
header h1 { margin: 0; }

.card { background: var(--card); border-radius: 16px; padding: 16px; margin: 12px 0; box-shadow: 0 1px 3px rgb(0 0 0 / 0.1); }

label { display: block; margin-bottom: 12px; font-weight: 600; }
input {
  display: block; width: 100%; margin-top: 4px; padding: 12px;
  font-size: 22px; border: 2px solid var(--border); border-radius: 10px;
}
input[name="number"] { font-weight: 700; font-size: 28px; }

button {
  font: inherit; font-weight: 700; border-radius: 12px; border: 2px solid transparent;
  padding: 12px 16px; cursor: pointer; width: 100%; min-height: 52px;
}
button:disabled { opacity: 0.35; cursor: default; }
button.big { min-height: 72px; font-size: 22px; }
button.primary { background: var(--navy); color: #fff; }
button.go { background: var(--green); color: #fff; }
button.danger-solid { background: var(--red); color: #fff; }
button.outline { background: #fff; border-color: var(--navy); color: var(--navy); }
button.outline.danger { border-color: var(--red); color: var(--red); }
button.link { background: none; color: var(--muted); font-weight: 400; text-decoration: underline; }

.row { display: flex; gap: 12px; margin: 12px 0; }
.row > * { flex: 1; }
details.card > button, .confirm > button { margin-top: 8px; }

.pill { font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: #eee; color: var(--muted); }
.pill.online { background: #dff0d8; color: var(--green); }
.pill.offline { background: #fff3cd; color: #8a6d00; }

.preview-wrap { aspect-ratio: 16 / 9; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; }
.tv {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  background: #fff; color: var(--navy); container-type: size;
}
.tv.dark { background: #000; color: #fff; }
.tv .number { font-size: 55cqh; font-weight: 700; line-height: 1.1; }
.tv .title { font-size: 9cqh; padding: 0 5cqw; }
.tv.dark .title { color: var(--gold); }
.tv .blank-note { color: #999; font-size: 16px; }

ol#songs { list-style: none; padding: 0; margin: 0; }
ol#songs li {
  display: flex; align-items: center; gap: 4px; background: var(--card);
  border-radius: 12px; padding: 8px 4px 8px 12px; margin-bottom: 8px;
  border: 3px solid transparent;
}
ol#songs li.current { border-color: var(--navy); }
ol#songs .pos { width: 32px; color: var(--muted); }
ol#songs .info { flex: 1; min-width: 0; cursor: pointer; }
ol#songs .num { font-size: 26px; font-weight: 700; }
ol#songs .ttl { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol#songs button { width: 44px; min-height: 44px; padding: 0; font-size: 20px; background: none; color: var(--navy); }
ol#songs button.del { color: var(--red); }

.muted { color: var(--muted); }
.error { color: var(--red); font-weight: 600; }
fieldset#controls { border: 0; padding: 0; margin: 0; min-width: 0; }
.card.warning { background: #fff3cd; color: #5c4a00; }
.card.warning p { margin: 8px 0 0; }
dialog#ask {
  width: min(420px, calc(100vw - 32px));
  border: 0; border-radius: 20px; padding: 0;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);
  color: var(--text);
}
dialog#ask .ask-body { padding: 24px; }
dialog#ask::backdrop { background: rgb(15 25 40 / 0.55); }
dialog#ask h3 { font-size: 22px; color: var(--navy); margin: 0 0 8px; }
dialog#ask p { margin: 0 0 20px; color: var(--muted); }
#ask-buttons { display: flex; flex-direction: column; gap: 10px; }
#ask-buttons button:not(.link) { min-height: 56px; }
