/* ═══════════════════════════════════════════
   myTunes — Kawaii Style 🌸
   Outer chrome is the site's .xp-section block
   ═══════════════════════════════════════════ */

/* Override section body bg for myTunes block only */
#mytunes-section .xp-section-body {
  background-color: #fff0f5;
  background-image: 
    linear-gradient(135deg, rgba(255, 240, 245, 0.4) 0%, rgba(252, 228, 240, 0.4) 60%, rgba(240, 228, 255, 0.4) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffb7c5' fill-opacity='0.25' d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
  background-size: auto, 48px 48px;
}

/* ── Variables ── */
:root {
  --mt-pink:         #ff6b9d;
  --mt-pink-mid:     #ff8fa3;
  --mt-pink-light:   #ffb7c5;
  --mt-pink-pale:    #fff0f5;
  --mt-lavender:     #c9b3e8;
  --mt-lavender-dk:  #9b78cc;
  --mt-mint:         #b5ead7;
  --mt-text:         #5c2d4e;
  --mt-text-soft:    #9b6080;
  --mt-lcd-bg:       #1a0826;
  --mt-lcd-text:     #ff9dd4;
  --mt-white:        #fff8fc;
}

.mytunes-wrap {
  max-width: 420px;
  margin: 0 auto;
  font-family: 'Noto Serif JP', 'Tahoma', Arial, sans-serif;
  user-select: none;
  background: linear-gradient(to bottom, #ffffff 0%, #fff0f5 10%, #ffdde5 100%);
  padding: 20px;
  border-radius: 20px;
  border: 4px ridge #ffb7c5;
  box-shadow: 
    0 10px 30px rgba(255, 107, 157, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.mytunes-body { /* no extra chrome — section body handles it */ }

/* ── LCD display ── */
.mytunes-display {
  border: 2px solid #e0b0bc;
  border-radius: 12px;
  background: #0a0410;
  padding: 10px 12px 8px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.4),
    inset 0 2px 15px rgba(255, 157, 212, 0.1);
}

/* Glass reflection effect */
.mytunes-display::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
  z-index: 3;
}

/* Scanlines — pink tint */
.mytunes-display::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(255, 157, 212, 0.04) 2px, rgba(255, 157, 212, 0.04) 3px
  );
  pointer-events: none;
  z-index: 1;
}

.mytunes-display-row1 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.mytunes-time {
  font-family: 'Courier New', monospace;
  font-size: 28px;
  font-weight: bold;
  color: var(--mt-lcd-text);
  letter-spacing: 2px;
  text-shadow:
    0 0 10px rgba(255, 157, 212, 0.9),
    0 0 24px rgba(255, 107, 157, 0.5);
  line-height: 1;
}

.mytunes-meta { text-align: right; line-height: 1.5; }

.mytunes-kbps,
.mytunes-khz {
  font-family: 'Courier New', monospace;
  font-size: 8px;
  color: var(--mt-lcd-text);
  text-shadow: 0 0 4px rgba(255, 157, 212, 0.6);
}

/* MONO / STEREO badges */
.mytunes-badges {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  position: relative;
  z-index: 2;
}

.mytunes-badge {
  font-family: 'Courier New', monospace;
  font-size: 7px;
  font-weight: bold;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 107, 157, 0.05);
  color: rgba(255, 157, 212, 0.2);
  border: 1px solid rgba(255, 157, 212, 0.12);
}

.mytunes-badge.on {
  background: rgba(255, 107, 157, 0.22);
  color: var(--mt-lcd-text);
  border-color: rgba(255, 107, 157, 0.55);
  box-shadow: 0 0 6px rgba(255, 107, 157, 0.4);
}

/* Scrolling ticker */
.mytunes-scroller {
  height: 14px;
  overflow: hidden;
  position: relative;
  border-top: 1px solid rgba(255, 157, 212, 0.15);
  padding-top: 2px;
  margin-bottom: 4px;
  z-index: 2;
}

.mytunes-scroller-text {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: var(--mt-lcd-text);
  white-space: nowrap;
  position: absolute;
  text-shadow: 0 0 6px rgba(255, 157, 212, 0.7);
  animation: mytunes-scroll 12s linear infinite;
}

@keyframes mytunes-scroll {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* Visualizer */
.mytunes-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 26px;
  position: relative;
  z-index: 2;
}

.mytunes-viz-bar {
  flex: 1;
  background: linear-gradient(to top, #ff6b9d, #c9b3e8, #b5ead7);
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 3px rgba(255, 107, 157, 0.35);
}

/* Loading overlay */
.mytunes-loader {
  position: absolute;
  inset: 0;
  background: rgba(26, 8, 38, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  color: #ff9dd4;
  text-shadow: 0 0 10px #ff9dd4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.mytunes-loader.visible {
  opacity: 1;
}

.mytunes-loader::after {
  content: '';
  animation: mytunes-load-blink 1.2s steps(1) infinite;
}

@keyframes mytunes-load-blink {
  50% { opacity: 0; }
}

/* ── Seek bar ── */
.mytunes-seekbar-wrap { margin-bottom: 14px; }

.mytunes-seekbar {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  background: #331a26;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.mytunes-seekbar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #ffccd8 30%, #ff6b9d 100%);
  border: 1px solid #ffb7c5;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 
    0 2px 5px rgba(0,0,0,0.4),
    inset 0 -1px 2px rgba(0,0,0,0.2);
  margin-top: -5px; /* Centers thumb on track */
}

/* ── Controls row ── */
.mytunes-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mytunes-playback { display: flex; gap: 8px; }

/* Physical style buttons */
.mytunes-btn {
  height: 32px;
  min-width: 34px;
  padding: 0 10px;
  background: radial-gradient(circle at 40% 30%, #ffc5d3 0%, #ff8fa3 100%);
  border: 1px solid #e08094;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: white;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    inset 0 -2px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.1s;
}

.mytunes-btn:hover {
  background: radial-gradient(circle at 40% 30%, #ffd5e3 0%, #ff9fb5 100%);
  transform: scale(1.05);
}

.mytunes-btn:active {
  transform: scale(0.95) translateY(1px);
  background: radial-gradient(circle at 50% 50%, #ff8fa3 0%, #ff6b9d 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mytunes-btn.playing {
  background: radial-gradient(circle at 40% 30%, #dcd0ef 0%, #9b78cc 100%);
  border-color: #8a68bb;
}

/* ── Links row ── */
.mytunes-links { display: flex; gap: 6px; }

.mytunes-link-btn {
  height: 28px;
  width: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.1s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0,0,0,0.1);
}

#mt-spotify { background: #1DB954; }
#mt-apple { background: #FC3C44; }

.mytunes-link-btn:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

.mytunes-link-btn:active {
  transform: scale(0.95);
}

/* ── Volume groupbox ── */
.mytunes-vol-groupbox {
  background: linear-gradient(to bottom, #fff0f5 0%, #fdeaf2 100%);
  border: 2px solid #ffccd8;
  border-radius: 16px;
  padding: 12px 14px 10px;
  position: relative;
  margin-top: 16px;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.8);
}

.mytunes-vol-title {
  position: absolute;
  top: -9px;
  left: 12px;
  background: linear-gradient(to right, #fff0f5, #fce4f0);
  padding: 0 6px;
  font-family: 'Noto Serif JP', sans-serif;
  font-size: .6rem;
  font-weight: bold;
  color: var(--mt-pink);
  letter-spacing: 1px;
}

.mytunes-vol-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mytunes-vol-icon { font-size: 13px; }

.mytunes-volume {
  -webkit-appearance: none;
  flex: 1;
  height: 8px;
  background: #331a26;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.mytunes-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #ffccd8 30%, #ff6b9d 100%);
  border: 1px solid #ffb7c5;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

/* ── Footer toggle buttons ── */
.mytunes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
}

.mytunes-ftr-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mytunes-footer-links {
  margin-left: auto;
}

.mytunes-ftr-btn {
  font-family: 'Noto Serif JP', sans-serif;
  font-size: .6rem;
  font-weight: bold;
  padding: 6px 14px;
  background: linear-gradient(to bottom, #ffffff 0%, #fce4f0 100%);
  border: 1px solid #ffccd8;
  border-radius: 12px;
  cursor: pointer;
  color: var(--mt-text-soft);
  letter-spacing: .5px;
  transition: all .15s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mytunes-ftr-btn:hover {
  background: rgba(255, 183, 197, 0.25);
  border-color: var(--mt-pink);
  color: var(--mt-pink);
}

.mytunes-ftr-btn.active {
  background: linear-gradient(to bottom, #ffccd8 0%, #ff8fa3 100%);
  border-color: #ff8fa3;
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* ── Playlist ── */
.mytunes-playlist { display: none; }
.mytunes-playlist.open { display: block; }

.mytunes-pl-header {
  background: linear-gradient(135deg, #ffb7c5, #c9b3e8);
  border-radius: 8px 8px 0 0;
  padding: 4px 10px;
  font-family: 'Noto Serif JP', sans-serif;
  font-size: .62rem;
  font-weight: bold;
  color: white;
  letter-spacing: 2px;
  text-shadow: 0 1px 2px rgba(100, 50, 80, 0.3);
}

.mytunes-pl-list {
  border: 1.5px solid rgba(255, 183, 197, 0.35);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: var(--mt-white);
  max-height: 160px;
  overflow-y: auto;
}

.mytunes-pl-list::-webkit-scrollbar { width: 5px; }

.mytunes-pl-list::-webkit-scrollbar-track {
  background: rgba(255, 240, 245, 0.8);
  border-radius: 3px;
}

.mytunes-pl-list::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--mt-pink-light), var(--mt-pink));
  border-radius: 3px;
}

.mytunes-pl-item {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  font-family: 'Noto Serif JP', sans-serif;
  font-size: .68rem;
  color: var(--mt-text);
  border-bottom: 1px solid rgba(255, 183, 197, 0.15);
  cursor: default;
  transition: background .1s;
}

.mytunes-pl-item:last-child { border-bottom: none; }

.mytunes-pl-item:hover {
  background: rgba(255, 183, 197, 0.2);
}

.mytunes-pl-item:hover .mytunes-pl-num,
.mytunes-pl-item:hover .mytunes-pl-dur {
  color: var(--mt-pink);
}

.mytunes-pl-item.active {
  background: linear-gradient(135deg, rgba(255,183,197,.3), rgba(201,179,232,.2));
  color: var(--mt-pink);
}

.mytunes-pl-item.active .mytunes-pl-num,
.mytunes-pl-item.active .mytunes-pl-dur {
  color: var(--mt-lavender-dk);
}

.mytunes-pl-num {
  font-size: .58rem;
  color: var(--mt-pink-light);
  min-width: 20px;
  flex-shrink: 0;
}

.mytunes-pl-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mytunes-pl-dur {
  font-size: .6rem;
  color: var(--mt-lavender-dk);
  font-family: 'Courier New', monospace;
  flex-shrink: 0;
  padding-left: 8px;
}

.mytunes-empty {
  padding: 10px;
  font-family: 'Noto Serif JP', sans-serif;
  font-size: .68rem;
  color: var(--mt-pink-light);
  font-style: italic;
  text-align: center;
}

/* ── Sparkles ── */
.mytunes-sparkle {
  position: absolute;
  pointer-events: none;
  font-size: 14px;
  z-index: 10;
  animation: mytunes-sparkle .9s ease-out forwards;
}

@keyframes mytunes-sparkle {
  0%   { transform: scale(0) rotate(0deg);   opacity: 1; }
  60%  { transform: scale(1.4) rotate(20deg); opacity: 1; }
  100% { transform: scale(0) rotate(40deg);   opacity: 0; }
}
