/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f59e0b;
    --accent-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --background: #fafafa;
    --surface: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    /* Color-specific variables */
    --color-red: #ef4444;
    --color-red-light: #fca5a5;
    --color-blue: #3b82f6;
    --color-blue-light: #93c5fd;
    --color-green: #10b981;
    --color-green-light: #6ee7b7;
    --color-yellow: #f59e0b;
    --color-yellow-light: #fbbf24;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Effects */
.background-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
    z-index: -1;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.logo-icon {
    font-size: 1.75rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    padding-top: 100px;
}

/* Hero Section */
.hero-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    min-height: 80vh;
    padding: 4rem 0;
}

.hero-content {
    max-width: 600px;
}

.hero-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.gradient-text {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.secondary-cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-cta-button:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Hero Visual */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
}

.color-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    animation: float 6s ease-in-out infinite;
}

.color-preview {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: pulse 2s ease-in-out infinite;
}

.color-preview.red {
    background: linear-gradient(135deg, var(--color-red) 0%, var(--color-red-light) 100%);
    animation-delay: 0s;
}

.color-preview.blue {
    background: linear-gradient(135deg, var(--color-blue) 0%, var(--color-blue-light) 100%);
    animation-delay: 0.5s;
}

.color-preview.green {
    background: linear-gradient(135deg, var(--color-green) 0%, var(--color-green-light) 100%);
    animation-delay: 1s;
}

.color-preview.yellow {
    background: linear-gradient(135deg, var(--color-yellow) 0%, var(--color-yellow-light) 100%);
    animation-delay: 1.5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* Game Section */
.game-section {
    min-height: 100vh;
    padding: 2rem 0;
}

.game-container {
    max-width: 1000px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.game-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.game-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.sound-toggle.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

/* Game Instructions */
.game-instructions {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.instruction-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    max-width: 600px;
    text-align: center;
}

.instruction-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.instruction-card ol {
    text-align: left;
    margin-bottom: 2rem;
    padding-left: 1rem;
}

.instruction-card li {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.mode-selection {
    margin: 2rem 0;
}

.mode-selection h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.mode-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.mode-btn:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.mode-btn.active {
    border-color: var(--accent-color);
    background: rgba(16, 185, 129, 0.1);
}

.mode-icon {
    font-size: 1.5rem;
}

.mode-name {
    font-weight: 600;
    color: var(--text-primary);
}

.mode-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.start-round-btn {
    background: var(--gradient-accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-round-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Game Play Area */
.game-play-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.game-status {
    text-align: center;
    margin-bottom: 1rem;
}

.game-status h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    margin: 0 auto;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.waiting {
    background: var(--color-yellow);
}

.status-indicator.playing {
    background: var(--color-blue);
}

.status-indicator.error {
    background: var(--color-red);
}

/* Color Grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.color-button {
    width: 120px;
    height: 120px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.color-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.color-button:active {
    transform: scale(0.95);
}

.color-button.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.color-inner {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    transition: all 0.2s ease;
}

/* Color Button Styles */
.color-button.red .color-inner {
    background: linear-gradient(135deg, var(--color-red) 0%, var(--color-red-light) 100%);
}

.color-button.blue .color-inner {
    background: linear-gradient(135deg, var(--color-blue) 0%, var(--color-blue-light) 100%);
}

.color-button.green .color-inner {
    background: linear-gradient(135deg, var(--color-green) 0%, var(--color-green-light) 100%);
}

.color-button.yellow .color-inner {
    background: linear-gradient(135deg, var(--color-yellow) 0%, var(--color-yellow-light) 100%);
}

/* Active/Lit States - MEJORADOS */
.color-button.lit {
    transform: scale(1.1);
    z-index: 10;
}

.color-button.lit .color-inner {
    transform: scale(1.2);
    filter: brightness(1.8) saturate(1.5);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.9);
}

.color-button.red.lit .color-inner {
    box-shadow: 0 0 40px var(--color-red-light), 0 0 80px var(--color-red);
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
}

.color-button.blue.lit .color-inner {
    box-shadow: 0 0 40px var(--color-blue-light), 0 0 80px var(--color-blue);
    background: linear-gradient(135deg, #74b9ff 0%, #a8d5ff 100%);
}

.color-button.green.lit .color-inner {
    box-shadow: 0 0 40px var(--color-green-light), 0 0 80px var(--color-green);
    background: linear-gradient(135deg, #55efc4 0%, #81ecec 100%);
}

.color-button.yellow.lit .color-inner {
    box-shadow: 0 0 40px var(--color-yellow-light), 0 0 80px var(--color-yellow);
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
}

/* Sequence Display */
.sequence-display {
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.sequence-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

#currentSequenceText {
    font-weight: 600;
    color: var(--text-primary);
}

/* Results Section */
.results-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.results-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    text-align: center;
    max-width: 500px;
    animation: scaleIn 0.6s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.results-card h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.primary-button,
.secondary-button {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.primary-button {
    background: var(--gradient-accent);
    color: white;
}

.secondary-button {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.secondary-button:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

/* Progress Section */
.progress-section {
    padding: 4rem 0;
}

.progress-container {
    max-width: 1000px;
    margin: 0 auto;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.progress-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-color);
}

.achievements-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.achievements-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.achievement-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease;
}

.achievement-card.unlocked {
    border-color: var(--accent-color);
    background: rgba(16, 185, 129, 0.05);
}

.achievement-card.locked {
    opacity: 0.5;
}

.achievement-card:hover {
    transform: translateY(-2px);
}

.achievement-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 10px;
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.achievement-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
        padding-top: 80px;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-links {
        display: none;
    }
    
    .hero-section {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .color-preview-grid {
        gap: 0.5rem;
    }
    
    .color-preview {
        width: 60px;
        height: 60px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .game-stats {
        gap: 1rem;
    }
    
    .color-button {
        width: 100px;
        height: 100px;
    }
    
    .mode-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .progress-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .progress-header {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .instruction-card,
    .results-card {
        padding: 1.5rem;
    }
    
    .color-button {
        width: 80px;
        height: 80px;
    }
    
    .progress-stats {
        grid-template-columns: 1fr;
    }
}
