/* ============================================================
   y&music - Stories Card Modal & Jam Live Reactions & Island Visualizer
   ============================================================ */

/* ── Apple Dynamic Island Mini-Visualizer in Bottom Bar ── */
.island-mini-visualizer {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2.5px;
  height: 16px;
  padding: 0 4px;
  margin: 0 6px 0 2px;
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.island-mini-visualizer:hover {
  opacity: 1;
  transform: scale(1.1);
}

.island-mini-visualizer .bar {
  width: 2.5px;
  height: 14px;
  transform-origin: bottom;
  transform: scaleY(0.25);
  border-radius: 999px;
  background: var(--accent-gradient, linear-gradient(180deg, var(--accent-primary, #dfb76c) 0%, var(--accent-hover, #ecd094) 100%));
  box-shadow: 0 0 8px rgba(var(--accent-rgb, 223, 183, 108), 0.55);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, box-shadow 0.3s ease;
}

/* Lively animated bouncing waves when playing - 100% GPU accelerated scaleY (Zero CPU layout reflow) */
.bottom-player.is-playing .island-mini-visualizer .bar-1,
.island-mini-visualizer.is-active .bar-1 {
  animation: dynamicIslandPulse1 0.75s ease-in-out infinite alternate;
}

.bottom-player.is-playing .island-mini-visualizer .bar-2,
.island-mini-visualizer.is-active .bar-2 {
  animation: dynamicIslandPulse2 0.65s ease-in-out 0.15s infinite alternate;
}

.bottom-player.is-playing .island-mini-visualizer .bar-3,
.island-mini-visualizer.is-active .bar-3 {
  animation: dynamicIslandPulse3 0.8s ease-in-out 0.3s infinite alternate;
}

.bottom-player.is-playing .island-mini-visualizer .bar-4,
.island-mini-visualizer.is-active .bar-4 {
  animation: dynamicIslandPulse4 0.7s ease-in-out 0.1s infinite alternate;
}

@keyframes dynamicIslandPulse1 {
  0% { transform: scaleY(0.25); }
  100% { transform: scaleY(1); }
}

@keyframes dynamicIslandPulse2 {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1.1); }
}

@keyframes dynamicIslandPulse3 {
  0% { transform: scaleY(0.2); }
  100% { transform: scaleY(0.85); }
}

@keyframes dynamicIslandPulse4 {
  0% { transform: scaleY(0.25); }
  100% { transform: scaleY(1.05); }
}

.bottom-player:not(.is-playing) .island-mini-visualizer .bar,
html[data-rocket-boost="true"] .island-mini-visualizer .bar {
  animation: none !important;
  transform: scaleY(0.22) !important;
  opacity: 0.45;
  background: var(--accent-primary, #dfb76c) !important;
  box-shadow: none !important;
}

/* ── Live Jam Floating Reaction Bubbles ── */
.jam-floating-reaction {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: jamFloatUp 2.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.jam-floating-reaction .emoji {
  font-size: 38px;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
  animation: jamEmojiWiggle 0.6s ease-in-out infinite alternate;
}

.jam-floating-reaction .sender {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

@keyframes jamFloatUp {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.6);
  }
  15% {
    opacity: 1;
    transform: translateY(0px) scale(1.15);
  }
  30% {
    transform: translateY(-40px) scale(1);
  }
  80% {
    opacity: 0.95;
    transform: translateY(-180px) scale(0.95);
  }
  100% {
    opacity: 0;
    transform: translateY(-260px) scale(0.7);
  }
}

@keyframes jamEmojiWiggle {
  0% { transform: rotate(-8deg); }
  100% { transform: rotate(8deg); }
}

/* ── Story Share Modal & 9:16 Card ── */
.story-share-modal {
  position: fixed;
  inset: 0;
  z-index: 10000050 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.story-share-modal.open {
  display: flex;
}

.story-modal-container {
  position: relative;
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  background: rgba(18, 19, 26, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: storyModalPop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes storyModalPop {
  0% { opacity: 0; transform: scale(0.94) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.story-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.story-modal-body {
  display: flex;
  gap: 28px;
  padding: 24px;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}

/* 9:16 Vertical Story Preview Frame */
.story-card-preview {
  position: relative;
  width: 270px;
  height: 480px;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: #0d0f15;
}

.story-card-bg {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  z-index: 1;
  transition: all 0.3s ease;
}

.story-card-glass-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.72) 100%);
  z-index: 2;
}

.story-card-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 18px;
  box-sizing: border-box;
  justify-content: space-between;
}

.story-card-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-brand-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.story-now-playing-pill {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fa2d48;
  background: rgba(250, 45, 72, 0.15);
  padding: 3px 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fa2d48;
  box-shadow: 0 0 6px #fa2d48;
  animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.3); opacity: 1; }
}

.story-artwork-wrapper {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 10px auto;
}

.story-artwork-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
  position: relative;
  z-index: 2;
}

.story-artwork-glow {
  position: absolute;
  inset: -15px;
  border-radius: 30px;
  z-index: 1;
  filter: blur(25px);
  pointer-events: none;
}

.story-track-info {
  text-align: center;
  margin: 2px 0 8px 0;
}

.story-track-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.3px;
}

.story-track-artist {
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-lyrics-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  padding: 8px 12px;
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.story-quote-icon {
  font-size: 11px;
  color: #fa2d48;
  flex-shrink: 0;
}

.story-lyrics-text {
  font-size: 10.5px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.story-audio-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.story-audio-waveform span {
  width: 2.5px;
  background: linear-gradient(180deg, #fa2d48, #a855f7);
  border-radius: 4px;
}
.story-audio-waveform span:nth-child(1) { height: 6px; }
.story-audio-waveform span:nth-child(2) { height: 12px; }
.story-audio-waveform span:nth-child(3) { height: 16px; }
.story-audio-waveform span:nth-child(4) { height: 8px; }
.story-audio-waveform span:nth-child(5) { height: 14px; }
.story-audio-waveform span:nth-child(6) { height: 15px; }
.story-audio-waveform span:nth-child(7) { height: 10px; }
.story-audio-waveform span:nth-child(8) { height: 16px; }
.story-audio-waveform span:nth-child(9) { height: 12px; }
.story-audio-waveform span:nth-child(10) { height: 6px; }

.story-listen-badge {
  font-size: 8.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.4px;
}

/* ── Customization Panel (Right Side) ── */
.story-controls-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 260px;
}

.story-control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.story-control-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.story-theme-selector {
  display: flex;
  gap: 8px;
}

.story-theme-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.story-theme-btn.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fa2d48;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(250, 45, 72, 0.25);
}

.theme-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.theme-swatch.aura { background: linear-gradient(135deg, #fa2d48, #a855f7); }
.theme-swatch.obsidian { background: #12131a; border: 1px solid rgba(255,255,255,0.3); }
.theme-swatch.neon { background: linear-gradient(135deg, #06b6d4, #d946ef); }

.story-input-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  resize: none;
  box-sizing: border-box;
}

.story-input-textarea:focus {
  outline: none;
  border-color: #fa2d48;
}

.story-lyrics-quick-picks {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.story-lyrics-quick-picks::-webkit-scrollbar { display: none; }

.story-lyrics-pill {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-size: 10.5px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s ease;
}

.story-lyrics-pill:hover {
  background: rgba(250, 45, 72, 0.2);
  border-color: #fa2d48;
  color: #fff;
}

/* Switch toggle */
.story-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}
.story-switch input { opacity: 0; width: 0; height: 0; }
.story-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 34px;
  transition: 0.2s;
}
.story-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}
.story-switch input:checked + .story-slider { background-color: #fa2d48; }
.story-switch input:checked + .story-slider:before { transform: translateX(14px); }

/* Actions */
.story-actions-wrapper {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.story-actions-subrow {
  display: contents;
}

.story-download-btn {
  flex: 2;
  height: 42px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  background: linear-gradient(135deg, #fa2d48, #e1306c);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.story-copy-btn {
  flex: 1.5;
  height: 42px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.story-share-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .story-share-modal {
    padding: max(10px, env(safe-area-inset-top, 10px)) 10px max(14px, env(safe-area-inset-bottom, 14px)) 10px !important;
    align-items: center !important;
  }

  .story-modal-container {
    max-height: 94vh !important;
    border-radius: 22px !important;
    width: 100% !important;
    max-width: 440px !important;
    margin: 0 auto !important;
  }

  .story-modal-header {
    padding: 12px 16px !important;
  }

  .story-modal-title {
    font-size: 15px !important;
  }

  .story-modal-body {
    flex-direction: column !important;
    padding: 12px 14px 18px 14px !important;
    gap: 14px !important;
    align-items: center !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-height: calc(94vh - 58px) !important;
  }

  .story-card-preview {
    width: 196px !important;
    height: 348px !important;
    border-radius: 18px !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.14) !important;
  }

  .story-card-content {
    padding: 12px 10px !important;
  }

  .story-artwork-wrapper {
    width: 110px !important;
    height: 110px !important;
    margin: 6px auto !important;
  }

  .story-artwork-wrapper img {
    border-radius: 14px !important;
  }

  .story-track-title {
    font-size: 13px !important;
  }

  .story-track-artist {
    font-size: 10.5px !important;
  }

  .story-lyrics-box {
    padding: 5px 8px !important;
    margin: 2px 0 !important;
  }

  .story-lyrics-text {
    font-size: 9.5px !important;
  }

  .story-controls-panel {
    width: 100% !important;
    min-width: 0 !important;
    gap: 12px !important;
  }

  .story-control-label {
    font-size: 11px !important;
  }

  .story-theme-selector {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }

  .story-theme-btn {
    padding: 7px 4px !important;
    font-size: 10.5px !important;
    gap: 4px !important;
    text-align: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }

  .story-actions-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 4px !important;
  }

  .story-actions-subrow {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .story-download-btn {
    width: 100% !important;
    flex: none !important;
    height: 44px !important;
    font-size: 13.5px !important;
    border-radius: 12px !important;
  }

  .story-copy-btn {
    flex: 1 !important;
    height: 42px !important;
    font-size: 12px !important;
  }

  .story-share-btn {
    width: 44px !important;
    height: 42px !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 380px) {
  .story-card-preview {
    width: 176px !important;
    height: 312px !important;
  }

  .story-artwork-wrapper {
    width: 96px !important;
    height: 96px !important;
  }

  .story-theme-btn {
    font-size: 9.5px !important;
  }
}

