:root {
    --bg-color: #C3F1FF;
    /* Sky blue */
    --primary-color: #FF8FA3;
    --secondary-color: #A2D2FF;
    --accent-color: #FDE2C4;

    --border-color: #7D5BA6;
    /* Deep purple border */

    --cell-1: #98F6D7;
    /* Mint */
    --cell-2: #FFC8DD;
    /* Pink */
    --cell-3: #D0BCFF;
    /* Purple */
    --cell-4: #FFF4B5;
    /* Yellow */

    --revealed-bg: #FFE5EC;

    --text-color: #5D4E6D;
    --white: #ffffff;
    --shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
    --transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    /* Cloud pattern approximation + Rainbow hint */
    background-image:
        radial-gradient(circle at 0% 100%, rgba(255, 183, 197, 1) 0%, rgba(255, 183, 197, 0) 25%),
        /* Pink glow */
        radial-gradient(circle at 100% 0%, rgba(162, 210, 255, 1) 0%, rgba(162, 210, 255, 0) 25%),
        /* Blue glow */
        radial-gradient(circle at 20% 20%, white 10%, transparent 10%),
        radial-gradient(circle at 80% 80%, white 15%, transparent 15%),
        radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.4) 5%, transparent 5%);
    background-size: 100% 100%;
}

#app {
    flex-direction: column;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: flex;
}

/* Header & Navigation */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.language-switch {
    display: flex;
    background: var(--white);
    padding: 6px;
    border-radius: 30px;
    border: 3px solid var(--border-color);
    gap: 5px;
}

.lang-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: var(--transition);
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn.active {
    opacity: 1;
    transform: scale(1.1);
}

.flag {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.icon-btn {
    border: 3px solid var(--border-color);
    background: var(--white);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

.icon-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

/* Logo & Title */
.logo-container {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 40px;
}

.kawaii-title {
    font-size: 3rem;
    color: var(--primary-color);
    text-shadow:
        3px 3px 0 var(--white),
        5px 5px 0 rgba(0, 0, 0, 0.1);
    -webkit-text-stroke: 2px var(--border-color);
    margin-bottom: 10px;
    font-weight: 800;
}

.logo-decoration {
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

/* Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    padding: 0 20px;
}

.btn {
    border: 3px solid var(--border-color);
    border-radius: 20px;
    padding: 16px 20px;
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'Quicksand', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    text-shadow: 1px 1px 0 var(--border-color);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    text-shadow: 1px 1px 0 var(--border-color);
}

.btn-accent {
    background-color: var(--cell-4);
    color: var(--text-color);
}

.btn-small {
    padding: 10px 20px;
    font-size: 1.1rem;
}

/* Game Area */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

.game-stats {
    display: flex;
    gap: 12px;
}

.stat-item {
    background: var(--white);
    padding: 8px 16px;
    border-radius: 25px;
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-color);
}

#game-board-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 15px;
    margin-bottom: 10px;
}

#game-board {
    display: grid;
    gap: 0;
    /* Tight grid like reference */
    padding: 8px;
    border: 6px solid var(--border-color);
    background: var(--border-color);
    /* Fill gaps with border color */
    border-radius: 12px;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.1);
}

.cell {
    width: 100%;
    aspect-ratio: 1/1;
    background: var(--cell-1);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.1);
    margin: 1px;
}

/* Dynamic font sizes based on difficulty/cell size */
.difficulty-easy .cell {
    font-size: 1.5rem;
}

.difficulty-medium .cell {
    font-size: 1.1rem;
}

.difficulty-hard .cell {
    font-size: 0.85rem;
}

.cell.color-1 {
    background-color: var(--cell-1);
}

.cell.color-2 {
    background-color: var(--cell-2);
}

.cell.color-3 {
    background-color: var(--cell-3);
}

.cell.color-4 {
    background-color: var(--cell-4);
}

.cell:active {
    transform: scale(0.95);
}

.cell.revealed {
    background: var(--revealed-bg);
    box-shadow: none;
    border-color: #E0E0E0;
    /* Softer border inside? Or keep thick? */
    border: 2px solid var(--border-color);
    /* Keep uniformity */
    margin: 1px;
}

.cell.mine {
    background: #FF8FA3;
}

.cell.flagged {
    /* Flag sits on top of unrevealed color */
    filter: brightness(1.1);
}

/* Numbers with improved visibility */
.cell[data-num] {
    font-family: 'Quicksand', sans-serif;
    -webkit-text-stroke: 1px white;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    paint-order: stroke fill;
}

.cell[data-num="1"] {
    color: #1E88E5;
    /* Vibrant Blue */
}

.cell[data-num="2"] {
    color: #2E7D32;
    /* Deep Green - Much better visibility */
}

.cell[data-num="3"] {
    color: #E53935;
    /* Vibrant Red */
}

.cell[data-num="4"] {
    color: #00897B;
    /* Deep Teal */
}

.cell[data-num="5"] {
    color: #8E24AA;
    /* Deep Purple */
}

.game-controls {
    text-align: center;
    margin-top: 5px;
    padding: 10px;
    font-weight: 700;
    color: var(--text-color);
    background: var(--white);
    border: 3px solid var(--border-color);
    border-radius: 20px;
    display: inline-block;
    align-self: center;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 30px 20px;
    border-radius: 30px;
    text-align: center;
    max-width: 380px;
    width: 100%;
    border: 6px solid var(--border-color);
    box-shadow: 0 10px 0 rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 1.8rem;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.result-icon {
    font-size: 70px;
    margin-bottom: 15px;
    filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.1));
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.animate-pop {
    animation: pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Responsive adjustments */
@media (max-width: 400px) {
    .kawaii-title {
        font-size: 2.4rem;
    }

    .cell {
        font-size: 1.2rem;
        border-radius: 6px;
        border-width: 1.5px;
    }

    #game-board {
        border-width: 4px;
        padding: 4px;
        gap: 0;
    }

    .header {
        margin-bottom: 20px;
    }
}
#app {
    width: 100%;
    height: 90vh; /* Constrain game area */
    position: relative;
    overflow: hidden; /* Keep game clipped */
    border-bottom: 5px solid white;
}

#app {
    width: 100%;
    height: 90vh;
    position: relative;
    overflow: hidden;
    border-bottom: 5px solid white;
}
