/* Version 1.4 - Security Hardened */
body {
    background: #1e1e1e;
    color: white;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
}

/* Hamburger Menu (Hidden on Desktop) */
.hamburger {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #333;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0;
    transition: 0.3s;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: 0.3s;
}

.hamburger.active {
    background: #4a8ef0;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 98;
}

.mobile-overlay.show {
    display: block;
}

/* Sidebar */
.sidebar {
    width: 70px;
    background: #252525;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 0 20px 0;
    gap: 15px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-btn {
    width: 50px;
    height: 50px;
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-btn:hover {
    background: #333;
    transform: scale(1.1);
}

.sidebar-btn.active {
    background: #4a8ef0;
}

/* Install Button in Sidebar */
.sidebar-btn.install-btn {
    background: linear-gradient(135deg, #4a8ef0, #2e6db7);
    animation: installPulse 2s infinite;
}

.sidebar-btn.install-btn:hover {
    background: linear-gradient(135deg, #5a9eff, #3e7dc7);
    transform: scale(1.15);
}

@keyframes installPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(74, 142, 240, 0.7);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(74, 142, 240, 0);
    }
}

/* Main Content */
.main-content {
    margin-left: 70px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 28px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 16px;
    flex-wrap: wrap;
    padding: 10px;
}

select,
button {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
}

select:hover,
button:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* Pause Button */
.pause-btn {
    background: #ff9500;
    color: white;
    font-weight: bold;
    padding: 6px 14px;
}

/* Hint Button */
.hint-btn {
    background: #9b59b6;
    color: white;
    font-weight: bold;
    padding: 6px 14px;
}

.hint-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Combo Display */
.combo-display {
    padding: 6px 14px;
    border-radius: 8px;
    background: #333;
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
}

.combo-display.combo-1 {
    background: #555;
    color: white;
}

.combo-display.combo-2 {
    background: linear-gradient(135deg, #f5af19, #f12711);
    color: white;
    animation: comboPulse 0.5s ease;
}

.combo-display.combo-3 {
    background: linear-gradient(135deg, #ff6b00, #ff0000);
    color: white;
    animation: comboPulse 0.5s ease;
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.6);
}

.combo-display.combo-4 {
    background: linear-gradient(135deg, #ff0000, #8b0000);
    color: #ffed4e;
    animation: comboPulse 0.5s ease;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    transform: scale(1.1);
}

.combo-display.combo-break {
    animation: comboShake 0.5s ease;
}

@keyframes comboPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes comboShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Language Button */
.lang-btn {
    font-size: 22px;
    padding: 5px 12px;
    border-radius: 8px;
    background: #444;
    color: white;
    transition: 0.2s;
}

.lang-btn:hover {
    background: #666;
}

/* Icon Pack Button */
.icon-btn-main {
    display: none;
}

.icon-panel {
    display: none;
}

.icon-pack-wrapper {
    display: none;
}

/* Sidebar Panel */
.sidebar-panel {
    position: fixed;
    left: 70px;
    top: 0;
    width: 350px;
    height: 100vh;
    background: #2a2a2a;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 99;
    overflow-y: auto;
    padding: 30px 25px;
}

.sidebar-panel.show {
    transform: translateX(0);
}

.close-panel {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: 0.2s;
}

.close-panel:hover {
    background: #444;
    color: white;
}

.panel-content {
    display: none;
}

.panel-content.active {
    display: block;
}

.panel-content h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #4a8ef0;
    font-size: 24px;
}

.panel-content h3 {
    color: #6ab7ff;
    font-size: 16px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.info-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #333;
    border-radius: 8px;
}

.info-section p {
    margin: 8px 0;
    line-height: 1.6;
    color: #ddd;
}

/* Icon Grid */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.icon-item {
    background: #333;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.icon-item:hover {
    background: #444;
    transform: translateY(-3px);
}

.icon-item.active {
    border-color: #4a8ef0;
    background: #3a3a3a;
}

.icon-preview {
    font-size: 40px;
}

.icon-name {
    font-size: 13px;
    color: #aaa;
}

/* Scores Display */
#scoresDisplay {
    background: #333;
    padding: 20px;
    border-radius: 12px;
}

#scoresDisplay p {
    margin: 15px 0;
    padding: 15px;
    background: #3a3a3a;
    border-radius: 8px;
}

/* Settings */
.settings-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #333;
    border-radius: 8px;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 10px;
}

.lang-option {
    flex: 1;
    padding: 12px;
    background: #444;
    border: 2px solid transparent;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
}

.lang-option:hover {
    background: #555;
}

.lang-option.active {
    border-color: #4a8ef0;
    background: #4a8ef0;
}

/* Theme Select */
.theme-select {
    width: 100%;
    padding: 12px;
    background: #444;
    color: white;
    border: 2px solid #555;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.theme-select:hover {
    border-color: #4a8ef0;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.toggle-switch input[type="checkbox"] {
    width: 50px;
    height: 26px;
    position: relative;
    appearance: none;
    background: #555;
    border-radius: 13px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-switch input[type="checkbox"]:checked {
    background: #4a8ef0;
}

.toggle-switch input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: 0.3s;
}

.toggle-switch input[type="checkbox"]:checked::before {
    left: 27px;
}

.toggle-label {
    color: #ddd;
    font-size: 14px;
}

/* Game Board */
.game-container {
    flex: 1;
    width: 90%;
    max-width: 700px;
    margin: 10px auto 20px;
    display: grid;
    gap: 15px;
    position: relative;
    padding-bottom: 20px;
    overflow-y: auto;
}

.game-container.paused::after {
    content: '⏸ PAUSED';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 48px;
    color: white;
    z-index: 100;
    border-radius: 12px;
}

.game-container.size-4 {
    max-width: min(600px, 85vh);
    gap: 15px;
}

.game-container.size-6 {
    max-width: min(650px, 85vh);
    gap: 10px;
}

.game-container.size-8 {
    max-width: min(700px, 85vh);
    gap: 8px;
}

.card {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.4s;
    container-type: size;
}

.card.hint-glow .back {
    animation: hintPulse 1s ease-in-out infinite;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.9), 
                0 0 50px rgba(255, 215, 0, 0.6);
    border: 3px solid rgba(255, 215, 0, 1);
}

@keyframes hintPulse {
    0%, 100% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.9), 
                    0 0 50px rgba(255, 215, 0, 0.6);
    }
    50% {
        box-shadow: 0 0 35px rgba(255, 215, 0, 1), 
                    0 0 70px rgba(255, 215, 0, 0.8);
    }
}

.card.flip {
    transform: rotateY(180deg);
}

.front,
.back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    backface-visibility: hidden;
}

.front {
    background: #fff;
    color: #000;
    transform: rotateY(180deg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50cqw;
}

.back {
    background: linear-gradient(135deg, #4a8ef0, #6ab7ff);
}

/* Themes */
.blue .back {
    background: linear-gradient(135deg, #4a8ef0, #6ab7ff);
}

.neon .back {
    background: linear-gradient(135deg, #ff00ff, #00ffff);
}

.pastel .back {
    background: linear-gradient(135deg, #ffd1dc, #c1e1ff);
}

.cyberpunk .back {
    background: radial-gradient(circle at top, #ff00ff, #05001a 60%);
}

.forest .back {
    background: linear-gradient(135deg, #0b6623, #2e8b57);
}

.fire .back {
    background: linear-gradient(135deg, #ff4b1f, #ff9068);
}

.ocean .back {
    background: linear-gradient(135deg, #0072ff, #00c6ff);
}

.gold .back {
    background: linear-gradient(135deg, #f5af19, #f12711);
}

.candy .back {
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
}

/* Popup */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
}

.popup.show {
    display: flex;
}

.popup-content {
    background: #222;
    padding: 20px;
    border-radius: 12px;
    width: 300px;
    text-align: center;
}

#closeScores {
    margin-top: 15px;
    padding: 8px 15px;
    background: #ff5757;
    color: white;
    border-radius: 8px;
    cursor: pointer;
}

/* Bonus Popup */
.bonus-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    padding: 20px 40px;
    border-radius: 20px;
    font-size: 32px;
    font-weight: bold;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.bonus-popup.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Game Over Popup specific styling */
#gameOverPopup .popup-content {
    background: #2a2a2a;
    border: 3px solid #ff5757;
}

#gameOverPopup h2 {
    color: #ff5757;
    margin-bottom: 15px;
}

#tryAgain {
    margin-top: 15px;
    padding: 10px 20px;
    background: #4a8ef0;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

#tryAgain:hover {
    background: #6ab7ff;
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    /* Show Hamburger */
    .hamburger {
        display: flex;
    }
    
    /* Hide sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }
    
    /* Show sidebar when menu is open */
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Sidebar panel adjustments */
    .sidebar-panel {
        left: 0;
        width: 100vw;
        max-width: 100%;
        z-index: 1000;
        padding: 60px 15px 20px 15px;
        overflow-y: auto;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .sidebar-panel.show {
        left: 0;
        width: 100vw;
        max-width: 100%;
    }
    
    /* Close button more visible on mobile */
    .close-panel {
        position: fixed !important;
        top: 15px !important;
        right: 15px !important;
        background: #ff5757 !important;
        color: white !important;
        font-size: 24px !important;
        padding: 5px 12px !important;
        z-index: 1001 !important;
        border-radius: 8px !important;
        line-height: 1 !important;
    }
    
    /* Main content adjustments */
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* Controls responsive */
    .controls {
        padding: 8px;
        gap: 8px;
        font-size: 14px;
    }
    
    select,
    button {
        padding: 5px 10px;
        font-size: 13px;
    }
    
    /* Game container */
    .game-container {
        width: 95%;
        gap: 8px;
        margin-top: 5px;
    }
    
    h1 {
        font-size: 20px;
        margin-top: 60px;
        margin-bottom: 8px;
    }
}