/* ==========================================================================
   Live Streams Section — Now streaming from IRIAM (GAS API)
   Swiper horizontal scroll layout + rich decorations
   ========================================================================== */

.section--streams {
  padding: var(--space-20) 0;
  background: var(--color-bg);
  position: relative;
  overflow: clip;
}

/* ── Floating Orbs (decorative background) ── */
.streams__orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.15;
}

.streams__orb--1 {
  width: 400px;
  height: 400px;
  background: var(--color-primary);
  top: -100px;
  right: -120px;
  animation: orbFloat1 8s ease-in-out infinite;
}

.streams__orb--2 {
  width: 300px;
  height: 300px;
  background: var(--color-accent-pink);
  bottom: -80px;
  left: -100px;
  animation: orbFloat2 10s ease-in-out infinite;
}

.streams__orb--3 {
  width: 200px;
  height: 200px;
  background: var(--color-accent-cyan);
  top: 40%;
  left: 50%;
  animation: orbFloat3 12s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 30px) scale(1.1); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.15); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(-50%, 0) scale(1); opacity: 0.1; }
  50% { transform: translate(-50%, -30px) scale(1.2); opacity: 0.2; }
}

/* ── Header ── */
.streams__header {
  text-align: center;
  margin-bottom: var(--space-10);
  position: relative;
  z-index: 1;
}

/* Section label (small tag above title) */
.streams__label {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--color-primary);
  background: rgba(155, 111, 204, 0.08);
  border: 1px solid rgba(155, 111, 204, 0.15);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-4);
  margin-bottom: var(--space-4);
  animation: labelGlow 3s ease-in-out infinite;
}

@keyframes labelGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(155, 111, 204, 0); }
  50% { box-shadow: 0 0 20px 2px rgba(155, 111, 204, 0.12); }
}

.streams__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--color-text);
  line-height: 1.1;
}

.streams__title-live {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

/* Shimmer on "LIVE" text */
.streams__title-live::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: titleShimmer 4s ease-in-out infinite;
}

@keyframes titleShimmer {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

.streams__sub {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  letter-spacing: var(--tracking-wide);
}

/* Live Indicator — animated pill */
.streams__live-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding: var(--space-2) var(--space-5);
  background: rgba(229, 62, 62, 0.06);
  border-radius: var(--radius-full);
  border: 1px solid rgba(229, 62, 62, 0.12);
  transition: all 0.3s ease;
  animation: indicatorPulse 3s ease-in-out infinite;
}

@keyframes indicatorPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0); }
  50% { box-shadow: 0 0 24px 4px rgba(229, 62, 62, 0.08); }
}

.streams__live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e53e3e;
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 8px rgba(229, 62, 62, 0); }
}

.streams__live-count {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: #e53e3e;
  line-height: 1;
}

.streams__live-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: #e53e3e;
  letter-spacing: 0.1em;
}

/* ── Swiper Wrapper ── */
.streams__swiper-wrap {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding: 0 var(--space-12);
}

.streams__swiper {
  overflow: clip;
  padding: var(--space-4) 0;
  touch-action: pan-y pinch-zoom;
}

/* Equalize slide heights */
.streams__swiper .swiper-wrapper {
  display: flex;
  align-items: stretch;
  touch-action: pan-y pinch-zoom;
}

.streams__swiper .swiper-slide {
  height: auto;
}

/* ── Navigation ── */
.streams__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.streams__nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border-light);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.streams__nav-btn:hover {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(155, 111, 204, 0.2);
  transform: scale(1.08);
}

.streams__nav-btn.swiper-button-disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Pagination dots */
.streams__pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.streams__pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border-light);
  opacity: 1;
  transition: all 0.3s ease;
  cursor: pointer;
}

.streams__pagination .swiper-pagination-bullet-active {
  background: var(--color-primary);
  width: 24px;
  border-radius: 4px;
}

/* ── Single Live Card (inside swiper-slide) ── */
/* ── Card — Thumbnail + avatar footer layout ── */
.streams__card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  text-decoration: none;
  color: inherit;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  height: 100%;
  overflow: hidden;
  -webkit-user-drag: none;
  user-select: none;
}

.streams__card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 12px 40px rgba(200, 160, 230, 0.18),
    0 4px 12px rgba(155, 111, 204, 0.08);
  border-color: transparent;
}

/* ON AIR badge */
.streams__card-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  background: linear-gradient(135deg, #e53e3e, #f56565);
  color: #fff;
  border-radius: var(--radius-full);
  z-index: 2;
  animation: badgeFlash 2s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
}

.streams__card-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes badgeFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Rank badge — top right */
.streams__card-rank {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  z-index: 2;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.streams__card-rank--s {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.streams__card-rank--a {
  background: linear-gradient(135deg, #f78fb3, #e056a0);
}

.streams__card-rank--b {
  background: linear-gradient(135deg, #a55eea, #8854d0);
}

.streams__card-rank--c {
  background: linear-gradient(135deg, #778beb, #546de5);
}

.streams__card-rank--d {
  background: linear-gradient(135deg, #63cdda, #3dc1d3);
}

/* Thumbnail area */
.streams__card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-bg-section);
}

.streams__card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.streams__card:hover .streams__card-thumb-img {
  transform: scale(1.05);
}

.streams__card-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(155, 111, 204, 0.08), rgba(232, 123, 197, 0.08));
}

/* Footer — avatar + name + arrow 横並び */
.streams__card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
}

/* Avatar — small circle in footer */
.streams__card-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #e53e3e;
  box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.12);
  background: var(--color-bg-section);
}

.streams__card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Name — 1行横書き、溢れは省略 */
.streams__card-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.streams__card:hover .streams__card-name {
  color: var(--color-primary);
}

/* Arrow */
.streams__card-arrow {
  color: var(--color-text-muted);
  transition: all 0.3s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.streams__card:hover .streams__card-arrow {
  color: var(--color-primary);
  transform: translateX(3px);
}

/* ── PC size-up ── */
@media (min-width: 1024px) {
  .section--streams {
    padding: var(--space-24) 0;
  }

  .section--streams > .container {
    max-width: 1400px !important;
  }

  .streams__header {
    margin-bottom: var(--space-12);
  }

  .streams__card-badge {
    font-size: 11px;
    padding: 4px 14px;
    gap: 5px;
    top: var(--space-3);
    left: var(--space-3);
  }

  .streams__card-badge::before {
    width: 6px;
    height: 6px;
  }

  .streams__card-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .streams__card-footer {
    padding: 10px 12px;
    gap: 8px;
  }

  .streams__card-name {
    font-size: var(--text-sm);
    -webkit-line-clamp: 1;
  }

  .streams__nav-btn {
    width: 44px;
    height: 44px;
  }
}

/* ── Loading ── */
.streams__loading {
  text-align: center;
  padding: var(--space-10) 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  position: relative;
  z-index: 1;
}

.streams__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spinLoader 0.8s linear infinite;
  margin: 0 auto var(--space-3);
}

@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

/* ── Empty State ── */
.streams__empty {
  text-align: center;
  padding: var(--space-10) 0;
  color: var(--color-text-muted);
  position: relative;
  z-index: 1;
}

.streams__empty-icon {
  margin-bottom: var(--space-3);
  opacity: 0.3;
}

.streams__empty p {
  font-size: var(--text-sm);
}

.streams__empty-hint {
  font-size: var(--text-xs);
  margin-top: var(--space-1);
  opacity: 0.6;
}

/* ── Platform Tabs ── */
.streams__tabs {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
  position: relative;
  z-index: 1;
}

.streams__tab {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-light);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
}

.streams__tab:hover {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
}

.streams__tab.is-active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(155, 111, 204, 0.3);
}

/* ── Grid Layout (replacing Swiper) ── */
.streams__grid-wrap {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding: 0 var(--space-4);
}

.streams__grid {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary-light) transparent;
}

.streams__grid::-webkit-scrollbar {
  height: 6px;
}

.streams__grid::-webkit-scrollbar-track {
  background: transparent;
}

.streams__grid::-webkit-scrollbar-thumb {
  background: var(--color-primary-light);
  border-radius: 3px;
}

.streams__grid .streams__card {
  flex: 0 0 140px;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .streams__grid {
    gap: var(--space-4);
  }

  .streams__grid .streams__card {
    flex: 0 0 180px;
  }
}

@media (min-width: 1024px) {
  .streams__grid {
    gap: var(--space-5);
  }

  .streams__grid .streams__card {
    flex: 0 0 220px;
  }
}

/* ── SP card adjustments ── */
@media (max-width: 639px) {
  .streams__card-thumb {
    aspect-ratio: 1 / 1;
  }

  .streams__card-footer {
    padding: 6px 8px;
    gap: 4px;
  }

  .streams__card-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }

  .streams__card-name {
    font-size: 11px;
  }

  .streams__card-badge {
    font-size: 8px;
    padding: 2px 6px;
    gap: 3px;
  }

  .streams__card-badge::before {
    width: 4px;
    height: 4px;
  }

  .streams__card-rank {
    font-size: 8px;
    padding: 2px 6px;
  }

  .streams__card-arrow svg {
    width: 12px;
    height: 12px;
  }
}

/* ── QR Modal ── */
.streams__qr-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.streams__qr-modal-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.streams__qr-modal-content {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

.streams__qr-title {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.streams__qr-img img {
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.streams__qr-name {
  font-weight: 700;
  margin-top: var(--space-3);
  font-size: var(--text-base);
}

.streams__qr-close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-3);
  font-size: 24px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1;
}

/* ── Card entry animation ── */
.streams__card {
  animation: cardFadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.swiper-slide:nth-child(1) .streams__card { animation-delay: 0s; }
.swiper-slide:nth-child(2) .streams__card { animation-delay: 0.08s; }
.swiper-slide:nth-child(3) .streams__card { animation-delay: 0.16s; }
.swiper-slide:nth-child(4) .streams__card { animation-delay: 0.24s; }
.swiper-slide:nth-child(5) .streams__card { animation-delay: 0.32s; }
.swiper-slide:nth-child(6) .streams__card { animation-delay: 0.40s; }
.swiper-slide:nth-child(7) .streams__card { animation-delay: 0.48s; }
.swiper-slide:nth-child(8) .streams__card { animation-delay: 0.56s; }

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
