:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    --font-main: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text-main); font-family: var(--font-main); line-height: 1.6; padding-bottom: 100px; overflow-x: hidden; }

/* Fondo Canvas */
#bg-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; opacity: 0.3; pointer-events: none; }

/* Header */
.glass-header { position: sticky; top: 0; background: var(--surface-glass); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; z-index: 50; }
.logo span { font-weight: 800; font-size: 1.3rem; letter-spacing: -1px; }

/* Botones */
.btn-primary { background: #0f172a; color: white; padding: 0.7rem 1.5rem; border-radius: 50px; border: none; cursor: pointer; font-weight: 600; transition: 0.2s; }
.btn-primary:hover { transform: scale(1.05); }
.btn-large { background: var(--primary); color: white; padding: 1.2rem 3rem; border-radius: 50px; border: none; font-size: 1.2rem; cursor: pointer; box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4); transition: 0.3s; }
.btn-large:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5); }
.btn-outline { background: transparent; border: 2px solid #cbd5e1; color: #64748b; padding: 1.2rem 3rem; border-radius: 50px; cursor: pointer; font-size: 1.1rem; font-weight: 500; }
.btn-icon { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); }

/* Layout */
.container { max-width: 1000px; margin: 0 auto; padding: 3rem 1.5rem; }
.glass-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; margin-bottom: 3rem; box-shadow: var(--shadow-sm); }
h1 { font-size: 3.5rem; line-height: 1.1; letter-spacing: -2px; margin-bottom: 1.5rem; }
h2 { font-size: 2rem; margin-bottom: 0.5rem; letter-spacing: -1px; }
.subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: 1.1rem; }

/* Alertas */
.grid-alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.alert-card { background: #f8fafc; padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); transition: 0.3s; }
.alert-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.alert-card .icon { font-size: 2rem; margin-bottom: 1rem; }
.alert-card .stat { font-weight: 800; color: var(--danger); font-size: 1.1rem; margin: 0.5rem 0; }
.alert-card.critical .stat { color: var(--warning); }
.alert-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--border); font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }

/* Galería */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.gallery-item { cursor: pointer; border-radius: 8px; overflow: hidden; transition: 0.3s; position: relative; }
.gallery-item:hover { transform: scale(1.02); }
.gallery-item img { width: 100%; height: 150px; object-fit: cover; display: block; }
.gallery-item figcaption { position: absolute; bottom: 0; width: 100%; background: rgba(0,0,0,0.7); color: white; text-align: center; font-size: 0.8rem; padding: 0.4rem; }

/* Lightbox */
.lightbox-modal { border: none; border-radius: 16px; padding: 0; background: rgba(0,0,0,0.9); color: white; max-width: 90vw; max-height: 90vh; }
.lightbox-modal::backdrop { background: rgba(0,0,0,0.85); backdrop-filter: blur(5px); }
#btn-close-lightbox { position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,0.2); border: none; color: white; font-size: 1.5rem; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; }
#lightbox-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 8px; }
#lightbox-caption { text-align: center; padding: 1rem; font-size: 1rem; color: #e2e8f0; }

/* Chat */
.chat-overlay { position: fixed; bottom: 110px; right: 20px; width: 350px; z-index: 40; display: none; }
.chat-overlay.active { display: block; }
.chat-window { background: var(--surface); border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; height: 500px; }
.chat-header { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; background: #f8fafc; }
.messages-area { flex: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.8rem; }
.msg { padding: 0.8rem 1rem; border-radius: 12px; max-width: 85%; font-size: 0.95rem; line-height: 1.4; }
.msg.bot { background: #f1f5f9; align-self: flex-start; border-bottom-left-radius: 2px; }
.msg.user { background: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.input-area { padding: 0.8rem; border-top: 1px solid var(--border); display: flex; gap: 0.5rem; }
.input-area input { flex: 1; padding: 0.8rem; border: 1px solid var(--border); border-radius: 8px; }
.input-area button { background: var(--primary); color: white; border: none; width: 40px; border-radius: 8px; cursor: pointer; }
.trust-label { text-align: center; font-size: 0.8rem; padding: 0.5rem; background: #f8fafc; color: var(--text-muted); }

/* Player Footer */
.glass-player { position: fixed; bottom: 0; left: 0; right: 0; height: 80px; background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: 250px 1fr 150px; align-items: center; padding: 0 2rem; z-index: 60; box-shadow: 0 -5px 20px rgba(0,0,0,0.05); }
.player-left { display: flex; align-items: center; gap: 1rem; }
.track-info .title { font-weight: 600; font-size: 0.9rem; display: block; }
.track-info .artist { font-size: 0.8rem; color: var(--text-muted); }
.player-center { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.controls { display: flex; align-items: center; gap: 1.5rem; }
.controls button { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-muted); }
.btn-play-main { font-size: 1.8rem; color: var(--text-main) !important; }
.progress-bar-container { width: 100%; max-width: 400px; height: 4px; background: #e2e8f0; border-radius: 2px; cursor: pointer; position: relative; }
.progress-bar { height: 100%; background: var(--text-main); border-radius: 2px; width: 0%; transition: width 0.1s linear; }
.player-right { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }

/* Modal Identity */
.glass-modal { border: none; border-radius: 16px; padding: 2.5rem; width: 90%; max-width: 450px; background: var(--surface); box-shadow: var(--shadow-lg); }
.glass-modal::backdrop { background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); }
#identity-form label { display: block; margin-bottom: 1.5rem; }
#identity-form input { width: 100%; padding: 1rem; margin-top: 0.5rem; border: 2px solid var(--border); border-radius: 8px; font-size: 1rem; }
#identity-form input:focus { border-color: var(--primary); outline: none; }
.error-msg { color: var(--danger); font-size: 0.85rem; display: block; margin-top: 0.5rem; min-height: 1.2rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; }

/* Animations */
.fade-in { opacity: 0; animation: fadeIn 0.8s ease forwards; }
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.pulse { animation: pulse-glow 2s infinite; }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4); } 50% { box-shadow: 0 8px 30px rgba(16, 185, 129, 0.6); } }

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    .glass-player { grid-template-columns: 1fr; height: 90px; padding: 10px; }
    .player-left, .player-right { display: none; }
    .chat-overlay { width: 95%; right: 2.5%; bottom: 100px; }
    .hero-actions { flex-direction: column; gap: 1rem; }
    .btn-large, .btn-outline { width: 100%; }
}
