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

/* Корень плеера — обёртка .bradio, не класс на body (чтобы не ломать стили сайта) */
.bradio {
  /* Контур плеера — жёлто-оранжевый (как акценты сайта), не голубой */
  --bradio-outline: #ffbd33;
  --bradio-outline-soft: rgba(255, 189, 51, 0.5);
  /* Свечение кнопок при нажатии */
  --bradio-btn-glow: #ffbd33;
  --bradio-btn-glow-mid: #ff9d33;
  --bradio-btn-glow-spread: rgba(255, 157, 51, 0.55);

  font-family: "Manrope", system-ui, sans-serif;
  color: var(--bradio-text, var(--body_radio-text, #ffffff));
  background: transparent;
}

.bradio__wrap {
  display: block;
  width: fit-content;
  max-width: 100%;
}

.bradio__shell {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border-radius: 12px;
  /* visible — иначе всплывающие меню обрезаются сверху/снизу */
  overflow: visible;
  border: 1px solid var(--bradio-outline, #ffbd33);
  box-shadow:
    0 0 14px var(--bradio-outline-soft, rgba(255, 189, 51, 0.45)),
    inset 0 0 22px rgba(255, 189, 51, 0.08);
}

.bradio__shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 50% at 50% 40%, rgba(90, 20, 30, 0.9), #1a0508);
  opacity: 0;
}

.bradio__shell:not(:has(img.bradio__frame[src]))::after,
.bradio__shell:has(img.bradio__frame[src=""])::after {
  opacity: 1;
}

@supports not selector(:has(*)) {
  .bradio__shell::after {
    opacity: 0.35;
  }
}

.bradio__frame {
  display: block;
  /* Сначала --bradio-*, затем старые имена --body_radio-* */
  width: var(--bradio-frame-width, var(--body_radio-frame-width, min(720px, 100%)));
  height: var(--bradio-frame-height, var(--body_radio-frame-height, auto));
  max-width: 100%;
  object-fit: contain;
  object-position: center center;
  position: relative;
  z-index: 1;
  border-radius: 11px;
}

.bradio__player {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--bradio-inset, var(--body_radio-inset, 8% 7% 10% 7%));
  pointer-events: none;
}

.bradio__player * {
  pointer-events: auto;
}

/* Карточка как на референсе: вертикально, прозрачная, только контент */
.bradio__glass {
  position: relative;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem 0.6rem;
  border-radius: 18px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.bradio__station {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: center;
  text-shadow:
    0 0 10px rgba(0, 0, 0, 0.85),
    0 1px 3px rgba(0, 0, 0, 0.9);
}

.bradio__viz {
  height: 52px;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
}

.bradio__viz-canvas {
  display: block;
  width: 100%;
  height: 52px;
}

.bradio__progress {
  position: relative;
  margin: 0 0 0.15rem;
}

.bradio__progress-line {
  position: relative;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  overflow: visible;
}

.bradio__progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 38%;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.85));
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
  animation: bradio_liveShimmer 2.5s ease-in-out infinite;
}

@keyframes bradio_liveShimmer {
  0%,
  100% {
    opacity: 0.85;
    width: 34%;
  }
  50% {
    opacity: 1;
    width: 44%;
  }
}

.bradio__progress-knob {
  position: absolute;
  top: 50%;
  left: 38%;
  width: 11px;
  height: 11px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #e8e8e8;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  animation: bradio_knobPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bradio_knobPulse {
  0%,
  100% {
    left: 34%;
  }
  50% {
    left: 44%;
  }
}

.bradio__progress-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--bradio-muted, var(--body_radio-muted, rgba(255, 255, 255, 0.55)));
  text-align: center;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

/* Якорь: попапы позиционируются от строки кнопок и открываются вниз */
.bradio__pop-anchor {
  position: relative;
  width: 100%;
  z-index: 6;
}

.bradio__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  width: 100%;
  padding: 0 0.15rem;
}

.bradio__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--bradio-text, var(--body_radio-text, #ffffff));
  cursor: pointer;
  border-radius: 50%;
  transition:
    transform 0.12s ease,
    opacity 0.15s ease,
    filter 0.15s ease,
    box-shadow 0.15s ease;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.75));
}

.bradio__btn:hover {
  opacity: 0.95;
  transform: scale(1.06);
}

/* Нажатие: жёлто-оранжевое свечение как на сайте */
.bradio__btn:active {
  transform: scale(0.94);
  filter:
    drop-shadow(0 0 6px var(--bradio-btn-glow, #ffbd33))
    drop-shadow(0 0 14px var(--bradio-btn-glow-spread, rgba(255, 157, 51, 0.65)))
    drop-shadow(0 0 22px rgba(255, 200, 80, 0.35));
}

.bradio__btn:focus-visible {
  outline: 2px solid var(--bradio-outline, #ffbd33);
  outline-offset: 3px;
}

.bradio__btn--icon {
  width: 44px;
  height: 44px;
}

.bradio__btn--icon .bradio__ico {
  width: 22px;
  height: 22px;
}

.bradio__btn--play {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.bradio__btn--play:active {
  border-color: var(--bradio-btn-glow, #ffbd33);
  box-shadow:
    0 0 0 2px var(--bradio-btn-glow-mid, #ff9d33),
    0 0 18px var(--bradio-btn-glow-spread, rgba(255, 157, 51, 0.7)),
    0 0 32px rgba(255, 210, 100, 0.35),
    0 4px 20px rgba(0, 0, 0, 0.45);
  filter: none;
}

.bradio__btn--play .bradio__ico {
  width: 28px;
  height: 28px;
  margin-left: 3px;
}

.bradio__btn--play .bradio__ico--pause {
  margin-left: 0;
}

.bradio__volume-pop {
  position: absolute;
  left: 0.5rem;
  width: min(260px, calc(100% - 1rem));
  bottom: calc(100% - 0.25rem);
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(12, 6, 10, 0.94);
  border: 1px solid var(--bradio-outline, #ffbd33);
  box-shadow:
    0 0 12px var(--bradio-outline-soft, rgba(255, 189, 51, 0.35)),
    0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 10;
}

.bradio__volume-pop[hidden] {
  display: none;
}

.bradio__volume-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--bradio-muted, var(--body_radio-muted, rgba(255, 255, 255, 0.55)));
  margin-bottom: 0.35rem;
}

/* Скрытый select для синхронизации с логикой */
.bradio__stations-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.bradio__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.bradio__select--sr {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* Меню станций по кнопке плейлиста */
.bradio__stations-menu {
  position: absolute;
  right: 0;
  left: auto;
  width: min(260px, calc(100% - 0.5rem));
  max-height: min(240px, 45vh);
  top: 100%;
  margin-top: 0.35rem;
  bottom: auto;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: rgba(12, 6, 10, 0.96);
  border: 1px solid var(--bradio-outline, #ffbd33);
  box-shadow:
    0 0 12px var(--bradio-outline-soft, rgba(255, 189, 51, 0.35)),
    0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 11;
  overflow: hidden;
}

.bradio__stations-menu[hidden] {
  display: none;
}

.bradio__stations-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bradio-btn-glow-mid, #ff9d33);
  border-bottom: 1px solid rgba(255, 189, 51, 0.25);
}

.bradio__stations-menu-close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  border-radius: 4px;
}

.bradio__stations-menu-close:hover {
  color: #fff;
  background: rgba(255, 189, 51, 0.15);
}

.bradio__stations-menu-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  overflow-y: auto;
  max-height: 200px;
}

.bradio__stations-menu-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--bradio-text, #fff);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.bradio__stations-menu-item:hover,
.bradio__stations-menu-item:focus-visible {
  background: rgba(255, 189, 51, 0.12);
  outline: none;
}

.bradio__stations-menu-item--active {
  background: rgba(255, 157, 51, 0.2);
  font-weight: 600;
  color: var(--bradio-btn-glow, #ffbd33);
}

.bradio__label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bradio-muted, var(--body_radio-muted, rgba(255, 255, 255, 0.55)));
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.85);
}

.bradio__select {
  width: 100%;
  min-height: 2.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 4, 10, 0.55);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  -webkit-appearance: menulist;
  appearance: auto;
}

.bradio__select option {
  background: #1a1420;
  color: #fff;
}

.bradio__volume-range {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 1.6rem;
  accent-color: var(--bradio-btn-glow, #ffbd33);
  cursor: pointer;
}

.bradio__volume-range::-webkit-slider-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--bradio-btn-glow, #ffbd33), var(--bradio-btn-glow-mid, #ff9d33));
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 12px var(--bradio-btn-glow-spread, rgba(255, 157, 51, 0.55));
}

.bradio__volume-range::-webkit-slider-runnable-track {
  height: 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
}

.bradio__volume-range::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--bradio-btn-glow, #ffbd33), var(--bradio-btn-glow-mid, #ff9d33));
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 10px var(--bradio-btn-glow-spread, rgba(255, 157, 51, 0.5));
}

.bradio__volume-range::-moz-range-track {
  height: 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 420px) {
  .bradio {
    --bradio-inset: 10% 5% 12% 5%;
  }

  .bradio__btn--icon {
    width: 38px;
    height: 38px;
  }

  .bradio__btn--play {
    width: 54px;
    height: 54px;
  }
}
