/* Reset and Base Styles */
* {
    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;
    line-height: 1.6;
}

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

/* Header Styles */
h1 {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-weight: 300;
    letter-spacing: 2px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
    border-bottom: 3px solid #007bff;
    padding-bottom: 10px;
}

h3 {
    color: #555;
    margin-bottom: 15px;
    font-weight: 500;
}

/* Card Components */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #28a745, #ffc107, #dc3545);
    border-radius: 20px 20px 0 0;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    margin: 8px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

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

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff5f6d 0%, #ffc371 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Game Grid Layout */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

/* Tile Game Styles */
.tile {
    padding: 25px;
    text-align: center;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tile:hover {
    transform: scale(1.08) rotate(2deg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.tile:hover::before {
    opacity: 1;
}

/* Flip Card Styles */
.flipcard {
    width: 250px;
    height: 150px;
    perspective: 1000px;
    margin: 15px auto;
}

.flipcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

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

.flipcard-front,
.flipcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    font-weight: 500;
}

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

.flipcard-back {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    transform: rotateY(180deg);
    padding: 15px;
    font-size: 14px;
}

/* Score Board */
.score-board {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    text-align: center;
}

.score-board div {
    font-weight: 500;
    font-size: 1.1rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #11998e 0%, #38ef7d 100%);
    transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, .2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, .2) 50%,
        rgba(255, 255, 255, .2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 30px 30px;
    animation: move 2s linear infinite;
}

@keyframes move {
    0% { background-position: 0 0; }
    100% { background-position: 30px 30px; }
}

/* File Input */
input[type="file"] {
    margin: 15px 0;
    padding: 15px;
    border: 3px dashed #667eea;
    border-radius: 15px;
    background: rgba(102, 126, 234, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-size: 16px;
}

input[type="file"]:hover {
    border-color: #764ba2;
    background: rgba(118, 75, 162, 0.1);
    transform: scale(1.02);
}

/* Question Options */
.question-options {
    margin: 25px 0;
}

.question-options label {
    display: block;
    margin: 12px 0;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.question-options label::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
    transition: left 0.5s;
}

.question-options label:hover {
    transform: translateX(10px);
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.question-options label:hover::before {
    left: 100%;
}

.question-options input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.3);
    accent-color: #667eea;
}

/* Matching Game */
.match-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.match-column {
    flex: 1;
    min-width: 250px;
}

.match-item {
    padding: 15px 20px;
    margin: 10px 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
    border-radius: 15px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 500;
    position: relative;
}

.match-item:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.match-item.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    transform: scale(1.05);
}

.match-item.matched {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.2) 0%, rgba(56, 239, 125, 0.2) 100%);
    border-color: #11998e;
    animation: pulse 0.6s ease-in-out;
}

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

/* Hiding Game */
.hiding-game {
    position: relative;
}

.hidden-text {
    background: linear-gradient(135deg, #333, #555);
    color: transparent;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.4s ease;
    display: inline-block;
    margin: 0 2px;
    position: relative;
    user-select: none;
}

.hidden-text::before {
    content: '?';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.hidden-text:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: scale(1.1);
}

.hidden-text.revealed {
    background: transparent;
    color: inherit;
    transform: scale(1);
}

.hidden-text.revealed::before {
    display: none;
}

/* JSON Example */
#jsonExample {
    background: rgba(102, 126, 234, 0.1);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    font-family: 'Courier New', monospace;
}

#jsonExample code {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 5px;
    display: block;
    margin-top: 10px;
    white-space: pre-wrap;
    font-size: 12px;
}

/* Results Section */
#resultContent > div {
    margin: 20px 0;
    padding: 20px;
    border-radius: 15px;
    border-left: 6px solid;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#resultContent > div::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 50px;
    background: inherit;
    border-radius: 50%;
    opacity: 0.1;
    transform: translate(25px, -25px);
}

#resultContent > div:hover {
    transform: translateX(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Game Controls */
#gameControls {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid rgba(102, 126, 234, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
        margin: 15px 0;
    }
    
    .game-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .flipcard {
        width: 100%;
        max-width: 300px;
    }
    
    .match-container {
        flex-direction: column;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        margin: 5px;
    }
    
    .score-board {
        grid-template-columns: 1fr;
        text-align: left;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .card {
        padding: 15px;
        border-radius: 15px;
    }
    
    .question-options label {
        padding: 12px 15px;
    }
    
    .tile {
        padding: 20px 15px;
    }
    
    .btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Animation Classes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.card {
    animation: fadeIn 0.6s ease-out;
}

.btn:active {
    animation: bounce 0.6s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}