/**
 * Busy Bee Hive - Modern HD Styles
 * Professional game styling with smooth graphics
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Prevent selection and callouts on mobile */
body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Subtle animated background gradient */
    background:
        radial-gradient(ellipse at 20% 30%, rgba(255, 200, 100, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(255, 180, 80, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

#game-canvas {
    display: block;
    /* SMOOTH rendering - NOT pixelated! */
    image-rendering: auto;
    image-rendering: smooth;
    image-rendering: optimizeQuality;
    -webkit-font-smoothing: antialiased;
    background: #FFF8DC;
    /* Beautiful shadow and glow */
    box-shadow:
        0 0 60px rgba(255, 200, 100, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    /* Smooth transition for resizing */
    transition: box-shadow 0.3s ease;
}

#game-canvas:hover {
    box-shadow:
        0 0 80px rgba(255, 200, 100, 0.4),
        0 25px 70px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* Loading Screen */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(255, 240, 200, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(255, 200, 100, 0.3) 0%, transparent 50%),
        linear-gradient(180deg, #FFB347 0%, #FF9933 30%, #FF8C00 60%, #CD853F 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader-container {
    text-align: center;
    color: #5D4E37;
}

.loader-container h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.5px;
}

.loader-container p {
    font-size: 18px;
    margin-bottom: 25px;
    opacity: 0.85;
    font-weight: 500;
}

/* Animated Bee Loader - Emoji Version */
.bee-loader {
    width: 120px;
    height: 120px;
    margin: 0 auto 25px;
    position: relative;
    animation: beeBounce 1.2s ease-in-out infinite;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.3));
}

.bee-emoji {
    font-size: 80px;
    display: block;
    line-height: 120px;
    text-align: center;
}

@keyframes beeBounce {
    0%, 100% {
        transform: translateY(0) rotate(-5deg);
    }
    25% {
        transform: translateY(-10px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
    75% {
        transform: translateY(-10px) rotate(0deg);
    }
}

/* Animated dots for "Loading..." */
.loading-text .dots {
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0% { opacity: 0.2; }
    50% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* Progress Bar - Modern pill style */
.progress-bar {
    width: 220px;
    height: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin: 0 auto;
    overflow: hidden;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 1px 2px rgba(255, 255, 255, 0.1);
}

.progress-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A, #CDDC39);
    background-size: 200% 100%;
    animation: progressPulse 2s ease-in-out infinite;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(139, 195, 74, 0.5);
}

@keyframes progressPulse {
    0% {
        transform: scaleX(0);
        background-position: 0% 50%;
    }
    50% {
        transform: scaleX(1);
        background-position: 100% 50%;
    }
    100% {
        transform: scaleX(0);
        background-position: 0% 50%;
    }
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .loader-container h1 {
        font-size: 32px;
    }

    .loader-container p {
        font-size: 15px;
    }

    .bee-loader {
        width: 70px;
        height: 70px;
    }

    .bee-loader::before {
        width: 45px;
        height: 35px;
    }

    #game-canvas {
        border-radius: 8px;
    }
}

/* Touch device joystick zone (visual feedback) */
@media (hover: none) and (pointer: coarse) {
    #game-container::after {
        content: '';
        position: absolute;
        bottom: 25px;
        left: 25px;
        width: 110px;
        height: 110px;
        border: 3px dashed rgba(255, 255, 255, 0.25);
        border-radius: 50%;
        pointer-events: none;
        box-shadow: 0 0 20px rgba(255, 200, 100, 0.1);
    }
}

/* Fullscreen mode */
#game-container:fullscreen {
    background: #0a0a15;
}

#game-container:fullscreen #game-canvas {
    border-radius: 0;
    box-shadow: none;
}

/* High DPI displays - Force smooth rendering */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #game-canvas {
        image-rendering: auto;
        image-rendering: smooth;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Accessibility - respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .bee-loader,
    .bee-loader::after,
    .progress-fill {
        animation: none;
    }

    .progress-fill {
        transform: scaleX(1);
    }

    #game-canvas {
        transition: none;
    }
}

/* Dark mode support for system preference */
@media (prefers-color-scheme: dark) {
    #game-container {
        background:
            radial-gradient(ellipse at 20% 30%, rgba(255, 180, 80, 0.08) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 70%, rgba(255, 160, 60, 0.08) 0%, transparent 50%),
            linear-gradient(135deg, #0d0d18 0%, #0f1525 50%, #0a1a30 100%);
    }
}
