/* ==========================================================================
   7Relax - Main Stylesheet
   Generated from inline styles in index.php
   ========================================================================== */

/* ---- Install Prompt Styles ---- */
#installPrompt {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  width: 360px;
  background: rgba(10, 10, 20, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(217, 166, 64, 0.3);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(217, 166, 64, 0.1);
  z-index: 10000;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#installPrompt.hidden { display: none !important; }
#installPrompt.visible { display: flex !important; }

.install-btn {
  min-height: 44px;
  min-width: 44px;
}

.install-close {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
}

.install-icon { font-size: 2.5rem; animation: bounce 2s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.install-title { font-size: 1.1rem; font-weight: 700; color: var(--primary-color); text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.install-desc { font-size: 0.85rem; color: #ccc; line-height: 1.5; }
.install-instructions, .ios-instructions {
  background: rgba(0, 122, 255, 0.15);
  border: 1px solid rgba(0, 122, 255, 0.3);
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.75rem;
  color: #aaa;
  text-align: left;
  line-height: 1.6;
}
.install-instructions strong, .ios-instructions strong { color: #007aff; font-weight: 700; }
.install-instructions ol, .ios-instructions ol { margin: 0.5rem 0 0 1.2rem; padding: 0; }
.install-instructions li, .ios-instructions li { margin: 0.3rem 0; }
.install-buttons { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: 0.25rem; }

.install-btn {
  padding: 0.6rem 1.2rem; border-radius: 10px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease; border: none; touch-action: manipulation;
}

.install-btn.primary {
  background: linear-gradient(135deg, var(--primary-color), #c49030);
  color: #0a0a14; box-shadow: 0 4px 16px rgba(217, 166, 64, 0.4);
}

.install-btn.primary:hover,
.install-btn.primary:active {
  background: linear-gradient(135deg, #c49030, var(--primary-color));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(217, 166, 64, 0.5);
}

.install-btn.secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

.install-btn.secondary:hover {
  background: rgba(255,255,255,0.2);
}

/* ---- Main Application Styles ---- */
:root {
  --primary-color: #D9A640;
  --accent-color: #6A5ACD;
  --text-color: #FFFFFF;
  --bg-gradient: linear-gradient(135deg, rgba(106,90,205,0.2), rgba(0,0,0,0.6));
  --neumorphic-shadow: 10px 10px 20px rgba(0,0,0,0.3), -10px -10px 20px rgba(255,255,255,0.05);
  --font-family: 'Poppins', sans-serif;
  --transition: all 0.3s ease;
  --bg-transition: opacity 1s ease;
  --card-bg: rgba(0,0,0,0.45);
  --card-border: rgba(255,255,255,0.08);
  --card-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

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

html { -webkit-text-size-adjust: 100%; }

/* Remove gray tap highlight on interactive elements */
button, .category-button, .fav-button, .icon-button,
input[type="range"], select {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Keep text selectable for content */
.track-name, .description, #quoteDisplay, .player-title {
    user-select: text;
}

/* Better focus states (accessibility) */
button:focus-visible,
.category-button:focus-visible,
.fav-button:focus-visible,
.icon-button:focus-visible,
input[type="range"]:focus-visible,
select:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(217, 166, 64, 0.3);
}

/* ============ BASE MOBILE-FIRST STYLES ============ */
body {
  font-family: var(--font-family);
  background: var(--bg-gradient), #000;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: scroll; /* fixed is broken on iOS Safari */
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport for mobile */
  padding: 1rem;
  transition: background-image var(--bg-transition);
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
  body { 
    padding-left: max(1rem, env(safe-area-inset-left)); 
    padding-right: max(1rem, env(safe-area-inset-right)); 
    padding-bottom: max(1rem, env(safe-area-inset-bottom)); 
  }
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.fav-button {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.fav-button:hover {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, rgba(217,166,64,0.2), rgba(217,166,64,0.05));
  transform: translateY(-1px);
}
.fav-button.active {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, rgba(217,166,64,0.2), rgba(217,166,64,0.05));
  transform: translateY(-1px);
  color: #ff3b30 !important;
}


.icon-button svg { width: 20px; height: 20px; }

header {
  width: 100%;
  max-width: 480px;
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.header-text { flex: 1; text-align: center; }

.icon-button { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }

main {
  width: 100%;
  max-width: 480px;
  min-width: 0;
  margin: 0 auto;
}

.title {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), #fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 8px rgba(217, 166, 64, 0.3);
  animation: fadeInDown 0.8s ease-out;
}

.subtitle {
  font-size: clamp(0.8rem, 2vw, 1rem);
  color: #aaa;
  margin-top: 0.25rem;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ============ PLAYER SECTION ============ */
.player-section {
  width: 100%;
  max-width: min(480px, calc(100vw - 32px));
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.player-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

/* --- Player Header --- */
.player-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.player-meta {
  font-size: 0.8rem;
  color: #aaa;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.player-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 44px;
  flex-wrap: nowrap;
}

.player-title-row .fav-button {
  flex: 0 0 auto;
  margin: 0 2px;
}

.player-title {
  flex: 1 1 0;
  min-width: 0;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.8rem;
  transition: opacity 0.3s ease;
  margin: 0;
}

/* Player controls bar for fav buttons */
.player-controls-bar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

/* --- Visualizer --- */
#visualizer {
  width: 100%;
  height: 80px;
  display: block;
  margin: 1.5rem 0;
  border-radius: 16px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--card-border);
}

/* --- Progress Bar --- */
.progress-container {
  margin-bottom: 1.5rem;
}

#progress {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin: 0.5rem 0;
}

#progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(217, 166, 64, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#progress::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(217, 166, 64, 0.5);
}

#progress::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(217, 166, 64, 0.7);
}

#progress:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

#progress::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(217, 166, 64, 0.7);
}

#progress::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(217, 166, 64, 0.5);
}

.time-display {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #888;
  font-variant-numeric: tabular-nums;
}

.ctl-icon { width: 32px; height: 32px; pointer-events: none; }
.icon-pause { display: none; }
.is-playing .icon-play { display: none; }
.is-playing .icon-pause { display: block; }

/* --- Controls --- */
.controls-main {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 1rem;
  flex-wrap: nowrap;
}

.controls-main button {
  min-width: 56px;
  min-height: 56px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neumorphic-shadow);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.controls-main button:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 3px;
}



.controls-main button:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4), 0 0 0 1px rgba(217, 166, 64, 0.2);
}

.controls-main button:active {
  transform: translateY(-1px) scale(0.98);
}

#playPauseButton {
  min-width: 72px;
  min-height: 72px;
  width: 72px;
  height: 72px;
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--primary-color), #c49030);
  color: #0a0a14;
  box-shadow: 0 8px 24px rgba(217, 166, 64, 0.4);
  -webkit-tap-highlight-color: transparent;
}

#playPauseButton:hover {
  background: linear-gradient(135deg, #c49030, var(--primary-color));
  box-shadow: 0 12px 32px rgba(217, 166, 64, 0.5);
}

/* --- Controls Secondary (Volume / Timer) --- */
.controls-secondary {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
  flex-wrap: wrap;
  min-height: 64px;
}

.timer-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.volume-container, .timer-container { min-height: 44px; }

#volume, #sleepTimer {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  cursor: pointer;
}

#volume::-webkit-slider-runnable-track,
#sleepTimer::-webkit-slider-runnable-track {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

#volume::-moz-range-track,
#sleepTimer::-moz-range-track {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

#volume::-webkit-slider-thumb,
#sleepTimer::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(217, 166, 64, 0.4);
}

#volume::-moz-range-thumb,
#sleepTimer::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(217, 166, 64, 0.4);
}

#sleepTimer {
  -webkit-appearance: none;
  appearance: none;
  height: 44px;
  padding: 0 2.25rem 0 0.75rem;
  background: var(--card-bg) url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23D9A640' d='M1.4 0 6 5.6 10.6 0 12 1.4 6 8 0 1.4z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

#sleepTimer:focus { border-color: var(--primary-color); }
#sleepTimer option { background: #1a1a2e; color: #fff; }

/* ============ CATEGORIES AREA ============ */
.category-select {
  display: flex;
  gap: 0.5rem 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0.75rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-wrap: nowrap;
  min-width: 0;
  scroll-padding: 0.75rem;
  overscroll-behavior-x: contain;
  width: 100%;
  max-width: 100%;
  contain: layout paint;
  isolation: isolate;
  scroll-behavior: smooth;
}
.category-select::-webkit-scrollbar { display: none; }

/* Desktop: wider container */
@media (min-width: 1024px) {
  .category-select {
    gap: 0.75rem;
    padding: 0.75rem 0;
  }
  .category-button {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    min-height: 52px;
  }
}

.category-button {
  flex: 0 0 auto;
  padding: 0.7rem 1.3rem;
  border-radius: 50px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  scroll-snap-align: start;
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
}

.category-button:hover,
.category-button.active {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, rgba(217, 166, 64, 0.2), rgba(217, 166, 64, 0.05));
  box-shadow: 0 4px 16px rgba(217, 166, 64, 0.2);
  transform: translateY(-2px);
}

.category-button.active {
  font-weight: 600;
}

/* ============ TRACKLIST ============ */
.tracklist-section {
  width: 100%;
  max-width: 480px;
  margin-top: 1.5rem;
}

.tracklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #aaa;
}

.tracklist {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--card-border);
  cursor: pointer;
  transition: var(--transition);
  min-width: 0;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}

.track-num {
  width: 28px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.8rem;
  color: #888;
  font-variant-numeric: tabular-nums;
}

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

.track-item:hover {
  background: rgba(255,255,255,0.03);
}

.track-item.playing {
  background: linear-gradient(90deg, rgba(217, 166, 64, 0.15), transparent);
  border-left: 3px solid var(--primary-color);
  padding-left: calc(1rem - 3px);
}

.track-num {
  width: 24px;
  text-align: right;
  font-size: 0.75rem;
  color: #888;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.track-name {
  flex: 1 1 0;
  min-width: 0;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-dur {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: #888;
  font-variant-numeric: tabular-nums;
}

.track-fav {
  font-size: 1.1rem;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: -14px 0;
  color: inherit;
}

.track-fav.on {
  color: #ff3b30;
}

.track-fav:hover { transform: scale(1.2); }

/* ============ TAP OVERLAY ============ */
#tapOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  text-align: center;
  padding: 2rem;
}

#tapOverlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tap-icon { font-size: 3.6rem; animation: pulseTap 1.6s ease-in-out infinite; }
@keyframes pulseTap { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

.tap-title {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), #fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 1rem 0 0.5rem;
}

.tap-sub {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: #aaa;
  margin-bottom: 0.5rem;
}

.tap-hint {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

/* ============ DESCRIPTION ============ */
.description {
  width: 100%;
  max-width: 480px;
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #ccc;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ============ LOADING SPINNER ============ */
#loadingSpinner {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  gap: 1rem;
}

#loadingSpinner.visible { display: flex; }

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(217, 166, 64, 0.3);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============ TABLET (768px - 1023px) ============ */
@media (min-width: 768px) and (max-width: 1023px) {
  .timer-container select#sleepTimer {
    height: 48px;
    padding: 0 2.5rem 0 0.9rem;
    font-size: 0.95rem;
  }
  body { padding: 2rem 2rem; }
  .player-section { padding: 2.5rem 2rem; }
  #visualizer { height: 100px; }
  .controls-main button { width: 72px; height: 72px; font-size: 1.8rem; }
  #playPauseButton { width: 84px; height: 84px; font-size: 2.2rem; }
  .category-button { padding: 0.75rem 1.5rem; font-size: 0.95rem; min-height: 48px; }
  .track-item { padding: 0.85rem 1.2rem; gap: 1rem; }
  .track-name { font-size: 1rem; }
  .description { padding: 2rem; font-size: 0.95rem; }
}

/* ============ MOBILE (< 768px) ============ */
@media (max-width: 767px) {
  .controls-secondary {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .timer-container, .volume-container {
    width: 100%;
  }
  .timer-container select#sleepTimer,
  .volume-container #volume {
    width: 100%;
  }
}

/* ============ DESKTOP (1024px+) ============ */
@media (min-width: 1024px) {
  body { padding: 3rem 2rem; }
  .player-section { padding: 3rem 2.5rem; max-width: 600px; }
  #visualizer { height: 120px; }
  .controls-main { gap: 1.5rem; }
  .controls-main button { width: 80px; height: 80px; font-size: 2rem; }
  #playPauseButton { width: 96px; height: 96px; font-size: 2.5rem; }
  .controls-secondary { max-width: 600px; padding-top: 1.5rem; }
  #volumeSlider, #sleepTimer { height: 6px; }
  .category-select { 
    flex-wrap: nowrap; 
    overflow-x: auto; 
    overflow-y: hidden; 
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .category-select::-webkit-scrollbar { display: none; }
  .category-button { padding: 0.85rem 1.75rem; font-size: 1rem; min-height: 52px; }
  .tracklist { max-width: 600px; max-height: 440px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .track-item { padding: 1rem 1.5rem; gap: 1.25rem; }
  .track-num { width: 32px; font-size: 0.85rem; }
  .track-name { font-size: 1.05rem; }
  .track-fav { font-size: 1.25rem; }
  .description { max-width: 600px; padding: 2.5rem; font-size: 1rem; }
  .progress-time { font-size: 0.8rem; }
}

/* ============ LANDSCAPE MOBILE (compact) ============ */
@media (orientation: landscape) and (max-height: 500px) {
  body {
    padding: 0.75rem max(0.75rem, env(safe-area-inset-left)) max(0.5rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-right));
  }
  header { margin-bottom: 0.5rem; }
  .title { font-size: clamp(1.2rem, 4vw, 1.8rem); }
  .subtitle { font-size: clamp(0.7rem, 1.5vw, 0.85rem); }
  .player-section { padding: 1rem; }
  .player-title-row { gap: 0.4rem; margin-bottom: 0.6rem; }
  .player-title { font-size: clamp(1rem, 3vw, 1.2rem); min-height: 1.8rem; }
  .controls-main { gap: 0.5rem; margin-bottom: 0.75rem; }
  .controls-main button { padding: 0.75rem 0; font-size: 1rem; min-height: 44px; }
  .controls-secondary { padding-top: 0.75rem; gap: 0.5rem; }
  .progress-container { margin-bottom: 0.5rem; }
  .category-select { gap: 0.4rem; padding: 0.3rem 0.5rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .category-button { padding: 0.5rem 0.9rem; font-size: 0.8rem; min-height: 44px; flex-shrink: 0; }
  .tracklist { max-height: 160px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .description { padding: 0.75rem; font-size: 0.8rem; }
  .tracklist-header { font-size: 0.85rem; }
  .track-item { padding: 0.45rem 0.6rem; gap: 0.4rem; min-height: 44px; }
  .track-item .track-num { width: 16px; font-size: 0.65rem; }
  .track-item .track-name { font-size: 0.8rem; }
  .track-item .track-fav { font-size: 0.8rem; }
}

/* ============ LARGE DESKTOP (1440px+) ============ */
@media (min-width: 1440px) {
  body { padding: 2.5rem 3rem; }
  .player-section { padding: 2.5rem 2.5rem; }
  main { gap: 2rem; }
}

/* Content visibility for performance */
.tracklist-section,
.description {
  content-visibility: auto;
  contain-intrinsic-size: 0 300px;
}

@media (max-width: 480px) {
  .player-title-row {
    gap: 0.5rem;
  }
  .fav-button {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    font-size: 1.3rem;
  }
  .timer-container select#sleepTimer {
    height: 52px;
    font-size: 1rem;
  }
  .tracklist {
    max-height: 260px;
  }
  .player-section {
    padding: 1rem 0.75rem;
  }
  .category-select {
    gap: 0.3rem 0.5rem;
    padding: 0.2rem 0.3rem;
    contain: layout paint;
  }
  .category-button {
    padding: 0.4rem 0.6rem;
    font-size: 0.72rem;
    min-width: 44px;
  }
}
