:root {
  --bg: #f4fbff;
  --ink: #17324a;
  --muted: #5f7c94;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(64, 126, 179, 0.28);
  --accent: #18b89a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --focus: #2aa9e0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
}

.player-body {
  background: radial-gradient(
    circle at 25% 20%,
    #d9f4ff 0%,
    #eef9ff 55%,
    #f7fcff 100%
  );
  overflow: hidden;
}

.player-root {
  position: fixed;
  inset: 0;
}

.player-root-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Tap menu overlay */
.tap-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.tap-menu-card {
  position: relative;
  width: min(520px, calc(100vw - 28px));
  padding: 14px 18px 20px;
  background: rgba(20, 20, 30, 0.92);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.tap-menu-back-corner {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.86rem !important;
  padding: 7px 12px !important;
  z-index: 2;
}

.tap-menu-main {
  display: grid;
  gap: 14px;
  padding-top: 30px;
}

.tap-menu-back-inline {
  justify-self: center;
  min-width: 160px;
}

.tap-menu-title {
  margin: 0;
  text-align: center;
  color: #f3f8ff;
  font-size: 1.35rem !important;
  font-weight: 700 !important;
}

.tap-menu-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tap-menu-btn-large {
  width: 100%;
  min-height: 56px;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  padding: 14px 16px !important;
}

@media (max-width: 520px) {
  .tap-menu-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

.connect-body {
  background: radial-gradient(
    circle at 25% 20%,
    #d9f4ff 0%,
    #eef9ff 55%,
    #f7fcff 100%
  );
  overflow: hidden;
}

.connect-root {
  position: fixed;
  inset: 0;
}

.connect-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 70% 30%,
      rgba(24, 184, 154, 0.2),
      transparent 36%
    ),
    radial-gradient(
      circle at 20% 80%,
      rgba(48, 163, 230, 0.2),
      transparent 42%
    ),
    linear-gradient(140deg, #eaf9ff, #f8fdff 55%, #e6f6ff);
}

.bg-layer {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 70% 30%,
      rgba(24, 184, 154, 0.2),
      transparent 36%
    ),
    radial-gradient(
      circle at 20% 80%,
      rgba(48, 163, 230, 0.2),
      transparent 42%
    ),
    linear-gradient(140deg, #eaf9ff, #f8fdff 55%, #e6f6ff);
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.bg-video.active {
  display: block;
  opacity: 1;
  visibility: visible;
}

.video-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 300ms linear;
  pointer-events: none;
}

.video-layer.active {
  opacity: 1;
}

.yt-slot,
.yt-slot iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.dark-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    transparent 26%,
    rgba(110, 177, 212, 0.2) 100%
  );
  pointer-events: none;
}

.live-probe-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: #000;
}

.live-probe-overlay.hidden {
  display: none;
}

.live-probe-card {
  min-width: 220px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #e8f7ff;
  background: rgba(8, 28, 44, 0.82);
  border: 1px solid rgba(109, 196, 241, 0.5);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

.unlock-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(241, 251, 255, 0.8);
  backdrop-filter: blur(4px);
}

.unlock-overlay.hidden {
  display: none;
}

.passive-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(241, 251, 255, 0.86);
  backdrop-filter: blur(6px);
}

.passive-overlay.hidden {
  display: none;
}

.pairing-overlay {
  position: absolute;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #f1fbff;
}

.pairing-overlay.hidden {
  display: none;
}

.pairing-card {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(145, 186, 218, 0.45);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(20, 52, 83, 0.2);
  display: grid;
  gap: 12px;
}

.pairing-card h2 {
  margin: 0;
  font-size: 22px;
}

.pairing-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.pairing-card input {
  margin-top: 2px;
}

.pairing-error {
  min-height: 18px;
  font-size: 12px;
  color: #cc3e55;
}

.pairing-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.passive-card {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(145, 186, 218, 0.45);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(20, 52, 83, 0.2);
  display: grid;
  gap: 12px;
}

.passive-card h2 {
  margin: 0;
  font-size: 22px;
}

.passive-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.passive-owner {
  font-size: 13px;
}

.controller-qr-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #f1fbff;
}

.controller-qr-overlay.hidden {
  display: none;
}

.controller-qr-card {
  width: min(560px, calc(100vw - 24px));
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(145, 186, 218, 0.45);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(20, 52, 83, 0.2);
  padding: 20px;
  display: grid;
  gap: 12px;
}

.controller-qr-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.controller-qr-back-corner {
  font-size: 0.85rem !important;
  padding: 8px 12px !important;
}

.controller-qr-head-spacer {
  width: 64px;
  height: 1px;
}

.controller-qr-card h2 {
  margin: 0;
  font-size: 24px;
  text-align: center;
}

.controller-qr-card p {
  margin: 0;
  color: var(--muted);
}

.controller-session-code {
  margin: 4px auto 0;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #173f60;
  font-variant-numeric: tabular-nums;
}

.controller-qr-frame {
  width: min(320px, 70vw);
  aspect-ratio: 1 / 1;
  margin: 4px auto;
  border: 1px solid rgba(145, 186, 218, 0.45);
  border-radius: 12px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.controller-qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.controller-link-text {
  font-size: 12px;
  word-break: break-all;
  text-align: center;
}

.controller-qr-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.controller-continue-btn {
  grid-column: 1 / -1;
  width: 100%;
}

.controller-open-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
}

.controller-open-split .btn {
  border-radius: 0;
  margin: 0;
}

.controller-open-main {
  border-top-left-radius: 10px !important;
  border-bottom-left-radius: 10px !important;
  display: grid;
  grid-template-rows: 3fr 1fr;
  justify-items: center;
  align-content: center;
  gap: 0;
  min-height: 102px;
  padding: 8px 10px !important;
}

.controller-open-trigger {
  min-width: 42px;
  width: 42px;
  padding: 0;
  border-top-right-radius: 10px !important;
  border-bottom-right-radius: 10px !important;
  border-left: 1px solid rgba(255, 255, 255, 0.45);
}

.controller-continue-btn {
  display: grid;
  grid-template-rows: 3fr 1fr;
  justify-items: center;
  align-content: center;
  gap: 0;
  min-height: 102px;
  padding: 8px 10px !important;
}

.controller-action-visual {
  display: block;
  width: 56px;
  height: 56px;
  align-self: center;
  justify-self: center;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.controller-action-visual-open {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='6' y='20' width='52' height='28' rx='14' fill='none' stroke='%23ffffff' stroke-width='4'/%3E%3Ccircle cx='24' cy='34' r='6' fill='%23ffffff'/%3E%3Ccircle cx='40' cy='34' r='6' fill='%23ffffff'/%3E%3Crect x='12' y='30' width='10' height='3' rx='1.5' fill='%23ffffff'/%3E%3Crect x='42' y='30' width='10' height='3' rx='1.5' fill='%23ffffff'/%3E%3C/svg%3E");
}

.controller-action-visual-continue {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='26' fill='none' stroke='%23ffffff' stroke-width='4'/%3E%3Cpath d='M27 20l18 12-18 12z' fill='%23ffffff'/%3E%3C/svg%3E");
}

.controller-action-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-align: center;
  align-self: center;
  justify-self: center;
}

@media (max-width: 540px) {
  .controller-qr-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

.unlock-card {
  width: min(520px, calc(100vw - 24px));
  padding: 20px;
  border: 1px solid rgba(64, 126, 179, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(37, 94, 133, 0.2);
}

.unlock-card h2 {
  margin: 0 0 12px;
  font-size: 24px;
}

.unlock-title {
  text-align: center;
}

.unlock-back-top {
  align-self: center;
  justify-self: center;
  margin-bottom: 10px;
  min-width: 160px;
}

.unlock-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.unlock-controller-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.unlock-controller-qr-frame {
  width: min(220px, 72vw);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 1px solid rgba(145, 186, 218, 0.45);
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.unlock-controller-qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.unlock-controller-link {
  margin: 0;
  font-size: 12px;
  text-align: center;
  word-break: break-all;
  color: #416783;
}

.unlock-card p {
  margin: 0 0 10px;
  color: #2f5877;
  line-height: 1.45;
}

.unlock-hint {
  color: var(--muted);
  font-size: 13px;
}

.status-panel {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: min(420px, 45vw);
  max-height: 48vh;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
}

.status-panel h1 {
  font-size: 14px;
  margin: 0 0 8px;
  color: #2d5f80;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-panel pre {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  color: #365f7d;
}

.status-panel.hidden {
  display: none;
}

.controller-body {
  background:
    radial-gradient(
      circle at 85% 8%,
      rgba(24, 184, 154, 0.18),
      transparent 30%
    ),
    radial-gradient(
      circle at 0% 100%,
      rgba(42, 169, 224, 0.18),
      transparent 38%
    ),
    #f2fbff;
  min-height: 100vh;
}

.controller-root {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 12px 12px
    calc(var(--sticky-transport-offset, 132px) + env(safe-area-inset-bottom));
}

.player-code-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8f3fb, #d8e8f4);
  border: 1px solid rgba(112, 151, 181, 0.4);
  color: #214f72;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.player-code-label {
  font-size: 12px;
  font-weight: 700;
  color: #426b89;
}

.player-open-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(112, 151, 181, 0.4);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.player-open-status.is-open {
  background: rgba(83, 215, 142, 0.2);
  border-color: rgba(45, 175, 103, 0.45);
  color: #1b6f44;
}

.player-open-status.is-closed {
  background: rgba(238, 245, 251, 0.9);
  color: #355f80;
}

.player-unavailable-notice {
  margin: 8px 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(96, 137, 167, 0.35);
  background: rgba(236, 246, 253, 0.9);
  color: #2f5f82;
  font-size: 12px;
  font-weight: 600;
}

.sticky-transport {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  max-height: min(45vh, 300px);
  overflow-y: auto;
  background: rgba(242, 251, 255, 0.95);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.sticky-now-playing {
  grid-column: 1 / -1;
  display: grid;
  gap: 2px;
  padding: 5px 7px;
  border-radius: 9px;
  border: 1px solid rgba(71, 133, 178, 0.22);
  background: rgba(255, 255, 255, 0.88);
}

.sticky-now-group {
  font-size: 10px;
  font-weight: 800;
  color: #1f5c82;
}

.sticky-top-toggle-stack {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  width: max-content;
}

.sticky-playback-state-label {
  position: absolute;
  top: 50%;
  left: calc(100% + 6px);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(214, 169, 30, 0.58);
  background: linear-gradient(
    180deg,
    rgba(247, 224, 130, 0.95),
    rgba(229, 189, 53, 0.95)
  );
  color: #5b4300;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.sticky-now-track,
.sticky-now-progress {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #335f7f;
}

.sticky-live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-left: 6px;
  width: auto !important;
  min-height: 18px;
  min-width: 0;
  padding: 1px 7px !important;
  border-radius: 999px;
  border: 1px solid rgba(214, 169, 30, 0.88);
  background: linear-gradient(180deg, #f5d46a, #dcae1d);
  color: #3f2d02;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.22) inset,
    0 0 12px rgba(220, 175, 46, 0.45);
  animation: sticky-live-pill-pulse 1.45s ease-in-out infinite;
  vertical-align: middle;
}

.sticky-transport .sticky-live-badge {
  min-height: 18px;
  min-width: 0;
  width: auto;
}

.sticky-live-action {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  cursor: pointer;
}

.sticky-live-action:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sticky-live-badge:disabled {
  cursor: not-allowed;
  opacity: 1;
  animation: none;
}

.sticky-live-badge.is-live-behind {
  border-color: rgba(214, 169, 30, 0.88);
  background: linear-gradient(180deg, #f5d46a, #dcae1d);
  color: #3f2d02;
}

.sticky-live-badge.is-live-edge {
  border-color: rgba(157, 0, 0, 0.96);
  background: linear-gradient(180deg, #ff3a3a, #b40000);
  color: #fff6f6;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18) inset,
    0 0 16px rgba(180, 0, 0, 0.52);
  animation: none;
}

.sticky-live-probe-loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  min-height: 18px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(77, 103, 121, 0.54);
  background: linear-gradient(180deg, #d7e0e7, #b5c3cf);
  color: #243744;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  vertical-align: middle;
}

.sticky-live-probe-spinner {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1.5px solid rgba(36, 55, 68, 0.2);
  border-top-color: rgba(36, 55, 68, 0.92);
  animation: sticky-live-spinner 0.8s linear infinite;
}

.sticky-live-badge.is-live-probe {
  border-color: rgba(104, 128, 145, 0.78);
  background: linear-gradient(180deg, #b8c7d2, #95a9b8);
  color: #1d2b35;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.26) inset,
    0 0 8px rgba(122, 145, 162, 0.2);
  animation: none;
}

.sticky-live-badge.is-live-ended {
  border-color: rgba(88, 96, 108, 0.88);
  background: linear-gradient(180deg, #8f99a6, #6b7786);
  color: #f5f7fa;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  animation: none;
}

.sticky-live-badge.is-non-live {
  border-color: rgba(104, 128, 145, 0.65);
  background: linear-gradient(180deg, #9db0be, #7a91a2);
  color: #eff5f9;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  animation: none;
}

.sticky-live-badge.is-live-edge::before {
  background: #f2fff7;
  box-shadow: 0 0 8px rgba(242, 255, 247, 0.9);
  animation: none;
}

.sticky-live-lag-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(214, 169, 30, 0.46);
  background: rgba(220, 175, 46, 0.16);
  color: #7b5c00;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
}

button.sticky-live-lag-label {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  cursor: pointer;
}

.sticky-live-ended-label {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(214, 169, 30, 0.46);
  background: rgba(220, 175, 46, 0.3);
  color: #7b5c00;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sticky-live-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #ffe4e4;
  box-shadow: 0 0 7px rgba(255, 237, 237, 0.85);
  animation: sticky-live-dot-pulse 0.95s ease-in-out infinite;
}

@keyframes sticky-live-dot-pulse {
  0% {
    opacity: 0.5;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

@keyframes sticky-live-spinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes sticky-live-pill-pulse {
  0% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.2) inset,
      0 0 8px rgba(214, 40, 40, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.26) inset,
      0 0 16px rgba(214, 40, 40, 0.62);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.2) inset,
      0 0 8px rgba(214, 40, 40, 0.35);
  }
}

.sticky-now-neighbors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sticky-now-neighbor {
  font-size: 9px;
  line-height: 1.2;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid rgba(71, 133, 178, 0.24);
  background: rgba(233, 245, 255, 0.7);
  color: #2f5875;
}

.sticky-transport .btn {
  min-height: 36px;
  width: 100%;
}

#sticky-stop {
  font-size: 17px;
  line-height: 1;
  font-weight: 900;
  border-color: rgba(204, 82, 82, 0.58);
  background: linear-gradient(180deg, #ffe7e7, #ffd2d2);
  color: #8e2e2e;
}

.sticky-volume-wrap {
  min-width: 0;
}

.sticky-secondary-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) minmax(140px, 1fr);
  gap: 6px;
  align-items: stretch;
}

.sticky-side-stack {
  display: grid;
  gap: 6px;
  align-content: stretch;
}

.sticky-side-stack .btn {
  min-height: 44px;
}

.sticky-volume-card {
  display: grid;
  gap: 4px;
  padding: 5px 6px;
  border-radius: 10px;
  border: 1px solid rgba(96, 146, 181, 0.22);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(244, 250, 255, 0.94)
  );
  box-shadow: 0 6px 14px rgba(42, 109, 152, 0.08);
}

.sticky-volume-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 14px;
}

.sticky-follow-track {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: #335f7f;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.sticky-follow-track span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-follow-track input[type="checkbox"] {
  width: 12px;
  height: 12px;
  accent-color: #207fc8;
}

.sticky-follow-track {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-volume-meter {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(71, 133, 178, 0.2);
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
}

.sticky-volume-slider {
  width: 100%;
  margin: 0;
  appearance: none;
  height: 12px;
  background: transparent;
}

.sticky-volume-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4fa2db, #9cc9ea);
}

.sticky-volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #2f678f;
  box-shadow: 0 2px 5px rgba(22, 73, 108, 0.2);
}

.sticky-volume-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4fa2db, #9cc9ea);
}

.sticky-volume-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #2f678f;
  box-shadow: 0 2px 5px rgba(22, 73, 108, 0.2);
}

.sticky-volume-controls-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 5px;
}

.sticky-volume-controls-row .btn {
  min-height: 30px;
  border-radius: 8px;
  font-weight: 800;
}

#sticky-volume-down,
#sticky-volume-up {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #204f70;
  border-color: rgba(81, 135, 170, 0.42);
  background: linear-gradient(180deg, #f5fbff, #dcebfa);
}

#sticky-mute {
  font-size: 14px;
  letter-spacing: 0.01em;
}

#sticky-play-pause {
  font-size: 19px;
  line-height: 1;
}

#sticky-play-pause.is-play {
  background: linear-gradient(180deg, #53d78e, #2daf67);
  border-color: rgba(57, 197, 124, 0.8);
  color: #f6fff8;
}

#sticky-play-pause.is-pause {
  background: linear-gradient(180deg, #f2c94c, #d4a514);
  border-color: rgba(214, 169, 30, 0.78);
  color: #3b2a00;
}

.sticky-volume-value {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #1f4f72;
  line-height: 1.1;
}

.sticky-volume-label {
  display: block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #67869f;
}

.sticky-volume-number {
  display: block;
  margin-top: 1px;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sticky-volume-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(184, 101, 127, 0.38);
  background: rgba(217, 121, 146, 0.12);
  color: #9e3e5b;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sticky-volume-lock-floating {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(33, 120, 201, 0.48);
  background: rgba(86, 170, 243, 0.14);
  color: #2d79b4;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .sticky-transport {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sticky-secondary-layout {
    grid-template-columns: minmax(96px, 1fr) minmax(170px, 1.6fr) minmax(
        96px,
        1fr
      );
    gap: 5px;
  }
}

@media (max-width: 520px) {
  .sticky-transport {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  }

  .sticky-secondary-layout {
    grid-template-columns: minmax(84px, 1fr) minmax(150px, 1.4fr) minmax(
        84px,
        1fr
      );
    gap: 4px;
  }

  .sticky-side-stack .btn {
    min-height: 40px;
  }
}

.panel {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 10px 18px rgba(42, 109, 152, 0.12);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
}

.section-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.session-collapsed-name {
  display: none;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #2a5f84;
  cursor: pointer;
}

.session-panel.is-collapsed .session-row,
.session-panel.is-collapsed .session-create,
.session-panel.is-collapsed .session-feedback {
  display: none;
}

.session-panel.is-collapsed .session-collapsed-name {
  display: block;
}

.session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}

.session-row-main {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.session-row-select {
  grid-template-columns: minmax(0, 1fr) auto;
}

.session-row-controls {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.session-row-add {
  display: flex;
  justify-content: flex-start;
}

.session-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.session-create[hidden] {
  display: none;
}

.session-create-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
  justify-content: end;
}

.session-row:last-child {
  margin-bottom: 0;
}

.session-panel .session-btn {
  min-height: 36px;
  font-size: 13px;
  padding: 6px 10px;
}

.session-panel .session-icon-btn {
  min-width: 36px;
  width: 36px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.add-track-btn {
  min-width: 0;
  width: auto;
  min-height: 0;
  height: auto;
  padding: 2px 8px;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #111111;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.library-panel .section-head-actions .add-track-btn {
  width: 52px;
  min-width: 52px;
  justify-content: center;
  text-align: center;
}

.add-track-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.session-panel input,
.session-panel select {
  min-height: 36px;
  font-size: 13px;
  padding: 6px 8px;
}

.session-feedback {
  min-height: 18px;
  margin: 4px 0 0;
  font-size: 12px;
  color: #3f6f93;
}

.session-feedback.is-error {
  color: #cc3e55;
}

.session-panel .session-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.group-controls .btn:disabled,
.track-card .btn:disabled,
.sticky-transport .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: saturate(0.7);
}

.btn.is-loading {
  position: relative;
  overflow: hidden;
  --btn-loader-track: rgba(31, 79, 114, 0.24);
  --btn-loader-head: rgba(31, 79, 114, 0.95);
}

.btn.btn-primary.is-loading {
  --btn-loader-track: rgba(255, 255, 255, 0.32);
  --btn-loader-head: rgba(255, 255, 255, 0.96);
}

.track-primary-action.is-pause.is-loading,
.group-play-btn.is-pause.is-loading {
  --btn-loader-track: rgba(59, 42, 0, 0.22);
  --btn-loader-head: rgba(59, 42, 0, 0.9);
}

.btn.is-soft-locked {
  opacity: 0.82;
  cursor: wait;
  filter: saturate(0.9);
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--btn-loader-track);
}

.btn.is-loading::before {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 2px;
  background: var(--btn-loader-head);
  animation: btn-loader-sweep 0.95s ease-in-out infinite;
}

@keyframes btn-loader-sweep {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

.preset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}

.preset-main-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.sticky-top {
  position: sticky;
  top: 8px;
  z-index: 6;
}

.now-panel h1 {
  margin: 0 0 10px;
  font-size: 21px;
  letter-spacing: 0.03em;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  font-size: 13px;
}

h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #2a5f84;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.large-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.transport-help {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(130, 178, 212, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #2f5877;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.btn {
  border: 1px solid rgba(132, 180, 214, 0.55);
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.95),
    rgba(233, 246, 255, 0.95)
  );
  color: #1f4f72;
  border-radius: 10px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.015em;
  padding: 8px;
}

.icon-action-btn.track-again-btn {
  border-color: rgba(57, 197, 124, 0.78);
  background: linear-gradient(180deg, #53d78e, #2daf67);
  color: #f6fff8;
}

.icon-action-btn.track-again-btn:disabled {
  border-color: rgba(57, 197, 124, 0.45);
  background: linear-gradient(180deg, #8ecfa9, #70b28f);
  color: rgba(246, 255, 248, 0.9);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(180deg, #34ceb0, #1fb899);
  border-color: rgba(56, 184, 155, 0.5);
  color: #ffffff;
}

.track-primary-action.is-play,
.group-play-btn.is-play {
  background: linear-gradient(180deg, #53d78e, #2daf67);
  border-color: rgba(57, 197, 124, 0.8);
  color: #f6fff8;
}

.track-primary-action.is-pause,
.group-play-btn.is-pause {
  background: linear-gradient(180deg, #f2c94c, #d4a514);
  border-color: rgba(214, 169, 30, 0.78);
  color: #3b2a00;
}

.btn-warn {
  background: linear-gradient(180deg, #a97414, #8a5c0f);
}

.btn-danger {
  background: linear-gradient(180deg, #d44949, #af2f2f);
  border-color: rgba(255, 193, 193, 0.6);
  color: #fff;
}

.btn-small {
  min-height: 42px;
  font-size: 13px;
  padding: 6px 10px;
}

.icon-btn {
  min-width: 36px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

label {
  display: block;
  margin-top: 8px;
  margin-bottom: 4px;
  color: #3f6f93;
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(132, 180, 214, 0.45);
  background: rgba(255, 255, 255, 0.98);
  color: #1c4b6d;
  padding: 9px 10px;
  font-size: 15px;
}

.split-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-error {
  min-height: 20px;
  margin: 8px 0 0;
  color: #cc3e55;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-layer[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(203, 231, 248, 0.6);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 48px rgba(42, 109, 152, 0.2);
}

.modal-card-compact {
  width: min(520px, calc(100vw - 24px));
}

.take-control-content {
  padding-top: 6px !important;
}

.take-control-message {
  margin: 0;
  color: #274f70;
  font-size: 18px;
  line-height: 1.45;
  word-break: break-word;
}

.take-control-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 4px;
}

.take-control-actions .btn {
  min-width: 128px;
  padding-inline: 14px;
}

@media (max-width: 520px) {
  .take-control-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .take-control-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

.modal-head {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.98);
  padding-bottom: 8px;
  z-index: 1;
}

.row-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.row-wrap select {
  max-width: 220px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 12px;
}

.checkbox-row input {
  width: 20px;
  min-height: auto;
  margin: 0;
}

.compact-checkbox {
  margin-top: 0;
  margin-bottom: 0;
}

.library-next-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid rgba(179, 206, 244, 0.18);
  border-radius: 12px;
  background: rgba(7, 16, 30, 0.7);
}

.next-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  min-height: 42px;
  min-width: 42px;
  width: 42px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: 10px;
  border: 1px solid rgba(220, 126, 126, 0.55);
  color: #ffffff;
  background: linear-gradient(180deg, #db6262, #bf4d4d);
}

.card-icon-btn {
  min-height: 30px;
  min-width: 30px;
  width: 30px;
  font-size: 13px;
}

.transport-url-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.transport-url-card {
  border: 1px solid rgba(145, 186, 218, 0.35);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  gap: 8px;
}

.transport-url-card h3 {
  margin: 0;
  font-size: 14px;
}

.transport-qr-frame {
  width: min(100%, 240px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 1px solid rgba(145, 186, 218, 0.35);
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.transport-qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 760px) {
  .transport-url-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.track-list {
  display: grid;
  gap: 6px;
}

.group-card {
  border: 1px solid rgba(130, 178, 212, 0.42);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  padding: 8px;
}

.group-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(95, 154, 195, 0.42);
  background: linear-gradient(
    140deg,
    rgba(232, 246, 255, 0.98),
    rgba(212, 236, 250, 0.96)
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 4px 10px rgba(34, 105, 146, 0.09);
}

.group-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.group-tail-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-left: auto;
}

.group-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  color: #174a6c;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-width: 0;
}

.group-title-wrap[role="button"] {
  cursor: pointer;
}

.group-now-playing {
  margin: 0;
  font-size: 12px;
  color: #2a5f84;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.group-controls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  overflow: visible;
  max-width: none;
}

.group-primary-controls,
.group-edit-controls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.group-controls .btn,
.group-controls select {
  min-height: 34px;
  height: 34px;
}

.group-play-btn {
  font-weight: 700;
}

.group-play-icon-btn {
  min-width: 56px;
  width: 56px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.group-meta-btn {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.group-start-btn {
  font-size: 10px;
}

.group-mode-btn {
  min-width: 58px;
  width: 58px;
  justify-content: center;
  text-align: center;
}

.group-toggle-btn {
  width: 46px;
  min-width: 46px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  border-color: rgba(105, 136, 163, 0.58);
  background: linear-gradient(180deg, #eef5fb, #dce8f1);
  color: #34546f;
}

.group-action-divider {
  width: 1px;
  min-width: 1px;
  align-self: stretch;
  background: rgba(64, 126, 179, 0.24);
}

.group-action-divider.is-hidden,
.group-edit-controls.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.group-start-options {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.group-start-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
}

.group-start-option-index {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 10px;
  background: rgba(24, 184, 154, 0.12);
  color: #127865;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.group-start-option-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: #214f72;
}

.group-mode-select {
  min-height: 34px;
  width: auto;
  min-width: 150px;
  font-size: 12px;
  padding: 4px 8px;
}

.group-track-list {
  display: grid;
  gap: 6px;
}

.background-library {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(145, 186, 218, 0.28);
}

.images-panel .background-library {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.section-subhead {
  margin-bottom: 8px;
}

.section-subhead h3 {
  margin: 0;
  font-size: 14px;
}

.background-list {
  display: grid;
  gap: 8px;
}

.background-list[hidden] {
  display: none;
}

.background-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(145, 186, 218, 0.36);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.background-card.is-selected {
  border-color: rgba(57, 197, 124, 0.8);
  background: linear-gradient(
    180deg,
    rgba(83, 215, 142, 0.2),
    rgba(45, 175, 103, 0.14)
  );
  box-shadow: inset 0 0 0 1px rgba(57, 197, 124, 0.18);
}

.background-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(145, 186, 218, 0.3);
}

.background-card-meta {
  display: grid;
  gap: 6px;
  align-content: center;
}

.background-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.background-card-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.background-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.background-card-meta h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
}

.background-card .btn {
  min-height: 34px;
}

.track-card {
  border: 1px solid rgba(145, 186, 218, 0.36);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.track-card.is-next {
  border-color: rgba(24, 184, 154, 0.95);
  box-shadow: inset 0 0 0 1px rgba(24, 184, 154, 0.35);
}

.track-card.is-transitioning-in {
  border-color: rgba(42, 169, 224, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(42, 169, 224, 0.45),
    0 0 0 1px rgba(42, 169, 224, 0.25);
  background: linear-gradient(
    180deg,
    rgba(232, 247, 255, 0.98),
    rgba(218, 238, 251, 0.98)
  );
}

.track-card.is-playing {
  border-color: rgba(57, 197, 124, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(57, 197, 124, 0.45),
    0 0 0 1px rgba(57, 197, 124, 0.25);
  background: linear-gradient(
    180deg,
    rgba(235, 255, 242, 0.96),
    rgba(220, 248, 232, 0.96)
  );
}

.track-card.is-paused {
  border-color: rgba(235, 184, 22, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(235, 184, 22, 0.45),
    0 0 0 1px rgba(235, 184, 22, 0.25);
  background: linear-gradient(
    180deg,
    rgba(255, 248, 221, 0.97),
    rgba(255, 238, 186, 0.97)
  );
}

.track-card.is-repeat-warning {
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.35);
}

.track-card.jump-highlight {
  box-shadow:
    inset 0 0 0 2px rgba(42, 169, 224, 0.75),
    0 0 0 2px rgba(42, 169, 224, 0.25);
}

.track-inline-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin: 6px 0;
  align-items: end;
}

.mini-field {
  display: block;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.mini-field select {
  margin-top: 4px;
  min-height: 34px;
  font-size: 13px;
  padding: 6px 8px;
}

.mini-checkbox {
  grid-column: 1 / -1;
  margin-top: 0;
}

.mini-checkbox input {
  width: 18px;
}

.track-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  position: relative;
}

.track-title-row h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(200, 58, 58, 0.72);
  background: linear-gradient(180deg, #ff9393, #e84a4a);
  color: #fff8f8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.track-now-playing-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(38, 148, 90, 0.72);
  background: linear-gradient(180deg, #8cf0b5, #34b56f);
  color: #083c20;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.track-remaining-badge {
  margin-left: 0;
  min-width: 96px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(155, 70, 8, 0.55);
  background: linear-gradient(180deg, #ffd979, #ffb641);
  color: #4a2700;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  text-align: center;
}

.track-play-mode-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
}

.track-remaining-wrap {
  margin-left: 10px;
  position: relative;
  display: inline-flex;
  align-items: center;
}

.track-transition-countdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  font-size: 10px;
  line-height: 1.1;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

.track-progress {
  margin: 2px 0 0;
  font-size: 12px;
  color: #2a5f84;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.track-remaining-badge.is-hidden {
  visibility: hidden;
}

.track-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
  overflow: hidden;
  max-width: 100%;
  margin-top: 6px;
}

.track-title-actions .action-text-btn {
  justify-content: center;
  text-align: center;
}

.track-primary-action {
  min-width: 96px;
  width: 96px;
  justify-content: center;
  text-align: center;
}

.track-primary-action.is-incoming {
  border-color: rgba(42, 169, 224, 0.8);
  background: linear-gradient(180deg, #61b9e4, #2a97cf);
  color: #f5fbff;
}

.track-action-divider {
  width: 1px;
  min-width: 1px;
  align-self: stretch;
  margin: 1px 4px;
  background: rgba(64, 126, 179, 0.24);
}

.editor-inline-btn {
  min-height: 28px;
  padding: 0 6px;
  font-size: 10px;
  letter-spacing: 0.01em;
}

#toggle-library-edit-mode.is-on {
  border-color: rgba(220, 38, 38, 0.75);
  background: linear-gradient(180deg, #ef6b6b, #cc2f2f);
  color: #fff7f7;
}

#toggle-library-edit-mode {
  font-size: 18px;
  line-height: 1;
}

.group-toggle-btn {
  border-color: rgba(57, 197, 124, 0.72);
  background: linear-gradient(180deg, #62dc96, #2daf67);
  color: #f6fff8;
}

.group-toggle-btn.is-collapsed {
  border-color: rgba(130, 145, 158, 0.64);
  background: linear-gradient(180deg, #e2e8ee, #c6d0d9);
  color: #435564;
}

.track-meta {
  margin: 4px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.group-card.is-repeat-warning {
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.3);
}

.group-card.is-playing,
.group-card.is-playing.is-repeat-warning {
  border-color: rgba(57, 197, 124, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(57, 197, 124, 0.45),
    0 0 0 1px rgba(57, 197, 124, 0.25);
  background: linear-gradient(
    180deg,
    rgba(235, 255, 242, 0.96),
    rgba(220, 248, 232, 0.96)
  );
}

.group-card.is-playing .group-title {
  color: #1f7a45;
}

.track-card .btn {
  min-height: 34px;
  font-size: 13px;
  padding: 6px;
}

.icon-action-btn {
  min-height: 34px;
  min-width: 34px;
  width: 34px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border-color: rgba(146, 155, 164, 0.7);
  background: linear-gradient(180deg, #d8dce0, #bcc3ca);
  color: #1f2a33;
}

.action-text-btn {
  min-width: max-content;
  width: auto;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.video-icon-btn {
  color: #d8f3ff;
}

.video-icon-btn.is-on {
  border-color: rgba(125, 255, 233, 0.55);
  background: linear-gradient(180deg, #0cb79f, #098f7e);
}

.video-icon-btn.is-group-locked,
.video-icon-btn.is-group-locked.is-on {
  border-color: rgba(220, 38, 38, 0.85);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.video-icon-btn.is-off,
.group-video-btn.is-off,
#sticky-toggle-video.is-off {
  border-color: rgba(220, 38, 38, 0.85);
  background: linear-gradient(180deg, #ef6b6b, #cc2f2f);
  color: #fff7f7;
}

.compact-toggle-btn {
  min-width: max-content;
  width: auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.compact-toggle-btn.is-on {
  border-color: rgba(57, 197, 124, 0.8);
  background: linear-gradient(180deg, #53d78e, #2daf67);
  color: #f6fff8;
}

.repeat-toggle-btn.is-on {
  border-color: rgba(214, 169, 30, 0.78);
  background: linear-gradient(180deg, #f2c94c, #d4a514);
  color: #3b2a00;
}

.icon-delete-btn {
  color: #1f2a33;
}

.icon-primary-btn {
  color: #1f2a33;
}

.icon-primary-btn.is-on {
  border-color: rgba(57, 197, 124, 0.8);
  background: linear-gradient(180deg, #53d78e, #2daf67);
  color: #f6fff8;
}

.pill {
  display: inline-block;
  font-size: 11px;
  border: 1px solid rgba(180, 214, 255, 0.35);
  color: #d6e9ff;
  border-radius: 999px;
  padding: 2px 7px;
}

@media (max-width: 760px) {
  .track-title-actions {
    gap: 2px;
  }

  .track-primary-action {
    min-width: 82px;
    width: 82px;
    font-size: 12px;
    padding: 0 6px;
  }

  .track-title-actions .action-text-btn {
    padding: 0 7px;
    font-size: 10px;
  }

  .editor-inline-btn {
    min-height: 24px;
    padding: 0 4px;
    font-size: 9px;
  }

  .track-action-divider {
    margin: 1px 2px;
  }
}

@media (max-width: 520px) {
  .track-title-actions {
    gap: 1px;
  }

  .editor-inline-btn {
    min-height: 22px;
    padding: 0 3px;
    font-size: 8px;
  }
}

@media (min-width: 780px) {
  .controller-root {
    padding: 18px 16px
      calc(var(--sticky-transport-offset, 150px) + env(safe-area-inset-bottom));
  }

  .group-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .group-controls {
    flex-wrap: nowrap;
    justify-content: flex-end;
    overflow: hidden;
    max-width: 100%;
  }

  .group-tail-wrap {
    margin-left: auto;
  }

  .status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .large-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .background-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
