/* ============================================================
   style.css – Red Ball Platformer Game Styles
   ============================================================ */

:root {
    --primary: #ee2222;
    --primary-glow: #ff6b6b;
    --bg-dark: #1a1a2e;
    --bg-darker: #0f0f1a;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.1);
    --text: #f0f0f0;
    --text-dim: #aaa;
    --accent: #ffd700;
    --success: #4ade80;
    --radius: 16px;
    --font: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-darker);
    font-family: var(--font);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* === CANVAS === */
#game-canvas {
    display: block;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(238, 34, 34, 0.15), 0 8px 32px rgba(0, 0, 0, 0.4);
    image-rendering: auto;
    z-index: 1;
}

/* === SCREEN OVERLAYS === */
.screen {
    display: none;
}

.screen.active {
    display: flex;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* === MENU BOX === */
.menu-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 40px 48px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    animation: slideUp 0.4s ease;
}

.menu-box.wide {
    max-width: 600px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    text-shadow: none;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1rem;
    margin-bottom: 28px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* === BUTTONS === */
.menu-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    margin: 10px 0;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.menu-btn.primary {
    background: linear-gradient(135deg, var(--primary), #cc1111);
    border-color: var(--primary);
    color: #fff;
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, var(--primary-glow), var(--primary));
    box-shadow: 0 4px 20px rgba(238, 34, 34, 0.4);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text);
    font-size: 1.2rem;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* === HUD === */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: none;
    flex-direction: column;
    pointer-events: none;
}

#hud .icon-btn {
    pointer-events: auto;
}

.hud-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.hud-left,
.hud-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hud-center {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.3s ease;
    border-radius: 0 2px 2px 0;
}

/* === LEVEL SELECT GRID === */
.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.level-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}

.level-btn.unlocked:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.level-btn.locked {
    opacity: 0.35;
    cursor: not-allowed;
}

.level-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.level-btn.locked .level-num {
    color: var(--text-dim);
}

.level-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* === INSTRUCTIONS === */
.instructions-content {
    text-align: left;
    margin: 16px 0;
    line-height: 2;
    font-size: 0.95rem;
}

.instructions-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 10px 0;
}

/* === TOUCH CONTROLS === */
#touch-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 12px 16px;
    pointer-events: none;
}

.touch-btn {
    position: fixed;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.touch-btn:active {
    background: rgba(255, 255, 255, 0.25);
}

.touch-left {
    bottom: 20px;
    left: 20px;
}

.touch-right {
    bottom: 20px;
    left: 100px;
}

.touch-jump {
    bottom: 20px;
    right: 20px;
}

/* Show touch controls on smaller screens during play (controlled by JS) */
@media (max-width: 900px) and (hover: none) {
    .touch-btn {
        width: 58px;
        height: 58px;
    }
}

@media (max-width: 600px) {
    .menu-box {
        padding: 28px 24px;
    }

    .game-title {
        font-size: 2rem;
    }

    .menu-btn {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
}