:root {
    --bg-color: #e0e5ec;
    --text-main: #4d5b7c;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    /* For 1-25 */
    --accent-blue: #3b82f6;
    /* For 26-50 */

    --shadow-light: #ffffff;
    --shadow-dark: #a3b1c6;

    --cell-size: 60px;
    --gap-size: 15px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-text {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    text-shadow: 2px 2px 4px rgba(163, 177, 198, 0.4), -2px -2px 4px rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}

.instruction {
    font-size: 0.9rem;
    color: #6c7a9c;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 25px;
    padding: 0 10px;
}

.status-box,
.timer-box {
    background: var(--bg-color);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.result-h {
    font-size: 1.4rem;
    color: var(--accent-red);
    font-weight: 800;
}

#timer {
    font-family: monospace;
    font-size: 1.2rem;
    min-width: 90px;
    text-align: right;
}

/* Grid */
.game-board {
    padding: 10px;
    background: var(--bg-color);
    border-radius: 20px;
    /* Inset shadow container for the grid feels nice */
    box-shadow: inset 6px 6px 12px var(--shadow-dark),
        inset -6px -6px 12px var(--shadow-light);
    padding: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--gap-size);
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    border-radius: 12px;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;

    /* Neumorphism Convex */
    box-shadow: 5px 5px 10px var(--shadow-dark),
        -5px -5px 10px var(--shadow-light);
    color: var(--text-main);
}

.cell:active {
    box-shadow: inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
    transform: scale(0.95);
}

/* Colors for active numbers */
.cell[data-tier="1"] {
    /* 1-25 */
    color: white;
    background: var(--accent-green);
    /* For colored buttons, shadow needs tweaking or just rely on color */
    box-shadow: 5px 5px 10px #05966955,
        -5px -5px 10px #34d39955;
}

.cell[data-tier="2"] {
    /* 26-50 */
    color: white;
    background: var(--accent-blue);
    box-shadow: 5px 5px 10px #2563eb55,
        -5px -5px 10px #60a5fa55;
    animation: fadeIn 0.3s ease;
}

.cell.empty {
    opacity: 0;
    pointer-events: none;
    cursor: default;
}

.cell.shake {
    animation: shake 0.4s ease;
    background: var(--accent-red);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(224, 229, 236, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-color);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 10px 10px 20px var(--shadow-dark),
        -10px -10px 20px var(--shadow-light);
    text-align: center;
    width: 80%;
    max-width: 350px;
}

.score-display {
    margin: 20px 0;
}

.score-display h3 {
    font-size: 2rem;
    color: var(--text-main);
}

.primary-btn {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

.primary-btn:active {
    transform: translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Responsive */
@media (max-width: 400px) {
    .cell-size {
        --cell-size: 50px;
        --gap-size: 10px;
    }

    .cell {
        font-size: 1rem;
    }
}