/* RESET */
* {
    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;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    overflow-x: hidden;
    padding: 10px;
}

.header {
    text-align: center;
    margin: 10px 0;
    z-index: 10;
}

h1 {
    font-size: 2em;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    margin-bottom: 5px;
}

.tagline {
    font-size: 0.9em;
    opacity: 0.9;
}

.ad-space {
    width: 100%;
    max-width: 728px;
    height: 90px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5px 0;
    border: 2px dashed rgba(255,255,255,0.3);
    font-size: 0.85em;
}

.game-wrapper {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.game-container {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.stat-box {
    background: rgba(255,255,255,0.2);
    padding: 8px 15px;
    border-radius: 10px;
    text-align: center;
    min-width: 100px;
}

.stat-label {
    font-size: 0.75em;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.4em;
    font-weight: bold;
    margin-top: 2px;
}

.level-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.level-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.level-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.level-btn.active {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    transform: scale(1.05);
}

/* CARDS */
.cards-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    position: relative;
    min-height: 300px;
}

.cards-grid {
    position: relative;
    width: 100%;
    height: 100%;
}

.card {
    position: absolute;
    width: 80px;
    height: 110px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.card.flipped {
    transform: rotateY(180deg) !important;
}

.card.matched {
    animation: matchPulse 0.5s ease-out;
    opacity: 0;
    pointer-events: none;
}

@keyframes matchPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid #fff;
}

.card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: rotateY(180deg);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* NAVIGATION & MORE */
.footer-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
    z-index: 10;
}

.nav-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.similar-games {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px;
    margin: 10px 0;
    width: 100%;
    max-width: 1200px;
}

.similar-games h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.game-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.game-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.game-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.about-section {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin: 10px 0;
    width: 100%;
    max-width: 1200px;
    line-height: 1.6;
}

/* WIN MODAL */
.win-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.win-content {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    animation: bounceIn 0.8s;
    max-width: 90%;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* CONFETTI */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #f0f;
    animation: confetti-fall 3s linear;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* MUSIC TOGGLE */
.music-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    padding: 10px 15px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 50px;
    color: white;
    cursor: pointer;
    font-size: 1.2em;
    z-index: 100;
    transition: all 0.3s;
}

.music-toggle:hover {
    background: rgba(255,255,255,0.3);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    h1 { font-size: 1.5em; }
    .card { width: 65px; height: 90px; }
    .card-back { font-size: 2em; }
    .stat-box { min-width: 80px; padding: 6px 10px; }
    .about-section, .similar-games { padding: 15px; }
}

@media (max-width: 480px) {
    .card { width: 55px; height: 75px; }
    .card-back { font-size: 1.5em; }
    h1 { font-size: 1.3em; }
    .level-btn { padding: 6px 10px; font-size: 0.75em; }
}
