/* System font stack for maximum performance */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: #f8f9fa;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}

/* ==================== HEADER & BANNER ==================== */
header {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.banner {
  max-width: 800px;
  width: 90%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* ==================== MAIN CONTENT ==================== */
main {
  padding: 2rem;
  max-width: 800px;
  width: 100%;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #222;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #333;
  text-align: left;
}

p {
  font-size: 1.2rem;
  line-height: 1.6;
  color: #666;
}

/* ==================== ANIMATIONS ==================== */
.fade-in {
  animation: fadeIn 1.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== AUDIO PLAYER ==================== */

/* Container */
.container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* Player Bar - Slim Design */
.player-bar {
  background: white;
  border-radius: 12px;
  padding: 12px 20px;
  margin: 20px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

/* Control Buttons */
.player-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.control-btn {
  background: #667eea;
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.3s ease;
}

.control-btn:hover {
  background: #764ba2;
  transform: scale(1.05);
}

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

.play-btn {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

/* Track Display (Inline) */
.track-display {
  flex: 1;
  min-width: 150px;
  padding: 0 10px;
  border-left: 2px solid #eee;
  border-right: 2px solid #eee;
}

.track-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.meta-title {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.title-text {
  font-weight: 600;
  font-size: 15px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.genre-text {
  font-size: 12px;
  color: #999;
  font-style: italic;
}

/* Progress Bar Section */
.progress-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1.5;
  min-width: 200px;
}

.progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  cursor: pointer;
  outline: none;
}

.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  transition: all 0.2s ease;
}

.progress-bar::-webkit-slider-thumb:hover {
  background: #764ba2;
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}

.progress-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.progress-bar::-moz-range-thumb:hover {
  background: #764ba2;
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}

.time-display {
  font-size: 12px;
  color: #666;
  font-weight: 500;
  min-width: 32px;
}

/* Volume Control */
.volume-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.volume-icon {
  font-size: 14px;
}

.volume-control {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.volume-control::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
}

.volume-control::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
}

/* ==================== PLAYLIST ==================== */
.playlist-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.playlist-container h2 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: #333;
  text-align: left;
}

.playlist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f9f9f9;
  border-left: 4px solid transparent;
}

.track-item:hover {
  background: #f0f0f0;
  transform: translateX(4px);
}

.track-item.active {
  background: #f0e6ff;
  border-left-color: #667eea;
}

.track-number {
  width: 30px;
  text-align: center;
  font-weight: 600;
  color: #667eea;
  font-size: 14px;
}

.track-info {
  flex: 1;
  min-width: 0;
}

.track-title {
  font-weight: 600;
  color: #333;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.track-genre {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
  text-align: left;
}

.track-duration {
  font-size: 12px;
  color: #666;
  font-weight: 500;
  min-width: 40px;
  text-align: right;
}

/* ==================== iframe Track list ==================== */
.playlist-container {
  max-height: 400px;  /* Adjust height as needed */
  overflow-y: auto;   /* Vertical scrollbar appears when needed */
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 16px;
  background-color: #fff;
}

.playlist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playlist-item {
  padding: 12px;
  background-color: #f0f0f0;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.playlist-item:hover {
  background-color: #e0e0e0;
}

.playlist-item.active {
  background-color: #007bff;
  color: #fff;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  main {
    padding: 1rem;
  }

  .player-bar {
    flex-direction: column;
    gap: 12px;
    padding: 10px 15px;
  }

  .player-controls {
    width: 100%;
    justify-content: center;
  }

  .track-display {
    width: 100%;
    border-left: none;
    border-right: none;
    border-bottom: 2px solid #eee;
    padding: 10px 0;
  }

  .progress-section {
    width: 100%;
    flex: 1;
    min-width: unset;
  }

  .volume-section {
    width: 100%;
    justify-content: center;
  }

  .playlist-container {
    padding: 15px;
  }

  .track-item {
    padding: 10px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  p {
    font-size: 1rem;
  }

  .control-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

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

  .title-text {
    font-size: 14px;
  }

  .volume-control {
    width: 60px;
  }

  .track-number {
    width: 25px;
    font-size: 12px;
  }

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

  .track-genre {
    font-size: 11px;
  }
}

/* ==================== LEVEL METER (inside the active track row) ==================== */
#meter {
  color: #667eea;
  flex-shrink: 0;
  margin: 0 12px;
}

/* ==================== BURGER MENU (waveform) ==================== */
header { position: relative; }
.menu-btn {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #222;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  z-index: 20;
}
.menu-btn:hover, .menu-btn[aria-expanded="true"] { color: #667eea; border-color: #667eea; }
.menu-btn:focus-visible { outline: 2px solid #667eea; outline-offset: 2px; }
.site-menu {
  position: absolute;
  top: 4rem;
  right: 1rem;
  min-width: 160px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  z-index: 20;
  overflow: hidden;
  text-align: left;
}
.site-menu[hidden] { display: none; }
.site-menu a {
  display: block;
  padding: 0.9rem 1.2rem;
  color: #333;
  text-decoration: none;
  font-size: 1rem;
}
.site-menu a:hover, .site-menu a:focus-visible { background: #f0f0f0; color: #667eea; }
