:root {
    --primary: #ff6b6b;
    --secondary: #4ecdc4;
    --accent: #ffe66d;
    --bg-color: #f7f9fc;
    --text-dark: #2d3436;
    --card-bg: rgba(255, 255, 255, 0.9);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Quicksand', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: var(--text-dark);
    overflow: hidden;
    height: 100vh;
    height: 100svh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.icon-btn {
    background: var(--card-bg);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    pointer-events: auto;
    transition: transform 0.2s;
}

.icon-btn:active {
    transform: scale(0.9);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

#start-screen {
    /* No solid background, just use the body gradient */
    background: transparent;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    /* Much more transparent */
    backdrop-filter: blur(8px);
    z-index: 10;
    padding: clamp(10px, 5vw, 40px);
    text-align: center;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.game-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 10vw, 3.5rem);
    color: var(--primary);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.5);
    width: 100%;
}

.game-subtitle {
    font-size: clamp(1rem, 4vw, 1.4rem);
    color: #636e72;
    margin-bottom: clamp(20px, 5vh, 40px);
    width: 100%;
}

.primary-btn {
    padding: clamp(12px, 3vh, 20px) clamp(24px, 10vw, 50px);
    font-size: clamp(1.1rem, 5vw, 1.5rem);
    font-weight: 700;
    font-family: var(--font-heading);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 0px #d63031;
    transition: all 0.1s;
    margin-bottom: 30px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0px #d63031;
}

.primary-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0px #d63031;
}

.game-over-btns {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    align-items: center;
}

.secondary-btn {
    padding: clamp(10px, 2.5vh, 18px) clamp(20px, 8vw, 40px);
    font-size: clamp(1rem, 4.5vw, 1.3rem);
    font-weight: 700;
    font-family: var(--font-heading);
    background: white;
    color: var(--text-dark);
    border: 3px solid var(--text-dark);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.1s;
    width: fit-content;
}

.secondary-btn:hover {
    background: #f1f2f6;
}

.secondary-btn:active {
    transform: translateY(2px);
}

.controls-hint {
    margin-top: 20px;
    font-size: clamp(0.7rem, 3vw, 0.9rem);
    color: rgba(0, 0, 0, 0.4);
    line-height: 1.6;
}

/* HUD Styling */
#game-hud {
    position: absolute;
    top: clamp(10px, 3vh, 30px);
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 5;
    padding: 0 clamp(10px, 5vw, 30px);
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 2vh, 25px);
}

.hud-top {
    display: flex;
    justify-content: space-between;
}

.score-container,
.level-container {
    background: var(--card-bg);
    padding: clamp(5px, 1.5vh, 10px) clamp(10px, 4vw, 25px);
    border-radius: 100px;
    font-weight: 700;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: clamp(0.5rem, 2vw, 0.75rem);
    text-transform: uppercase;
    color: #95a5a6;
    letter-spacing: 1px;
}

#score,
#level {
    font-size: clamp(1rem, 4vw, 1.3rem);
    color: var(--text-dark);
}

.math-question-container {
    align-self: center;
    background: white;
    padding: clamp(8px, 1.5vh, 20px) clamp(20px, 8vw, 50px);
    border-radius: 20px;
    font-size: clamp(1.4rem, 6vw, 2.5rem);
    font-weight: 700;
    box-shadow: var(--shadow);
    border: 4px solid var(--secondary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.character-preview {
    margin-bottom: 40px;
}

.cube-character {
    width: 100px;
    height: 100px;
    background: var(--secondary);
    border-radius: 20px;
    position: relative;
    box-shadow: 0 10px 0 #3db3a9, var(--shadow);
    animation: float 3s ease-in-out infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cube-character::before {
    content: '◔ ◡ ◔';
    font-size: 40px;
    color: #2d3436;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

#game-over-screen h2 {
    font-size: 3.5rem;
    color: #ff7675;
    font-family: var(--font-heading);
    margin-bottom: 20px;
}

.final-stats {
    font-size: 1.5rem;
    margin-bottom: 40px;
}