/* ===================================
   CSS CUSTOM PROPERTIES (Design System)
   =================================== */
:root {
    /* Colors - Day Theme */
    --sky-day: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 100%);
    --sky-sunset: linear-gradient(180deg, #FF6B6B 0%, #FFD93D 50%, #FFA07A 100%);
    --sky-night: linear-gradient(180deg, #0F2027 0%, #203A43 50%, #2C5364 100%);

    /* Primary Colors */
    --primary-yellow: #FFD700;
    --primary-orange: #FF8C00;
    --bee-body: #FFB300;
    --bee-stripes: #2C2C2C;

    /* Flower Colors */
    --flower-pink: #FF69B4;
    --flower-purple: #DA70D6;
    --flower-red: #FF6347;
    --flower-orange: #FF7F50;

    /* UI Colors */
    --ui-bg: rgba(255, 255, 255, 0.15);
    --ui-bg-solid: rgba(255, 255, 255, 0.95);
    --ui-border: rgba(255, 255, 255, 0.3);
    --text-primary: #2C2C2C;
    --text-light: #FFFFFF;
    --shadow: rgba(0, 0, 0, 0.2);

    /* Power-up Colors */
    --pollen-gold: #FFD700;
    --nectar-blue: #4169E1;
    --honey-amber: #FFBF00;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-index */
    --z-canvas: 1;
    --z-hud: 10;
    --z-screen: 20;
    --z-wind: 15;
}

/* ===================================
   RESET & BASE STYLES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: var(--sky-day);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ===================================
   GAME CONTAINER
   =================================== */
.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-canvas);
    cursor: pointer;
}

/* ===================================
   SCREENS (Menu, Tutorial, Pause, Game Over)
   =================================== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: var(--z-screen);
    animation: fadeIn var(--transition-normal);
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.menu-content {
    background: var(--ui-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--ui-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px var(--shadow);
    animation: slideUp var(--transition-slow);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===================================
   MAIN MENU
   =================================== */
.title-container {
    margin-bottom: var(--spacing-lg);
}

.game-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-light);
    text-shadow: 3px 3px 6px var(--shadow);
    margin-bottom: var(--spacing-xs);
    animation: bounce 2s infinite;
}

@keyframes bounce {

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

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

.bee-emoji {
    display: inline-block;
    animation: buzz 0.5s infinite;
}

@keyframes buzz {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    font-weight: 300;
    text-shadow: 2px 2px 4px var(--shadow);
}

.high-score-display {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.high-score-display .label {
    color: var(--text-light);
    font-weight: 600;
    font-size: 1rem;
}

.high-score-display .score {
    color: var(--primary-yellow);
    font-weight: 800;
    font-size: 1.5rem;
    text-shadow: 2px 2px 4px var(--shadow);
}

.controls-info {
    margin-top: var(--spacing-md);
    color: var(--text-light);
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Blog Links Section */
.blog-links {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.blog-title-small {
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    text-align: center;
    opacity: 0.9;
}

.blog-link {
    display: block;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    text-decoration: none;
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.blog-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
    border-color: var(--primary-yellow);
}


/* ===================================
   BUTTONS
   =================================== */
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    box-shadow: 0 4px 15px var(--shadow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-yellow), var(--primary-orange));
    color: var(--text-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.3);
    color: var(--text-light);
    border: 2px solid var(--ui-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.btn-icon-only {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid var(--ui-border);
    border-radius: var(--radius-full);
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: var(--spacing-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ===================================
   TUTORIAL
   =================================== */
.tutorial-content {
    background: var(--ui-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--ui-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.tutorial-animation {
    position: relative;
    height: 150px;
    margin-bottom: var(--spacing-lg);
}

.tutorial-bee {
    position: absolute;
    font-size: 4rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: tutorialFloat 2s infinite;
}

@keyframes tutorialFloat {

    0%,
    100% {
        transform: translate(-50%, -50%);
    }

    50% {
        transform: translate(-50%, -70%);
    }
}

.tutorial-hand {
    position: absolute;
    font-size: 3rem;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    animation: tutorialTap 1s infinite;
}

@keyframes tutorialTap {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

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

.tutorial-content h2 {
    color: var(--text-light);
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
    text-shadow: 2px 2px 4px var(--shadow);
}

.tutorial-text {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-sm);
}

.tutorial-text.small {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: var(--spacing-lg);
}

/* ===================================
   IN-GAME HUD
   =================================== */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: var(--spacing-sm);
    z-index: var(--z-hud);
    pointer-events: none;
    display: none;
}

.hud.active {
    display: block;
}

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

.hud-left,
.hud-center,
.hud-right {
    flex: 1;
}

.hud-center {
    display: flex;
    justify-content: center;
}

.hud-right {
    display: flex;
    justify-content: flex-end;
}

.score-display {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid var(--ui-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-light);
    text-shadow: 2px 2px 4px var(--shadow);
    min-width: 80px;
    text-align: center;
}

.lives-container {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid var(--ui-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    display: flex;
    gap: 4px;
}

.life-icon {
    font-size: 1.5rem;
    filter: drop-shadow(2px 2px 4px var(--shadow));
}

.powerup-indicator {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid var(--ui-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 1.5rem;
    min-width: 50px;
    text-align: center;
    display: none;
}

.powerup-indicator.active {
    display: block;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {

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

    50% {
        transform: scale(1.1);
    }
}

.btn-pause {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid var(--ui-border);
    border-radius: var(--radius-full);
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    pointer-events: all;
    transition: all var(--transition-fast);
}

.btn-pause:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* ===================================
   GAME OVER SCREEN
   =================================== */
.game-over-title {
    color: var(--text-light);
    font-size: 2.5rem;
    margin-bottom: var(--spacing-lg);
    text-shadow: 2px 2px 4px var(--shadow);
}

.score-summary {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
}

.score-item .label {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
}

.score-item .value {
    color: var(--text-light);
    font-size: 1.5rem;
    font-weight: 800;
    text-shadow: 2px 2px 4px var(--shadow);
}

.score-item.highlight .value {
    color: var(--primary-yellow);
    font-size: 2rem;
}

.new-high-score {
    background: linear-gradient(135deg, var(--primary-yellow), var(--primary-orange));
    color: var(--text-primary);
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: var(--spacing-lg);
    animation: celebrate 0.5s infinite;
}

@keyframes celebrate {

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

    50% {
        transform: scale(1.05);
    }
}

.new-high-score.hidden {
    display: none;
}

/* ===================================
   WIND INDICATOR
   =================================== */
.wind-indicator {
    position: absolute;
    top: 50%;
    right: var(--spacing-md);
    transform: translateY(-50%);
    z-index: var(--z-wind);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.wind-indicator.active {
    display: flex;
}

.wind-arrow {
    font-size: 2rem;
    filter: drop-shadow(2px 2px 4px var(--shadow));
    transition: transform var(--transition-normal);
}

.wind-indicator.up .wind-arrow {
    transform: rotate(-90deg);
}

.wind-indicator.down .wind-arrow {
    transform: rotate(90deg);
}

.wind-indicator.gust .wind-arrow {
    animation: gustPulse 0.3s infinite;
}

@keyframes gustPulse {

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

    50% {
        transform: scale(1.3);
    }
}

.wind-text {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid var(--ui-border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.hidden {
    display: none !important;
}

/* ===================================
   RESPONSIVE DESIGN - MOBILE OPTIMIZED
   =================================== */

/* Tablets and small laptops */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .menu-content {
        padding: var(--spacing-lg);
    }

    .score-display {
        font-size: 1.5rem;
        padding: var(--spacing-xs) var(--spacing-sm);
        min-width: 60px;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 1rem;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .combo-display {
        font-size: 1.4rem;
        padding: 6px 16px;
        top: 70px;
    }
}

/* Mobile phones - Portrait */
@media (max-width: 480px) {

    /* Typography */
    .game-title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .tutorial-bee {
        font-size: 3rem;
    }

    .tutorial-hand {
        font-size: 2rem;
    }

    /* HUD Optimization */
    .hud-top {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .hud-left,
    .hud-center,
    .hud-right {
        flex: none;
        width: 100%;
    }

    .hud-left {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .hud-center {
        justify-content: space-between;
        align-items: center;
    }

    .score-display {
        font-size: 1.8rem;
        padding: 8px 16px;
        min-width: auto;
        flex: 1;
    }

    .lives-container {
        padding: 4px 8px;
    }

    .life-icon {
        font-size: 1.2rem;
    }

    /* Honey jar - more compact */
    .honey-jar-container {
        padding: 4px 8px;
        gap: 6px;
    }

    .honey-icon {
        font-size: 1.1rem;
    }

    .honey-progress {
        width: 60px;
        height: 10px;
    }

    .honey-count {
        font-size: 0.9rem;
        min-width: 16px;
    }

    /* Combo display - smaller and higher */
    .combo-display {
        font-size: 1.2rem;
        padding: 6px 12px;
        top: 100px;
    }

    /* Power-up indicator */
    .powerup-indicator {
        font-size: 1.3rem;
        padding: 4px 8px;
        min-width: 40px;
    }

    /* Pause button */
    .btn-pause {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
        top: 8px;
        right: 8px;
    }

    /* Menu content */
    .menu-content {
        padding: var(--spacing-md);
        max-width: 90%;
    }

    /* Buttons - larger touch targets */
    .btn-primary,
    .btn-secondary {
        font-size: 1.1rem;
        padding: 14px var(--spacing-md);
        min-height: 48px;
    }

    .btn-icon-only {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }

    /* Wind indicator */
    .wind-indicator {
        right: 8px;
    }

    .wind-arrow {
        font-size: 1.5rem;
    }

    .wind-text {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* Score summary */
    .score-item .label {
        font-size: 0.9rem;
    }

    .score-item .value {
        font-size: 1.3rem;
    }

    .score-item.highlight .value {
        font-size: 1.6rem;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    .game-title {
        font-size: 1.6rem;
    }

    .score-display {
        font-size: 1.5rem;
        padding: 6px 12px;
    }

    .combo-display {
        font-size: 1rem;
        padding: 4px 10px;
    }

    .honey-progress {
        width: 50px;
    }

    .btn-pause {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .menu-content {
        max-height: 90vh;
        overflow-y: auto;
        padding: var(--spacing-sm);
    }

    .game-title {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .high-score-display {
        padding: 8px 12px;
        margin-bottom: 12px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 10px var(--spacing-md);
        margin-bottom: 8px;
        font-size: 0.95rem;
    }

    .tutorial-content {
        padding: var(--spacing-md);
        max-height: 90vh;
        overflow-y: auto;
    }

    .tutorial-animation {
        height: 100px;
        margin-bottom: var(--spacing-sm);
    }

    .tutorial-bee {
        font-size: 2.5rem;
    }

    .tutorial-hand {
        font-size: 1.8rem;
    }

    .hud-top {
        padding: 4px;
    }

    .score-display {
        font-size: 1.3rem;
        padding: 4px 10px;
    }

    .combo-display {
        top: 50px;
        font-size: 1rem;
    }

    .btn-pause {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

/* Touch-friendly improvements for all mobile devices */
@media (hover: none) and (pointer: coarse) {

    /* Ensure all interactive elements are at least 44x44px */
    .btn-primary,
    .btn-secondary,
    .btn-icon-only,
    .btn-pause {
        min-width: 44px;
        min-height: 44px;
    }

    /* Prevent text selection on touch */
    * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    /* Remove hover effects on touch devices */
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-icon-only:hover,
    .btn-pause:hover {
        transform: none;
    }

    /* Active states for touch feedback */
    .btn-primary:active {
        transform: scale(0.95);
        opacity: 0.9;
    }

    .btn-secondary:active {
        transform: scale(0.95);
        opacity: 0.9;
    }

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

/* ===================================
   SOUND TOGGLE
   =================================== */
.sound-toggle .sound-on,
.sound-toggle .sound-off {
    transition: opacity var(--transition-fast);
}

.sound-toggle.muted .sound-on {
    display: none;
}

.sound-toggle.muted .sound-off {
    display: inline;
}