/* ========================================
   BLOCK BLAST GAME STYLES
   Created by Shivanya
   ======================================== */

/* CSS Variables - Easy to change colors! */
:root {
    --bg-color: #1a1a2e;           /* Dark background */
    --board-bg: #16213e;           /* Board background */
    --cell-empty: #0f3460;         /* Empty cell color */
    --cell-border: #1e3a5f;        /* Cell border */
    --text-color: #ffffff;         /* White text */
    --accent-color: #f472b6;       /* Pink accent */
    --button-color: #8b5cf6;       /* Purple buttons */
}

/* Block colors - rainbow! */
:root {
    --block-red: #ef4444;
    --block-orange: #f97316;
    --block-yellow: #eab308;
    --block-green: #22c55e;
    --block-cyan: #06b6d4;
    --block-blue: #3b82f6;
    --block-purple: #8b5cf6;
    --block-pink: #ec4899;
}

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

/* Make icons filled instead of outlined */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Body styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

/* Main container for everything */
.game-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

/* Header styles */
header {
    margin-bottom: 15px;
}

/* Back button to return to main portal */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.back-button:hover {
    transform: translateX(-5px);
}

/* Main title */
header h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #f472b6, #8b5cf6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 5px;
}

header h1 .material-symbols-rounded {
    -webkit-text-fill-color: #8b5cf6;
}

/* Subtitle under the title */
.subtitle {
    color: #94a3b8;
    font-size: 1rem;
}

/* Score board showing stats */
.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.score, .high-score {
    display: flex;
    align-items: center;
    gap: 5px;
}

.score {
    color: #fbbf24;
}

.high-score {
    color: #f472b6;
}

/* Main game area */
main {
    position: relative;
}

/* The game board grid */
.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    background: var(--board-bg);
    padding: 10px;
    border-radius: 15px;
    margin: 0 auto 20px auto;
    max-width: 360px;
    aspect-ratio: 1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Each cell on the board */
.cell {
    background: var(--cell-empty);
    border-radius: 4px;
    aspect-ratio: 1;
    transition: background 0.15s, transform 0.15s;
}

/* Cell when it's filled with a block */
.cell.filled {
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Highlight cells when hovering with a piece */
.cell.highlight-valid {
    background: rgba(34, 197, 94, 0.5) !important;
    transform: scale(1.05);
}

.cell.highlight-invalid {
    background: rgba(239, 68, 68, 0.5) !important;
}

/* Clearing animation */
.cell.clearing {
    animation: clearPop 0.3s ease-out forwards;
}

@keyframes clearPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); }
    100% { transform: scale(0); opacity: 0; }
}

/* Area for the block pieces */
.pieces-area {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: var(--board-bg);
    border-radius: 15px;
    max-width: 360px;
    margin: 0 auto;
}

/* Each piece slot */
.piece-slot {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

/* The draggable piece */
.piece {
    display: grid;
    gap: 2px;
    cursor: grab;
    transition: transform 0.2s, opacity 0.2s;
    touch-action: none;
}

.piece:hover {
    transform: scale(1.1);
}

.piece.dragging {
    cursor: grabbing;
    opacity: 0.8;
    position: fixed;
    z-index: 1000;
    pointer-events: none;
}

/* Each block in a piece */
.piece-block {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Empty space in piece grid */
.piece-block.empty {
    background: transparent !important;
    box-shadow: none;
}

/* Overlay screens (game over) */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    gap: 15px;
    z-index: 100;
}

/* Hide overlay when not needed */
.overlay.hidden {
    display: none;
}

.overlay h2 {
    font-size: 2rem;
    color: var(--accent-color);
}

.overlay p {
    color: #94a3b8;
    font-size: 1.2rem;
}

/* Play button */
.play-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--button-color), #a78bfa);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.5);
}

/* Instructions */
.instructions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    color: #64748b;
    font-size: 0.9rem;
}

/* Footer with credits */
footer {
    margin-top: 15px;
}

.created-by {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, var(--accent-color), #ec4899);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Combo text popup */
.combo-text {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fbbf24;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    animation: comboFloat 1s ease-out forwards;
    pointer-events: none;
    z-index: 50;
}

@keyframes comboFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

/* Responsive design */
@media (max-width: 420px) {
    .game-board {
        max-width: 300px;
        padding: 8px;
        gap: 2px;
    }

    .pieces-area {
        max-width: 300px;
        gap: 10px;
        padding: 10px;
    }

    .piece-slot {
        width: 80px;
        height: 80px;
    }

    .piece-block {
        width: 16px;
        height: 16px;
    }

    header h1 {
        font-size: 1.5rem;
    }
}
