:root {
  --overlay-bg: #060b19;
  --overlay-panel: rgba(8, 17, 37, 0.78);
  --overlay-panel-strong: rgba(9, 20, 43, 0.9);
  --overlay-border: rgba(111, 151, 245, 0.35);
  --overlay-border-soft: rgba(111, 151, 245, 0.2);
  --overlay-text: #e7efff;
  --overlay-muted: #9fb1d1;
  --overlay-live-red: #ff4d5a;
  --overlay-electric: #5b8cff;
  --overlay-green: #37d39b;
  --overlay-orange: #f59e0b;

  --overlay-tint-rgb: 91, 140, 255;
  --overlay-tint-rgb-soft: 46, 77, 151;
  --overlay-tint-rgb-bright: 148, 182, 255;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Martian Mono", monospace;
  color: var(--overlay-text);
  background: #050912;
}

body.mode-offline {
  background: #04070f;
}

.os-timelapse-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #060b19;
}

.os-timelapse-video,
.os-timelapse-iframe {
  width: 100%;
  height: 100%;
  display: none;
  border: 0;
  object-fit: contain;
  background: #000;
}

.os-timelapse-iframe {
  pointer-events: none;
}

.os-timelapse-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(231, 239, 255, 0.55);
  font-family: "Martian Mono", monospace;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  background: radial-gradient(circle at 50% 40%, rgba(91, 140, 255, 0.18), rgba(6, 11, 25, 0.92));
}

.overlay-root {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  pointer-events: none;
}

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

.overlay-noise,
.overlay-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay-noise {
  opacity: 0.08;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.08) 0.6px, transparent 0.6px),
    radial-gradient(rgba(255, 255, 255, 0.05) 0.6px, transparent 0.6px);
  background-size: 4px 4px, 6px 6px;
  background-position: 0 0, 2px 2px;
  mix-blend-mode: soft-light;
}

.overlay-vignette {
  background:
    linear-gradient(180deg, rgba(6, 10, 20, 0.85), transparent 32%),
    linear-gradient(0deg, rgba(6, 10, 20, 0.92), transparent 30%),
    linear-gradient(90deg, rgba(6, 10, 20, 0.65), transparent 22%),
    linear-gradient(270deg, rgba(6, 10, 20, 0.65), transparent 22%);
}

.live-topbar,
.overlay-panel,
.overlay-bottom-strip {
  border: 1px solid var(--overlay-border);
  background: linear-gradient(145deg, rgba(9, 19, 40, 0.88), rgba(7, 15, 33, 0.78));
  box-shadow: 0 18px 40px rgba(4, 8, 22, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.live-topbar {
  position: relative;
  z-index: 2;
  min-height: 56px;
  border-radius: 14px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.live-topbar.is-live {
  border-color: rgba(111, 151, 245, 0.44);
}

.live-topbar.is-offline {
  opacity: 0.78;
  border-color: rgba(111, 151, 245, 0.24);
}

.live-topbar-left,
.live-topbar-center,
.live-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.live-topbar-center {
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.live-topbar-title {
  font-size: clamp(14px, 1.5vw, 20px);
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #eef4ff;
  text-transform: uppercase;
}

.live-topbar-right {
  font-size: 12px;
  color: var(--overlay-muted);
  gap: 12px;
  justify-self: end;
}

.live-topbar-left {
  overflow: hidden;
}

.world-clock-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.world-clock-city {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(159, 177, 209, 0.88);
  text-transform: uppercase;
}

.world-clock-flag {
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  color: #eef4ff;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--overlay-live-red);
  box-shadow: 0 0 14px rgba(255, 77, 90, 0.6);
  animation: pulse-live 1.2s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.78); opacity: 0.45; }
}

.pill,
.live-mode-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--overlay-border-soft);
  background: rgba(10, 20, 42, 0.85);
}

.pill.playing {
  color: #ffd7db;
  border-color: rgba(255, 77, 90, 0.6);
  background: rgba(75, 18, 26, 0.58);
}

.pill.paused {
  color: var(--overlay-muted);
}

.live-mode-pill {
  color: #d4e3ff;
}

.live-mode-pill[data-mode="schedule"] {
  border-color: rgba(55, 211, 155, 0.6);
  background: rgba(10, 58, 46, 0.58);
  color: #d9fff1;
}

.live-mode-pill[data-mode="queue"] {
  border-color: rgba(245, 158, 11, 0.58);
  background: rgba(70, 44, 8, 0.58);
  color: #ffe5b3;
}

.live-now-text {
  max-width: min(62ch, 60vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #eaf1ff;
  font-size: 12px;
}

.live-now-sep {
  color: rgba(159, 177, 209, 0.8);
}

.live-clock {
  color: #edf3ff;
  font-weight: 600;
  font-family: "Martian Mono", monospace;
  font-size: 12px;
}

.overlay-main-grid {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 12px;
}

.overlay-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.overlay-col-center {
  justify-content: flex-start;
}

.overlay-panel {
  border-radius: 14px;
  padding: 12px;
}

.now-playing {
  min-height: clamp(360px, 56vh, 520px);
  display: flex;
  flex-direction: column;
}

.now-playing .panel-head {
  margin-bottom: 12px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1;
}

.panel-kicker {
  color: var(--overlay-muted);
  font-size: 11px;
}

.now-artist-row {
  display: flex;
  flex-direction: column;
  gap: 26px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 12px;
  border-radius: 14px;
  border: 1px solid rgba(111, 151, 245, 0.2);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.08), rgba(8, 15, 31, 0) 58%),
    linear-gradient(160deg, rgba(11, 22, 46, 0.92), rgba(8, 15, 31, 0.88));
  box-shadow: 0 14px 30px rgba(3, 8, 20, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  margin-bottom: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

.now-artist-visual {
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 32px;
  padding: 0;
  background: transparent;
  box-shadow: 0 14px 32px rgba(4, 8, 20, 0.54);
}

.now-artist-visual::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 40px;
  background: radial-gradient(circle at 50% 46%, rgba(120, 160, 255, 0.26), rgba(120, 160, 255, 0));
  filter: blur(3px);
  pointer-events: none;
  z-index: 0;
}

.now-artist-copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.now-artist-avatar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 28px;
  border: 1px solid rgba(111, 151, 245, 0.26);
  background: rgba(8, 14, 30, 0.9);
  object-fit: cover;
}

.now-artist-name {
  font-weight: 800;
  font-size: clamp(16px, 1.65vw, 24px);
  line-height: 0.96;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #f2f7ff;
  text-shadow: 0 5px 20px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  white-space: nowrap;
  max-width: 100%;
  width: 100%;
  margin-top: 8px;
}

.now-artist-country {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(111, 151, 245, 0.34);
  background: rgba(9, 18, 38, 0.86);
  color: #dbe7ff;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.now-artist-country-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  line-height: 1;
}

.now-artist-country-name {
  white-space: nowrap;
}

.now-audio-block {
  border: 1px solid rgba(111, 151, 245, 0.28);
  border-radius: 12px;
  background: linear-gradient(170deg, rgba(8, 16, 34, 0.82), rgba(5, 10, 22, 0.88));
  padding: 10px;
}

.now-track-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  opacity: 0.94;
}

.os-cover-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid rgba(var(--overlay-tint-rgb), 0.42);
  background: rgba(5, 9, 21, 0.95);
}

.os-cover-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.os-music-bars {
  position: absolute;
  left: 50%;
  bottom: 5px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}

.os-music-bars span {
  width: 3px;
  border-radius: 3px;
  background: rgba(var(--overlay-tint-rgb-bright), 0.95);
  transform-origin: bottom;
  animation: eq 0.7s ease-in-out infinite alternate;
}

.os-music-bars span:nth-child(2) { animation-delay: 0.12s; }
.os-music-bars span:nth-child(3) { animation-delay: 0.22s; }
.os-music-bars span:nth-child(4) { animation-delay: 0.08s; }

@keyframes eq {
  from { height: 3px; }
  to { height: 16px; }
}

.now-track-meta {
  min-width: 0;
}

.track,
.artist {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.track {
  font-size: 12px;
  font-weight: 600;
  color: #e9f2ff;
}

.artist {
  margin-top: 2px;
  font-size: 10px;
  color: rgba(159, 177, 209, 0.9);
  font-family: "Martian Mono", monospace;
}

.track > span,
.artist > span,
.now-artist-name > span {
  display: inline-block;
  white-space: nowrap;
}

.track.is-marquee > span,
.artist.is-marquee > span,
.now-artist-name.is-marquee > span {
  animation: marquee var(--marquee-duration, 10s) linear infinite;
}

@keyframes marquee {
  0%, 12% { transform: translateX(0); }
  88%, 100% { transform: translateX(var(--marquee-distance, -40px)); }
}

.track-progress-shell {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  border: 1px solid rgba(111, 151, 245, 0.28);
  background: rgba(5, 12, 25, 0.8);
  overflow: hidden;
}

#trackProgress {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(111, 151, 245, 0.7), rgba(55, 211, 155, 0.9));
}

.track-progress-label {
  margin-top: 6px;
  font-size: 10px;
  color: rgba(159, 177, 209, 0.88);
  font-family: "Martian Mono", monospace;
}

.now-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.now-tags:empty {
  display: none;
  margin-top: 0;
}

.now-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(111, 151, 245, 0.4);
  background: rgba(10, 19, 40, 0.78);
  color: #dbe7ff;
  font-size: 12px;
}

.panel-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #d7e3ff;
}

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

.pulse-item {
  border: 1px solid rgba(111, 151, 245, 0.24);
  border-radius: 10px;
  padding: 8px;
  background: rgba(8, 16, 34, 0.68);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pulse-item span {
  font-size: 11px;
  color: var(--overlay-muted);
}

.pulse-item strong {
  font-size: 13px;
  color: #edf3ff;
}

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

.command-hint-pill {
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(111, 151, 245, 0.34);
  background: rgba(8, 16, 34, 0.68);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Martian Mono", monospace;
  font-size: 12px;
  color: #eaf1ff;
}

.stage-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage-display {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(111, 151, 245, 0.24);
  background: #000;
  overflow: hidden;
  min-height: 0;
}

.stage-overlay-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 14px;
  background: none;
}

.stage-hint-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.stage-hint {
  border: 1px solid rgba(111, 151, 245, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: #d7e4ff;
  background: rgba(8, 16, 35, 0.64);
}

.stage-caption {
  margin: 0;
  font-size: 13px;
  color: var(--overlay-muted);
}

.command-feed {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 320px;
  overflow: hidden;
}

.command-feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(111, 151, 245, 0.24);
  border-radius: 9px;
  padding: 8px;
  background: rgba(7, 15, 31, 0.68);
  font-family: "Martian Mono", monospace;
  font-size: 12px;
  animation: feed-in 180ms ease;
}

@keyframes feed-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.command-feed-user {
  color: var(--overlay-muted);
}

.command-feed-cmd {
  color: #eaf1ff;
}

.command-feed-time {
  color: rgba(159, 177, 209, 0.7);
  font-size: 11px;
}

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

.quick-action {
  border: 1px solid rgba(111, 151, 245, 0.36);
  border-radius: 11px;
  background: rgba(8, 16, 34, 0.72);
  color: #e5efff;
  padding: 10px;
  font-size: 12px;
  pointer-events: none;
}

.overlay-bottom-strip {
  position: relative;
  z-index: 2;
  min-height: 44px;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.bottom-brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #eef4ff;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.bottom-cta {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: #dbe7ff;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bottom-cta.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.bottom-cta.is-swap {
  opacity: 0;
  transform: translateY(5px);
}

.bottom-status-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.status-chip {
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(111, 151, 245, 0.3);
  background: rgba(8, 16, 34, 0.78);
  font-size: 11px;
  color: #d9e6ff;
  display: inline-flex;
  align-items: center;
}

.now-playing.track-changing .track,
.now-playing.track-changing .artist,
.now-playing.track-changing .os-cover-wrap {
  animation: track-in 240ms ease;
}

@keyframes track-in {
  from { opacity: 0.26; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.os-offline {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  background: #000;
}

.os-offline.show {
  display: flex;
}

.offline-countdown {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.offline-countdown-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2vw, 28px);
}

.flip-group {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.flip-pair {
  display: inline-flex;
  gap: 8px;
}

.flip-digit {
  position: relative;
  width: clamp(52px, 6vw, 84px);
  height: clamp(82px, 9vw, 128px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #f4f4f4;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.08) inset,
    0 18px 40px rgba(0, 0, 0, 0.38);
}

.flip-digit-value {
  color: #161616;
  font-family: "Inter", Arial, sans-serif;
  font-size: clamp(50px, 6.2vw, 88px);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.flip-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Inter", Arial, sans-serif;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .offline-countdown-row {
    gap: 12px;
  }

  .flip-pair {
    gap: 4px;
  }
}

@media (max-width: 560px) {
  .offline-countdown {
    padding: 12px;
  }

  .offline-countdown-row {
    flex-wrap: wrap;
  }

  .flip-group {
    gap: 3px;
  }

  .flip-label {
    font-size: 10px;
    letter-spacing: 0.08em;
  }
}

