:root {
    --bg-color: #1e1e2e;
    --text-color: #ffffff;
    --tile-1: #ff4b4b;
    /* Red */
    --tile-2: #2ecc71;
    /* Green */
    --tile-3: #ff70c6;
    /* Pink */
    --tile-4: #4bdaff;
    /* Light Blue */
    --tile-5: #ffe03b;
    /* Yellow */
    /* Slightly adjusted for contrast */
}

a,
button,
div,
h1,
p,
span {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Fredoka', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    /* Mobile friendly full height */
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 20px;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

/* Start Screen */
h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #ff4b4b, #4bdaff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.level-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
}

.level-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    font-family: inherit;
}

.level-btn span {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.7;
}

.level-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.level-btn:active {
    transform: scale(0.95);
}

/* Game Screen */
.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 0 20px;
}

.info-pill {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
}

#tile-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.tile {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tile:active {
    transform: scale(0.9);
}

/* Tile Colors */
.tile[data-value="1"] {
    background-color: var(--tile-1);
    color: white;
}

.tile[data-value="2"] {
    background-color: var(--tile-2);
    color: white;
}

.tile[data-value="3"] {
    background-color: var(--tile-3);
    color: white;
}

.tile[data-value="4"] {
    background-color: var(--tile-4);
    color: black;
}

.tile[data-value="5"] {
    background-color: var(--tile-5);
    color: black;
}

/* Result Screen */
.result-info {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    border-radius: 15px;
}

.result-info p {
    margin: 5px 0;
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.9;
}

.final-score {
    font-size: 4rem;
    font-weight: 700;
    margin: 20px 0;
}

.restart-btn {
    background: var(--tile-4);
    color: #1e1e2e;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 30px;
    transition: transform 0.2s;
}

.restart-btn:hover {
    transform: scale(1.05);
}

/* Animations */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.3s;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.pop {
    animation: pop 0.2s;
}

/* Countdown Screen */
.sequence-display {
    font-size: 1.5rem;
    margin: 20px 0;
    font-weight: 600;
    color: var(--tile-4);
}

.countdown-circle {
    width: 120px;
    height: 120px;
    border: 5px solid var(--tile-2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    font-weight: 700;
    margin-top: 30px;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.4);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(46, 204, 113, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(46, 204, 113, 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(46, 204, 113, 0.4);
    }
}