/* style.css - Throw Blocks (Polished Version) */

/* Base Resets for a clean game container */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #2b2b46;
    /* Static gradient for stability - subtle animation can be added if desired */
    background-image: radial-gradient(circle at 50% 0%, #3b3a62, #2b2b46 70%);
    font-family: 'Fredoka One', cursive, sans-serif;
    /* Important i18n considerations: ensure Fredoka One is loaded for this font */
    touch-action: none; /* Critical fix: prevents full-page scrolling bounce on mobile */
    overscroll-behavior: none;
    overflow: hidden;
    color: #ffffff;
    user-select: none;
    -webkit-user-select: none;
}

#particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none !important; /* CRITICAL FIX: Stops particles from blocking button clicks */
}

.particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: rise 10s infinite linear;
}

@keyframes rise {
    0% { transform: translateY(0); opacity: 0; }
    10% { opacity: 0.3; }
    90% { opacity: 0.3; }
    100% { transform: translateY(-100vh); opacity: 0; }
}

/* Layout Wrappers */
.game-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

.ui-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

/* Glassmorphism Effect for UI boxes */
.ui-box {
    flex: 1;
    /* Translucent dark fill for "glass" effect */
    background-color: rgba(0, 0, 0, 0.3);
    /* Subtle border for separation */
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
}

.ui-label {
    font-size: 12px;
    color: #a0aec0;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0 0 5px 0;
}

.ui-value {
    font-size: 28px;
    margin: 0;
    line-height: 1;
}

/* Game Board with concavity */
#gameBoard {
    position: relative;
    display: grid;
    gap: 5px;
    padding: 5px;
    /* Concave dark board */
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 4px 15px rgba(0,0,0,0.5);
    margin: 0 auto;
}

.grid-placeholder {
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* Block Styling - Enhanced Glow and Polished Centering */
.block {
    position: absolute;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    margin: 0 !important;
    padding: 0 !important;
    
    color: #ffffff !important;
    border-radius: 8px;
    font-weight: 900 !important;
    /* Soft glow drop-shadow and layered shadow for complex pop */
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.4);
    transition: top 0.15s ease-out, left 0.15s ease-out, transform 0.1s ease-out;
    /* Subtle text depth */
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.7);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important; 
    /* Mathematical center fixing i18n text quirks */
    line-height: normal !important; 
}

.block.popping {
    animation: pop-out 0.2s ease-in-out forwards;
    z-index: 20;
}

@keyframes pop-out {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(0); opacity: 0; }
}

.block.merged {
    animation: fall-in 0.2s ease-out;
}

@keyframes fall-in {
    from { transform: scale(0.5); }
    to { transform: scale(1); }
}

/* Polished Launcher */
#launcher-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    /* Translucent dark fill with inner concavity */
    background-color: rgba(0,0,0,0.15);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
    touch-action: none;
}

#launcher-slot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Modern metallic gradient handle */
    background-image: linear-gradient(to bottom, #4a5568, #2d3748);
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    cursor: grab;
    z-index: 30;
    touch-action: none;
    border-radius: 12px;
}

#launcher-slot:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.05);
}

#current-block {
    transition: none !important;
}

/* Polished Next Blocks Preview */
#next-blocks-container {
    margin-top: 15px;
    background-color: rgba(0,0,0,0.3);
    padding: 10px 20px;
    border-radius: 50px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 15px;
    border: 1px solid rgba(255,255,255,0.05);
}

#next-blocks-preview {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px;
}

/* Overlays (Menus & Ads) */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(5px);
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.overlay-content {
    background: linear-gradient(to bottom, #2a2b4a, #1a1b2e);
    padding: 30px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.15);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.overlay-title {
    font-size: 42px;
    margin: 0 0 20px 0;
    line-height: 1.1;
    color: #fbbf24;
    text-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

.btn-custom {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    font-size: 20px;
    font-family: 'Fredoka One', cursive;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    color: white;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
    margin-bottom: 12px;
    position: relative;
    z-index: 10000; 
    pointer-events: auto !important;
}

.btn-custom:active {
    transform: translateY(4px);
    box-shadow: inset 0 0 0 rgba(0,0,0,0);
}

/* Interactive Buttons */
.btn-green { background-color: #22c55e; }
.btn-green:hover { background-color: #16a34a; }

.btn-blue { background-color: #3b82f6; }
.btn-blue:hover { background-color: #2563eb; }

.btn-gray { background-color: #64748b; }
.btn-gray:hover { background-color: #475569; }

.btn-red { background-color: #ef4444; }
.btn-red:hover { background-color: #dc2626; }

.hidden {
    display: none !important;
}

/* Ad Container */
#adContainer {
    width: 100%;
    height: 250px;
    background-color: #000;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}