/* V17 ONE FEEL Radio — compact / expanded / dismissed state machine */

.pga-v17-radio {
  --v17-radio-accent: #ff7800;
  --v17-radio-accent-soft: #ffb15c;
  --v17-radio-gradient: linear-gradient(135deg, #ff7800 0%, #ff9b33 48%, #ffd27a 100%);
  --v17-radio-bg: rgba(9, 9, 9, 0.92);
  --v17-radio-border: rgba(255, 255, 255, 0.12);
  --v17-radio-text: #ffffff;
  --v17-radio-muted: rgba(255, 255, 255, 0.72);
  --v17-radio-safe-bottom: 132px;
  --v17-radio-mobile-safe-bottom: 118px;

  position: fixed;
  z-index: 99970;
  color: var(--v17-radio-text);
  -webkit-text-fill-color: var(--v17-radio-text);
  font-family: "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  isolation: isolate;
}

/* Theme / Elementor cannot wash radio type back to dark body copy */
.pga-v17-radio p,
.pga-v17-radio button,
.pga-v17-radio span,
.pga-v17-radio input,
.pga-v17-radio label {
  color: var(--v17-radio-text);
  -webkit-text-fill-color: var(--v17-radio-text);
  font-family: inherit;
}

.pga-v17-radio__backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 0;
  padding: 0;
  margin: 0;
}

/* Expanded covers sticky CTA (99990); backdrop stays under panel inside root */
.pga-v17-radio[data-ui-state="expanded"] {
  z-index: 99995;
}

.pga-v17-radio[data-ui-state="expanded"] .pga-v17-radio__backdrop {
  z-index: 1;
}

.pga-v17-radio__backdrop[hidden] {
  display: none !important;
}

.pga-v17-radio__panel,
.pga-v17-radio__pill {
  position: relative;
  z-index: 2;
  background: var(--v17-radio-bg);
  border: 1px solid var(--v17-radio-border);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 120, 0, 0.08) inset;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ——— Compact (default) ——— */
.pga-v17-radio[data-ui-state="compact"] {
  left: 16px;
  bottom: var(--v17-radio-safe-bottom);
  width: auto;
  max-width: min(240px, calc(100vw - 32px));
}

/* Clip expanded panel in compact — keep YT mounted so minimize ≠ stop */
.pga-v17-radio[data-ui-state="compact"] .pga-v17-radio__panel {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.pga-v17-radio[data-ui-state="compact"] .pga-v17-radio__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 210px;
  max-width: 100%;
  min-height: 54px;
  padding: 6px 8px 6px 6px;
  border-radius: 999px;
}

.pga-v17-radio__pill-play,
.pga-v17-radio__pill-dismiss {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.pga-v17-radio__pill-play {
  background: var(--v17-radio-gradient);
  color: #111;
}

.pga-v17-radio__pill-play svg,
.pga-v17-radio__pill-dismiss {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.pga-v17-radio__pill-dismiss {
  font-size: 22px;
  line-height: 1;
  color: var(--v17-radio-muted);
  width: auto;
  height: auto;
}

.pga-v17-radio__pill-dismiss:hover,
.pga-v17-radio__pill-dismiss:focus-visible {
  color: #fff;
  outline: none;
}

.pga-v17-radio__pill-body {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.pga-v17-radio__pill-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.pga-v17-radio__pill-brand {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: var(--v17-radio-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pga-v17-radio__pill-label {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.pga-v17-radio__pill-wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
  flex: 0 0 auto;
}

.pga-v17-radio__pill-wave span {
  width: 3px;
  height: 40%;
  border-radius: 999px;
  background: var(--v17-radio-gradient);
  opacity: 0.55;
}

.pga-v17-radio[data-playing="true"] .pga-v17-radio__pill-wave span {
  opacity: 1;
  animation: pga-v17-radio-wave 0.9s ease-in-out infinite;
}

.pga-v17-radio[data-playing="true"] .pga-v17-radio__pill-wave span:nth-child(1) { animation-delay: 0s; }
.pga-v17-radio[data-playing="true"] .pga-v17-radio__pill-wave span:nth-child(2) { animation-delay: 0.15s; height: 90%; }
.pga-v17-radio[data-playing="true"] .pga-v17-radio__pill-wave span:nth-child(3) { animation-delay: 0.08s; height: 60%; }

/* ——— Expanded — desktop card ——— */
.pga-v17-radio[data-ui-state="expanded"] {
  left: 16px;
  bottom: var(--v17-radio-safe-bottom);
  width: min(292px, calc(100vw - 28px));
}

.pga-v17-radio[data-ui-state="expanded"] .pga-v17-radio__pill {
  display: none !important;
}

.pga-v17-radio__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px 12px;
  border-radius: 18px;
}

.pga-v17-radio__sheet-handle {
  display: none;
}

.pga-v17-radio__chrome {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  cursor: grab;
}

.pga-v17-radio__chrome:active {
  cursor: grabbing;
}

.pga-v17-radio[data-mobile="true"] .pga-v17-radio__chrome {
  cursor: default;
}

.pga-v17-radio__chrome-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.pga-v17-radio__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--v17-radio-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.pga-v17-radio__icon-btn:hover,
.pga-v17-radio__icon-btn:focus-visible {
  color: #fff;
  border-color: rgba(255, 120, 0, 0.45);
  outline: none;
}

.pga-v17-radio__brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pga-v17-radio__brand-label {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--v17-radio-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.pga-v17-radio__artist,
.pga-v17-radio__count,
.pga-v17-radio__pill-dismiss,
.pga-v17-radio__icon-btn {
  color: var(--v17-radio-muted);
  -webkit-text-fill-color: var(--v17-radio-muted);
}

.pga-v17-radio__pill-play,
.pga-v17-radio__btn--play {
  color: #111;
  -webkit-text-fill-color: #111;
}

.pga-v17-radio__now {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--v17-radio-text);
}

.pga-v17-radio__artist,
.pga-v17-radio__count {
  margin: 0;
  font-size: 12px;
  color: var(--v17-radio-muted);
  line-height: 1.3;
}

.pga-v17-radio__yt {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pga-v17-radio__yt iframe,
.pga-v17-radio__yt #pga-v17-radio-yt {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.pga-v17-radio__wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 28px;
  padding: 0 4px;
}

.pga-v17-radio__wave span {
  display: block;
  width: 4px;
  height: 30%;
  border-radius: 999px;
  background: var(--v17-radio-gradient);
  opacity: 0.55;
  transform-origin: bottom center;
}

.pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span {
  opacity: 1;
  animation: pga-v17-radio-wave 0.9s ease-in-out infinite;
}

.pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span:nth-child(1) { animation-delay: 0s; height: 42%; }
.pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span:nth-child(2) { animation-delay: 0.12s; height: 78%; }
.pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span:nth-child(3) { animation-delay: 0.24s; height: 55%; }
.pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span:nth-child(4) { animation-delay: 0.08s; height: 92%; }
.pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span:nth-child(5) { animation-delay: 0.2s; height: 48%; }
.pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span:nth-child(6) { animation-delay: 0.16s; height: 70%; }
.pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span:nth-child(7) { animation-delay: 0.04s; height: 38%; }

@keyframes pga-v17-radio-wave {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .pga-v17-radio[data-playing="true"] .pga-v17-radio__wave span,
  .pga-v17-radio[data-playing="true"] .pga-v17-radio__pill-wave span {
    animation: none;
    transform: none;
    opacity: 1;
  }
}

.pga-v17-radio__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pga-v17-radio__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
}

.pga-v17-radio__btn:hover,
.pga-v17-radio__btn:focus-visible {
  border-color: rgba(255, 120, 0, 0.55);
  outline: none;
}

.pga-v17-radio__btn--play {
  min-width: 48px;
  min-height: 48px;
  border: 0;
  background: var(--v17-radio-gradient);
  color: #111;
  font-weight: 800;
}

.pga-v17-radio__btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.pga-v17-radio__btn--play svg {
  width: 20px;
  height: 20px;
}

.pga-v17-radio__volume {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
}

.pga-v17-radio__volume input[type="range"] {
  width: 100%;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
  cursor: pointer;
}

.pga-v17-radio__volume input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--v17-radio-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(255, 120, 0, 0.25);
}

.pga-v17-radio__volume input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--v17-radio-accent);
  border: 2px solid #fff;
}

.pga-v17-radio__gate {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 0, 0.35);
  background: rgba(255, 120, 0, 0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.pga-v17-radio[data-needs-gesture="true"][data-ui-state="expanded"] .pga-v17-radio__gate {
  display: block;
}

.pga-v17-radio__empty {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--v17-radio-muted);
}

.pga-v17-radio[data-dragging="true"] {
  opacity: 0.96;
}

/* ——— Mobile compact ——— */
@media (max-width: 640px) {
  .pga-v17-radio[data-ui-state="compact"] {
    left: 12px;
    bottom: var(--v17-radio-mobile-safe-bottom);
    max-width: min(190px, calc(100vw - 24px));
  }

  .pga-v17-radio[data-ui-state="compact"] .pga-v17-radio__pill {
    width: 175px;
    min-height: 48px;
    padding: 4px 6px 4px 4px;
  }

  .pga-v17-radio__pill-label {
    max-width: 72px;
    font-size: 11px;
  }

  /* Expanded — bottom sheet (covers sticky; z-index set above) */
  .pga-v17-radio[data-ui-state="expanded"][data-mobile="true"],
  .pga-v17-radio[data-ui-state="expanded"] {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    touch-action: pan-y;
  }

  .pga-v17-radio[data-ui-state="expanded"] .pga-v17-radio__panel {
    min-height: 280px;
    max-height: min(380px, 72vh);
    border-radius: 18px 18px 0 0;
    padding-top: 8px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: rgba(9, 9, 9, 0.97);
    color: #fff;
  }

  .pga-v17-radio[data-ui-state="expanded"] .pga-v17-radio__sheet-handle {
    display: flex;
    justify-content: center;
    padding: 4px 0 8px;
  }

  .pga-v17-radio__sheet-handle span {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
  }

  .pga-v17-radio[data-ui-state="expanded"] .pga-v17-radio__yt {
    max-height: 120px;
    aspect-ratio: 16 / 9;
  }

  .pga-v17-radio[data-ui-state="expanded"] .pga-v17-radio__wave {
    height: 20px;
  }
}
