body {
  font-family: 'Outfit', sans-serif;
  user-select: none;
}

.font-display {
  font-family: 'Space Grotesk', sans-serif;
}

.vinyl-grooves {
  background: radial-gradient(circle, 
    #1f2937 0%, 
    #0b0f19 18%, 
    #1f2937 19%, 
    #0b0f19 32%, 
    #374151 33%, 
    #0b0f19 48%, 
    #1f2937 49%, 
    #0b0f19 68%, 
    #374151 69%, 
    #030712 100%);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.9), inset 0 0 20px rgba(255, 255, 255, 0.08);
}

.vinyl-shine {
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 42%, rgba(255,255,255,0) 58%, rgba(255,255,255,0.12) 100%);
}

.tonearm-container {
  transform-origin: 22px 22px;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tonearm-playing {
  transform: rotate(27deg);
}

.tonearm-idle {
  transform: rotate(0deg);
}

@keyframes warn-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.10); }
  50% { box-shadow: 0 0 24px rgba(245, 158, 11, 0.25); }
}
.warning-note {
  animation: warn-pulse 2.8s ease-in-out infinite;
}

input[type=range] {
  accent-color: #f59e0b;
}

input[type=range].pitch-slider {
  appearance: slider-vertical;
  writing-mode: bt-lr;
  height: 80px;
  width: 4px;
  background: #1e293b;
  border-radius: 4px;
}
input[type=range].pitch-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f59e0b;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}
input[type=range].pitch-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f59e0b;
  cursor: pointer;
  border: none;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.vinyl-color-btn {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.vinyl-color-btn:hover {
  transform: scale(1.06);
  border-color: rgba(255, 255, 255, 0.3);
}

.vinyl-color-btn.active {
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3), inset 0 0 20px rgba(245, 158, 11, 0.05);
  transform: scale(1.04);
}

.vinyl-color-btn .color-swatch {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.4), inset 0 4px 8px rgba(255,255,255,0.1);
}

.vinyl-color-btn .check-mark {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f59e0b;
  color: #0f172a;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.vinyl-color-btn.active .check-mark {
  opacity: 1;
  transform: scale(1);
}

.vinyl-color-btn .label-text {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.vinyl-color-btn:hover .label-text,
.vinyl-color-btn.active .label-text {
  opacity: 1;
  color: rgba(255,255,255,0.7);
}

.vinyl-color-btn .groove-preview {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.03);
  pointer-events: none;
}

.vinyl-color-btn .groove-preview:nth-child(2) {
  inset: 24%;
}

.vinyl-color-btn .groove-preview:nth-child(3) {
  inset: 36%;
}

.vinyl-color-btn .ring-preview {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.04);
  pointer-events: none;
}

.label-gradient-btn {
  position: relative;
  height: 48px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.08);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  overflow: hidden;
}

.label-gradient-btn:hover {
  transform: scale(1.04);
  border-color: rgba(255,255,255,0.25);
}

.label-gradient-btn.active {
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
  transform: scale(1.04);
}

.label-gradient-btn .check-mark {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f59e0b;
  color: #0f172a;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

.label-gradient-btn.active .check-mark {
  opacity: 1;
  transform: scale(1);
}

#storage-indicator {
  position: relative;
  cursor: help;
}

#storage-indicator .group-hover\:opacity-100 {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
  transform: translateX(-50%) translateY(-4px);
}

#storage-indicator:hover .group-hover\:opacity-100,
#storage-indicator:focus .group-hover\:opacity-100 {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* For mobile click support */
#storage-indicator .tooltip-visible {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateX(-50%) translateY(0) !important;
}

#storage-indicator:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
}

#storage-indicator .tooltip-arrow {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(15, 23, 42, 0.95);
  border-left: 1px solid rgba(51, 65, 85, 0.6);
  border-top: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 2px 0 0 0;
}

#lyrics-panel {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#lyrics-panel:not(.hidden) {
  display: flex !important;
}

.lyrics-line {
  padding: 4px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
  font-size: 13px;
  line-height: 1.6;
  color: #94a3b8;
}

.lyrics-line.active {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.08);
  font-weight: 600;
  transform: scale(1.02);
}

.lyrics-line.active::before {
  content: '♪ ';
  color: #f43f5e;
  font-weight: 400;
}

/* Scrollbar for lyrics panel */
#lyrics-content::-webkit-scrollbar {
  width: 4px;
}
#lyrics-content::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 4px;
}
#lyrics-content::-webkit-scrollbar-thumb {
  background: #f43f5e;
  border-radius: 4px;
}
#lyrics-content::-webkit-scrollbar-thumb:hover {
  background: #e11d48;
}

@media (max-width: 480px) {
    header {
        padding: 8px 12px;
    }
    header .flex.items-center.gap-3 {
        gap: 6px;
    }
    header .w-10.h-10 {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    header h1 {
        font-size: 14px;
    }
    header .text-xs {
        font-size: 8px !important;
    }
    header .px-3.py-1.5 {
        padding: 4px 8px;
        font-size: 9px;
    }
    
    .header-actions .hidden.xl\\:flex {
        display: none !important;
    }

    .lg\\:col-span-5,
    .lg\\:col-span-7 {
        grid-column: span 12 !important;
    }
    .gap-6 {
        gap: 12px;
    }
    .p-4 {
        padding: 10px;
    }
    .md\\:p-6 {
        padding: 10px;
    }

    .rounded-2xl {
        border-radius: 16px;
    }
    .min-h-\[360px\] {
        min-height: 240px;
    }
    .max-h-\[500px\] {
        max-height: 340px;
    }

    #playlist-tabs-container button {
        padding: 4px 8px !important;
        font-size: 9px !important;
    }
    #playlist-tabs-container .fa-compact-disc {
        font-size: 8px !important;
    }

    .song-item {
        padding: 6px 10px !important;
        gap: 6px !important;
    }
    .song-item .w-8.h-8 {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    .song-item .title {
        font-size: 11px !important;
    }
    .song-item .text-\[11px\] {
        font-size: 9px !important;
    }

    .max-w-\[420px\] {
        max-width: 100%;
    }
    .max-w-\[370px\] {
        max-width: 100%;
    }
    .rounded-2xl.p-4 {
        padding: 8px;
    }
    .p-4.md\\:p-6 {
        padding: 8px;
    }

    .absolute.left-3.bottom-4 {
        left: 2px !important;
        bottom: 8px !important;
        padding: 6px 8px !important;
    }
    .pitch-slider {
        height: 50px !important;
        width: 3px !important;
    }
    .pitch-slider::-webkit-slider-thumb {
        width: 12px !important;
        height: 12px !important;
    }
    .text-\[8px\] {
        font-size: 6px !important;
    }
    .text-\[9px\] {
        font-size: 7px !important;
    }

    .top-5.right-5.w-28.h-56 {
        width: 20px;
        height: 40px;
        top: 2px;
        right: 2px;
    }
    .tonearm-container {
        transform: scale(0.5) !important;
        transform-origin: top right !important;
    }
    .tonearm-playing {
        transform: scale(0.5) rotate(27deg) !important;
    }

    .w-\[82\%\] {
        width: 85% !important;
    }
    .h-\[82\%\] {
        height: 85% !important;
    }
    .w-\[44\%\] {
        width: 50% !important;
    }
    .h-\[44\%\] {
        height: 50% !important;
    }
    .w-4.h-4 {
        width: 8px !important;
        height: 8px !important;
    }

    #lyrics-panel {
        border-radius: 12px !important;
        padding: 10px !important;
    }
    #lyrics-panel .text-sm {
        font-size: 11px !important;
    }
    #lyrics-panel .text-xs {
        font-size: 9px !important;
    }
    .lyrics-line {
        font-size: 11px !important;
        padding: 2px 8px !important;
    }
    #lyrics-content {
        max-height: 200px !important;
    }
    #lyrics-manual-input {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }
    #lyrics-manual-add {
        font-size: 9px !important;
        padding: 4px 8px !important;
    }

    /* --- Equalizer --- */
    .grid-cols-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
        padding: 6px !important;
    }
    .grid-cols-4 label {
        font-size: 8px !important;
    }
    .grid-cols-4 input[type="range"] {
        height: 2px !important;
    }
    .grid-cols-4 .text-\[9px\] {
        font-size: 7px !important;
    }

    /* --- Transport Controls --- */
    .flex.items-center.justify-between.gap-4 {
        gap: 6px !important;
    }
    .w-28 {
        width: 70px !important;
    }
    .w-10.h-10 {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
    }
    .w-14.h-14 {
        width: 44px !important;
        height: 44px !important;
        font-size: 14px !important;
    }

    /* --- Volume Control --- */
    .w-28 .w-full {
        width: 50px !important;
    }

    /* --- Modals --- */
    .max-w-md {
        max-width: 95% !important;
        margin: 0 8px !important;
    }
    .p-6 {
        padding: 16px !important;
    }
    .text-xl {
        font-size: 16px !important;
    }
    .text-xs {
        font-size: 10px !important;
    }
    .px-3.py-2 {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }

    /* --- Customizer Modal --- */
    .grid-cols-4.gap-3 {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 4px !important;
    }
    .grid-cols-3.gap-3 {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
    }
    .vinyl-color-btn {
        border-radius: 8px !important;
    }
    .vinyl-color-btn .color-swatch {
        width: 60% !important;
        height: 60% !important;
    }
    .label-gradient-btn {
        height: 32px !important;
    }

    /* --- Footer --- */
    footer {
        flex-direction: column !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 8px 12px !important;
        text-align: center !important;
    }
    footer .flex.items-center.gap-4 {
        gap: 6px !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    footer .text-xs {
        font-size: 9px !important;
    }
    footer .text-\[10px\] {
        font-size: 8px !important;
    }
    footer .hidden.sm\\:block {
        display: none !important;
    }

    /* --- Toast --- */
    #toast-container {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
    }
    #toast-container .px-4.py-2\\.5 {
        padding: 8px 12px !important;
        font-size: 10px !important;
    }

    /* --- Warning Note --- */
    .warning-note {
        padding: 8px 10px !important;
        gap: 6px !important;
    }
    .warning-note .text-lg {
        font-size: 14px !important;
    }
    .warning-note .text-xs {
        font-size: 9px !important;
    }
    .warning-note .text-\[11px\] {
        font-size: 8px !important;
    }
}

/* ---- Tablet Optimization ---- */
@media (min-width: 481px) and (max-width: 768px) {
    .lg\\:col-span-5 {
        grid-column: span 12 !important;
    }
    .lg\\:col-span-7 {
        grid-column: span 12 !important;
    }
    .gap-6 {
        gap: 16px;
    }
    .max-w-\[420px\] {
        max-width: 80%;
    }
    .grid-cols-4 {
        grid-template-columns: 1fr 1fr !important;
    }
    .w-28 {
        width: 80px !important;
    }
}

/* ---- Small Mobile Fixes ---- */
@media (max-width: 360px) {
    header .flex.items-center.gap-2 {
        gap: 4px !important;
    }
    header .px-3.py-1\\.5 {
        padding: 2px 6px !important;
        font-size: 8px !important;
    }
    .song-item .title {
        font-size: 10px !important;
    }
    .text-\[10px\] {
        font-size: 8px !important;
    }
    .text-\[11px\] {
        font-size: 9px !important;
    }
    .w-14.h-14 {
        width: 38px !important;
        height: 38px !important;
        font-size: 12px !important;
    }
    .w-10.h-10 {
        width: 28px !important;
        height: 28px !important;
        font-size: 10px !important;
    }
    .p-4 {
        padding: 6px !important;
    }
    .rounded-2xl {
        border-radius: 12px !important;
    }
}


@media (pointer: coarse) {
    button, 
    .song-item,
    .playlist-item,
    .rpm-btn,
    .vinyl-color-btn,
    .label-gradient-btn,
    #lyrics-toggle-btn,
    #lofi-filter-btn {
        min-height: 36px !important;
    }
    
    input[type="range"] {
        height: 6px !important;
    }
    input[type="range"]::-webkit-slider-thumb {
        width: 20px !important;
        height: 20px !important;
    }
    input[type="range"]::-moz-range-thumb {
        width: 20px !important;
        height: 20px !important;
    }
    .pitch-slider::-webkit-slider-thumb {
        width: 16px !important;
        height: 16px !important;
    }
}
