/* ================================================================
   GLOBAL PLAYER — 神殿の祭壇
   深緑の闇 × 翡翠の光 × 和風紋様 × 粒子 × 呼吸アニメーション
   ================================================================ */

/* ===== レイアウト固定 ===== */
.player {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 88px;
  z-index: 1200;
  overflow: hidden;
}

/* ===== 背景レイヤー① 深緑の闇（ジャパニーズファンタジー） ===== */
.player-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(14, 28, 20, 0.97) 0%,
      rgba(10, 22, 16, 0.99) 100%);
  border-top: 1px solid rgba(60, 140, 90, 0.30);
  box-shadow:
    0 -2px 40px rgba(40, 120, 70, 0.20),
    0 -1px 8px rgba(20, 80, 40, 0.30);
}

/* ===== 背景レイヤー② 翡翠の光（上から神々しく） ===== */
.player-glow {
  position: absolute;
  top: -60%;
  left: 0;
  width: 100%;
  height: 220%;
  background:
    radial-gradient(ellipse at 50% 0%,
      rgba(60, 180, 100, 0.12) 0%,
      rgba(40, 140, 80, 0.06) 40%,
      transparent 65%);
  pointer-events: none;
  transition: opacity 1.2s ease;
}

.player.playing .player-glow {
  background:
    radial-gradient(ellipse at 50% 0%,
      rgba(80, 210, 120, 0.22) 0%,
      rgba(50, 160, 90, 0.10) 40%,
      transparent 65%);
  animation: glowPulse 3.5s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.80; }
  50%       { opacity: 1; }
}

/* ===== 背景レイヤー③ 和風円形紋様 ===== */
.player-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url('../images/pattern-circle.svg');
  background-repeat: repeat;
  background-size: 120px 120px;
  pointer-events: none;
}

/* ===== 背景レイヤー④ 粒子（::before） ===== */
.player::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, rgba(80, 200, 120, 0.12) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.12;
  pointer-events: none;
  transition: opacity 1s ease;
}

.player.playing::before {
  opacity: 0.22;
  animation: particleDrift 8s linear infinite;
}

@keyframes particleDrift {
  0%   { background-position: 0 0; }
  100% { background-position: 60px 60px; }
}

/* ===== 上辺の光ライン ===== */
.player::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(80, 200, 120, 0.00) 10%,
    rgba(100, 220, 140, 0.60) 30%,
    rgba(120, 240, 160, 0.90) 50%,
    rgba(100, 220, 140, 0.60) 70%,
    rgba(80, 200, 120, 0.00) 90%,
    transparent 100%
  );
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.player.playing::after {
  animation: topLineGlow 3s ease-in-out infinite;
}

@keyframes topLineGlow {
  0%, 100% { opacity: 0.70; }
  50%       { opacity: 1; box-shadow: 0 0 8px rgba(100, 220, 140, 0.60); }
}

/* ===== 呼吸アニメーション（再生中） ===== */
.player.playing {
  animation: playerBreathe 4.5s ease-in-out infinite;
}

@keyframes playerBreathe {
  0%, 100% { transform: scaleY(1); }
  50%       { transform: scaleY(1.006); }
}

/* ===== 曲変更フェード ===== */
.player.track-changing .player-left {
  animation: trackFade 0.6s ease;
}

@keyframes trackFade {
  0%   { opacity: 1; }
  30%  { opacity: 0; }
  70%  { opacity: 0; }
  100% { opacity: 1; }
}

/* ===== 内部レイアウト ===== */
.player-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 24px;
}

/* ===== 左: 曲情報 ===== */
.player-left {
  flex: 0 0 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(200, 240, 215, 0.95);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  text-shadow: 0 0 12px rgba(80, 200, 120, 0.40);
}

.track-tags {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.player-tag {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: rgba(120, 210, 150, 0.80);
  background: rgba(60, 160, 90, 0.12);
  border: 1px solid rgba(80, 180, 110, 0.28);
  border-radius: 100px;
  padding: 1px 7px;
  white-space: nowrap;
  font-family: 'Noto Sans JP', sans-serif;
}

/* ===== 中央: コントロール ===== */
.player-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 前・次ボタン */
.btn-prev,
.btn-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(40, 100, 60, 0.20);
  border: 1px solid rgba(80, 180, 110, 0.22);
  color: rgba(120, 210, 150, 0.70);
  cursor: pointer;
  transition: all 0.22s ease;
}

.btn-prev:hover,
.btn-next:hover {
  background: rgba(60, 140, 80, 0.30);
  border-color: rgba(100, 210, 140, 0.50);
  color: rgba(160, 240, 190, 0.95);
  transform: scale(1.10);
  box-shadow: 0 0 10px rgba(80, 200, 120, 0.25);
}

/* 再生ボタン（核） */
.btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(145deg,
    rgba(50, 130, 75, 0.90) 0%,
    rgba(30, 90, 55, 0.95) 100%);
  border: 1.5px solid rgba(100, 210, 140, 0.45);
  color: rgba(200, 245, 220, 0.98);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow:
    0 2px 16px rgba(40, 120, 70, 0.40),
    0 0 0 0 rgba(80, 200, 120, 0),
    inset 0 1px 0 rgba(140, 240, 170, 0.20);
}

.btn-play:hover {
  background: linear-gradient(145deg,
    rgba(65, 155, 90, 0.95) 0%,
    rgba(40, 110, 65, 0.98) 100%);
  transform: scale(1.08);
  box-shadow:
    0 4px 24px rgba(50, 150, 90, 0.50),
    0 0 28px rgba(80, 210, 120, 0.30),
    inset 0 1px 0 rgba(160, 255, 190, 0.25);
}

.player.playing .btn-play {
  background: linear-gradient(145deg,
    rgba(55, 145, 80, 0.95) 0%,
    rgba(35, 100, 60, 0.98) 100%);
  animation: playBtnGlow 2.8s ease-in-out infinite;
}

@keyframes playBtnGlow {
  0%, 100% {
    box-shadow:
      0 2px 16px rgba(40, 120, 70, 0.40),
      0 0 20px rgba(80, 200, 120, 0.35),
      inset 0 1px 0 rgba(140, 240, 170, 0.20);
  }
  50% {
    box-shadow:
      0 2px 20px rgba(50, 140, 80, 0.55),
      0 0 40px rgba(90, 220, 130, 0.55),
      0 0 60px rgba(70, 180, 110, 0.20),
      inset 0 1px 0 rgba(160, 255, 190, 0.30);
  }
}

/* ===== シークバー ===== */
.seekbar {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 4px;
  background: rgba(60, 140, 80, 0.18);
  border-radius: 100px;
  cursor: pointer;
  transition: height 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.30);
}

.seekbar:hover {
  height: 6px;
}

.seek-progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    rgba(40, 140, 80, 0.90) 0%,
    rgba(70, 200, 120, 0.95) 50%,
    rgba(100, 230, 150, 1.00) 100%
  );
  border-radius: 100px;
  transition: width 0.1s linear;
  pointer-events: none;
  box-shadow:
    0 0 6px rgba(80, 210, 120, 0.60),
    0 0 14px rgba(60, 180, 100, 0.35);
}

/* 再生中はシークバーが光る */
.player.playing .seek-progress {
  animation: seekGlow 2.5s ease-in-out infinite;
}

@keyframes seekGlow {
  0%, 100% {
    box-shadow:
      0 0 6px rgba(80, 210, 120, 0.60),
      0 0 14px rgba(60, 180, 100, 0.35);
  }
  50% {
    box-shadow:
      0 0 10px rgba(100, 230, 140, 0.85),
      0 0 22px rgba(70, 200, 120, 0.55),
      0 0 36px rgba(50, 160, 90, 0.25);
  }
}

/* シークバー先端の光点 */
.seek-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(160, 255, 190, 1.00) 0%,
    rgba(100, 220, 140, 0.90) 60%,
    rgba(60, 170, 100, 0.70) 100%);
  border: 1.5px solid rgba(200, 255, 220, 0.80);
  box-shadow:
    0 0 8px rgba(100, 230, 140, 0.80),
    0 0 16px rgba(70, 200, 120, 0.50);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.seekbar:hover .seek-thumb {
  opacity: 1;
}

/* ===== 時間表示 ===== */
.time {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: rgba(100, 200, 130, 0.55);
}

/* ===== 右: モード・音量 ===== */
.player-right {
  flex: 0 0 230px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== お気に入りボタン — 灯火 / アンバー ===== */
.btn-fav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(210, 148, 62, 0.38);
  cursor: pointer;
  transition: all 0.22s ease;
}
.btn-fav:hover {
  color: rgba(255, 184, 88, 0.85);
  border-color: rgba(255, 150, 50, 0.30);
  background: rgba(160, 100, 20, 0.12);
}
.btn-fav.is-fav {
  color: rgba(255, 159, 58, 0.96);
  border-color: rgba(255, 140, 50, 0.52);
  background: rgba(180, 100, 18, 0.16);
  box-shadow:
    0 0 6px  rgba(255, 180, 80, 0.48),
    0 0 16px rgba(255, 130, 40, 0.24),
    0 0 32px rgba(255, 110, 30, 0.10);
}
.btn-fav.is-fav:hover {
  color: rgba(255, 200, 110, 1);
  background: rgba(190, 110, 20, 0.22);
  box-shadow:
    0 0 8px  rgba(255, 190, 90, 0.55),
    0 0 22px rgba(255, 140, 50, 0.30),
    0 0 40px rgba(255, 110, 30, 0.14);
}
.btn-fav:disabled {
  color: rgba(160, 120, 55, 0.18);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
  opacity: 0.4;
}

/* 保存リストボタン (モーダルトリガー) — 灯火 / アンバー */
.fav-list-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(140, 90, 18, 0.12);
  border: 1px solid rgba(200, 130, 45, 0.24);
  border-radius: 3px;
  padding: 0 8px;
  height: 26px;
  cursor: pointer;
  white-space: nowrap;
  color: rgba(210, 148, 62, 0.70);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  line-height: 1;
  transition: all 0.18s ease;
  user-select: none;
}
.fav-list-btn svg {
  flex-shrink: 0;
  opacity: 0.75;
}
.fav-list-btn__count {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: rgba(230, 165, 70, 0.65);
}
.fav-list-btn:hover {
  color: rgba(255, 184, 88, 0.95);
  border-color: rgba(255, 148, 45, 0.45);
  background: rgba(160, 100, 20, 0.20);
  box-shadow: 0 0 8px rgba(255, 160, 60, 0.18);
}
.fav-list-btn:hover .fav-list-btn__count {
  color: rgba(255, 184, 88, 0.90);
}
.fav-list-btn:hover svg {
  opacity: 1;
}

/* リピート・シャッフルボタン */
.btn-repeat,
.btn-shuffle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(80, 180, 110, 0.40);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-repeat:hover,
.btn-shuffle:hover {
  color: rgba(120, 220, 150, 0.80);
  border-color: rgba(80, 180, 110, 0.30);
  background: rgba(50, 140, 80, 0.12);
}

.btn-repeat[data-mode="one"],
.btn-repeat[data-mode="all"],
.btn-shuffle[data-active="true"] {
  color: rgba(120, 230, 155, 0.95);
  border-color: rgba(80, 200, 120, 0.45);
  background: rgba(50, 160, 90, 0.15);
  box-shadow: 0 0 8px rgba(80, 200, 120, 0.25);
}

/* 音量 */
.volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-icon {
  color: rgba(80, 180, 110, 0.50);
  flex-shrink: 0;
}

.volume {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: rgba(60, 140, 80, 0.22);
  border-radius: 100px;
  outline: none;
  border: none;
  cursor: pointer;
  box-shadow: none;
}

.volume:focus {
  outline: none;
  box-shadow: none;
}

.volume:focus-visible {
  outline: none;
  box-shadow: none;
}

.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(140, 230, 170, 1.00) 0%,
    rgba(80, 180, 110, 0.90) 100%);
  border: 1.5px solid rgba(200, 255, 220, 0.70);
  box-shadow: 0 0 6px rgba(80, 200, 120, 0.50);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.volume::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(100, 220, 140, 0.70);
}

.volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(100, 200, 130, 0.90);
  border: 1.5px solid rgba(200, 255, 220, 0.70);
  cursor: pointer;
}

/* ===== ページ下部のpadding（プレイヤー分） ===== */
body {
  padding-bottom: 88px;
}

/* ===== モバイル対応 ===== */
@media (max-width: 768px) {
  .player {
    height: 72px;
  }

  body {
    padding-bottom: 72px;
  }

  .player-inner {
    padding: 0 12px;
    gap: 12px;
  }

  .player-left {
    flex: 0 0 140px;
  }

  .track-title {
    font-size: 0.78rem;
  }

  .player-right {
    flex: 0 0 auto;
  }

  .btn-repeat,
  .btn-shuffle {
    display: none;
  }

  .fav-list-btn__label {
    display: none;  /* 小画面: "保存リスト" テキストを隠しアイコン+件数のみ表示 */
  }

  .volume-wrap {
    display: none;
  }

  .btn-play {
    width: 42px;
    height: 42px;
  }

  .btn-prev,
  .btn-next {
    width: 28px;
    height: 28px;
  }

  .seekbar {
    max-width: 100%;
  }

  .time {
    font-size: 0.55rem;
  }
}

@media (max-width: 480px) {
  .player-left {
    flex: 0 0 120px;
  }

  .track-title {
    font-size: 0.72rem;
  }

  .player-inner {
    gap: 8px;
  }
}

/* ===== プレイヤー 足跡ボタン ===== */
.player-btn-footprint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(154, 218, 180, 0.45);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.22s ease;
}
.player-btn-footprint:hover {
  color: rgba(154, 218, 180, 0.9);
  border-color: rgba(100, 180, 130, 0.35);
  background: rgba(45, 90, 61, 0.18);
}

/* ===== プレイヤー 足跡ポップアップ ===== */
.player-fp-popup {
  position: fixed;
  bottom: calc(72px + 0.5rem); /* プレイヤーの高さ分上 */
  right: 1rem;
  width: 300px;
  background: rgba(8, 18, 14, 0.96);
  border: 1px solid rgba(100, 180, 130, 0.3);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  z-index: 9000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(154,218,180,0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.player-fp-popup[hidden] { display: none; }

.player-fp-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
}
.player-fp-popup__track {
  font-size: 0.78rem;
  color: rgba(154, 218, 180, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.player-fp-popup__close {
  background: transparent;
  border: none;
  color: rgba(154, 218, 180, 0.5);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
  flex-shrink: 0;
  transition: color 0.2s;
}
.player-fp-popup__close:hover { color: rgba(154, 218, 180, 0.9); }

.player-fp-popup__fields {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.player-fp-popup__nick,
.player-fp-popup__body {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(100, 180, 130, 0.22);
  border-radius: 6px;
  color: rgba(220, 235, 225, 0.9);
  font-size: 0.8rem;
  padding: 0.4rem 0.55rem;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
  resize: none;
  transition: border-color 0.2s;
}
.player-fp-popup__nick::placeholder,
.player-fp-popup__body::placeholder { color: rgba(154, 218, 180, 0.3); }
.player-fp-popup__nick:focus,
.player-fp-popup__body:focus { border-color: rgba(100, 180, 130, 0.55); }

.player-fp-popup__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.55rem;
}
.player-fp-popup__count {
  font-size: 0.72rem;
  color: rgba(154, 218, 180, 0.4);
}
.player-fp-popup__submit {
  background: rgba(45, 90, 61, 0.55);
  border: 1px solid rgba(100, 180, 130, 0.4);
  border-radius: 5px;
  color: rgba(154, 218, 180, 0.9);
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.player-fp-popup__submit:hover {
  background: rgba(45, 90, 61, 0.85);
  border-color: rgba(100, 180, 130, 0.7);
}
.player-fp-popup__note {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  min-height: 1em;
  color: transparent;
}
.player-fp-popup__note--success { color: rgba(100, 200, 140, 0.85); }
.player-fp-popup__note--error   { color: rgba(220, 100, 80, 0.85); }

@media (max-width: 768px) {
  .player-fp-popup {
    right: 0.5rem;
    width: calc(100vw - 1rem);
    max-width: 340px;
  }
}
