* {
    box-sizing: border-box;
}

:root {
    --primary: #0066CC; 
    --secondary: #FFD700;
    --accent: #FF2A2A;
    --bg-dark: #0a0a0f;
    --glass-bg: rgba(25, 25, 35, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overflow-x: hidden !important;
    position: relative;
}

body {
    font-family: 'Outfit', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ambient-background {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 102, 204, 0.15) 0%, rgba(10, 10, 15, 1) 50%);
    z-index: -1;
    transition: background 2s ease;
    filter: blur(60px);
}

.glass-container {
    width: 95%;
    max-width: 450px;
    height: 90vh;
    max-height: 850px;
    min-height: 600px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    z-index: 10;
}

/* ============================================
   RESPONSIVE - Mobile First
   ============================================ */

/* Pantallas pequeñas (hasta 480px - móvil portrait) */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
    }
    .glass-container {
        width: 100% !important;
        max-width: 100% !important;
        height: 100svh !important;
        height: 100dvh !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
    }
    .v2-header {
        padding: 16px 16px 5px !important;
    }
    .v2-player {
        padding: 10px 16px !important;
    }
    .refran-text-container {
        margin: 5px 16px !important;
        font-size: clamp(0.85rem, 3.5vw, 1.1rem) !important;
    }
    .modern-controls {
        gap: 16px !important;
    }
}

/* Pantallas muy pequeñas (hasta 360px - Android pequeño) */
@media (max-width: 360px) {
    .record-player {
        width: min(220px, 65vw) !important;
        height: min(220px, 65vw) !important;
    }
    .glass-btn.primary {
        width: 65px !important;
        height: 65px !important;
    }
    .glass-btn.secondary {
        width: 44px !important;
        height: 44px !important;
    }
}

/* Pantallas con poca altura (teclado abierto o móvil landscape pequeño) */
@media (max-height: 600px) {
    .glass-container { min-height: 0; height: 100vh; }
    .v2-header { padding: 8px 20px 2px; }
    .record-player { 
        width: min(140px, 30vh); 
        height: min(140px, 30vh); 
        margin-bottom: 5px; 
    }
    .refran-text-container { 
        min-height: 30px; 
        margin: 2px 16px; 
        font-size: 0.8rem; 
    }
    .song-title { font-size: 1rem; }
    .glass-btn.primary { width: 50px; height: 50px; }
    .glass-btn.primary svg { width: 22px; height: 22px; }
    .modern-controls { margin-bottom: 5px; gap: 12px; }
    .song-info { margin-bottom: 5px; }
    .scrolling-text-container { height: 40px; }
}


/* Tablets y pantallas medianas */
@media (min-width: 481px) and (max-width: 768px) {
    .glass-container {
        width: 90%;
        max-width: 420px;
    }
}


.v2-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 10px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.v2-header h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #fff, var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-indicator {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #FF3030;
}

.pulse {
    width: 8px;
    height: 8px;
    background-color: #FF3030;
    border-radius: 50%;
    box-shadow: 0 0 10px #FF3030;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0%   { opacity: 1; transform: scale(1);   box-shadow: 0 0 0 0 rgba(255, 48, 48, 0.7); }
    50%  { opacity: 0.4; transform: scale(0.9); box-shadow: 0 0 0 5px rgba(255, 48, 48, 0); }
    100% { opacity: 1; transform: scale(1);   box-shadow: 0 0 0 0 rgba(255, 48, 48, 0); }
}

.refran-text-container {
    margin: 10px 20px;
    min-height: 60px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: clamp(1rem, 4vw, 1.25rem);
    font-weight: 400;
    color: var(--secondary);
    font-style: italic;
    text-shadow: 1px 2px 6px rgba(0,0,0,0.9), 0 0 15px rgba(0,0,0,0.6);
    line-height: 1.3;
    letter-spacing: 0.5px;
}

.v2-player {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly; /* Mejor distribución vertical */
    padding: 20px;
    min-height: 0;
}

.record-player {
    width: min(280px, 70vw);
    height: min(280px, 70vw);
    position: relative;
    margin-bottom: 30px;
}

.vinyl-wrapper {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, #222 0%, #050505 100%);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 40px rgba(255,255,255,0.05);
    transition: transform 0.5s ease;
    animation: spin 8s linear infinite;
    animation-play-state: paused;
}

/* Los surcos del vinilo */
.vinyl-wrapper::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle at center,
        transparent 0,
        transparent 2px,
        rgba(255, 255, 255, 0.03) 3px,
        transparent 4px
    );
    pointer-events: none;
}

/* Reflejos de luz en el disco */
.vinyl-wrapper::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        rgba(255, 255, 255, 0.05) 10%,
        transparent 20%,
        transparent 40%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 60%,
        transparent 80%,
        rgba(255, 255, 255, 0.05) 90%,
        transparent 100%
    );
    pointer-events: none;
}

.vinyl-wrapper.playing {
    animation-play-state: running;
}

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

.vinyl-cover {
    width: 40%;
    height: 40%;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
}

.vinyl-hole {
    width: 15px;
    height: 15px;
    background: var(--bg-dark);
    border-radius: 50%;
    position: absolute;
    border: 2px solid #222;
    z-index: 5;
}

/* Estilos Modo CD */
.vinyl-wrapper.is-cd {
    background: conic-gradient(
        from 0deg,
        #ddd 0%,
        #999 10%,
        #888 20%,
        #bbb 30%,
        #eee 40%,
        #999 50%,
        #888 60%,
        #bbb 70%,
        #ddd 80%,
        #eee 90%,
        #ddd 100%
    );
    box-shadow: 0 20px 50px rgba(0,0,0,0.4), inset 0 0 10px rgba(255,255,255,0.8);
}

.vinyl-wrapper.is-cd::before {
    background: repeating-radial-gradient(
        circle at center,
        transparent 0,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 11px,
        transparent 12px
    );
    opacity: 0.3;
}

.vinyl-wrapper.is-cd::after {
    background: conic-gradient(
        from 0deg,
        rgba(255, 0, 0, 0.1) 0%,
        rgba(255, 255, 0, 0.1) 15%,
        rgba(0, 255, 0, 0.1) 30%,
        rgba(0, 255, 255, 0.1) 45%,
        rgba(0, 0, 255, 0.1) 60%,
        rgba(255, 0, 255, 0.1) 75%,
        rgba(255, 0, 0, 0.1) 100%
    );
    mix-blend-mode: overlay;
}

.vinyl-wrapper.is-cd .vinyl-cover {
    width: 35%;
    height: 35%;
    border: 1px solid rgba(0,0,0,0.1);
}

.vinyl-wrapper.is-cd .vinyl-hole {
    width: 12%;
    height: 12%;
    background: #111;
    border: 2px solid #666;
}


.song-info {
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
    flex-shrink: 0;
    min-width: 0; /* Crucial para flexbox */
}


.scrolling-text-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center; /* Centrado por defecto */
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    min-width: 0;
}

.song-title {
    margin: 0;
    font-size: clamp(1.2rem, 6vw, 1.8rem);
    font-weight: 800;
    white-space: nowrap;
    line-height: 1.2;
    padding: 0 30px;
    width: 100%;
    text-align: center;
}

/* Animación de desplazamiento mejorada */
.scrolling-text-container.is-long .song-title {
    width: auto;
    display: inline-block;
    padding-left: 100%;
    animation: marquee 15s linear infinite;
    text-align: left;
}

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

.station-name {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: var(--accent);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.modern-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.glass-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.glass-btn.secondary {
    width: 50px;
    height: 50px;
}

.glass-btn.secondary svg {
    width: 24px;
    height: 24px;
}

.glass-btn.secondary:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.05);
}

.glass-btn.primary {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), #003366);
    box-shadow: 0 10px 20px rgba(0, 102, 204, 0.3);
}

.glass-btn.primary svg {
    width: 35px;
    height: 35px;
}

.glass-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 102, 204, 0.5);
}

.history-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.1);
    border-radius: 30px 30px 0 0;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.4s;
    padding: 30px;
    box-sizing: border-box;
    z-index: 100;
}

@media (max-width: 450px) {
    .history-panel { border-radius: 20px 20px 0 0; }
}

.history-panel.active {
    transform: translateY(0);
    visibility: visible;
}

.history-panel h3 {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    color: var(--secondary);
}

.modern-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    max-height: calc(100% - 40px);
}

.modern-history-list li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background 0.2s ease;
}

.modern-history-list li:hover {
    background: rgba(255,255,255,0.02);
}

.modern-history-list li::before {
    content: '🎵';
    font-size: 1rem;
    opacity: 0.4;
    flex-shrink: 0;
}

.history-item-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    min-width: 0;
}

.history-song-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 500;
}

.history-song-time {
    font-size: 0.8rem;
    opacity: 0.5;
    margin-left: 10px;
    font-family: 'monospace', sans-serif;
    color: var(--secondary);
}

/* Nostr Zap Notifications */
#zap-btn svg {
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

#zap-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: #FFD700;
}

/* PayPal Styles */
.glass-btn.paypal:hover {
    background: rgba(0, 112, 186, 0.1);
    border-color: #0070ba;
}

.paypal-link-btn {
    display: inline-block;
    background: #0070ba;
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 112, 186, 0.3);
}

.paypal-link-btn:hover {
    background: #005ea6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 112, 186, 0.4);
}

.record-player:hover {
    transform: scale(1.02);
}

.record-player:active {
    transform: scale(0.98);
}

/* Zap Modal Styles */
.modern-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--glass-bg);
    padding: clamp(20px, 5vw, 40px);
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    text-align: center;
    max-width: 90%;
    width: min(400px, 90vw); /* Más ancho en pantallas grandes */
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-content h3 {
    margin-top: 0;
    color: var(--secondary);
    font-size: 1.5rem;
}

#qrcode-container {
    background: #fff;
    padding: 15px;
    border-radius: 20px;
    margin: 20px 0;
    display: inline-block;
}

#zap-qr {
    width: 200px;
    height: 200px;
    display: block;
}

.zap-address {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 25px;
}

.close-modal {
    background: var(--primary);
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.close-modal:hover {
    transform: scale(1.05);
}

.zap-help {
    font-size: 0.85rem;
    color: #ccc;
    line-height: 1.4;
    margin: 10px 0 20px;
}

/* Efecto Celebración Zap */
.zap-active .ambient-background {
    animation: zap-bg-flash 0.5s infinite alternate, zap-bg-spin 2s linear infinite;
    opacity: 0.8 !important;
    background: radial-gradient(circle, #FFD700 0%, #FFA500 50%, #FF4500 100%);
}

.zap-active .glass-container {
    animation: zap-shake 0.2s infinite;
    border-color: #FFD700;
    box-shadow: 0 0 100px rgba(255, 215, 0, 0.4);
}

.zap-active .vinyl-wrapper {
    animation: zap-spin-fast 0.5s linear infinite, zap-brilliant 1s infinite alternate;
    animation-play-state: running !important;
    border: 2px solid #FFD700;
    overflow: visible;
}

.zap-active .vinyl-wrapper::after {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, transparent 70%);
    animation: zap-sparkle 0.5s infinite;
    z-index: -1;
    border-radius: 50%;
}

@keyframes zap-spin-fast {
    from { transform: rotate(0deg) scale(1.1); }
    to { transform: rotate(360deg) scale(1.1); }
}

@keyframes zap-brilliant {
    from { filter: brightness(1) contrast(1); }
    to { filter: brightness(1.5) contrast(1.2) drop-shadow(0 0 20px #fff); }
}

@keyframes zap-sparkle {
    0% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.3; transform: scale(0.8); }
}

@keyframes zap-bg-flash {
    from { filter: blur(60px) brightness(1); }
    to { filter: blur(40px) brightness(2); }
}

@keyframes zap-bg-spin {
    from { transform: rotate(0deg) scale(1.5); }
    to { transform: rotate(360deg) scale(2); }
}

@keyframes zap-shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
}
