:root {
    --bg-color: #FFF9F0;
    --primary-color: #FF9AA2;
    /* Soft Pink */
    --primary-dark: #FF7E88;
    --secondary-color: #A0E7E5;
    /* Mint */
    --secondary-dark: #81D4D1;
    --accent-color: #FFDAC1;
    /* Peach */
    --board-color: #FCE38A;
    /* Soft Yellow */
    --board-shadow: #E8CC68;
    --text-color: #6B5B95;
    --white: #FFFFFF;

    --chip-p1: #FF6F69;
    /* Red-ish */
    --chip-p2: #6FA3EF;
    /* Blue-ish */

    --font-main: 'Baloo 2', cursive;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    /* Polka dot pattern */
    background-image: radial-gradient(var(--accent-color) 20%, transparent 20%),
        radial-gradient(var(--accent-color) 20%, transparent 20%);
    background-position: 0 0, 20px 20px;
    background-size: 40px 40px;

    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    position: relative;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    z-index: 10;
}

.left-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.right-controls {
    display: flex;
    align-items: center;
}

.icon-btn,
.lang-btn {
    background: var(--white);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--accent-color);
    transition: transform 0.1s, box-shadow 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    outline: none;
    padding: 0;
    overflow: hidden;
}

.kawaii-flag {
    width: 100%;
    height: 100%;
    display: block;
}

.icon-btn:active,
.lang-btn:active,
.lang-btn.active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--accent-color);
}


.lang-btn.active {
    border-color: var(--primary-color);
    box-shadow: none;
}

.language-selector {
    display: flex;
    gap: 0.5rem;
}

#btn-header-home {
    font-size: 1.5rem;
    padding: 0;
    line-height: 1;
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    /* Stack screens */
    top: 60px;
    /* Below header */
    left: 0;
    width: 100%;
    height: calc(100% - 80px);
    transition: opacity 0.3s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    top: 0;
}

.hidden {
    display: none !important;
}

/* Typography & Titles */
h1.title {
    font-size: 3rem;
    color: var(--primary-color);
    text-shadow: 2px 2px 0 var(--accent-color);
    margin-bottom: 1rem;
    text-align: center;
}

h2 {
    font-size: 2rem;
    color: var(--secondary-dark);
    margin-bottom: 1.5rem;
}

.mascot-container {
    margin-bottom: 2rem;
    animation: bounce 2.5s infinite ease-in-out;
    display: flex;
    justify-content: center;
}

.mascot-img {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}

.mascot-img-small {
    width: 120px;
    height: auto;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* Menu Content Centering */
.menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.menu-buttons,
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Buttons */

.kawaii-btn {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1.3rem;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 1.5rem;
    /* Rounded pill shape */
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.1s, box-shadow 0.1s, filter 0.2s;
    width: 80%;
    max-width: 280px;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    /* Clear default margin */
}

.kawaii-btn:hover {
    filter: brightness(1.05);
}

.kawaii-btn:active {
    transform: translateY(6px);
    box-shadow: none;
}

.primary {
    background-color: var(--primary-color);
    box-shadow: 0 6px 0 var(--primary-dark);
}

.secondary {
    background-color: var(--secondary-color);
    box-shadow: 0 6px 0 var(--secondary-dark);
}

.easy {
    background-color: #B4F8C8;
    color: #444;
    box-shadow: 0 6px 0 #94D8A8;
}

.medium {
    background-color: #FBE7C6;
    color: #444;
    box-shadow: 0 6px 0 #DBC7A6;
}

.hard {
    background-color: #FF9AA2;
    box-shadow: 0 6px 0 #E27B83;
}

.small {
    width: auto;
    font-size: 1rem;
    padding: 0.5rem 1.5rem;
    background-color: var(--accent-color);
    color: #444;
    box-shadow: 0 4px 0 #E3C0A7;
}

.warning {
    background-color: #FFDAC1;
    color: #555;
    box-shadow: 0 4px 0 #E3C0A7;
    width: auto;
    font-size: 1rem;
    padding: 0.5rem 1.5rem;
}

/* Game Board */
.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.player-score {
    text-align: center;
    background: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    border: 2px solid #eee;
}

.player-name {
    display: block;
    font-weight: bold;
    font-size: 0.9rem;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.p1 .score-value {
    color: var(--chip-p1);
}

.p2 .score-value {
    color: var(--chip-p2);
}

.turn-indicator {
    background: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 6px;
    background-color: var(--board-color);
    padding: 10px;
    border-radius: 20px;
    box-shadow: 0 8px 0 var(--board-shadow);
    max-width: 100%;
    aspect-ratio: 7/6;
    margin: 0 auto 1.5rem auto;
    width: 100%;
}

.cell {
    background-color: var(--bg-color);
    /* Effectively "transparent" showing bg */
    border-radius: 50%;
    width: 100%;
    height: 100%;
    cursor: pointer;
    position: relative;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.1);
}

/* Chips */
.cell.taken::after {
    content: '';
    position: absolute;
    width: 90%;
    height: 90%;
    top: 5%;
    left: 5%;
    border-radius: 50%;
    animation: dropIn 0.4s cubic-bezier(0.5, 1.8, 0.7, 0.8);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 2px 3px rgba(0, 0, 0, 0.2);
}

.cell.p1::after {
    background-color: var(--chip-p1);
}

.cell.p2::after {
    background-color: var(--chip-p2);
}

/* Winning Animation */
.cell.win::after {
    /* Kawaii Face */
    background-image: radial-gradient(circle at 30% 35%, black 4px, transparent 5px),
        radial-gradient(circle at 70% 35%, black 4px, transparent 5px);

    box-shadow: 0 0 15px var(--white), inset 0 -3px 0 rgba(0, 0, 0, 0.2);
    animation: pop 0.5s ease infinite alternate;
}

.cell.win::before {
    /* Mouth */
    content: '';
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 10px;
    border-bottom: 3px solid black;
    border-radius: 50%;
    z-index: 2;
}

@keyframes dropIn {
    0% {
        transform: translateY(-300px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pop {
    from {
        transform: scale(0.95);
    }

    to {
        transform: scale(1.05);
    }
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: 2rem;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: zoomIn 0.3s ease;
}

.kawaii-celebration {
    margin: 1rem 0;
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (min-width: 600px) {
    .app-container {
        border: 4px solid var(--board-color);
        border-radius: 30px;
        height: auto;
        min-height: 600px;
        box-shadow: 0 10px 0 #E8CC68;
        background: white;
    }

    body {
        background-color: #FFEFD5;
        /* Darker bg for contrast on desktop */
    }
}
