* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.upload-area {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
    max-width: 500px;
    width: 100%;
    transition: transform 0.3s ease;
}

.upload-area:hover {
    transform: translateY(-5px);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 10px;
}

.upload-content h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 10px;
}

.upload-content p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Game Settings */
.game-settings {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.game-settings h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 20px;
}

.settings-row {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.setting-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.setting-item label {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.setting-item input {
    width: 80px;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    transition: border-color 0.3s ease;
}

.setting-item input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-info {
    margin-bottom: 20px;
}

.settings-info p {
    color: #666;
    font-size: 1.1rem;
    font-weight: 500;
}

.settings-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.setting-item.full-width {
    width: 100%;
    max-width: 300px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

#scaleSlider {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

#scaleSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

#scaleSlider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

#scaleSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

#scaleSlider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

#scaleValue {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1rem;
    min-width: 50px;
    text-align: center;
}

/* Game Section */
.game-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.score-board {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.score-item .label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.score-item .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.game-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.game-controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 300px;
    width: 100%;
}

.control-item label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Game Board */
.game-board {
    display: grid;
    gap: 15px;
    margin-bottom: 30px;
    justify-items: center;
    justify-content: center;
}

.card {
    width: 120px;
    height: 120px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    overflow: hidden;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    overflow: hidden;
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.card.matched {
    opacity: 0.6;
    cursor: default;
}

.card.matched:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Game Message */
.game-message {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    opacity: 0;
    transition: all 0.3s ease;
}

.game-message.show {
    opacity: 1;
}

.game-message.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.game-message.info {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .game-controls-row {
        width: 100%;
        max-width: 400px;
    }
    
    .score-board {
        justify-content: center;
    }
    
    .game-board {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .card {
        width: 100px;
        height: 100px;
    }
    
    .card-front, .card-back {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .upload-area {
        padding: 20px;
    }
    
    .game-section {
        padding: 20px;
    }
    
    .game-settings {
        padding: 20px;
    }
    
    .settings-row {
        flex-direction: column;
        gap: 20px;
    }
    
    .setting-item.full-width {
        max-width: 100%;
    }
    
    .slider-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-controls-row .slider-container {
        flex-direction: row;
        gap: 15px;
    }
    
    .game-board {
        gap: 8px;
    }
    
    .card {
        width: 80px;
        height: 80px;
    }
    
    .card-front, .card-back {
        font-size: 1.2rem;
    }
}

/* Celebration Overlay */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.celebration-content {
    text-align: center;
    color: white;
    z-index: 1001;
    animation: slideInUp 0.8s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.celebration-title {
    font-size: 4rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: bounce 1s ease-in-out infinite alternate;
}

.celebration-subtitle {
    font-size: 3rem;
    margin-bottom: 30px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: bounce 1s ease-in-out infinite alternate 0.2s;
}

@keyframes bounce {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.celebration-btn {
    font-size: 1.5rem;
    padding: 15px 40px;
    animation: pulse 2s ease-in-out infinite;
}

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

/* Fireworks Container */
.fireworks-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1001;
}

/* Responsive celebration */
@media (max-width: 768px) {
    .celebration-title {
        font-size: 2.5rem;
    }
    
    .celebration-subtitle {
        font-size: 2rem;
    }
    
    .celebration-btn {
        font-size: 1.2rem;
        padding: 12px 30px;
    }
}
