:root {
  /* Canonical Atero brand — src/theme/colors.ts (BRAND_NAVY, BRAND_GOLD, neutrals) */
  --atune-navy: #0d1326;
  --atune-navy-2: #111827;
  --atune-navy-3: #070b14;
  --atune-gold: #cfb87c;
  --atune-gold-2: #dec98e;
  --atune-text: #f3f4f6;
  --atune-muted: #9ca3af;
  --atune-faint: rgba(243, 244, 246, 0.55);
  --atune-card: rgba(13, 19, 38, 0.72);
  --atune-card-strong: rgba(13, 19, 38, 0.88);
  --atune-border: rgba(207, 184, 124, 0.22);
  --atune-gold-wash-10: rgba(207, 184, 124, 0.1);
  --atune-gold-wash-14: rgba(207, 184, 124, 0.14);
  --atune-gold-wash-42: rgba(207, 184, 124, 0.42);
  --atune-gold-wash-32: rgba(207, 184, 124, 0.32);
  --atune-aura-opacity-real: 0.42;
  --atune-aura-opacity-fallback: 0.48;
  --overscan-x: clamp(16px, 5vw, 72px);
  --overscan-y: clamp(12px, 4.5vh, 56px);
  --grid-gap-x: clamp(16px, 2.8vw, 44px);
  --grid-gap-y: clamp(12px, 2vh, 28px);
  --atune-artist-size: clamp(16px, 2vw, 38px);
  --atune-brand-name-size: clamp(15px, 1.95vw, 36px);
  --atune-brand-site-size: clamp(14px, 1.82vw, 33px);
  --atune-brand-icon-size: clamp(30px, 2.75vw, 46px);
  --atune-surface-bg: var(--atune-navy-3);
}

html.atune-receiver-idle {
  --atune-surface-bg: var(--atune-navy);
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background-color: var(--atune-surface-bg);
  color: var(--atune-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body > tv-overlay,
body > cast-overlay,
cast-controls,
cast-media-player,
.controls-overlay,
.player-controls,
.controls-progress,
[class*="ControlBar"],
[class*="control-bar"],
[class*="controls-overlay"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.atune-media-engine {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}

.atune-media-engine audio {
  display: block;
  width: 0;
  height: 0;
}

.atune-root {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: auto;
  isolation: isolate;
  background-color: var(--atune-surface-bg);
}

.atune-ambient-aura {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: var(--atune-aura-opacity-real);
  contain: strict;
}

.atune-root--fallback-art .atune-ambient-aura {
  opacity: var(--atune-aura-opacity-fallback);
}

.atune-aura-blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  pointer-events: none;
}

.atune-aura-blob--gold-accent {
  width: 30vmin;
  height: 30vmin;
  left: 10%;
  top: 14%;
  background: radial-gradient(
    circle,
    rgba(207, 184, 124, 0.82) 0%,
    rgba(222, 201, 142, 0.52) 34%,
    rgba(207, 184, 124, 0.22) 58%,
    transparent 72%
  );
  animation: atune-aura-drift-gold-accent 8s ease-in-out infinite alternate;
}

.atune-aura-blob--gold-wash {
  width: 36vmin;
  height: 36vmin;
  right: 12%;
  top: 20%;
  background: radial-gradient(
    circle,
    rgba(222, 201, 142, 0.48) 0%,
    rgba(207, 184, 124, 0.28) 38%,
    rgba(207, 184, 124, 0.1) 58%,
    transparent 74%
  );
  animation: atune-aura-drift-gold-wash 13s ease-in-out infinite alternate;
}

.atune-aura-blob--navy-deep {
  width: 34vmin;
  height: 34vmin;
  right: 16%;
  bottom: 12%;
  background: radial-gradient(
    circle,
    rgba(13, 19, 38, 0.72) 0%,
    rgba(17, 24, 39, 0.46) 42%,
    rgba(207, 184, 124, 0.14) 58%,
    transparent 76%
  );
  animation: atune-aura-drift-navy-deep 18s ease-in-out infinite alternate;
}

.atune-aura-blob--navy-counter {
  width: 26vmin;
  height: 26vmin;
  left: 14%;
  bottom: 16%;
  background: radial-gradient(
    circle,
    rgba(17, 24, 39, 0.62) 0%,
    rgba(13, 19, 38, 0.34) 44%,
    rgba(207, 184, 124, 0.08) 62%,
    transparent 78%
  );
  animation: atune-aura-drift-navy-counter 20s ease-in-out infinite alternate;
}

@keyframes atune-aura-drift-gold-accent {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(16%, 12%, 0) scale(1.1);
  }
}

@keyframes atune-aura-drift-gold-wash {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(-14%, 10%, 0) scale(1.08);
  }
}

@keyframes atune-aura-drift-navy-deep {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(-12%, -14%, 0) scale(1.06);
  }
}

@keyframes atune-aura-drift-navy-counter {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(12%, -10%, 0) scale(1.05);
  }
}

/* Two-panel layout: artwork | now-playing */
.atune-shell {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding:
    max(var(--overscan-y), env(safe-area-inset-top, 0px))
    max(var(--overscan-x), env(safe-area-inset-right, 0px))
    max(var(--overscan-y), env(safe-area-inset-bottom, 0px))
    max(var(--overscan-x), env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "artwork nowplaying";
  gap: var(--grid-gap-x);
  min-height: 0;
  min-width: 0;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.art-cell {
  grid-area: artwork;
  container-type: size;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.art-wrap {
  position: relative;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1 / 1;
  max-width: 100%;
  max-height: 100%;
  border-radius: clamp(12px, 3.6vh, 44px);
  overflow: hidden;
  box-shadow: 0 34px 88px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--atune-border);
  background: linear-gradient(145deg, var(--atune-gold-wash-14), rgba(13, 19, 38, 0.94));
}

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

.artwork[data-fallback-artwork="true"] {
  object-fit: cover;
  object-position: center;
  padding: 0;
  box-sizing: border-box;
}

.artwork[hidden],
.artwork-empty[hidden] {
  display: none;
}

.artwork-empty {
  position: absolute;
  inset: 0;
  display: block;
  background:
    radial-gradient(circle at 34% 22%, rgba(207, 184, 124, 0.22), transparent 36%),
    linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(7, 11, 20, 0.98));
}

.info-card {
  grid-area: nowplaying;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--atune-border);
  border-radius: clamp(12px, 2.8vh, 36px);
  background: var(--atune-card);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(20px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(14px, 3.2vh, 36px) clamp(14px, 2.8vw, 36px);
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.atune-idle-shell {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  position: absolute;
  inset: 0;
  z-index: 2;
  padding:
    max(var(--overscan-y), env(safe-area-inset-top, 0px))
    max(var(--overscan-x), env(safe-area-inset-right, 0px))
    max(var(--overscan-y), env(safe-area-inset-bottom, 0px))
    max(var(--overscan-x), env(safe-area-inset-left, 0px));
  pointer-events: none;
  text-align: center;
}

.atune-root.atune-root--idle .atune-idle-shell {
  display: flex;
  background-color: var(--atune-surface-bg);
}

.atune-root--idle .atune-shell {
  display: none;
}

.atune-root--idle .atune-ambient-aura {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  background: none !important;
}

.atune-idle-icon {
  width: clamp(140px, 34vmin, min(42vw, 52vh));
  height: clamp(140px, 34vmin, min(42vw, 52vh));
  object-fit: contain;
  border: none;
  outline: none;
  border-radius: 0;
  box-shadow: none;
  filter: none;
  background-color: var(--atune-surface-bg);
  margin-bottom: 0;
}

.atune-idle-brand {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 48px);
  font-weight: 700;
  color: var(--atune-text);
  letter-spacing: -0.02em;
}

.atune-idle-site {
  margin: clamp(4px, 0.45vh, 8px) 0 0;
  font-size: clamp(14px, 1.8vw, 28px);
  font-weight: 600;
  color: var(--atune-gold);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
}

.atune-idle-site:link,
.atune-idle-site:visited {
  color: var(--atune-gold);
  text-decoration: none;
}

.atune-idle-site:hover,
.atune-idle-site:focus-visible {
  text-decoration: underline;
}

.atune-idle-site:focus-visible {
  outline: 2px solid var(--atune-gold-wash-42);
  outline-offset: 3px;
}

.atune-idle-tagline {
  margin: clamp(14px, 1.9vh, 24px) 0 0;
  font-size: clamp(13px, 1.65vw, 26px);
  font-weight: 500;
  color: var(--atune-text);
  letter-spacing: 0.01em;
}

.brand-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: clamp(8px, 1.1vw, 18px);
  min-width: 0;
  margin-bottom: clamp(2px, 0.4vh, 6px);
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-icon {
  width: var(--atune-brand-icon-size);
  height: var(--atune-brand-icon-size);
  border-radius: 0.42em;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 0 28px rgba(207, 184, 124, 0.28);
}

.brand-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--atune-text);
  font-size: var(--atune-brand-name-size);
  line-height: 1.12;
  font-weight: 800;
}

.brand-site {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--atune-gold);
  font-size: var(--atune-brand-site-size);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  white-space: nowrap;
}

.source-badge {
  margin-left: auto;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 40%;
  padding: 0.44em 0.72em;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--atune-muted);
  font-size: 0.75em;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title {
  margin: clamp(8px, 1.8vh, 22px) 0 0;
  font-size: clamp(28px, 4.8vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.06em;
  font-weight: 850;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.subtitle {
  margin: clamp(6px, 1.1vh, 14px) 0 0;
  color: var(--atune-muted);
  font-size: var(--atune-artist-size);
  line-height: 1.18;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-block {
  margin-top: clamp(10px, 2.8vh, 32px);
  flex-shrink: 0;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  color: var(--atune-muted);
  font-size: clamp(13px, 1.2vw, 22px);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  margin-top: clamp(6px, 0.9vh, 12px);
  height: clamp(8px, 0.9vh, 14px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--atune-gold), var(--atune-gold-2));
  box-shadow: 0 0 24px rgba(207, 184, 124, 0.45);
  transition: width 260ms linear;
}

.transport-row {
  margin-top: clamp(10px, 2.2vh, 26px);
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  gap: 0;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  pointer-events: auto;
  max-width: 100%;
}

.transport-btn {
  width: clamp(52px, 6vw, 120px);
  height: clamp(52px, 6vw, 120px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: var(--atune-text);
  background: rgba(255, 255, 255, 0.09);
  cursor: pointer;
  backdrop-filter: blur(14px);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 4;
}

.transport-icon {
  width: 40%;
  height: 40%;
  display: block;
  flex: 0 0 auto;
}

.transport-btn.play {
  width: clamp(62px, 7vw, 140px);
  height: clamp(62px, 7vw, 140px);
  color: var(--atune-navy-3);
  background: linear-gradient(145deg, var(--atune-gold), var(--atune-gold-2));
  box-shadow: 0 16px 40px rgba(207, 184, 124, 0.28);
}

.transport-btn.play .transport-icon {
  width: 36%;
  height: 36%;
}

.transport-btn:not(:disabled):active {
  transform: scale(0.96);
}

@media (max-width: 1100px), (max-height: 680px) {
  .brand-site {
    display: none;
  }
}

@media (max-height: 720px) {
  .title {
    -webkit-line-clamp: 1;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .atune-root {
    position: relative;
    min-height: 100%;
  }

  .atune-shell {
    height: auto;
    min-height: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "artwork"
      "nowplaying";
    overflow: visible;
  }

  .art-cell {
    min-height: min(72vw, 320px);
  }

  .art-wrap {
    width: min(72vw, 320px);
  }

  .info-card {
    min-height: 0;
  }
}

.atune-debug-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 38vh;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.82);
  color: #e8e8e8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  pointer-events: none;
  border-top: 1px solid rgba(207, 184, 124, 0.45);
}

.atune-debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  background: rgba(13, 19, 38, 0.95);
  pointer-events: auto;
}

.atune-debug-title {
  font-weight: 700;
  color: #cfb87c;
}

.atune-debug-dump {
  pointer-events: auto;
  border: 1px solid rgba(207, 184, 124, 0.55);
  background: rgba(13, 19, 38, 0.9);
  color: #cfb87c;
  font: inherit;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.atune-debug-log {
  margin: 0;
  padding: 6px 8px;
  overflow: auto;
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
}
