:root {
    --bg-color: #FFF5F7;
    --primary-color: #FF9AA2;
    --secondary-color: #B5EAD7;
    --accent-color: #C7CEEA;
    --text-color: #6D6D6D;
    --white: #FFFFFF;
    --font-heading: 'Fredoka', cursive;
    --font-body: 'Varela Round', sans-serif;
    --shadow-soft: 0 4px 10px rgba(0, 0, 0, 0.1);
    --shadow-btn: 0 6px 0 rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-body);
    color: var(--text-color);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Orientation Lock Overlay */
#rotate-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-color);
    z-index: 1000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.rotate-content {
    animation: bounce 2s infinite ease-in-out;
}

.rotate-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@media screen and (orientation: landscape) and (max-height: 500px) {
    #rotate-message {
        display: flex;
    }

    #game-container {
        display: none;
    }
}

#ui-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    z-index: 30;
    pointer-events: none;
}

#stats-container {
    grid-column: 2;
    background: rgba(255, 255, 255, 0.85);
    padding: 10px 25px;
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 20px;
    pointer-events: auto;
}

#controls-container {
    grid-column: 3;
    justify-self: end;
    background: rgba(255, 255, 255, 0.85);
    padding: 8px 15px;
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
}

.logo-container {
    margin-bottom: 10px;
    animation: bounceIn 0.8s ease-out;
}

/* UI State Handling */
#stats-container {
    display: none;
    /* Hidden by default in menu */
}

#game-container.playing #stats-container {
    display: flex;
    /* Shown during gameplay */
}

#game-container.playing .lang-btn,
#game-container.playing .separator {
    display: none;
    /* Hidden during gameplay */
}

#ui-header>* {
    pointer-events: auto;
}

.separator {
    width: 2px;
    height: 30px;
    background-color: var(--accent-color);
    margin: 0 5px;
}

.lang-btn,
.icon-btn {
    background: var(--white);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.1s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn.active {
    background-color: var(--secondary-color);
    border: 3px solid var(--white);
}

.lang-btn:active,
.icon-btn:active {
    transform: scale(0.9);
}

.lang-btn svg {
    width: 28px;
    height: 28px;
    display: block;
}

#score-board {
    font-family: var(--font-heading);
    font-size: 32px;
    color: var(--primary-color);
    text-shadow: 2px 2px 0px #fff;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 15px;
    border-radius: 20px;
}

#lives-display {
    font-size: 24px;
    letter-spacing: 5px;
}

#game-canvas {
    background-color: #fff;
    box-shadow: var(--shadow-soft);
    border-radius: 12px;
    max-width: 100%;
    max-height: 100%;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.95) 0%, rgba(255, 220, 225, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

#overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Kawaii Background Details */
#overlay::before,
#overlay::after {
    content: '⭐';
    position: absolute;
    font-size: 40px;
    opacity: 0.2;
    animation: float 4s infinite ease-in-out;
}

#overlay::before {
    top: 10%;
    left: 10%;
}

#overlay::after {
    bottom: 10%;
    right: 10%;
    animation-delay: 2s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    50% {
        transform: translateY(-20px) rotate(20deg);
    }
}

#menu-content {
    text-align: center;
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 30px;
    box-shadow: 0 15px 30px rgba(255, 154, 162, 0.15);
    border: 3px solid var(--white);
    max-width: 85%;
}

h1 {
    font-family: var(--font-heading);
    font-size: 36px;
    color: var(--primary-color);
    margin: 0 0 5px 0;
    text-shadow: 2px 2px 0px #FFDAC1;
}

p {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-color);
}

#menu-langs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.big-btn {
    background: linear-gradient(135deg, var(--primary-color), #FFC3A0);
    color: white;
    border: none;
    padding: 12px 35px;
    font-family: var(--font-heading);
    font-size: 24px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 0 #E5878F, 0 10px 20px rgba(255, 154, 162, 0.3);
    transition: all 0.2s;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.1);
    margin-top: 15px;
}

.big-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 10px 0 #E5878F, 0 20px 40px rgba(255, 154, 162, 0.5);
}

.big-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #E5878F;
}

.controls-hint {
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 13px;
    opacity: 0.8;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

@media (hover: none) and (pointer: coarse) {
    .desktop-hint {
        display: none;
    }

    .mobile-hint {
        display: block;
    }
}

@media (hover: hover) {
    .desktop-hint {
        display: block;
    }

    .mobile-hint {
        display: none;
    }
}

@media (max-width: 600px) {
    #ui-header {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 5px;
    }

    #stats-container {
        padding: 6px 15px;
        gap: 15px;
        order: 1;
    }

    #controls-container {
        padding: 5px 12px;
        gap: 10px;
        order: 2;
    }

    #score-board {
        font-size: 24px;
    }

    #lives-display {
        font-size: 20px;
    }

    .lang-btn,
    .icon-btn {
        width: 40px;
        height: 40px;
    }

    h1 {
        font-size: 32px;
    }
}
