:root {
  color-scheme: dark;
  --bg: #101817;
  --panel: #182421;
  --border: #31413b;
  --text: #edf2e8;
  --muted: #a5b4a7;
  --accent: #dcf979;
  --ink: #18220c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #101817;
  background: var(--bg);
  color: #edf2e8;
  color: var(--text);
  font:
    16px "DM Sans",
    system-ui,
    sans-serif;
  line-height: 1.55;
}
main {
  max-width: 1240px;
  margin: auto;
  padding: 32px 48px;
}
nav {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
}
a {
  color: var(--text);
  text-decoration: none;
}
a:hover {
  color: var(--accent);
}
.brand {
  margin-right: auto;
  font:
    700 24px "Space Grotesk",
    sans-serif;
  letter-spacing: -1px;
}
.brand span {
  display: block;
  font:
    500 9px "DM Sans",
    sans-serif;
  letter-spacing: 3px;
  color: var(--muted);
  margin-top: 4px;
}
header {
  padding: 56px 0 30px;
}
h1,
h2,
h3 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  line-height: 1.12;
}
h1 {
  font-size: clamp(36px, 5vw, 64px);
  letter-spacing: -2px;
  margin: 16px 0 24px;
}
h2 {
  font-size: 23px;
}
h3 {
  font-size: 19px;
  margin: 0 0 8px;
}
p {
  color: var(--muted);
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--accent);
}
.status {
  font-size: 12px;
  color: var(--accent);
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 32px;
  align-items: start;
}
form,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: 18px;
  margin: 0 0 24px;
}
.panel {
  position: relative;
}
label {
  display: block;
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 600;
}
label:first-child {
  margin-top: 0;
}
input,
select,
button {
  font: inherit;
  border-radius: 9px;
  padding: 13px 16px;
}
input,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
}
input:focus,
select:focus {
  border-color: var(--accent);
}
select {
  margin-top: 12px;
}
button {
  background: var(--accent);
  border: 1px solid transparent;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  margin: 12px 8px 0 0;
}
button:hover {
  filter: brightness(1.08);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.danger {
  background: #763e3a;
  color: #ffe8dc;
}
.small {
  padding: 8px 12px;
  font-size: 12px;
}
.input-row {
  display: flex;
  gap: 8px;
}
.input-row button {
  margin: 0;
  white-space: nowrap;
}
.tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.tabs button {
  font-size: 13px;
  margin: 0;
}
.song {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  padding: 16px;
  margin: 16px 0;
  background: var(--panel);
}
.song.is-cached {
  border-color: #6366f1;
}
.song-badge-cached {
  display: inline-block;
  background: #10b981;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
  margin-left: 6px;
  vertical-align: middle;
}
.song img {
  width: 132px;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: 8px;
}
.song p {
  font-size: 12px;
  margin: 0;
}
.song button {
  margin-top: 10px;
}
ol,
ul {
  padding-left: 20px;
}
li {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
li:last-child {
  border: 0;
}
#message {
  color: #efd5a2;
  min-height: 24px;
  font-size: 14px;
}
#now {
  font-weight: 600;
  color: var(--accent);
}
footer {
  padding: 36px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  margin-top: 42px;
}
.gate {
  max-width: 560px;
  padding-top: 12vh;
}
.gate h1 {
  font-size: 40px;
}
.code {
  font-family: monospace;
  font-size: 64px;
  letter-spacing: 12px;
  color: var(--accent);
}
[hidden] {
  display: none !important;
}
pre {
  white-space: pre-wrap;
  color: var(--muted);
  font: 14px/1.8 system-ui;
}
.tv main {
  max-width: none;
  padding: 20px 32px;
}
.tv-top {
  display: flex;
  gap: 24px;
  align-items: center;
}
.tv-top a {
  margin-right: auto;
  font-weight: 700;
}
.tv-top button {
  margin: 0;
}
.stage {
  position: relative;
  background: #080e0c;
  border-radius: 20px;
  overflow: hidden;
  min-height: 60vh;
  display: grid;
  place-items: center;
}
.stage video {
  width: 100%;
  max-height: 75vh;
}
.stage #idle {
  padding: 40px;
  text-align: center;
}
.stage #idle h1 {
  font-size: clamp(40px, 5vw, 72px);
}
#idle-qr {
  width: 190px;
  border: 12px solid white;
  border-radius: 8px;
}
.corner-qr {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 96px;
  background: white;
  padding: 5px;
  border-radius: 5px;
}
.turn {
  position: absolute;
  top: 30px;
  left: 30px;
  background: var(--accent);
  color: var(--ink);
  padding: 16px 24px;
  border-radius: 10px;
  font-size: 25px;
}
.tv-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.tv-bottom h2 {
  font-size: 14px;
  color: var(--muted);
}
@media (max-width: 760px) {
  main {
    padding: 24px 20px;
  }
  nav {
    gap: 18px;
    font-size: 13px;
  }
  .brand {
    font-size: 21px;
  }
  header {
    padding-top: 36px;
  }
  .layout {
    display: flex;
    flex-direction: column;
  }
  .layout > section,
  .layout > aside {
    width: 100%;
  }
  .song {
    grid-template-columns: 96px 1fr;
    gap: 12px;
  }
  .song img {
    width: 96px;
  }
  .song h3 {
    font-size: 16px;
  }
  .panel,
  form {
    padding: 20px;
  }
  .tv-top {
    flex-wrap: wrap;
    gap: 10px;
  }
  .tv-bottom {
    grid-template-columns: 1fr;
  }
  .corner-qr {
    width: 70px;
  }
}

/* Shared interaction baseline; viewport ownership is scoped to TV only. */
:root {
  --scroll-thumb: #66796c;
  --scroll-track: #101817;
  --scroll-hover: #a5b4a7;
}
* {
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  scrollbar-width: thin;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--scroll-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 2px solid var(--scroll-track);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-hover);
}
::-webkit-scrollbar-thumb:active {
  background: var(--accent);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
input,
select,
button {
  min-height: 44px;
}
textarea {
  resize: none;
}
.phone main {
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}
.phone-heading {
  padding: 32px 0 12px;
}
.phone-heading h1 {
  font-size: clamp(30px, 4vw, 46px);
  margin: 12px 0;
  letter-spacing: -1px;
}
.phone-heading p {
  margin: 10px 0;
}
.queue-jump {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 44px;
  color: var(--accent);
  margin: 0 0 16px;
}
.phone .layout > *,
.song > div,
.input-row > input {
  min-width: 0;
}
.phone .song,
.phone li,
.phone #now {
  overflow-wrap: anywhere;
}
.phone .song .small {
  min-width: 148px;
}
.phone #search {
  min-width: 76px;
}
.phone #room-queue {
  scroll-margin-top: 16px;
}
.phone #message {
  min-height: 44px;
}
.phone .tabs button {
  flex: 1;
  min-height: 46px;
}
@media (max-width: 760px) {
  .phone main {
    padding: 20px 16px max(32px, env(safe-area-inset-bottom));
  }
  .phone nav {
    gap: 12px;
    padding-bottom: 18px;
    font-size: 12px;
  }
  .phone .brand {
    font-size: 22px;
  }
  .phone .brand span {
    letter-spacing: 2px;
    font-size: 8px;
  }
  .phone-heading {
    padding-top: 22px;
  }
  .phone-heading .eyebrow {
    font-size: 10px;
    letter-spacing: 1.3px;
  }
  .phone-heading h1 {
    font-size: 32px;
  }
  .phone .layout {
    gap: 16px;
  }
  .phone form {
    padding: 18px 16px;
    margin-bottom: 18px;
  }
  .phone .song {
    padding: 12px;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: start;
  }
  .phone .song img {
    width: 88px;
    aspect-ratio: 1;
  }
  .phone .song h3 {
    line-height: 1.35;
  }
  .phone .song .small {
    width: 100%;
    min-width: 0;
    margin-right: 0;
  }
  .phone #clear-search {
    padding-inline: 10px;
  }
  .phone #library-controls {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
  }
  .phone #prev,
  .phone #next {
    min-width: 120px;
  }
  .phone footer {
    margin-top: 24px;
    padding-block: 20px;
  }
}
.tv {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}
.tv main {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
.tv .stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  background: #000;
}
.tv .stage #player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}
.tv #idle {
  position: absolute;
  inset: 76px 0 18%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 12px;
  overflow: auto;
}
.tv #idle h1 {
  font-size: clamp(28px, 5vw, 64px);
  margin: 10px 0 20px;
}
.tv #idle p {
  margin: 8px;
}
.tv #idle-qr {
  width: clamp(96px, 18vh, 190px);
}
.tv .tv-top {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  z-index: 4;
  padding: 8px 12px;
  gap: 16px;
  background: rgb(8 14 12 / 88%);
  border-radius: 10px;
  font-size: 12px;
}
.tv #message {
  position: absolute;
  top: 76px;
  left: 16px;
  right: 16px;
  z-index: 5;
  margin: 0;
  min-height: 0;
  background: rgb(8 14 12 / 92%);
  padding: 10px;
  border-radius: 8px;
}
.tv #message:empty {
  display: none;
}
.tv .player-overlay {
  position: absolute;
  inset: 88px 24px auto;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}
.tv .singer-caption {
  max-width: min(60%, 560px);
  padding: 12px 20px;
  background: rgb(8 14 12 / 85%);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  overflow-wrap: anywhere;
}
.tv #singer {
  color: var(--text);
  font-size: clamp(20px, 2.5vw, 36px);
  font-weight: 700;
  margin: 4px 0;
  line-height: 1.2;
}
.tv #now {
  color: var(--muted);
  font-size: clamp(12px, 1.2vw, 18px);
  margin: 8px 0 0;
}
.tv .qr-caption {
  flex: none;
  margin: 0;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background: rgb(8 14 12 / 85%);
}
.tv .corner-qr {
  position: static;
  width: clamp(96px, 10vw, 160px);
  height: auto;
  padding: 6px;
  display: block;
}
.tv .qr-caption figcaption {
  color: var(--text);
  font-size: 12px;
  margin-top: 6px;
}
.tv .tv-bottom {
  position: absolute;
  bottom: 16px;
  left: 24px;
  right: 24px;
  display: block;
  max-height: 16%;
  overflow: auto;
}
.tv .tv-bottom h2 {
  margin: 0;
}
.tv .tv-bottom ol {
  display: flex;
  gap: 40px;
  margin: 8px 0;
}
.tv .tv-bottom li {
  border: 0;
  padding: 0;
  min-width: 160px;
  will-change: transform, opacity;
  transition: transform 120ms ease, opacity 120ms ease;
}
.queue-more {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--surface);
  will-change: transform, opacity;
}
.tv .tv-bottom {
  display: none !important;
}
.tv.is-playing .tv-top {
  opacity: 0;
  transition: opacity 160ms;
}
.tv.is-playing .tv-top:hover,
.tv.is-playing .tv-top:focus-within {
  opacity: 1;
}
@media (max-width: 760px) {
  .tv .tv-top {
    gap: 8px;
    flex-wrap: wrap;
  }
  .tv .tv-top .status {
    display: none;
  }
  .tv .player-overlay {
    inset: 88px 12px auto;
    gap: 10px;
  }
  .tv .singer-caption {
    padding: 10px 12px;
    max-width: calc(100% - 124px);
  }
  .tv .singer-caption .eyebrow {
    font-size: 9px;
    letter-spacing: 1px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
@media (forced-colors: active) {
  * {
    scrollbar-color: auto;
  }
  :focus-visible {
    outline-color: Highlight;
  }
  .tv .singer-caption,
  .tv .qr-caption {
    border: 1px solid CanvasText;
  }
}

/* Compact phone remote and independent TV overlay anchors. */
.phone main {
  max-width: 800px;
  padding-top: 12px;
}
.phone nav:first-child {
  padding-bottom: 10px;
}
.phone .phone-user {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  align-items: center;
  margin-top: 12px;
}
.phone .phone-user label {
  margin: 0;
  font-size: 12px;
}
.phone .phone-user input {
  padding: 8px 12px;
}
.phone .phone-user .status {
  grid-column: 1/-1;
  margin: 0;
  font-size: 11px;
}
.phone .tabs {
  margin: 12px 0 0;
  padding: 0 0 10px;
  gap: 6px;
}
.phone .tabs button {
  font-size: 13px;
  padding: 9px 10px;
  flex: 1;
}
.phone .layout {
  display: block;
}
.phone .layout > section,
.phone .layout > aside {
  width: 100%;
}
.phone #message {
  min-height: 22px;
  margin: 8px 0;
  font-size: 12px;
}
.phone #search-form {
  padding: 12px;
  margin-bottom: 12px;
}
.phone #library-controls {
  padding: 12px;
}
.phone #library-controls > label {
  font-size: 12px;
  margin: 8px 0 4px;
}
.phone #library-controls > label:first-child {
  margin-top: 0;
}
.phone #library-controls select {
  margin-top: 0;
}
.phone #prev,
.phone #next {
  min-width: 100px;
  padding: 8px 12px;
}
.phone .song {
  padding: 10px;
  gap: 12px;
  margin: 10px 0;
  grid-template-columns: 72px minmax(0, 1fr);
}
.phone .song img {
  width: 72px;
  aspect-ratio: 1;
}
.phone .song h3 {
  font-size: 15px;
  line-height: 1.35;
}
.phone .song button {
  margin-top: 6px;
}
.phone #room-queue {
  padding: 16px;
}
.phone #room-queue h2 {
  font-size: 18px;
  margin: 12px 0;
}
.phone #room-queue li {
  padding: 12px 0;
}
.phone .playback-actions {
  display: flex;
  gap: 8px;
  margin: 16px 0 22px;
}
.phone .playback-actions button {
  flex: 1;
  margin: 0;
}
:is(.phone, .admin) dialog {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 22px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
}
:is(.phone, .admin) dialog::backdrop {
  background: rgb(0 0 0 / 75%);
}
:is(.phone, .admin) dialog form {
  border: 0;
  padding: 0;
  margin: 0;
}
:is(.phone, .admin) dialog h2 {
  margin-top: 0;
  font-size: 22px;
}
:is(.phone, .admin) dialog p {
  overflow-wrap: anywhere;
}
:is(.phone, .admin) .dialog-actions {
  display: flex;
  gap: 8px;
}
:is(.phone, .admin) .dialog-actions button {
  flex: 1;
  margin: 0;
  min-width: 0;
}
:is(.phone, .admin) .confirm-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #94a3b8;
  margin: 12px 0;
  cursor: pointer;
  user-select: none;
}
:is(.phone, .admin) .confirm-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
}
:is(.phone, .admin) .confirm-option[hidden] {
  display: none !important;
}
.tv .tv-paused-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid #ef4444;
  color: #ffffff;
  padding: 16px 36px;
  border-radius: 9999px;
  font-size: clamp(24px, 4vmin, 44px);
  font-weight: 700;
  letter-spacing: 2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
.tv .tv-paused-badge[hidden] {
  display: none !important;
}
:is(.phone, .admin) #confirm-error {
  min-height: 24px;
  color: #efd5a2;
  font-size: 13px;
}
.tv .player-overlay {
  inset: 16px 20px 20px;
  display: block;
}
.tv .singer-caption {
  position: absolute;
  top: 0;
  left: 0;
  max-width: min(65%, 560px);
}
.tv .qr-caption {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  right: 0;
}
.tv .tv-top {
  z-index: 4;
}
.tv.is-playing .tv-top {
  left: auto;
  max-width: 32%;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tv.is-playing .singer-caption {
  max-width: min(60%, 560px);
}
.tv.is-playing .tv-top a {
  margin-right: 0;
}
.tv.is-playing .tv-top button {
  max-width: 100%;
}
.tv .stage:fullscreen {
  width: 100vw;
  height: 100dvh;
}
.tv .stage:-webkit-full-screen {
  width: 100vw;
  height: 100dvh;
}
.tv .stage:-moz-full-screen {
  width: 100vw;
  height: 100dvh;
}
.tv .stage:-ms-fullscreen {
  width: 100vw;
  height: 100dvh;
}
@media (max-width: 760px) {
  .tv .player-overlay {
    inset: 12px 12px 16px;
  }
  .tv .singer-caption {
    max-width: 72%;
  }
  .phone main {
    padding: 12px 12px max(20px, env(safe-area-inset-bottom));
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.phone #library-controls .input-row button {
  margin: 0;
}
.phone .library-options {
  margin-top: 8px;
  font-size: 12px;
}
.phone .library-options summary {
  cursor: pointer;
  min-height: 36px;
  display: list-item;
  padding: 8px 0;
  color: var(--muted);
}
.phone .pagination {
  display: flex;
  gap: 8px;
}
.phone .pagination button {
  flex: 1;
  margin-right: 0;
}
.phone .volume-control {
  margin: 12px 0 18px;
}
.phone .volume-control label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.phone .volume-control input {
  width: 100%;
  min-height: 44px;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.phone .volume-control output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.phone .playback-actions {
  flex-wrap: wrap;
}

/* Admin: compact room controls, shared palette and touch targets. */
.admin main {
  max-width: 1100px;
  padding: 20px 24px 32px;
}
.admin nav {
  padding-bottom: 16px;
  gap: 18px;
  font-size: 13px;
}
.admin .admin-heading,
.admin .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin .heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin h1 {
  font-size: 26px;
  letter-spacing: -0.7px;
  margin: 20px 0 8px;
}
.admin h2 {
  font-size: 18px;
  margin: 0;
}
.admin #message {
  min-height: 24px;
  margin: 8px 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.admin button {
  min-height: 44px;
  margin: 0;
  padding: 10px 14px;
  font-size: 13px;
}
.admin input {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 14px;
}
.admin .panel,
.admin form {
  padding: 18px;
  margin: 0;
  border-radius: 18px;
}
.admin #login {
  max-width: 420px;
}
.admin .input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.admin .input-row input {
  min-width: 0;
  flex: 1;
}
.admin .input-row button {
  flex-shrink: 0;
}
.admin .admin-status {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.admin .admin-status div {
  padding: 12px;
  min-width: 0;
}
.admin dt {
  font-size: 11px;
  color: var(--muted);
}
.admin dd {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.admin .admin-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 0;
  gap: 6px;
  padding: 0;
  margin-bottom: 16px;
}
.admin .admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.admin .hint {
  font-size: 12px;
  margin: 8px 0 14px;
}
.admin .admin-search {
  padding: 0;
  border: 0;
  background: transparent;
}
.admin .admin-list {
  padding: 0;
  list-style: none;
  margin: 12px 0 0;
}
.admin .admin-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.admin .admin-list li:last-child {
  border-bottom: 0;
}
.admin .admin-item-copy {
  flex: 1;
  min-width: 0;
}
.admin .admin-item-copy strong {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.admin .admin-item-copy span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin-top: 3px;
}
.admin .admin-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.admin .now-playing strong {
  color: var(--accent);
}
.admin .empty {
  color: var(--muted);
  font-size: 13px;
}
.admin .admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin .admin-pagination {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.admin #cookies-form > button {
  margin-top: 12px;
}
@media (max-width: 760px) {
  .admin main {
    padding: 12px 12px 24px;
  }
  .admin .brand {
    font-size: 21px;
  }
  .admin .admin-status {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .admin .admin-grid {
    grid-template-columns: 1fr;
  }
  .admin .panel,
  .admin form {
    padding: 14px;
  }
  .admin .admin-tabs button {
    padding: 10px 4px;
    font-size: 12px;
  }
  .admin #library li {
    flex-wrap: wrap;
    gap: 8px;
  }
  .admin #library .admin-item-copy {
    flex-basis: 100%;
  }
  .admin #library .admin-item-actions {
    margin-left: auto;
  }
}

.song-preview {
  display: block;
  align-self: start;
  border-radius: 9px;
}
.song-preview img {
  display: block;
}
.song-preview:hover {
  opacity: 0.85;
}
.phone .search-hint {
  font-size: 12px;
  margin: 0 0 8px;
}
/* Responsive remote lists and disclosure audio controls. */
.phone .audio-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.phone .audio-actions button {
  margin: 0;
  min-height: 44px;
}
.phone #queue {
  padding: 0;
  list-style: none;
}
.phone #queue li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  will-change: transform, opacity;
  transition: transform 120ms ease, opacity 120ms ease;
}
.phone .queue-copy {
  flex: 1 1 160px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.phone #queue button {
  margin: 0;
  min-height: 44px;
  padding: 8px;
  font-size: 12px;
}
.phone .queue-grip {
  touch-action: none;
  cursor: grab;
  min-width: 44px;
}
.phone .queue-move {
  min-width: 44px;
}
.phone .queue-hint {
  font-size: 12px;
  margin: 8px 0;
}
.phone .dragging {
  opacity: 0.65;
  transform: scale(1.02);
  will-change: transform, opacity;
}
.phone .drop-target {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 9px;
}
#queue progress {
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 6px;
  accent-color: var(--accent);
}
.queue-failed {
  background: rgba(220, 38, 38, 0.08) !important;
  border-left: 4px solid #dc2626 !important;
  padding-left: 12px !important;
}
.queue-badge-failed {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}
.queue-error-msg {
  display: block;
  font-size: 13px;
  color: #ef4444;
  margin-top: 4px;
}
.queue-retry {
  min-height: 44px;
  min-width: 96px;
  font-size: 13px;
  font-weight: 600;
  margin-right: 12px;
}
.download-status {
  font-size: 12px;
  color: var(--muted);
}
.phone .results,
.phone #room-queue,
.phone .song {
  min-width: 0;
}
.phone .song h3,
.phone #now {
  overflow-wrap: anywhere;
}
@media (min-width: 600px) {
  .phone .results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .phone .song {
    margin: 0;
  }
}
/* Scale TV chrome with both viewport dimensions, including short displays. */
.tv {
  --tv-unit: clamp(2px, 1vmin, 12px);
}
.tv .player-overlay {
  inset: calc(var(--tv-unit) * 1.5);
}
.tv .singer-caption {
  padding: calc(var(--tv-unit) * 1) calc(var(--tv-unit) * 1.5);
}
.tv #singer {
  font-size: clamp(14px, 3vmin, 32px);
}
.tv #now {
  font-size: clamp(10px, 1.5vmin, 16px);
}
.tv .singer-caption .eyebrow {
  font-size: clamp(8px, 1vmin, 11px);
  letter-spacing: 0.16em;
}
.tv .corner-qr {
  width: clamp(52px, 14vmin, 140px);
  padding: 4px;
}
.tv .qr-caption {
  padding: calc(var(--tv-unit) * 0.7);
  bottom: calc(var(--tv-unit) * 1.5);
}
.tv .qr-caption figcaption {
  font-size: clamp(9px, 1.2vmin, 12px);
}
.tv .tv-top {
  font-size: clamp(9px, 1.4vmin, 12px);
  padding: calc(var(--tv-unit) * 0.7);
  gap: calc(var(--tv-unit) * 0.7);
}
.tv .tv-top button {
  font-size: inherit;
  padding: calc(var(--tv-unit) * 0.6) calc(var(--tv-unit) * 0.9);
}
.tv #idle h1 {
  font-size: clamp(20px, 6vmin, 64px);
}
.tv #idle {
  padding: 2vmin;
}
.tv #idle-qr {
  width: clamp(64px, 20vmin, 190px);
}
.tv #idle p {
  font-size: clamp(10px, 1.6vmin, 16px);
}
.phone #queue li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
}
.phone .queue-grip {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: start;
}
.phone .queue-copy {
  grid-column: 2;
  grid-row: 1;
}
.phone .queue-actions {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* Older engines may treat dialog as an ordinary element. */
.phone dialog:not([open]) {
  display: none;
}
.phone .fallback-dialog[open] {
  display: block;
  position: fixed;
  z-index: 20;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
  margin: 0;
  padding: 22px;
  border: 1px solid #31413b;
  border-radius: 18px;
  background: #182421;
  color: #edf2e8;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.75);
}
.phone .fallback-dialog form {
  padding: 0;
  border: 0;
  margin: 0;
}
/* Old TV engines: explicit fallbacks for CSS variables, clamp, inset and grid. */
.legacy-browser body {
  background: #101817;
  color: #edf2e8;
}
.legacy-browser p,
.legacy-browser label {
  color: #a5b4a7;
}
.legacy-browser a {
  color: #edf2e8;
}
.legacy-browser .tv .singer-caption,
.legacy-browser .tv .qr-caption,
.legacy-browser .tv .tv-top,
.legacy-browser .tv #message {
  background: rgba(8, 14, 12, 0.88);
}
.legacy-browser form,
.legacy-browser .panel {
  background: #182421;
  border-color: #31413b;
}
.legacy-browser input,
.legacy-browser select {
  background: #101817;
  color: #edf2e8;
  border-color: #31413b;
}
.legacy-browser button {
  background: #dcf979;
  color: #18220c;
}
.legacy-browser .secondary {
  background: transparent;
  color: #edf2e8;
  border-color: #a5b4a7;
}
.legacy-browser .status,
.legacy-browser .phone #now {
  color: #dcf979;
}
.legacy-browser .phone button[aria-pressed="true"] {
  background: #dcf979;
  color: #18220c;
  border-color: #dcf979;
}
.legacy-browser .phone button:focus,
.legacy-browser .phone a:focus {
  outline: 2px solid #dcf979;
  outline-offset: 2px;
}
.legacy-browser .phone .phone-user,
.legacy-browser .phone .song {
  display: block;
}
.legacy-browser .phone .song {
  border: 1px solid #31413b;
  background: #182421;
}
.legacy-browser .phone .tabs button + button {
  margin-left: 6px;
}
.legacy-browser .phone .dialog-actions button + button {
  margin-left: 8px;
}
.legacy-browser h1 {
  font-size: 32px;
}
.legacy-browser .tv {
  height: 100vh;
  background: #000;
}
.legacy-browser .tv .stage {
  display: block;
  height: 100%;
}
.legacy-browser .tv #player {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.legacy-browser .tv #idle {
  top: 64px;
  right: 0;
  bottom: 15%;
  left: 0;
  display: block;
  text-align: center;
  padding: 16px;
}
.legacy-browser .tv #idle h1 {
  font-size: 4vw;
}
.legacy-browser .tv #idle-qr {
  width: 120px;
  max-height: 24vh;
}
.legacy-browser .tv .tv-top {
  top: 12px;
  right: 12px;
  left: 12px;
  font-size: 12px;
  padding: 8px;
}
.legacy-browser .tv.is-playing .tv-top {
  left: auto;
  max-width: 32%;
  opacity: 1;
}
.legacy-browser .tv .player-overlay {
  top: 12px;
  right: 12px;
  bottom: 12px;
  left: 12px;
}
.legacy-browser .tv .singer-caption {
  max-width: 60%;
  padding: 10px 14px;
  border-left-color: #dcf979;
}
.legacy-browser .tv #singer {
  font-size: 24px;
  color: #edf2e8;
}
.legacy-browser .tv #now {
  font-size: 14px;
}
.legacy-browser .tv .eyebrow {
  font-size: 10px;
  color: #dcf979;
}
.legacy-browser .tv .qr-caption {
  right: 0;
  bottom: 12px;
  padding: 8px;
}
.legacy-browser .tv .corner-qr {
  width: 100px;
}
.legacy-browser .tv #message {
  top: 76px;
}
