/* ========= Radio · List ========= */
.view-radio .player-placeholder { font-weight: 600; }

.view-radio-list { --radio-cols: 5; }

.view-radio-list .grid-radio{
  display: grid;
  grid-template-columns: repeat(var(--radio-cols), minmax(0, 1fr));
  gap: 16px;
}

.view-radio-list .radio-card{
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  min-height: 96px; 
  @supports (min-height: clamp(1px, 1vh, 1px)) {
    min-height: clamp(76px, 9vh, 112px);
  }
  text-align: left;
}

.view-radio-list .radio-card__logo{
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #0f0e18;
  flex: 0 0 auto;
  display: block;
  max-width: none;  
}

@supports (width: clamp(1px, 1vw, 1px)) {
  .view-radio-list .radio-card__logo{
    width: clamp(52px, 5vw, 72px);
    height: clamp(52px, 5vw, 72px);
  }
}

.view-radio-list .radio-card__title{
  font-weight: 800;
  color: var(--txt);
  font-size: clamp(14px, 1.05vw, 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-radio-list .radio-card__title{
  min-width: 0;
  flex: 1 1 auto;
  font-size: 16px; 
}
@supports (font-size: clamp(1px, 1vw, 1px)) {
  .view-radio-list .radio-card__title{ font-size: clamp(14px, 1.05vw, 20px); }
}

.view-radio-list [data-focusable].is-focus::after{
  border-radius: calc(var(--radius) + 6px);
}

@media (max-width: 1800px){ .view-radio-list { --radio-cols: 4; } }
@media (max-width: 1500px){ .view-radio-list { --radio-cols: 3; } }
@media (max-width: 1100px){ .view-radio-list { --radio-cols: 2; } }
@media (max-width: 760px) { .view-radio-list { --radio-cols: 1; } }


/* ========= RADIO · PLAYER ========= */

.view-radio-player{
  height: calc(100svh - var(--topbar-h, 100px));
  display: block;
  overflow: hidden;    
  min-height: 360px;
}

.rp-grid{
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  overflow: hidden;          
  min-width: 0;
  min-height: 0;
}

.rp-sidebar{
  height: 100%;
  background: var(--card-2);
  border-radius: var(--radius, 18px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;     
  min-width: 0;
  min-height: 0;
}

.rp-list{
  flex: 1 1 auto;
  padding: 10px 10px 14px;
  overflow: auto;
  min-width: 0;
  min-height: 0;
  scrollbar-width: thin;                    
  scrollbar-color: #2d2a40 #0f0e18;        
}
.rp-list::-webkit-scrollbar{ width: 10px; }
.rp-list::-webkit-scrollbar-track{
  background: #0f0e18;
  border-radius: 999px;
}
.rp-list::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, #45405e, #2d2a40);
  border-radius: 999px;
  border: 2px solid #0f0e18;
}

.rp-item{
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card, #201f33);
  border-radius: var(--radius, 18px);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  text-align: left;
}

.rp-item__logo{
  width: 44px; height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: #0f0e18;
  flex: 0 0 auto;
}

.rp-item__title{
  font-weight: 800;
  color: var(--txt, #fff);
  font-size: clamp(14px, .95vw, 18px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rp-item.is-focused::after,
.rp-item[data-focusable].is-focus::after{
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid var(--accent, #ffd764);
  border-radius: calc(var(--radius, 18px) + 6px);
  pointer-events: none;
}
.rp-item.is-active{ outline: 2px solid rgba(255,215,100,.4); }

.rp-main{
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;  
}

.rp-top{
  flex: 0 0 auto;
  padding: 8px 12px;
  background: var(--card-2);
  border-radius: var(--radius, 18px);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  position: relative;

}

.rp-top.is-focus{
  box-shadow:
    0 0 0 3px var(--accent, #ffd764) inset,
    var(--shadow);
  border-radius: 8px;
}

.view-radio-player .rp-top{ position: relative; }  

.view-radio-player .rp-top.is-focus{
  box-shadow: 0 0 0 3px var(--accent, #ffd764) inset, var(--shadow) !important;
  border-radius: var(--radius, 18px);
}

.rp-audio-wrap{
  width: 100%;
  height: clamp(48px, 5.2vh, 64px);
  background: transparent;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;  
  align-items: center;
  gap: 0;         
  min-width: 0;
}

.rp-audio{
  width: clamp(120px, 12vw, 160px);
  height: 100%;
}

.rp-audio::-webkit-media-controls-enclosure{ border-radius: 999px; padding: 0 6px; }
.rp-audio::-webkit-media-controls-timeline,
.rp-audio::-webkit-media-controls-current-time-display,
.rp-audio::-webkit-media-controls-time-remaining-display,
.rp-audio::-webkit-media-controls-seek-back-button,
.rp-audio::-webkit-media-controls-seek-forward-button,
.rp-audio::-webkit-media-controls-mute-button,
.rp-audio::-webkit-media-controls-volume-slider,
.rp-audio::-webkit-media-controls-volume-control-hover-background,
.rp-audio::-webkit-media-controls-volume-slider-container,
.rp-audio::-webkit-media-controls-playback-rate-button,
.rp-audio::-webkit-media-controls-download-button,
.rp-audio::-webkit-media-controls-cast-button,
.rp-audio::-webkit-media-controls-overflow-button{
  display: none !important;
}

.rp-viz{
  --bar-w: 4px;                    
  --gap-w: 4px;                   
  --viz-color: #fff;              

  background-image: repeating-linear-gradient(
    90deg,
    var(--viz-color) 0 calc(var(--bar-w)),
    transparent calc(var(--bar-w)) calc(var(--bar-w) + var(--gap-w))
  );

  height: 22px;
  opacity: .85;
  user-select: none;
  pointer-events: none;

  --wave-w: 160px;
  --wave-h-min: 22px;
  --wave-h-max: 34px;
  --speed-x: 6s;
  --speed-y: 1.6s;

  -webkit-mask-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 100' preserveAspectRatio='none'>\
  <path d='M0,100 C10,60 35,35 55,70 C80,110 100,20 130,55 C155,82 170,62 200,100 L200,100 0,100 Z' fill='white'/>\
</svg>");
  mask-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 100' preserveAspectRatio='none'>\
  <path d='M0,100 C10,60 35,35 55,70 C80,110 100,20 130,55 C155,82 170,62 200,100 L200,100 0,100 Z' fill='white'/>\
</svg>");
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
  -webkit-mask-size: var(--wave-w) var(--wave-h-min);
  mask-size: var(--wave-w) var(--wave-h-min);

  animation: none;
  animation-play-state: paused;
  will-change: mask-position, -webkit-mask-position, mask-size, -webkit-mask-size;
}

.is-playing .rp-viz{
  animation:
    vizScrollX var(--speed-x) linear infinite,
    vizPulseY  var(--speed-y) ease-in-out infinite;
  animation-play-state: running;
}

@keyframes vizScrollX {
  to {
    -webkit-mask-position: var(--wave-w) 0;
            mask-position: var(--wave-w) 0;
  }
}

@keyframes vizPulseY {
  0%,100% {
    -webkit-mask-size: var(--wave-w) var(--wave-h-min);
            mask-size: var(--wave-w) var(--wave-h-min);
  }
  50%     {
    -webkit-mask-size: var(--wave-w) var(--wave-h-max);
            mask-size: var(--wave-w) var(--wave-h-max);
  }
}

@keyframes adInL2R {
  from {
    transform: translateX(-12%);
    opacity: 0;
  }
  to {
    transform: translateX(0%);
    opacity: 1;
  }
}

.rp-ads__img {
  will-change: transform, opacity;
}

.rp-ads__img.ad-enter {
  animation: adInL2R 480ms ease-out both;
}

.rp-ads{
  flex: 1 1 auto;
  background: var(--card-2);
  border-radius: var(--radius, 18px);
  box-shadow: var(--shadow);
  overflow: hidden;         
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}
.rp-ads::after{
  position: absolute;
  top: 8px; right: 12px;
  font-size: 11px;
  color: rgba(255,255,255,.35);
}
.rp-ads__img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--card-2);
}

@media (max-width: 1200px){
  .rp-grid{ grid-template-columns: 1.1fr 1.9fr; }
}
@media (max-width: 980px){
  .rp-grid{ grid-template-columns: 1fr; }
  .rp-main{ order: -1; } 
}

@media (max-height: 820px){
  .rp-item{ padding: 12px; margin-bottom: 10px; }
  .rp-item__logo{ width: 40px; height: 40px; }
  .rp-audio-wrap{ height: clamp(44px, 4.8vh, 58px); }
}
@media (max-height: 700px){
  .rp-item{ padding: 10px; margin-bottom: 8px; }
  .rp-item__logo{ width: 36px; height: 36px; }
  .rp-audio-wrap{ height: clamp(40px, 4.2vh, 52px); }
}

.rp-item:focus, .rp-item:focus-visible,
.backchip:focus, .backchip:focus-visible { outline: none; }

.fav-btn.is-added img { filter: drop-shadow(0 0 0.6rem rgba(0, 0, 0, 0.35)); }

.rp-item.is-fav { outline: 2px solid #ffdf00; } 

.rp-top .fav-btn{
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: transparent;
  transition: background-color .18s ease, box-shadow .18s ease, filter .18s ease;
}

.rp-top .fav-btn img{
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1) contrast(100%) saturate(0) !important;
  opacity: .96;
  transition: filter .18s ease, transform .12s ease, opacity .18s ease;
}

.rp-top .fav-btn.is-added{
  background: rgba(239, 68, 68, .18);                    
  box-shadow: 0 0 0 2px rgba(239, 68, 68, .7) inset;  
}
.rp-top .fav-btn.is-added img{
  filter: invert(15%) sepia(98%) saturate(7440%) hue-rotate(-5deg) brightness(95%) contrast(110%);
  transform: scale(1.05);
}

.rp-top.is-focus .fav-btn.is-added{
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .9) inset;
}

.modal-backdrop[hidden],
.modal[hidden] { display: none; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(1px);
  z-index: 9998;
}

.modal {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  z-index: 9999;
}

.modal__card {
  width: min(520px, 92vw);
  background: var(--bg);
  color: var(--txt, #fff);
  border-radius: calc(var(--radius, 12px) + 2px);
  box-shadow: 0 12px 45px rgba(0,0,0,0.35);
  padding: 20px 18px;
  outline: none;
}

.modal__title {
  margin: 0 0 8px 0;
  font-size: clamp(18px, 1.2vw, 22px);
  font-weight: 800;
}

.modal__msg {
  margin: 0 0 16px 0;
  opacity: .9;
}

.modal__actions {
  display: flex; gap: 10px; justify-content: flex-end;
}

.btn {
  padding: 10px 14px;
  background: var(--panel-bg, rgba(255,255,255,0.06));
  border: 1px solid var(--panel-border, rgba(255,255,255,0.12));
  border-radius: 10px;
  font-weight: 700;
}
.btn-primary {
  background: var(--brand, #7a5cff);
  border-color: transparent;
  color: white;
}

.modal [data-modal-focus].is-focus,
.modal [data-modal-focus]:focus-visible {
  outline: 2px solid var(--brand, #7a5cff);
  outline-offset: 2px;
  border-radius: 12px;
}

body.modal-open .view-tv-list {
  pointer-events: none;
  user-select: none;
}

#rpAudio{
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  border: 0 !important;
  outline: 0 !important;
  flex: 0 0 0 !important; 
}
#rpAudio:focus, #rpAudio:focus-visible { outline: 0 !important; }
