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

html, body 
{
    height: 100%;
}

/* Body styles */
body 
{
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(135deg,#a8edea,#fed6e3);
    background-image: url('https://www.transparenttextures.com/patterns/cubes.png');
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Selection screen and game container */
.selection-screen,
.container 
{
    width: 95%;
    max-width: 900px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* Main headings */
.selection-screen h1,
.container h1 
{
    margin-bottom: 10px;
    color: #2a75bb;
    font-size: 2em;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Subtitle under the main title */
.subtitle 
{
    font-size: 1.2em;
    color: #ff3e3e;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 500;
}

/* Rules box for instructions */
.rules-box 
{
    width: 90%;
    background: rgba(255,255,255,0.95);
    border: 2px solid #2a75bb;
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-size: 0.95em;
    line-height: 1.4;
    color: #333;
    text-align: left;
}

/* Generation selector */
.generation-options 
{
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.generation-options select 
{
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 1em;
}

/* Controls section (timer and restart button) */
.controls 
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
}

/* Timer container for circular timer */
#timer-container 
{
    position: relative;
    width: 60px;
    height: 60px;
}

/* Timer text inside the circle */
#timer-text 
{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #ff3e3e;
}

/* Buttons */
button 
{
    padding: 10px 25px;
    border: none;
    background: linear-gradient(135deg,#ffcb05,#f5b700);
    color: #2a75bb;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s, color 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button:hover 
{
    transform: scale(1.1);
    background: linear-gradient(135deg,#2a75bb,#1c4f8a);
    color: #fff;
}

/* Game board grid */
.game-board {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    grid-template-rows: repeat(3,1fr);
    gap: 15px;
    justify-items: center;
    flex-grow: 1;
    width: 100%;
}

/* Card container */
.card {
    width: 130px;
    height: 130px;
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.3s;
}

.card:hover 
{
    transform: scale(1.1);
}

/* Card inner for 3d rotation */
.card-inner 
{
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

/* Front and back sides of card */
.card-front,
.card-back 
{
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 15px;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Front side with pokemon image */
.card-front 
{
    background: #fff;
    transform: rotateY(180deg);
    overflow: hidden;
}

.card-front img 
{
    width: 80%;
    height: 80%;
    object-fit: contain;
}

/* Back side */
.card-back {
    background: linear-gradient(135deg,#2a75bb,#1c4f8a);
}

/* Modal with background blur */
.modal 
{
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Modal content box */
.modal-content 
{
    background: #fff;
    padding: 30px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.modal-content p 
{
    font-size: 2em;
    margin-bottom: 20px;
    color: #2a75bb;
}

/* Responsive design */
@media (max-width:600px)
{
    .card 
    {
        width: 80px;
        height: 80px;
    }

    .modal-content 
    {
        padding: 20px 30px;
    }

    h1 
    {
        font-size: 1.5em;
    }

    .subtitle 
    {
        font-size: 1em;
    }

    #timer-text 
    {
        font-size: 0.9em;
    }
}