/* ==========================================================================
   Radio Senise Centrale - Clean Player, TV, Video.js & Volume UI
   ========================================================================== */

/* --- Custom Font Declarations --- */
@font-face {
  font-family: 'RSCHeadingNowA';
  src: url('fonts/RSCHeadingNow A.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RSCHeadingNowB';
  src: url('fonts/RSCHeadingNow - B.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RSCHeadingNow';
  src: url('fonts/RSCHeadingNow - B.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RSCHeadingNow';
  src: url('fonts/RSCHeadingNow.woff2') format('woff2'),
       url('fonts/RSCHeadingNow A.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --- CSS Variables & Design Tokens --- */
:root {
  --bg-color: #121214;
  --bg-gradient: radial-gradient(circle at center, #1a1a1d 0%, #0c0c0e 100%);
  --card-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.02) 100%), rgba(20, 20, 25, 0.52);
  --card-border: rgba(255, 255, 255, 0.16);
  --card-glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.03) 100%), rgba(16, 16, 22, 0.38);
  --card-glass-border: rgba(255, 255, 255, 0.26);
  --accent-red: #d32f2f;
  --accent-red-bright: #e50914;
  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.4);
  --font-heading: 'RSCHeadingNow', 'Oswald', sans-serif;
  --font-body: 'Montserrat', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --scale: 1;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
}

@media (max-height: 850px) {
  :root { --scale: 0.92; }
}
@media (max-height: 750px) {
  :root { --scale: 0.84; }
}
@media (max-height: 650px) {
  :root { --scale: 0.72; }
}
@media (max-height: 550px) {
  :root { --scale: 0.62; }
}
@media (max-width: 480px) {
  :root { --scale: 0.88; }
}
@media (max-width: 380px) {
  :root { --scale: 0.76; }
}

/* --- Fullscreen App Preloader --- */
.app-preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: var(--bg-color);
  background: var(--loader-bg-gradient, var(--bg-gradient));
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.38s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.app-preloader::before {
  content: '';
  position: absolute;
  top: calc((var(--safe-area-top) + 4rem) * -1);
  left: 0;
  right: 0;
  height: calc(var(--safe-area-top) + 10rem);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.2) 55%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}

.app-preloader::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.09) 0%, transparent 48%),
    linear-gradient(180deg, rgba(12, 12, 14, 0.16), rgba(12, 12, 14, 0.52));
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
  pointer-events: none;
}

.app-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-preloader.is-channel-switch {
  transition: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: all !important;
  background-color: var(--loader-bg-color, var(--bg-color));
  background-image: var(--loader-bg-gradient, var(--bg-gradient));
}

.app-preloader.is-channel-switch.fade-out {
  transition: opacity 0.38s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.38s cubic-bezier(0.4, 0, 0.2, 1) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.preloader-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding:
    max(1.5rem, calc(var(--safe-area-top) + 0.75rem))
    1.5rem
    max(1.5rem, calc(var(--safe-area-bottom) + 0.75rem));
}

.preloader-spinner {
  width: 52px;
  height: 52px;
  border: 3.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent-red-bright);
  border-radius: 50%;
  animation: preloaderSpin 0.85s linear infinite;
  box-shadow: 0 0 20px rgba(229, 9, 20, 0.35);
}

.preloader-text {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  color: var(--text-white);
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.85;
  text-align: center;
  text-wrap: balance;
}

@keyframes preloaderSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- Global Reset & Box Sizing --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html:not(.panel-html) {
  width: 100%;
  height: 100%;
  height: 100svh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: var(--bg-color);
  background: var(--bg-gradient);
  transition: background-color 0.6s ease;
}

body:not(.panel-body) {
  width: 100%;
  min-width: 100%;
  height: 100%;
  height: 100svh;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  background: transparent;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  color: var(--text-white);
  font-family: var(--font-body);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  transition: background 0.6s ease, background-color 0.6s ease;
  position: fixed;
  inset: 0;
  isolation: isolate;
}

body::before {
  content: '';
  position: fixed;
  top: calc(var(--safe-area-top) * -1);
  right: calc(var(--safe-area-right) * -1);
  bottom: calc(var(--safe-area-bottom) * -1);
  left: calc(var(--safe-area-left) * -1);
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  pointer-events: none;
  z-index: -1;
  transform: translateZ(0);
  will-change: background-image, background-color;
}

/* --- Top Header: Brand Logo --- */
.top-header {
  position: absolute;
  top: max(1.5rem, var(--safe-area-top));
  left: max(2rem, var(--safe-area-left));
  z-index: 100;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.6));
  transition: transform 0.36s ease, opacity 0.36s ease, filter 0.36s ease;
}

.brand-name {
  display: none !important;
}

.brand-logo:hover {
  transform: scale(1.04);
}

/* --- App Container: Perfectly Centered & Non-Scrollable --- */
.app-container {
  width: 100%;
  height: 100%;
  height: 100svh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  padding:
    max(1.5rem, calc(var(--safe-area-top) + 0.75rem))
    max(1.25rem, calc(var(--safe-area-right) + 0.5rem))
    max(1.5rem, calc(var(--safe-area-bottom) + 0.75rem))
    max(1.25rem, calc(var(--safe-area-left) + 0.5rem));
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.channel-transition-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 50;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.12) 0%, transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: opacity 0.34s ease, backdrop-filter 0.34s ease, -webkit-backdrop-filter 0.34s ease;
}

body.is-channel-switching .channel-transition-overlay {
  opacity: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* --- Mode Switcher: Desktop --- */
.mode-switcher {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem;
  border-radius: 36px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 28px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.mode-btn:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.08);
}

.mode-btn.active {
  background: var(--accent-red);
  color: var(--text-white);
  box-shadow: 0 4px 16px rgba(211, 47, 47, 0.5);
}

.mode-icon {
  width: 20px;
  height: 20px;
}

/* --- Main Content Grid --- */
.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 640px;
  height: 100%;
  max-height: 100%;
  position: relative;
  z-index: 10;
  box-sizing: border-box;
  overflow: hidden;
}

/* --- Central Player Card (Scale-Vector Geometry System) --- */
.player-card {
  width: calc(440px * var(--scale, 1));
  max-width: 94vw;
  max-height: calc(100dvh - 2.6rem);
  box-sizing: border-box;
  background: var(--card-bg, linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.02) 100%), rgba(20, 20, 25, 0.52));
  border: calc(1px * var(--scale)) solid var(--card-border, rgba(255, 255, 255, 0.16));
  border-top: calc(1px * var(--scale)) solid rgba(255, 255, 255, 0.32);
  border-radius: calc(40px * var(--scale));
  padding: calc(2rem * var(--scale)) calc(1.8rem * var(--scale));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 calc(35px * var(--scale)) calc(85px * var(--scale)) calc(-15px * var(--scale)) rgba(0, 0, 0, 0.75),
              inset 0 calc(1px * var(--scale)) calc(1px * var(--scale)) 0 rgba(255, 255, 255, 0.35),
              inset 0 calc(-1px * var(--scale)) calc(1px * var(--scale)) 0 rgba(0, 0, 0, 0.3);
  position: relative;
  backdrop-filter: blur(40px) saturate(200%) brightness(104%);
  -webkit-backdrop-filter: blur(40px) saturate(200%) brightness(104%);
  transition: var(--transition-smooth), background 0.6s ease, border-color 0.6s ease, backdrop-filter 0.6s ease, box-shadow 0.6s ease;
}

body.is-channel-switching .brand-logo {
  opacity: 0.22;
  transform: translateY(-4px) scale(0.97);
  filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.6)) blur(1px);
}

body.is-channel-switching .player-card,
body.is-channel-switching .tv-card {
  transform: translateY(8px) scale(0.985);
  opacity: 0.82;
  filter: saturate(0.88);
}

.player-card.glass-mode {
  background: var(--card-glass-bg, linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.03) 100%), rgba(16, 16, 22, 0.38));
  border: calc(1px * var(--scale)) solid var(--card-glass-border, rgba(255, 255, 255, 0.25));
  border-top: calc(1px * var(--scale)) solid rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(50px) saturate(220%) brightness(108%);
  -webkit-backdrop-filter: blur(50px) saturate(220%) brightness(108%);
  box-shadow: 0 calc(40px * var(--scale)) calc(95px * var(--scale)) calc(-10px * var(--scale)) rgba(0, 0, 0, 0.72),
              inset 0 calc(1.5px * var(--scale)) calc(1.5px * var(--scale)) 0 rgba(255, 255, 255, 0.55),
              inset 0 calc(-1px * var(--scale)) calc(1px * var(--scale)) 0 rgba(0, 0, 0, 0.35),
              0 0 calc(50px * var(--scale)) var(--accent-red-glow, rgba(229, 9, 20, 0.2));
}

/* --- Circular Cover Container (Scale-Vector Ratio) --- */
.cover-container {
  position: relative;
  width: calc(270px * var(--scale));
  height: calc(270px * var(--scale));
  aspect-ratio: 1 / 1;
  margin-bottom: calc(1.5rem * var(--scale));
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, filter 0.3s ease;
}

.cover-ring {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: calc(4px * var(--scale)) solid var(--accent-red);
  overflow: hidden;
  box-shadow: 0 calc(15px * var(--scale)) calc(40px * var(--scale)) rgba(0, 0, 0, 0.85),
              0 0 calc(35px * var(--scale)) var(--accent-red-glow, rgba(229, 9, 20, 0.45));
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0d0d0f;
  transition: border-color 0.6s ease, box-shadow 0.6s ease;
}

/* --- Pure 60FPS Hardware-Accelerated Vinyl Rotation --- */
@keyframes spinCover {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Default Station Cover (Shown as solid background until Spotify artwork finishes loading) */
.default-cover-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
  transform: rotate(0deg);
  opacity: 1;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

.cover-container.has-song-art .default-cover-image {
  opacity: 1;
  pointer-events: none;
}

/* Rotating Container for 60FPS Song Artwork Spin */
.cover-rotator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: rotate(0deg);
  will-change: transform, opacity;
  transform-origin: center center;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.cover-rotator.playing {
  animation: spinCover 18s linear infinite;
  opacity: 1;
}

.cover-rotator.paused {
  opacity: 1;
}

/* --- Smooth Fade & Soft Scale Cover Animation --- */
@keyframes coverFadeOut {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
  100% {
    transform: scale(0.94);
    opacity: 0;
    filter: brightness(1.1);
  }
}

@keyframes coverFadeIn {
  0% {
    transform: scale(1.05);
    opacity: 0;
    filter: brightness(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, filter 0.3s ease;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: block;
}

.cover-image.flip-out {
  animation: coverFadeOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.cover-image.flip-in {
  animation: coverFadeIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cover-image.updating {
  opacity: 0;
}

/* Central Overlay Play/Pause Button - Perfect Geometric & Optical Center */
.play-overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(64px * var(--scale));
  height: calc(64px * var(--scale));
  border-radius: 50%;
  background: var(--glass-bg);
  border: calc(1.5px * var(--scale)) solid var(--glass-border);
  backdrop-filter: blur(8px);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 calc(6px * var(--scale)) calc(20px * var(--scale)) rgba(0, 0, 0, 0.4);
}

.tv-overlay-btn {
  position: absolute;
  top: 50%;
  right: calc(16px * var(--scale));
  transform: translateY(-50%);
  width: calc(42px * var(--scale));
  height: calc(42px * var(--scale));
  border-radius: 50%;
  background: var(--accent-red-bright, rgba(229, 9, 20, 0.85));
  border: calc(1.5px * var(--scale)) solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 12;
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 calc(4px * var(--scale)) calc(15px * var(--scale)) var(--accent-red-glow, rgba(229, 9, 20, 0.5));
}

.tv-overlay-btn svg {
  width: calc(20px * var(--scale));
  height: calc(20px * var(--scale));
}

.tv-overlay-btn:hover {
  transform: translateY(-50%) scale(1.1);
  background: var(--accent-red-bright, #e50914);
  box-shadow: 0 6px 20px var(--accent-red-glow, rgba(229, 9, 20, 0.8));
}

.icon-play,
.icon-pause {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.icon-play svg {
  width: calc(30px * var(--scale));
  height: calc(30px * var(--scale));
  margin-left: calc(3px * var(--scale));
}

.icon-pause svg {
  width: calc(28px * var(--scale));
  height: calc(28px * var(--scale));
  margin-left: 0;
}

/* When PLAYING: Hide pause button overlay by default on desktop */
.play-overlay-btn.is-playing {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  pointer-events: auto;
}

/* Hover over cover ring/container reveals pause button smoothly */
.cover-container:hover .play-overlay-btn.is-playing,
.cover-ring:hover .play-overlay-btn.is-playing {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.play-overlay-btn:hover {
  transform: translate(-50%, -50%) scale(1.08) !important;
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* Helper Class to Toggle Display */
.hidden {
  display: none !important;
}

/* --- LIVE Badge --- */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: calc(0.35rem * var(--scale));
  padding: calc(0.18rem * var(--scale)) calc(0.9rem * var(--scale));
  border: calc(1.2px * var(--scale)) solid rgba(255, 255, 255, 0.6);
  border-radius: calc(50px * var(--scale));
  margin-bottom: calc(1rem * var(--scale));
  background: rgba(0, 0, 0, 0.2);
  transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.6s ease, background 0.6s ease;
}

.live-dot {
  width: calc(6px * var(--scale));
  height: calc(6px * var(--scale));
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 calc(7px * var(--scale)) #22c55e;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.live-text {
  font-family: var(--font-heading);
  font-size: calc(0.88rem * var(--scale));
  font-weight: 700;
  font-style: normal;
  letter-spacing: calc(1px * var(--scale));
  color: var(--text-white);
}

.station-identity {
  display: none !important;
}

.station-identity-tv {
  display: none !important;
}

/* --- Track Info & Crisp Marquee --- */
.track-info {
  text-align: center;
  margin-bottom: calc(1.75rem * var(--scale));
  width: 100%;
  min-height: calc(95px * var(--scale));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: calc(0.1rem * var(--scale));
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease, filter 0.28s ease;
}

.track-info.station-only-mode {
  gap: 0;
}

/* Mascherino Virtuale Container with Crisp Unclipped Edges */
.text-mask-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(4px * var(--scale)) 0;
}

.text-mask-container.has-scrolling {
  justify-content: flex-start;
}

.artist-name {
  font-family: 'RSCHeadingNowA', 'RSCHeadingNow', 'Oswald', sans-serif;
  font-size: calc(2.95rem * var(--scale));
  font-weight: 700;
  font-style: normal;
  color: var(--accent-red-bright);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: calc(0.5px * var(--scale));
  text-shadow: 0 calc(2px * var(--scale)) calc(10px * var(--scale)) rgba(229, 9, 20, 0.25);
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.55, 0, 0.1, 1), opacity 0.35s ease;
  will-change: transform, opacity;
}

.song-title {
  font-family: var(--font-heading);
  font-size: calc(1.8rem * var(--scale));
  font-weight: 700;
  font-style: normal;
  color: var(--text-white);
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: calc(0.5px * var(--scale));
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.55, 0, 0.1, 1), opacity 0.35s ease;
  will-change: transform, opacity;
}

.song-title.station-only-mode {
  font-family: var(--font-heading);
  font-size: calc(1.8rem * var(--scale));
  font-weight: 700;
  color: var(--text-white);
  text-transform: uppercase;
}

.marquee-inner {
  display: inline-block;
  white-space: nowrap;
}

/* Slide Down Animation Classes inside Mascherino Virtuale */
.text-slide-out-down {
  transform: translateY(120%) !important;
  opacity: 0 !important;
  transition: transform 0.35s ease-in, opacity 0.35s ease-in !important;
}

.text-slide-in-prep {
  transform: translateY(-120%) !important;
  opacity: 0 !important;
  transition: none !important;
}

.text-slide-in-active {
  transform: translateY(0%) !important;
  opacity: 1 !important;
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.38s ease !important;
}

/* Ultra-Smooth Crisp Marquee Bounce Animation */
@keyframes marqueeScroll {
  0%, 15% {
    transform: translateX(0px);
  }
  50%, 65% {
    transform: translateX(var(--scroll-offset, -100px));
  }
  100% {
    transform: translateX(0px);
  }
}

.artist-name .marquee-inner.is-scrolling,
.song-title .marquee-inner.is-scrolling {
  animation: marqueeScroll var(--marquee-duration, 8s) cubic-bezier(0.42, 0, 0.58, 1) infinite;
  will-change: transform;
}

/* --- Redesigned Sleek Volume UI --- */
.volume-control-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(0.75rem * var(--scale));
  padding: calc(0.45rem * var(--scale)) calc(1.1rem * var(--scale));
  border-radius: calc(30px * var(--scale));
  background: rgba(0, 0, 0, 0.35);
  border: calc(1px * var(--scale)) solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 calc(4px * var(--scale)) calc(15px * var(--scale)) rgba(0, 0, 0, 0.3);
  width: calc(220px * var(--scale));
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease;
}

body.is-channel-switching .cover-container,
body.is-channel-switching .track-info,
body.is-channel-switching .live-badge,
body.is-channel-switching .volume-control-wrapper {
  opacity: 0.18;
  transform: translateY(10px) scale(0.975);
  filter: blur(2px);
}

.volume-btn {
  background: none;
  border: none;
  color: var(--text-white);
  width: calc(30px * var(--scale));
  height: calc(30px * var(--scale));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.volume-btn:hover {
  color: var(--accent-red-bright);
  transform: scale(1.1);
}

.speaker-icon {
  width: calc(18px * var(--scale));
  height: calc(18px * var(--scale));
}

.volume-slider-container {
  width: 100%;
  display: flex;
  align-items: center;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: calc(4px * var(--scale));
  border-radius: calc(3px * var(--scale));
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: calc(13px * var(--scale));
  height: calc(13px * var(--scale));
  border-radius: 50%;
  background: var(--text-white);
  box-shadow: 0 0 calc(8px * var(--scale)) rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.volume-slider::-webkit-slider-thumb:hover {
  background: var(--accent-red-bright);
  transform: scale(1.25);
}

/* --- TV Card Section & Video.js Styling --- */
.tv-card {
  width: 100%;
  max-width: min(600px, 92vw, calc((100dvh - 3rem) * 0.9));
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: clamp(24px, 5vw, 40px);
  padding: clamp(1.2rem, 3vh, 1.85rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  gap: 1.25rem;
}

.tv-screen-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  overflow: hidden;
  background-color: #000;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65);
}

.tv-video-player {
  width: 100% !important;
  height: 100% !important;
  border-radius: 22px;
}

/* Custom Video.js Styling */
.video-js .vjs-big-play-button {
  background-color: rgba(211, 47, 47, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
  border-radius: 50% !important;
  width: 68px !important;
  height: 68px !important;
  line-height: 66px !important;
  margin-top: -34px !important;
  margin-left: -34px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.video-js .vjs-play-progress {
  background-color: var(--accent-red-bright) !important;
}

.tv-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.tv-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  font-style: normal;
  color: var(--text-white);
  letter-spacing: 0.5px;
}

/* --- Mobile / Small Screen Harmonization --- */
@media (max-width: 899px) {
  .top-header {
    top: max(1.1rem, calc(var(--safe-area-top) + 0.4rem));
    left: max(1.35rem, calc(var(--safe-area-left) + 0.4rem));
  }
  
  .brand-logo {
    height: clamp(54px, 12vw, 68px);
    max-width: 170px;
  }

  .brand-lockup {
    gap: 0.65rem;
  }

  .app-container {
    padding:
      max(3rem, calc(var(--safe-area-top) + 1.25rem))
      max(0.75rem, calc(var(--safe-area-right) + 0.5rem))
      max(0.85rem, calc(var(--safe-area-bottom) + 0.5rem))
      max(0.75rem, calc(var(--safe-area-left) + 0.5rem));
    gap: 0.75rem;
  }

  .mode-btn {
    padding: 0.3rem 0.9rem;
    font-size: 0.9rem;
  }
}

@media (max-height: 650px) {
  .top-header {
    top: max(0.5rem, var(--safe-area-top));
    left: max(0.75rem, var(--safe-area-left));
  }

  .brand-logo {
    height: 34px;
  }

  .app-container {
    padding:
      max(2.2rem, calc(var(--safe-area-top) + 0.5rem))
      max(0.5rem, calc(var(--safe-area-right) + 0.5rem))
      max(0.5rem, calc(var(--safe-area-bottom) + 0.5rem))
      max(0.5rem, calc(var(--safe-area-left) + 0.5rem));
    gap: 0.35rem;
  }
}

@supports (-webkit-touch-callout: none) {
  html,
  body,
  .app-container {
    height: 100%;
    height: 100dvh;
    height: -webkit-fill-available;
    max-height: 100dvh;
    overflow: hidden !important;
  }

  body::before {
    top: calc((var(--safe-area-top) + 10vh) * -1);
    right: calc((var(--safe-area-right) + 4vw) * -1);
    bottom: calc((var(--safe-area-bottom) + 10vh) * -1);
    left: calc((var(--safe-area-left) + 4vw) * -1);
  }
}

/* --- Offline Mode Player Overlay & Style --- */
@keyframes offlineCardPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.72;
  }
}

.player-card.is-offline {
  position: relative;
  opacity: 1;
  filter: none;
  pointer-events: auto;
  min-height: var(--offline-player-card-height, auto);
  border-color: rgba(239, 68, 68, 0.35) !important;
  box-shadow: 0 20px 50px rgba(239, 68, 68, 0.12) !important;
  animation: offlineCardPulse 1.5s ease-in-out infinite;
  will-change: opacity;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.player-card.is-offline .play-overlay-btn,
.player-card.is-offline .tv-overlay-btn,
.player-card.is-offline .volume-control-wrapper {
  display: none !important;
}

.player-card.is-offline .cover-image {
  filter: none;
}

.player-card.is-offline .artist-name {
  color: #ff6b6b !important;
}

.player-card.is-offline .song-title {
  color: #ffaaaa !important;
}

.player-card.is-offline .live-badge {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
}

.player-card.is-offline .live-dot {
  background-color: #ef4444 !important;
  box-shadow: 0 0 8px #ef4444 !important;
  animation: none !important;
}
