:root {
    --bg-color: #fce4ec;
    --primary: #ff8fa3;
    --primary-dark: #ff4d6d;
    --secondary: #c9ada7;
    --accent: #ffb7c5;
    --success: #a7c957;
    --fail: #e5989b;
    --text-color: #5f4b66;
    --shadow: 0 8px 0 rgba(0, 0, 0, 0.1);
    --font-main: 'Fredoka', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: var(--bg-color);
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#app {
    flex-direction: column;
    width: 100%;
    max-width: 500px;
    height: 90vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    border-radius: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 8px solid white;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    transition: all 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Header */
header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 10px;
}

.lang-selector {
    display: flex;
    gap: 10px;
}

.flag-btn,
.sound-btn {
    background: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 12px;
    padding: 2px 8px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flag-img {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.flag-btn.active {
    background: var(--accent);
    transform: scale(1.1);
}

.flag-btn:hover,
.sound-btn:hover {
    transform: scale(1.1);
}

/* Hero */
.hero {
    text-align: center;
}

.mascot {
    width: 150px;
    border-radius: 30px;
    background-color: white;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.1));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-dark);
    text-shadow: 2px 2px 0 white;
    margin-top: 10px;
}

h2 {
    font-size: 2rem;
    color: var(--primary-dark);
    text-shadow: 1.5px 1.5px 0 white;
    margin-bottom: 15px;
    text-align: center;
}

/* Menu & Buttons */
.menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 90%;
}

.menu-btn {
    padding: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    background: white;
    color: var(--text-color);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    border-bottom: 6px solid #ddd;
}

.menu-btn:active {
    transform: translateY(4px);
    border-bottom-width: 2px;
}

.menu-btn.mode-btn {
    background: var(--accent);
    color: white;
    border-bottom-color: #ff8fa3;
}

.menu-btn.primary {
    background: var(--primary);
    color: white;
    border-bottom-color: var(--primary-dark);
}

.menu-btn.secondary {
    background: var(--secondary);
    color: white;
    border-bottom-color: #a38f8b;
}

/* Game Screen */
.game-header {
    text-align: center;
}

.target-label {
    font-size: 1.2rem;
    opacity: 0.8;
}

#target-time {
    font-size: 3rem;
    color: var(--primary-dark);
}

.timer-display {
    background: white;
    padding: 30px;
    border-radius: 30px;
    box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    text-align: center;
}

#timer-text {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}

#timer-text.blurred {
    filter: blur(15px);
    opacity: 0.3;
}

.main-btn {
    padding: 20px 60px;
    font-size: 2rem;
    border-radius: 30px;
    border: none;
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 0 var(--primary-dark);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}

.main-btn:active {
    transform: translateY(6px);
    box-shadow: 0 4px 0 var(--primary-dark);
}

.main-btn.stop {
    background: #ff5c8a;
    box-shadow: 0 10px 0 #d90429;
}

.main-btn.stop:active {
    box-shadow: 0 4px 0 #d90429;
}

/* Results */
.result-content {
    text-align: center;
    width: 100%;
}

#result-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.result-stats {
    background: white;
    padding: 20px;
    border-radius: 25px;
    margin-bottom: 30px;
}

.time-box,
.diff-box {
    margin: 10px 0;
    font-size: 1.3rem;
}

#final-time,
#diff-time {
    font-weight: 700;
    color: var(--primary-dark);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Animations */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s;
}

@keyframes celebrate {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }

    100% {
        transform: scale(1);
    }
}

.celebrate {
    animation: celebrate 0.5s infinite;
}

/* Responsive */
@media (max-height: 700px) {
    #app {
        height: 95vh;
    }

    h1 {
        font-size: 1.8rem;
    }

    .mascot {
        width: 100px;
    }

    #timer-text {
        font-size: 3rem;
    }

    .main-btn {
        font-size: 1.5rem;
    }
}
#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;
}
