/**
 * Bubble Pop Frenzy - Main Styles
 */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Arial', 'Helvetica Neue', sans-serif;
    background-color: #87CEEB;
    
    /* Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Prevent touch callouts on iOS */
    -webkit-touch-callout: none;
    
    /* Prevent tap highlight on mobile */
    -webkit-tap-highlight-color: transparent;
}

/* Game container */
#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #87CEEB 0%, #FFFACD 100%);
    position: relative;
}

/* Game canvas */
#game-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    
    /* Crisp rendering for canvas */
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    
    /* Prevent pointer events from being captured by container */
    touch-action: none;
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
}

.loading::after {
    content: 'Loading...';
    font-size: 24px;
    color: #FF69B4;
    font-weight: bold;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    /* Smaller screens */
    #game-container {
        padding: 0;
    }
}

@media (min-width: 800px) {
    /* Larger screens - center with max width */
    #game-container {
        padding: 20px;
    }
    
    #game-canvas {
        border-radius: 20px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    }
}

/* Landscape orientation handling */
@media (orientation: landscape) and (max-height: 500px) {
    #game-container {
        padding: 10px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Keep the cheerful colors even in dark mode */
    body {
        background-color: #87CEEB;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles (hide game) */
@media print {
    #game-container {
        display: none;
    }
}

/* ==============================
   Help Modal Styles
   ============================== */

.modal-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #E8F4F8 0%, #FFF5E6 50%, #FFE4EC 100%);
    border-radius: 24px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 4px solid #FF69B4;
    animation: modalPopIn 0.3s ease-out;
}

@keyframes modalPopIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #FF69B4;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.modal-close-btn:hover {
    transform: scale(1.1);
    background: #FF1493;
}

.modal-title {
    text-align: center;
    color: #FF69B4;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0px #FFF;
    line-height: 1.4;
}

.help-section {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    padding: 15px;
}

.help-section h3 {
    color: #9370DB;
    font-size: 1.2rem;
    margin-bottom: 12px;
    text-align: center;
}

.bubble-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bubble-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: 12px;
    background: white;
    gap: 12px;
    transition: transform 0.2s;
}

.bubble-item:hover {
    transform: translateX(5px);
}

.bubble-item.good {
    border-left: 4px solid #90EE90;
}

.bubble-item.bad {
    border-left: 4px solid #FF6B6B;
    background: #FFF0F0;
}

.bubble-item.special {
    border-left: 4px solid #87CEEB;
}

.bubble-icon {
    font-size: 1.8rem;
    min-width: 40px;
    text-align: center;
}

.bubble-name {
    flex: 1;
    font-weight: bold;
    color: #333;
    font-size: 1rem;
}

.bubble-points {
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 0 #333;
    font-size: 0.95rem;
    text-align: right;
}

.bubble-points small {
    color: #666;
    font-size: 0.8rem;
    text-shadow: none;
    font-weight: normal;
}

.scoring-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.scoring-list li {
    padding: 10px 5px;
    font-size: 1rem;
    color: #333;
    line-height: 1.5;
    border-bottom: 1px dashed #E0E0E0;
}

.scoring-list li:last-child {
    border-bottom: none;
}

.modal-cta {
    text-align: center;
    margin-top: 20px;
}

.start-game-btn {
    background: linear-gradient(135deg, #FF69B4 0%, #FF1493 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 5px 20px rgba(255, 105, 180, 0.4);
}

.start-game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 105, 180, 0.6);
}

.start-game-btn:active {
    transform: scale(0.98);
}

/* Help button on start screen */
#help-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #9370DB 0%, #8A2BE2 100%);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(147, 112, 219, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 100;
}

#help-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(147, 112, 219, 0.6);
}

#help-btn:active {
    transform: scale(0.95);
}

/* Responsive adjustments for modal */
@media (max-width: 480px) {
    .modal-content {
        padding: 20px;
        border-radius: 16px;
        border-width: 3px;
    }
    
    .modal-title {
        font-size: 1.2rem;
        padding-right: 30px;
    }
    
    .help-section h3 {
        font-size: 1rem;
    }
    
    .bubble-item {
        padding: 8px 10px;
        gap: 8px;
    }
    
    .bubble-icon {
        font-size: 1.4rem;
        min-width: 30px;
    }
    
    .bubble-name {
        font-size: 0.9rem;
    }
    
    .bubble-points {
        font-size: 0.85rem;
    }
    
    .scoring-list li {
        font-size: 0.9rem;
    }
    
    .start-game-btn {
        padding: 12px 30px;
        font-size: 1.1rem;
    }
    
    #help-btn {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
        top: 15px;
        right: 15px;
    }
}

@media (min-width: 800px) {
    .modal-content {
        padding: 40px;
    }
    
    .modal-title {
        font-size: 1.8rem;
    }
}
