:root {
    --hs-navy: #1E2B4D;
    --hs-blue: #0066B3;
    --hs-blue-light: #3D8FD1;
    --hs-red: #E31837;
    --bg-primary: #0D1321;
    --bg-secondary: #141C2F;
    --bg-tertiary: #1A253D;
    --accent-primary: #0066B3;
    --accent-secondary: #3D8FD1;
    --accent-highlight: #E31837;
    --text-primary: #ffffff;
    --text-secondary: #8A9BB8;
    --text-muted: #4A5F82;
    --glow-blue: rgba(0, 102, 179, 0.4);
    --glow-light: rgba(61, 143, 209, 0.3);
    --glow-red: rgba(227, 24, 55, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bg-particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(0, 102, 179, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(30, 43, 77, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 40%, rgba(227, 24, 55, 0.05) 0%, transparent 60%);
}

.particle {
    position: absolute;
    width: 2px; height: 2px;
    background: var(--hs-blue-light);
    border-radius: 50%;
    opacity: 0;
    animation: floatParticle 10s infinite;
}

@keyframes floatParticle {
    0%, 100% { opacity: 0; transform: translateY(100vh) scale(0); }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { opacity: 0; transform: translateY(-100px) scale(1); }
}

.bg-grid {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(0, 102, 179, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 102, 179, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.header {
    position: relative;
    z-index: 10;
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 102, 179, 0.15);
}

.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon { width: 44px; height: 44px; position: relative; }
.logo-icon svg { width: 100%; height: 100%; }
.logo-text { display: flex; flex-direction: column; }

.logo-name {
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--hs-blue-light), var(--hs-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 102, 179, 0.2);
    border-radius: 25px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s ease;
}

.status-dot.connecting { background: #FFA500; animation: pulse 1s infinite; }
.status-dot.connected { background: #00CC6A; box-shadow: 0 0 12px rgba(0, 204, 106, 0.6); }
.status-dot.error { background: var(--hs-red); box-shadow: 0 0 12px var(--glow-red); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    padding: 40px;
}

.orb-container {
    position: relative;
    width: 300px; height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-rings { position: absolute; width: 100%; height: 100%; }

.orb-ring {
    position: absolute;
    border: 1px solid rgba(0, 102, 179, 0.15);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.orb-ring:nth-child(1) { width: 220px; height: 220px; }
.orb-ring:nth-child(2) { width: 260px; height: 260px; animation: ringPulse 3s ease-in-out infinite; }
.orb-ring:nth-child(3) { width: 300px; height: 300px; animation: ringPulse 3s ease-in-out infinite 0.5s; }

@keyframes ringPulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.05); }
}

.orb-glow {
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow-blue) 0%, transparent 70%);
    filter: blur(30px);
    opacity: 0.6;
    transition: all 0.5s ease;
}

.orb-glow.active {
    opacity: 1;
    width: 280px; height: 280px;
    animation: orbPulse 2s ease-in-out infinite;
}

@keyframes orbPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

.orb {
    position: relative;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-secondary));
    border: 2px solid rgba(0, 102, 179, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.orb::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--hs-red), var(--hs-blue), var(--hs-navy), var(--hs-blue), var(--hs-red));
    opacity: 0;
    z-index: -1;
    transition: opacity 0.4s ease;
}

.orb:hover::before, .orb.listening::before {
    opacity: 1;
    animation: borderRotate 4s linear infinite;
}

.orb:hover { transform: scale(1.08); border-color: transparent; }

.orb.listening {
    border-color: transparent;
    box-shadow: 
        0 0 40px var(--glow-blue),
        0 0 80px rgba(0, 102, 179, 0.2),
        inset 0 0 40px rgba(0, 102, 179, 0.1);
}

@keyframes borderRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mic-icon {
    width: 55px; height: 55px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.mic-icon svg {
    width: 100%; height: 100%;
    fill: var(--text-secondary);
    transition: fill 0.3s ease;
}

.orb:hover .mic-icon svg { fill: var(--hs-blue-light); }

.orb.listening .mic-icon svg {
    fill: var(--hs-blue-light);
    filter: drop-shadow(0 0 10px var(--glow-blue));
    animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.instruction-text { margin-top: 50px; text-align: center; }

.instruction-text h2 {
    font-size: 26px;
    font-weight: 500;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.instruction-text h2 span { color: var(--hs-blue-light); }
.instruction-text p { color: var(--text-secondary); font-size: 15px; }

.start-btn {
    margin-top: 35px;
    padding: 18px 52px;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--hs-blue), var(--hs-navy));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.start-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--hs-blue-light), var(--hs-blue));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 50px var(--glow-blue);
}

.start-btn:hover::before { opacity: 1; }
.start-btn span { position: relative; z-index: 1; }

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.start-btn.stop { background: linear-gradient(135deg, var(--hs-red), #a01025); }
.start-btn.stop:hover { box-shadow: 0 15px 50px var(--glow-red); }

.connection-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, var(--bg-secondary) 60%, transparent 100%);
    padding: 50px 40px 35px;
    z-index: 20;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.connection-panel.visible { opacity: 1; transform: translateY(0); }
.connection-steps { max-width: 550px; margin: 0 auto; }

.step {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 0;
    opacity: 0.25;
    transform: translateX(-25px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.step.active { opacity: 1; transform: translateX(0); }
.step.completed { opacity: 0.5; }

.step-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.step.active .step-icon {
    border-color: var(--hs-blue);
    background: rgba(0, 102, 179, 0.15);
    box-shadow: 0 0 20px var(--glow-blue);
}

.step.completed .step-icon {
    border-color: #00CC6A;
    background: rgba(0, 204, 106, 0.1);
    color: #00CC6A;
}

.step.error .step-icon {
    border-color: var(--hs-red);
    background: rgba(227, 24, 55, 0.1);
    color: var(--hs-red);
}

.step-content { flex: 1; }
.step-title { font-size: 15px; font-weight: 500; margin-bottom: 3px; transition: color 0.3s ease; }
.step.active .step-title { color: var(--hs-blue-light); }
.step-description { font-size: 12px; color: var(--text-muted); }

.step-loader {
    width: 22px; height: 22px;
    border: 2px solid var(--bg-tertiary);
    border-top-color: var(--hs-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 0;
    flex-shrink: 0;
}

.step.active .step-loader { opacity: 1; }
.step.completed .step-loader, .step.error .step-loader { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    top: 100px; left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 102, 179, 0.3);
    padding: 16px 28px;
    border-radius: 14px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s ease;
    z-index: 100;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(0, 204, 106, 0.4); background: linear-gradient(135deg, var(--bg-tertiary), rgba(0, 204, 106, 0.08)); }
.toast.error { border-color: rgba(227, 24, 55, 0.4); background: linear-gradient(135deg, var(--bg-tertiary), rgba(227, 24, 55, 0.08)); }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }

.footer-brand {
    position: fixed;
    bottom: 20px; right: 30px;
    font-size: 11px;
    color: var(--text-muted);
    z-index: 5;
    letter-spacing: 1px;
}

.footer-brand span { color: var(--hs-blue); }

/* ============ ICE VISUALIZER ============ */
.ice-visualizer {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 102, 179, 0.05);
    border: 1px solid rgba(0, 102, 179, 0.2);
    border-radius: 16px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    display: none;
}

.ice-visualizer.active {
    display: block;
    animation: fadeInUp 0.4s ease;
}

.ice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 102, 179, 0.15);
}

.ice-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hs-blue-light);
}

.ice-counter {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 12px;
}

.ice-graph {
    position: relative;
    min-height: 200px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.ice-center-node {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--hs-blue), var(--hs-navy));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    z-index: 10;
    box-shadow: 0 0 30px var(--glow-blue);
}

.ice-node {
    position: relative;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 102, 179, 0.3);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-secondary);
    animation: nodeAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: scale(0);
    white-space: nowrap;
}

.ice-node.stun {
    border-color: rgba(0, 204, 106, 0.4);
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(0, 204, 106, 0.1));
}

.ice-node.turn {
    border-color: rgba(255, 165, 0, 0.4);
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(255, 165, 0, 0.1));
}

.ice-node.candidate {
    border-color: rgba(61, 143, 209, 0.4);
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(61, 143, 209, 0.1));
}

.ice-node.success {
    border-color: rgba(0, 204, 106, 0.6);
    box-shadow: 0 0 15px rgba(0, 204, 106, 0.3);
}

.ice-node .node-icon {
    margin-right: 6px;
}

.ice-node .node-type {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 4px;
}

@keyframes nodeAppear {
    0% { opacity: 0; transform: scale(0) rotate(-10deg); }
    50% { transform: scale(1.1) rotate(2deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes nodePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 102, 179, 0.4); }
    50% { box-shadow: 0 0 0 8px transparent; }
}

.ice-node.pulsing {
    animation: nodeAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               nodePulse 1.5s ease-in-out infinite 0.5s;
}

/* Líneas de conexión simuladas */
.ice-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--hs-blue-light), transparent);
    transform-origin: left center;
    animation: lineGrow 0.3s ease forwards;
    opacity: 0.5;
}

@keyframes lineGrow {
    from { width: 0; }
    to { width: 100%; }
}
/* ============ TRANSCRIPCIÓN ESTILO LYRICS ============ */
.transcription-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, 
        rgba(13, 19, 33, 0.98) 0%,
        rgba(13, 19, 33, 0.95) 60%,
        transparent 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px 20px 30px;
    z-index: 50;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
}

.transcription-container.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.transcription-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.transcription-icon {
    font-size: 14px;
    animation: pulse 2s ease-in-out infinite;
}

.transcription-text {
    text-align: center;
    min-height: 80px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 0 10px;
    scroll-behavior: smooth;
    
    /* Ocultar scrollbar pero permitir scroll */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.transcription-text::-webkit-scrollbar {
    display: none;
}

.transcription-text .placeholder {
    font-size: 18px;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.6;
}

/* Texto final - palabras confirmadas */
.transcription-text .final {
    display: block;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
    text-shadow: 0 0 40px rgba(0, 102, 179, 0.3);
    animation: lyricsFadeIn 0.4s ease-out;
}

/* Texto interim - palabras en proceso */
.transcription-text .interim {
    display: block;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--hs-blue-light);
    opacity: 0.7;
    animation: lyricsGlow 1.5s ease-in-out infinite;
}

/* Respuesta del asistente */
.transcription-text .response {
    display: block;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 102, 179, 0.2);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--hs-blue-light);
    text-shadow: 0 0 30px rgba(61, 143, 209, 0.4);
}

/* Indicador de escuchando */
.transcription-pulse {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.transcription-pulse::before,
.transcription-pulse::after,
.transcription-pulse span {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--hs-blue-light);
    border-radius: 50%;
    animation: lyricsDots 1.4s ease-in-out infinite;
}

.transcription-pulse::after {
    animation-delay: 0.2s;
}

.transcription-pulse span {
    animation-delay: 0.4s;
}

@keyframes lyricsFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes lyricsGlow {
    0%, 100% {
        opacity: 0.7;
        text-shadow: 0 0 20px rgba(61, 143, 209, 0.3);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 40px rgba(61, 143, 209, 0.6);
    }
}

@keyframes lyricsDots {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============ RESPONSIVE MÓVIL ============ */
@media (max-width: 768px) {
    .header {
        padding: 16px 20px;
    }
    
    .logo-name {
        font-size: 20px;
    }
    
    .status-badge {
        padding: 8px 14px;
        font-size: 11px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .orb-container {
        width: 200px;
        height: 200px;
    }
    
    .orb {
        width: 120px;
        height: 120px;
    }
    
    .orb-glow {
        width: 140px;
        height: 140px;
    }
    
    .orb-glow.active {
        width: 180px;
        height: 180px;
    }
    
    .mic-icon {
        width: 40px;
        height: 40px;
    }
    
    .orb-ring:nth-child(1) { width: 150px; height: 150px; }
    .orb-ring:nth-child(2) { width: 175px; height: 175px; }
    .orb-ring:nth-child(3) { width: 200px; height: 200px; }
    
    .instruction-text {
        margin-top: 30px;
    }
    
    .instruction-text h2 {
        font-size: 22px;
    }
    
    .start-btn {
        padding: 16px 40px;
        font-size: 14px;
    }
    
    /* Transcripción móvil - estilo lyrics */
    .transcription-container {
        padding: 30px 15px 25px;
    }
    
    .transcription-text .final {
        font-size: 22px;
    }
    
    .transcription-text .interim {
        font-size: 18px;
    }
    
    .transcription-text .response {
        font-size: 18px;
    }
    
    .connection-panel {
        padding: 30px 20px 25px;
    }
    
    .step {
        gap: 12px;
        padding: 10px 0;
    }
    
    .step-icon {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .step-title {
        font-size: 13px;
    }
    
    .ice-visualizer {
        padding: 15px;
        margin-top: 20px;
    }
    
    .footer-brand {
        bottom: 10px;
        right: 15px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .orb-container {
        width: 160px;
        height: 160px;
    }
    
    .orb {
        width: 100px;
        height: 100px;
    }
    
    .mic-icon {
        width: 35px;
        height: 35px;
    }
    
    .orb-ring:nth-child(1) { width: 120px; height: 120px; }
    .orb-ring:nth-child(2) { width: 140px; height: 140px; }
    .orb-ring:nth-child(3) { width: 160px; height: 160px; }
    
    .instruction-text h2 {
        font-size: 18px;
    }
    
    .instruction-text p {
        font-size: 13px;
    }
    
    .transcription-text .final {
        font-size: 20px;
    }
    
    .transcription-text .interim {
        font-size: 16px;
    }
}