/* ===========================
   This is AI Sound — Player
   Futuristic Dark Theme
   =========================== */

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

:root {
  --cyan:     #00f5ff;
  --violet:   #a855f7;
  --magenta:  #ec4899;
  --bg-deep:  #040810;
  --bg-card:  #080e1a;
  --bg-card2: #0a1220;
  --border:   rgba(0, 245, 255, 0.12);
  --border-hover: rgba(0, 245, 255, 0.3);
  --text-hi:  #f0f8ff;
  --text-mid: #7ec8d8;
  --text-lo:  #3a5a6a;
  --radius:   20px;
  --radius-sm: 12px;
  --shadow-glow: 0 0 40px rgba(0,245,255,0.15), 0 0 80px rgba(168,85,247,0.1);
}

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-hi);
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ──────────────────────────────────────────
   Background Effects
   ────────────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,245,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  animation: floatGlow 12s ease-in-out infinite alternate;
}
.glow-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,245,255,0.08) 0%, transparent 70%);
  top: -200px; left: -200px;
  animation-delay: 0s;
}
.glow-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(168,85,247,0.1) 0%, transparent 70%);
  bottom: -150px; right: -100px;
  animation-delay: -4s;
}
.glow-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(236,72,153,0.06) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -8s;
}

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

/* ──────────────────────────────────────────
   App Layout
   ────────────────────────────────────────── */
.app-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ──────────────────────────────────────────
   Header
   ────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(0,245,255,0.6));
}
.logo-icon svg { width: 100%; height: 100%; }

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.logo-main {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
.logo-sub {
  font-family: 'Space Mono', monospace;
  font-size: 0.62rem;
  color: var(--text-mid);
  letter-spacing: 0.18em;
}

.track-count-badge {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--cyan);
  border: 1px solid rgba(0,245,255,0.3);
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(0,245,255,0.05);
}

/* ──────────────────────────────────────────
   Main Layout
   ────────────────────────────────────────── */
.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 36px;
  padding: 36px 0;
  align-items: start;
}

/* ──────────────────────────────────────────
   Player Section
   ────────────────────────────────────────── */
.player-section {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-card2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: var(--shadow-glow);
  position: sticky;
  top: 24px;
}

/* Artwork */
.artwork-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.artwork-ring {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  border: 1px solid rgba(0,245,255,0.15);
  animation: pulseRing 4s ease-in-out infinite;
}
.ring-1 { animation-delay: 0s;   transform: scale(1.08); }
.ring-2 { animation-delay: 1.3s; transform: scale(1.16); }
.ring-3 { animation-delay: 2.6s; transform: scale(1.24); border-color: rgba(168,85,247,0.1); }

@keyframes pulseRing {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

.artwork-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid rgba(0,245,255,0.2);
  display: block;
  filter: drop-shadow(0 0 30px rgba(0,245,255,0.25));
  transition: filter 0.3s ease;
}
.artwork-img.playing {
  filter: drop-shadow(0 0 50px rgba(0,245,255,0.5));
}

@keyframes rotateSlow {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.artwork-overlay {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}
.artwork-container:hover .artwork-overlay {
  opacity: 1;
}

.play-overlay-icon {
  width: 60px; height: 60px;
  background: rgba(0,245,255,0.2);
  border: 2px solid rgba(0,245,255,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.play-overlay-icon:hover {
  background: rgba(0,245,255,0.35);
  transform: scale(1.08);
}
.play-overlay-icon svg { width: 28px; height: 28px; }

/* Song Info */
.now-playing-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.now-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--cyan);
  opacity: 0.7;
}

.song-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text-hi), var(--text-mid));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.4s ease;
}

.song-artist {
  font-size: 0.95rem;
  color: #aae9f6;
  font-weight: 500;
}
.artist-x-link {
  text-decoration: none;
  color: #aae9f6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease, transform 0.15s ease;
}
.artist-x-link:hover {
  color: var(--cyan);
  transform: translateY(-1px);
}
.x-icon-inline {
  width: 13px;
  height: 13px;
  fill: currentColor;
  opacity: 0.65;
  transition: opacity 0.2s ease;
}
.artist-x-link:hover .x-icon-inline {
  opacity: 1;
}

.song-description-wrapper {
  background: rgba(0,245,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-height: 56px;
}
.song-description {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.65;
}
.desc-placeholder {
  color: var(--text-lo);
  font-style: italic;
  font-size: 0.8rem;
}

/* Progress */
.progress-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-wrapper {
  cursor: pointer;
  padding: 10px 0;
}

.progress-bar-bg {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: visible;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  border-radius: 100px;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(0,245,255,0.5);
}

.progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0,245,255,0.8);
  transition: transform 0.2s ease;
  pointer-events: none;
}
.progress-bar-wrapper:hover .progress-thumb {
  transform: translate(-50%, -50%) scale(1);
}

.time-row {
  display: flex;
  justify-content: space-between;
}
.time-current, .time-total {
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-lo);
}
.time-current { color: var(--cyan); }

/* Controls */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s, filter 0.2s;
  border-radius: 50%;
  padding: 8px;
}
.ctrl-btn:hover {
  color: var(--text-hi);
  transform: scale(1.1);
}
.ctrl-btn:active { transform: scale(0.95); }

.ctrl-btn svg { width: 24px; height: 24px; }

.ctrl-shuffle svg,
.ctrl-repeat svg { width: 20px; height: 20px; }

.ctrl-shuffle.active,
.ctrl-repeat.active {
  color: var(--cyan);
  filter: drop-shadow(0 0 6px rgba(0,245,255,0.8));
}

.ctrl-prev svg,
.ctrl-next svg { width: 26px; height: 26px; }

.ctrl-play-main {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  padding: 0;
  box-shadow: 0 0 30px rgba(0,245,255,0.4);
  transition: box-shadow 0.3s, transform 0.2s;
}
.ctrl-play-main:hover {
  box-shadow: 0 0 50px rgba(0,245,255,0.7);
  transform: scale(1.05);
  color: white;
}
.ctrl-play-main:active { transform: scale(0.95); }
.ctrl-play-main.playing {
  box-shadow: 0 0 40px rgba(0,245,255,0.5), 0 0 80px rgba(168,85,247,0.3);
  animation: playPulse 2s ease-in-out infinite;
}

@keyframes playPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(0,245,255,0.4), 0 0 60px rgba(168,85,247,0.2); }
  50%       { box-shadow: 0 0 60px rgba(0,245,255,0.7), 0 0 100px rgba(168,85,247,0.4); }
}

.play-btn-inner {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.play-btn-inner svg { width: 28px; height: 28px; }

/* Volume */
.volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vol-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  transition: color 0.2s;
  flex-shrink: 0;
}
.vol-icon-btn:hover { color: var(--cyan); }
.vol-icon-btn svg { width: 20px; height: 20px; }

.volume-slider-wrapper {
  flex: 1;
  cursor: pointer;
  padding: 10px 0;
}
.volume-track {
  position: relative;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
}
.volume-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  border-radius: 100px;
}
.volume-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0,245,255,0.8);
  pointer-events: none;
  transition: transform 0.1s;
}

.vol-pct {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-lo);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────
   Playlist Section
   ────────────────────────────────────────── */
.playlist-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.playlist-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: var(--text-mid);
  font-weight: 400;
}

.pl-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,245,255,0.08);
  border: 1px solid rgba(0,245,255,0.25);
  border-radius: 100px;
  color: var(--cyan);
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.pl-action-btn:hover {
  background: rgba(0,245,255,0.16);
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(0,245,255,0.25);
}
.pl-action-btn svg { width: 14px; height: 14px; }

.playlist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(8,14,26,0.9), rgba(10,18,32,0.9));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.playlist-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 0 2px 2px 0;
}

.playlist-item:hover {
  border-color: var(--border-hover);
  background: linear-gradient(135deg, rgba(0,245,255,0.05), rgba(168,85,247,0.04));
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.playlist-item:hover::before { opacity: 1; }

.playlist-item.active {
  border-color: rgba(0,245,255,0.4);
  background: linear-gradient(135deg, rgba(0,245,255,0.1), rgba(168,85,247,0.08));
  box-shadow: 0 0 20px rgba(0,245,255,0.12), inset 0 1px 0 rgba(0,245,255,0.1);
}
.playlist-item.active::before { opacity: 1; }

.pl-thumb {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(0,245,255,0.1);
  transition: border-color 0.2s, border-radius 0.4s ease;
}
.playlist-item.active .pl-thumb {
  border-radius: 50%;
  border-color: rgba(0,245,255,0.4);
  box-shadow: 0 0 12px rgba(0,245,255,0.3);
}
.playlist-item.active.is-playing .pl-thumb {
  border-radius: 50%;
  animation: itemRotate 8s linear infinite;
  box-shadow: 0 0 16px rgba(0,245,255,0.5);
}

@keyframes itemRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.pl-info {
  flex: 1;
  min-width: 0;
}
.pl-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}
.playlist-item.active .pl-title {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.pl-artist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  min-width: 0;
}
.pl-artist {
  font-size: 0.75rem;
  color: #8ab4c4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-item.active .pl-artist { color: #aae9f6; }

.pl-x-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #557585;
  transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease;
  padding: 3px;
  border-radius: 4px;
  flex-shrink: 0;
}
.playlist-item:hover .pl-x-link {
  color: #8ab4c4;
}
.pl-x-link:hover {
  color: var(--cyan) !important;
  background: rgba(0, 245, 255, 0.1);
  transform: scale(1.15);
}
.x-icon-mini {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.pl-num {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-lo);
  width: 20px;
  text-align: right;
  flex-shrink: 0;
}
.playlist-item.active .pl-num {
  color: var(--cyan);
}

.pl-playing-indicator {
  width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
}
.playlist-item.active.is-playing .pl-playing-indicator {
  display: flex;
}
.playlist-item.active.is-playing .pl-num {
  display: none;
}
.bar {
  width: 3px;
  background: var(--cyan);
  border-radius: 2px;
  animation: soundBars 1s ease-in-out infinite;
}
.bar:nth-child(1) { height: 8px;  animation-delay: 0s; }
.bar:nth-child(2) { height: 14px; animation-delay: 0.15s; }
.bar:nth-child(3) { height: 10px; animation-delay: 0.3s; }

@keyframes soundBars {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  50%       { transform: scaleY(1.2); opacity: 1; }
}

/* ──────────────────────────────────────────
   Footer
   ────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-lo);
  letter-spacing: 0.05em;
}

/* ──────────────────────────────────────────
   Transitions for track changes
   ────────────────────────────────────────── */
.fade-out {
  animation: fadeOut 0.25s ease forwards;
}
.fade-in {
  animation: fadeIn 0.35s ease forwards;
}
@keyframes fadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.96); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ──────────────────────────────────────────
   Responsive — Tablet (960px以下)
   ────────────────────────────────────────── */
@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .player-section {
    position: static;
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
  }
}

/* ──────────────────────────────────────────
   Responsive — Mobile (600px以下)
   ────────────────────────────────────────── */
@media (max-width: 600px) {

  /* Wrapper */
  .app-wrapper {
    padding: 0 16px;
  }

  /* Header */
  .site-header {
    padding: 16px 0 14px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .logo-icon { width: 34px; height: 34px; }
  .logo-main { font-size: 1.05rem; }
  .logo-sub  { font-size: 0.55rem; }
  .track-count-badge {
    font-size: 0.6rem;
    padding: 5px 10px;
  }

  /* Main layout */
  .main-layout {
    gap: 16px;
    padding: 16px 0 24px;
  }

  /* Player card */
  .player-section {
    padding: 20px 18px 24px;
    border-radius: 16px;
    gap: 20px;
  }

  /* Artwork — コンパクトに */
  .artwork-container {
    width: 72%;
    margin: 0 auto;
  }
  .ring-1 { transform: scale(1.06); }
  .ring-2 { transform: scale(1.12); }
  .ring-3 { transform: scale(1.18); }

  /* Song info */
  .now-label { font-size: 0.55rem; }
  .song-title {
    font-size: 1.25rem;
    line-height: 1.25;
  }
  .song-artist { font-size: 0.85rem; }

  /* Description */
  .song-description-wrapper {
    padding: 10px 12px;
    min-height: 48px;
  }
  .song-description { font-size: 0.8rem; line-height: 1.6; }

  /* Progress */
  .progress-bar-wrapper { padding: 12px 0; }
  .progress-bar-bg { height: 5px; }
  .progress-thumb {
    width: 16px; height: 16px;
  }
  .time-current, .time-total { font-size: 0.68rem; }

  /* Controls — ボタンを大きく・タップしやすく */
  .controls-row {
    gap: 8px;
    justify-content: space-between;
    padding: 0 4px;
  }
  .ctrl-btn {
    padding: 10px;
  }
  .ctrl-btn svg { width: 26px; height: 26px; }
  .ctrl-shuffle svg,
  .ctrl-repeat svg { width: 22px; height: 22px; }
  .ctrl-prev svg,
  .ctrl-next svg  { width: 30px; height: 30px; }

  .ctrl-play-main {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
  }
  .play-btn-inner svg { width: 32px; height: 32px; }

  /* Volume */
  .volume-row { gap: 8px; }
  .vol-icon-btn svg { width: 22px; height: 22px; }
  .vol-pct { font-size: 0.6rem; }

  /* Playlist section */
  .playlist-section { gap: 12px; }

  .playlist-header {
    padding: 0 2px;
  }
  .playlist-title { font-size: 0.7rem; }
  .pl-action-btn {
    font-size: 0.6rem;
    padding: 7px 14px;
  }

  .playlist { gap: 5px; }

  /* Playlist items — タップしやすく */
  .playlist-item {
    padding: 12px 14px;
    border-radius: 10px;
    gap: 12px;
  }
  .pl-thumb {
    width: 44px;
    height: 44px;
    border-radius: 7px;
    flex-shrink: 0;
  }
  .pl-title  { font-size: 0.85rem; }
  .pl-artist { font-size: 0.7rem; }
  .pl-num    { font-size: 0.6rem; width: 18px; }

  /* Footer */
  .site-footer {
    padding: 16px 0;
    font-size: 0.65rem;
  }
}

/* ──────────────────────────────────────────
   Responsive — Very small (390px以下)
   ────────────────────────────────────────── */
@media (max-width: 390px) {
  .app-wrapper { padding: 0 12px; }
  .artwork-container { width: 65%; }
  .song-title { font-size: 1.1rem; }
  .controls-row { gap: 4px; }
  .ctrl-play-main { width: 64px; height: 64px; }
  .player-section { padding: 16px 14px 20px; }
}
