/* Scoped to game container only */
.joowons-blast-game {
    /* New Blue Theme */
    --bg-gradient-top: #3a5ba0;
    --bg-gradient-bottom: #2d4a82;
    --grid-bg: #1e3a6e;
    --grid-border: #4a7cc9;
    --cell-empty: #25508a;
    --text-color: #ffffff;

    /* Block Colors - Vibrant & 3D */
    --block-red: #e74c3c;
    --block-orange: #f39c12;
    --block-yellow: #f1c40f;
    --block-green: #2ecc71;
    --block-cyan: #3498db;
    --block-blue: #2980b9;
    --block-purple: #9b59b6;
    --block-teal: #1abc9c;
    --block-pink: #fd79a8;

    --cell-size: 40px;
    --gap-size: 3px;
    --spawn-scale: 0.55;
    --spawn-slot-height: calc(((var(--cell-size) + var(--gap-size)) * 4) * var(--spawn-scale) + 18px);

    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

.joowons-blast-game *,
.joowons-blast-game *::before,
.joowons-blast-game *::after {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Prevent pinch zoom on game */
body.joowons-blast-game {
    touch-action: pan-x pan-y;
    -ms-touch-action: pan-x pan-y;
}

/* Screen Flash Overlay */
#screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.6) 0%, transparent 70%);
}

#screen-flash.flash-active {
    animation: screenFlash 0.3s ease-out forwards;
}

@keyframes screenFlash {
    0% {
        opacity: 0.8;
        transform: scale(0.8);
    }

    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

/* Global Interaction Effects */
.action-effect {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1600;
    opacity: 0;
    transform: scale(0);
    animation: actionPulse 0.45s ease-out forwards;
    mix-blend-mode: screen;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent 65%);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

.action-effect.pointer {
    background: radial-gradient(circle, rgba(255, 200, 50, 0.9), transparent 70%);
    box-shadow: 0 0 18px rgba(255, 180, 60, 0.5);
}

.action-effect.keyboard {
    background: radial-gradient(circle, rgba(141, 196, 255, 0.9), transparent 70%);
    box-shadow: 0 0 18px rgba(141, 196, 255, 0.5);
}

.interaction-target {
    animation: interactionFlash 0.35s ease-out;
}

@keyframes interactionFlash {
    0% {
        filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
        transform: scale(1);
    }
    70% {
        filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.8));
        transform: scale(1.03);
    }
    100% {
        filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
        transform: scale(1);
    }
}

@keyframes actionPulse {
    0% {
        opacity: 0.9;
        transform: scale(0.6);
    }
    80% {
        opacity: 0.4;
        transform: scale(1.8);
    }
    100% {
        opacity: 0;
        transform: scale(2.2);
    }
}

body.joowons-blast-game {
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg-gradient-bottom) 100%);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

body.joowons-blast-game::before {
    content: '';
    position: fixed;
    inset: -30%;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.2), transparent 45%),
        radial-gradient(circle at 80% 30%, rgba(70, 164, 255, 0.4), transparent 55%),
        radial-gradient(circle at 50% 80%, rgba(255, 118, 176, 0.25), transparent 60%);
    filter: blur(60px);
    opacity: 0.6;
    animation: auroraDrift 16s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

body.joowons-blast-game::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.04) 0%, transparent 60%);
    opacity: 0.35;
    mix-blend-mode: screen;
    pointer-events: none;
}

.joowons-blast-game #app {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 12px 16px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.joowons-blast-game #app::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.06), transparent 55%);
    pointer-events: none;
    z-index: -1;
}

/* Header */
.game-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
}

.game-title-row {
    text-align: center;
    margin-bottom: 0;
}

.game-title {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGradient 4s ease infinite;
    margin: 0;
    padding: 0;
    text-shadow: none;
    letter-spacing: 1px;
}

@keyframes titleGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.game-url-watermark {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 100;
}

.header-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 6px;
}

.game-header .score-label {
    font-size: 0.65rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.best-score-card {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.85);
    transition: transform 0.2s, box-shadow 0.2s;
    flex: 0.8;
    justify-content: space-between;
}

.best-score-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.best-score-card:hover,
.best-score-card:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.best-score-value {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffc107;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Current Score */
.current-score {
    text-align: center;
    padding: 3px 10px 4px;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(13, 27, 61, 0.82), rgba(10, 19, 42, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.current-score::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 8px;
    background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.12), transparent 65%);
    opacity: 0.9;
    pointer-events: none;
}

#score {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-color);
    letter-spacing: 1px;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 255, 255, 0.15);
    position: relative;
    line-height: 1.1;
}

.header-current-score {
    flex: 1.6;
    margin: 0;
}

.combo-display {
    align-self: flex-end;
    margin-top: 0;
}

#score::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: -4px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    opacity: 0.7;
    animation: scoreUnderline 2.6s ease-in-out infinite;
}

/* Combo Display */
.combo-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.8rem;
    padding: 3px 14px;
    border-radius: 999px;
    visibility: hidden;
    opacity: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #fffcf2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, rgba(255, 86, 58, 0.4), rgba(255, 136, 0, 0.45));
    box-shadow:
        0 8px 15px rgba(255, 107, 53, 0.25),
        inset 0 0 10px rgba(255, 255, 255, 0.15);
    transition: opacity 0.2s, transform 0.2s;
    position: relative;
}

.combo-active {
    visibility: visible;
    opacity: 1;
    animation: comboPulse 0.5s ease-out;
}

/* BGM Player */
.bgm-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0;
    margin-bottom: 12px;
}

.bgm-controls {
    display: flex;
    align-items: center;
    gap: 2px;
}

.bgm-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.9);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.bgm-btn.bgm-play {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
    background: linear-gradient(135deg, var(--block-cyan), var(--block-blue));
}

.bgm-btn.bgm-play:hover {
    filter: brightness(1.2);
}

.bgm-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bgm-title {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.bgm-progress-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bgm-time {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.6);
    min-width: 28px;
}

.bgm-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
}

.bgm-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--block-cyan), var(--block-purple));
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.bgm-volume-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bgm-volume-icon {
    font-size: 0.75rem;
}

.bgm-volume {
    width: 50px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
}

.bgm-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--block-cyan);
    cursor: pointer;
}

.bgm-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--block-cyan);
    cursor: pointer;
    border: none;
}

/* Mobile responsive */
@media (max-width: 400px) {
    .bgm-player {
        padding: 4px 8px;
        gap: 6px;
    }

    .bgm-btn {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }

    .bgm-btn.bgm-play {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .bgm-title {
        max-width: 80px;
        font-size: 0.65rem;
    }

    .bgm-volume-container {
        /* Show volume on mobile - just make it smaller */
        gap: 2px;
    }

    .bgm-volume {
        width: 40px;
        height: 16px; /* Taller for easier touch */
        padding: 6px 0; /* Touch target padding */
    }

    .bgm-volume::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }

    .bgm-volume::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }
}

.combo-overlay,
.line-clear-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1500;
    mix-blend-mode: screen;
}

.combo-overlay {
    opacity: 0;
}

.combo-spark {
    background: radial-gradient(circle at center, rgba(255, 176, 46, 0.35), transparent 65%);
    animation: comboSpark 0.7s ease-out forwards;
}

.combo-super {
    background: radial-gradient(circle at 40% 40%, rgba(255, 97, 56, 0.45), transparent 70%),
        radial-gradient(circle at 60% 60%, rgba(255, 214, 102, 0.35), transparent 70%);
    animation: comboSuper 0.7s ease-out forwards;
}

.combo-mega {
    background: radial-gradient(circle at 50% 50%, rgba(255, 86, 175, 0.6), transparent 70%),
        radial-gradient(circle at 30% 30%, rgba(120, 219, 255, 0.45), transparent 75%);
    animation: comboMega 0.75s ease-out forwards;
}

.combo-omega {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.9), transparent 65%),
        conic-gradient(from 0deg, rgba(255, 78, 80, 0.4), rgba(255, 229, 100, 0.4), rgba(106, 215, 255, 0.4), rgba(255, 78, 80, 0.4));
    animation: comboOmega 0.85s ease-out forwards;
}

.line-clear-overlay {
    opacity: 0;
}

.line-clear-spark {
    background: radial-gradient(circle at center, rgba(131, 192, 255, 0.35), transparent 65%);
    animation: lineClearSpark 0.5s ease-out forwards;
}

.line-clear-wave {
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), transparent 70%),
        radial-gradient(circle at 70% 70%, rgba(120, 174, 255, 0.4), transparent 70%);
    animation: lineClearWave 0.6s ease-out forwards;
}

.line-clear-storm {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8), transparent 55%),
        radial-gradient(circle at 20% 80%, rgba(255, 137, 205, 0.55), transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(132, 196, 255, 0.6), transparent 60%);
    animation: lineClearStorm 0.7s ease-out forwards;
}

#score.score-burst {
    animation: scoreBurst 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#score.score-burst-strong {
    animation: scoreInferno 0.5s cubic-bezier(0.45, 1.64, 0.47, 1);
    text-shadow: 0 5px 12px rgba(0, 0, 0, 0.5), 0 0 24px rgba(255, 204, 0, 0.6);
}

body.joowons-blast-game.combo-shake {
    animation: comboQuake 0.45s ease-out;
}

#game-container.grid-flash {
    animation: gridFlash 0.5s ease-out;
}

#game-container.grid-flare {
    animation: gridFlare 0.6s ease-out;
}

.firework {
    --tx: 0px;
    --ty: -80px;
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, var(--fw-color, #fff) 60%, transparent 100%);
    box-shadow: 0 0 18px var(--fw-glow, rgba(255, 255, 255, 0.9)), 0 0 40px rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    mix-blend-mode: screen;
    z-index: 1700;
    animation: fireworkTrail 0.9s ease-out forwards;
}

.fabric-stream {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, var(--fw-color, #fff) 45%, transparent 100%);
    box-shadow: 0 0 20px var(--fw-glow, rgba(255, 255, 255, 0.9));
    animation: fabricStream 1.1s ease-out forwards;
}

.fabric-stream::before,
.fabric-stream::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 40px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0));
    border-radius: 40% 40% 60% 60%;
    transform-origin: top center;
    transform: translate(-50%, -10%) rotate(-10deg);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
    animation: fabricFlow 1.1s ease-out forwards;
}

.fabric-stream::after {
    transform: translate(-50%, -10%) rotate(10deg) scaleX(-1);
    opacity: 0.8;
}

.fabric-wide::before,
.fabric-wide::after {
    height: 55px;
    width: 16px;
}

.firework::before,
.firework::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 0%, rgba(255, 255, 255, 0.6) 60%, transparent 100%);
    opacity: 0.8;
    animation: fireworkHalo 0.9s ease-out forwards;
}

.firework::after {
    inset: -6px;
    filter: blur(6px);
    opacity: 0.6;
}

.firework-shard {
    position: fixed;
    width: 2px;
    height: var(--shard-length, 80px);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), var(--fw-color, #fff));
    filter: drop-shadow(0 0 8px var(--fw-glow, rgba(255, 255, 255, 0.8)));
    transform-origin: top center;
    transform: translate(-50%, -50%) rotate(var(--shard-angle, 0rad));
    animation: fireworkShard 0.9s ease-out forwards;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 1650;
}

.firework-ring {
    position: fixed;
    width: var(--ring-size, 120px);
    height: var(--ring-size, 120px);
    margin-left: calc(var(--ring-size, 120px) / -2);
    margin-top: calc(var(--ring-size, 120px) / -2);
    border-radius: 50%;
    border: 2px solid var(--fw-color, #fff);
    box-shadow: 0 0 30px var(--fw-glow, rgba(255, 255, 255, 0.7));
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 1650;
    animation: fireworkRing 1s ease-out forwards;
    opacity: 0.8;
}

@keyframes comboPulse {
    0% {
        transform: scale(1.5);
        opacity: 0;
    }

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

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Game Container */
#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.3rem auto 0.6rem;
    position: relative;
    /* For 3D canvas overlay */
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1;
    border-radius: 20px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.08), transparent 55%),
        radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.04), transparent 65%);
    box-shadow:
        0 30px 60px rgba(9, 15, 40, 0.65),
        inset 0 0 25px rgba(255, 255, 255, 0.08);
}

#game-container::before,
#game-container::after {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 26px;
    pointer-events: none;
}

#game-container::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(79, 147, 255, 0.35));
    filter: blur(20px);
    opacity: 0.7;
}

#game-container::after {
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 30px rgba(66, 135, 245, 0.4);
    animation: boardAura 6s ease-in-out infinite;
}

/* 3D Canvas Overlay */
#three-canvas-container {
    pointer-events: none;
    /* Let clicks pass through to 2D board */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    border-radius: 10px;
}

#three-canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Grid */
.grid-8x8 {
    display: grid;
    grid-template-columns: repeat(8, var(--cell-size));
    grid-template-rows: repeat(8, var(--cell-size));
    gap: var(--gap-size);
    background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.08), transparent 60%),
        linear-gradient(180deg, rgba(35, 59, 109, 0.9), rgba(11, 25, 54, 0.95));
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -6px 12px rgba(0, 0, 0, 0.8),
        0 20px 45px rgba(8, 12, 35, 0.85);
    position: relative;
    overflow: visible;
    isolation: isolate;
}

.grid-8x8::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(51, 153, 255, 0.25));
    z-index: -2;
    filter: blur(18px);
    opacity: 0.8;
}

.grid-8x8::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25), transparent 70%);
    z-index: -1;
    opacity: 0.6;
    animation: boardGlow 5s ease-in-out infinite;
}

/* Empty Cell */
.cell {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(145deg, rgba(24, 34, 58, 0.8), rgba(9, 14, 29, 0.9));
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.cell::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.cell.filled {
    border: none;
    box-shadow:
        0 6px 12px rgba(0, 0, 0, 0.45),
        0 0 20px rgba(255, 255, 255, 0.15);
    animation: cellPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cell.filled::before {
    opacity: 1;
}

.cell.filled::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 55%);
    opacity: 0;
    animation: cellShimmer 1.2s ease forwards;
    pointer-events: none;
}

/* Ghost Highlight (Visual Drop Preview) */
.highlight-ghost {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow:
        0 0 12px rgba(255, 255, 255, 0.35),
        inset 0 0 6px rgba(255, 255, 255, 0.4);
    z-index: 5;
    animation: ghostPulse 0.6s ease-in-out infinite alternate;
}

/* 3D Block Style Mixin via Classes */
.color-red {
    background: linear-gradient(135deg, #ff6b5b 0%, var(--block-red) 50%, #c0392b 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #a93226,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-orange {
    background: linear-gradient(135deg, #ffb347 0%, var(--block-orange) 50%, #d68910 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #b9770e,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-yellow {
    background: linear-gradient(135deg, #ffe066 0%, var(--block-yellow) 50%, #d4ac0d 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #b7950b,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-green {
    background: linear-gradient(135deg, #58d68d 0%, var(--block-green) 50%, #239b56 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #1d8348,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-cyan {
    background: linear-gradient(135deg, #5dade2 0%, var(--block-cyan) 50%, #2471a3 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #1a5276,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-blue {
    background: linear-gradient(135deg, #5499c7 0%, var(--block-blue) 50%, #1f618d 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #154360,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-purple {
    background: linear-gradient(135deg, #bb8fce 0%, var(--block-purple) 50%, #76448a 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #5b2c6f,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-teal {
    background: linear-gradient(135deg, #6ff1d5 0%, var(--block-teal) 50%, #148f77 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #117a65,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-pink {
    background: linear-gradient(135deg, #ffb0d6 0%, var(--block-pink) 50%, #c44569 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        0 3px 0 #ad3958,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Spawner */
#spawner-container {
    width: 100%;
    max-width: 420px;
    min-height: 105px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 14px;
    margin-top: 12px;
    margin-bottom: 6px;
    gap: 18px;
    position: relative;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(12, 26, 59, 0.9), rgba(6, 13, 32, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 20px 40px rgba(4, 6, 15, 0.65);
    overflow: visible;
}

.spawn-slot {
    flex: 1 1 110px;
    max-width: 120px;
    height: var(--spawn-slot-height);
    min-width: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    overflow: visible;
    position: relative;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 12px;
    background: rgba(12, 20, 38, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Block Part */
.block-part {
    width: var(--cell-size);
    height: var(--cell-size);
    border-radius: 5px;
}

/* Draggable Block */
.draggable-block {
    display: grid;
    gap: var(--gap-size);
    cursor: grab;
    touch-action: none;
    transition: transform 0.1s ease-out;
    will-change: transform, opacity;
}

.draggable-block:active {
    cursor: grabbing;
}

.spawn-slot .draggable-block {
    transform: scale(var(--spawn-scale)) !important;
    transform-origin: center center;
    will-change: transform;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
    animation: pieceIdle 3.6s ease-in-out infinite;
}

/* Animations */

@keyframes auroraDrift {
    0% {
        transform: translate3d(-5%, -5%, 0) scale(1);
    }

    50% {
        transform: translate3d(4%, 3%, 0) scale(1.05);
    }

    100% {
        transform: translate3d(-2%, 5%, 0) scale(0.95);
    }
}

@keyframes boardAura {
    0% {
        opacity: 0.4;
        transform: scale(0.98);
    }

    50% {
        opacity: 0.85;
        transform: scale(1);
    }

    100% {
        opacity: 0.4;
        transform: scale(0.98);
    }
}

@keyframes boardGlow {
    0% {
        opacity: 0.3;
        transform: scale(0.98);
    }

    60% {
        opacity: 0.75;
        transform: scale(1.02);
    }

    100% {
        opacity: 0.3;
        transform: scale(0.98);
    }
}

@keyframes scoreUnderline {
    0% {
        opacity: 0;
        transform: translateX(-20%);
    }

    40% {
        opacity: 1;
    }

    60% {
        transform: translateX(20%);
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateX(40%);
    }
}

@keyframes cellPop {
    0% {
        transform: translateZ(0) scale(0.6);
        filter: brightness(0.6);
    }

    70% {
        transform: translateZ(0) scale(1.1);
        filter: brightness(1.2);
    }

    100% {
        transform: translateZ(0) scale(1);
        filter: brightness(1);
    }
}

@keyframes cellShimmer {
    0% {
        opacity: 0;
        transform: scale(0.6);
    }

    40% {
        opacity: 0.8;
        transform: scale(1.05);
    }

    100% {
        opacity: 0;
        transform: scale(1.3);
    }
}

@keyframes ghostPulse {
    0% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

@keyframes spawnPulse {
    0% {
        opacity: 0.35;
        transform: scale(0.95);
    }

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

    100% {
        opacity: 0.35;
        transform: scale(0.95);
    }
}

@keyframes pieceIdle {
    0%,
    100% {
        transform: scale(0.55);
    }

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

@keyframes comboSpark {
    0% {
        opacity: 0.9;
        transform: scale(0.8);
    }

    100% {
        opacity: 0;
        transform: scale(1.3);
    }
}

@keyframes comboSuper {
    0% {
        opacity: 0.9;
        transform: scale(0.7);
        filter: blur(0px);
    }

    60% {
        opacity: 0.8;
        transform: scale(1.15);
        filter: blur(3px);
    }

    100% {
        opacity: 0;
        transform: scale(1.4);
        filter: blur(8px);
    }
}

@keyframes comboMega {
    0% {
        opacity: 1;
        transform: scale(0.6) rotate(0deg);
    }

    70% {
        opacity: 0.9;
        transform: scale(1.2) rotate(15deg);
    }

    100% {
        opacity: 0;
        transform: scale(1.4) rotate(25deg);
    }
}

@keyframes comboOmega {
    0% {
        opacity: 1;
        transform: scale(0.5) rotate(0deg);
        filter: blur(0px);
    }

    80% {
        opacity: 0.9;
        transform: scale(1.3) rotate(25deg);
        filter: blur(4px);
    }

    100% {
        opacity: 0;
        transform: scale(1.6) rotate(40deg);
        filter: blur(10px);
    }
}

@keyframes lineClearSpark {
    0% {
        opacity: 0.7;
        transform: scale(0.9);
    }

    100% {
        opacity: 0;
        transform: scale(1.4);
    }
}

@keyframes lineClearWave {
    0% {
        opacity: 0.8;
        transform: scaleX(0.8) scaleY(0.9);
    }

    70% {
        opacity: 0.7;
        transform: scaleX(1.2) scaleY(1.05);
    }

    100% {
        opacity: 0;
        transform: scaleX(1.3) scaleY(1.1);
    }
}

@keyframes lineClearStorm {
    0% {
        opacity: 1;
        transform: scale(0.6);
    }

    100% {
        opacity: 0;
        transform: scale(1.6);
        filter: blur(6px);
    }
}

@keyframes comboQuake {
    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    25% {
        transform: translate3d(4px, -3px, 0);
    }

    50% {
        transform: translate3d(-4px, 3px, 0);
    }

    75% {
        transform: translate3d(3px, 2px, 0);
    }
}

@keyframes gridFlash {
    0% {
        box-shadow: 0 0 0 rgba(255, 255, 255, 0.2);
        filter: brightness(1);
    }

    100% {
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.35);
        filter: brightness(1.2);
    }
}

@keyframes gridFlare {
    0% {
        box-shadow: 0 0 0 rgba(255, 255, 255, 0.2);
        transform: scale(1);
    }

    40% {
        box-shadow: 0 0 35px rgba(255, 255, 255, 0.4);
        transform: scale(1.02);
    }

    100% {
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.25);
        transform: scale(1);
    }
}

@keyframes scoreInferno {
    0% {
        transform: scale(1) rotate(-2deg);
    }

    40% {
        transform: scale(1.25) rotate(2deg);
    }

    70% {
        transform: scale(0.95) rotate(-1deg);
    }

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

@keyframes fireworkTrail {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.3);
    }

    60% {
        opacity: 1;
        transform: translate(calc(-50% + var(--tx) * 0.6), calc(-50% + var(--ty) * 0.6)) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.2);
    }
}

@keyframes fireworkHalo {
    0% {
        transform: scale(0.6);
        opacity: 0.9;
    }

    70% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

@keyframes fireworkShard {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) rotate(var(--shard-angle, 0rad)) scaleY(0.2);
    }

    60% {
        opacity: 0.8;
        transform: translate(calc(-50% + var(--shard-tx, 0px) * 0.4), calc(-50% + var(--shard-ty, 0px) * 0.4)) rotate(calc(var(--shard-angle, 0rad) + 0.1rad)) scaleY(1);
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--shard-tx, 0px)), calc(-50% + var(--shard-ty, 0px))) rotate(calc(var(--shard-angle, 0rad) + 0.2rad)) scaleY(0.6);
    }
}

@keyframes fireworkRing {
    0% {
        transform: scale(0.5);
        opacity: 0.9;
    }

    70% {
        opacity: 0.7;
        transform: scale(1.2);
    }

    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

@keyframes fabricStream {
    0% {
        opacity: 0.95;
        transform: translate(-50%, -50%) scale(0.4);
    }

    40% {
        opacity: 0.9;
        transform: translate(calc(-50% + var(--tx) * 0.4), calc(-50% + var(--ty) * 0.4)) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.7);
    }
}

@keyframes fabricFlow {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -10%) rotate(-10deg) scaleY(0.3);
    }

    50% {
        opacity: 0.75;
        transform: translate(-50%, -10%) rotate(-5deg) scaleY(1.1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -10%) rotate(-15deg) scaleY(1.4);
    }
}

@keyframes fireworkOrb {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.4);
    }

    60% {
        opacity: 0.8;
        transform: translate(calc(-50% + var(--tx) * 0.5), calc(-50% + var(--ty) * 0.5)) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.8);
    }
}

@keyframes fireworkStarLine {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scaleX(0.3);
    }

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

@keyframes fireworkDust {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.6);
    }

    60% {
        opacity: 0.8;
        transform: translate(calc(-50% + var(--tx) * 0.5), calc(-50% + var(--ty) * 0.5)) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.4);
    }
}

/* Screen shake for big clears */
@keyframes screenShake {

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

    20% {
        transform: translateX(-3px) rotate(-0.5deg);
    }

    40% {
        transform: translateX(3px) rotate(0.5deg);
    }

    60% {
        transform: translateX(-2px) rotate(-0.3deg);
    }

    80% {
        transform: translateX(2px) rotate(0.3deg);
    }
}

.screen-shake {
    animation: screenShake 0.3s ease-out;
}

/* ========== ENHANCED SPECTACULAR EFFECTS ========== */

/* Star Particle */
.star-particle {
    --tx: 0px;
    --ty: -100px;
    position: fixed;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 1800;
    mix-blend-mode: screen;
}

.star-particle::before {
    content: '⭐';
    font-size: 20px;
    position: absolute;
    filter: drop-shadow(0 0 8px var(--star-color, gold));
    animation: starBurst 1.2s ease-out forwards;
}

.star-particle.large::before {
    content: '✨';
    font-size: 28px;
}

@keyframes starBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
    }
    40% {
        opacity: 1;
        transform: translate(calc(-50% + var(--tx) * 0.5), calc(-50% + var(--ty) * 0.5)) scale(1.2) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.5) rotate(360deg);
    }
}

/* Glitter/Sparkle Effect */
.sparkle {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 1750;
    background: radial-gradient(circle, var(--sparkle-color, white) 0%, transparent 70%);
    border-radius: 50%;
    animation: sparkleFloat 0.8s ease-out forwards;
}

.sparkle::before,
.sparkle::after {
    content: '';
    position: absolute;
    background: var(--sparkle-color, white);
}

.sparkle::before {
    width: 2px;
    height: 16px;
    left: 4px;
    top: -3px;
    border-radius: 2px;
}

.sparkle::after {
    width: 16px;
    height: 2px;
    left: -3px;
    top: 4px;
    border-radius: 2px;
}

@keyframes sparkleFloat {
    0% {
        opacity: 1;
        transform: translate(var(--sx, 0), var(--sy, 0)) scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translate(calc(var(--sx, 0) + var(--tx) * 0.5), calc(var(--sy, 0) + var(--ty) * 0.5)) scale(1.5) rotate(90deg);
    }
    100% {
        opacity: 0;
        transform: translate(calc(var(--sx, 0) + var(--tx)), calc(var(--sy, 0) + var(--ty))) scale(0.3) rotate(180deg);
    }
}

/* Rainbow Wave Overlay */
.rainbow-wave-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1600;
    background: linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.15),
        rgba(255, 127, 0, 0.15),
        rgba(255, 255, 0, 0.15),
        rgba(0, 255, 0, 0.15),
        rgba(0, 127, 255, 0.15),
        rgba(75, 0, 130, 0.15),
        rgba(148, 0, 211, 0.15)
    );
    background-size: 200% 100%;
    mix-blend-mode: screen;
    animation: rainbowSweep 0.8s ease-out forwards;
}

@keyframes rainbowSweep {
    0% {
        opacity: 0;
        background-position: 200% 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        background-position: -100% 0;
    }
}

/* Lightning Effect */
.lightning-bolt {
    position: fixed;
    width: 4px;
    height: 100px;
    pointer-events: none;
    z-index: 1900;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 255, 255, 0.9) 20%,
        rgba(255, 255, 200, 1) 50%,
        rgba(255, 255, 255, 0.9) 80%,
        transparent 100%
    );
    filter: blur(1px);
    box-shadow:
        0 0 10px rgba(255, 255, 100, 0.8),
        0 0 20px rgba(255, 255, 100, 0.6),
        0 0 30px rgba(255, 255, 100, 0.4);
    animation: lightningFlash 0.3s ease-out forwards;
    clip-path: polygon(
        0% 0%, 60% 30%, 40% 30%, 100% 100%, 40% 60%, 60% 60%
    );
}

@keyframes lightningFlash {
    0% {
        opacity: 1;
        transform: scaleY(0);
    }
    20% {
        transform: scaleY(1);
    }
    40% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scaleY(1) translateY(50px);
    }
}

/* Enhanced Line Clear - MEGA Storm */
.line-clear-mega-storm {
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 1), transparent 40%),
        conic-gradient(from 0deg,
            rgba(255, 0, 0, 0.4),
            rgba(255, 165, 0, 0.4),
            rgba(255, 255, 0, 0.4),
            rgba(0, 255, 0, 0.4),
            rgba(0, 127, 255, 0.4),
            rgba(139, 0, 255, 0.4),
            rgba(255, 0, 0, 0.4)
        );
    animation: megaStorm 1s ease-out forwards;
}

@keyframes megaStorm {
    0% {
        opacity: 1;
        transform: scale(0.3) rotate(0deg);
        filter: brightness(2) saturate(2);
    }
    30% {
        opacity: 1;
        transform: scale(1.2) rotate(90deg);
    }
    100% {
        opacity: 0;
        transform: scale(2) rotate(180deg);
        filter: brightness(1) saturate(1) blur(10px);
    }
}

/* Shockwave Ring */
.shockwave-ring {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1550;
    border: 3px solid var(--ring-color, rgba(255, 255, 255, 0.8));
    box-shadow:
        0 0 15px var(--ring-color, rgba(255, 255, 255, 0.6)),
        inset 0 0 15px var(--ring-color, rgba(255, 255, 255, 0.3));
    animation: shockwaveExpand 0.6s ease-out forwards;
}

@keyframes shockwaveExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* Explosion Debris */
.explosion-debris {
    --tx: 0px;
    --ty: 0px;
    position: fixed;
    width: 8px;
    height: 8px;
    pointer-events: none;
    z-index: 1700;
    background: var(--debris-color, white);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--debris-glow, rgba(255, 200, 100, 0.8));
    animation: debrisFly 0.8s ease-out forwards;
}

@keyframes debrisFly {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.3) rotate(720deg);
    }
}

/* Confetti */
.confetti {
    --tx: 0px;
    --ty: 100px;
    position: fixed;
    width: 10px;
    height: 14px;
    pointer-events: none;
    z-index: 1650;
    background: var(--confetti-color, gold);
    animation: confettiFall 1.5s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) rotateX(720deg) rotateY(360deg) rotateZ(540deg);
    }
}

/* Enhanced Combo Display Fire Animation */
.combo-display.combo-active {
    position: relative;
}

.combo-display.combo-active::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: inherit;
    background: linear-gradient(45deg,
        rgba(255, 100, 0, 0.6),
        rgba(255, 200, 0, 0.6),
        rgba(255, 100, 0, 0.6)
    );
    background-size: 200% 200%;
    animation: comboFireGlow 0.5s ease-in-out infinite;
    filter: blur(8px);
    z-index: -1;
}

@keyframes comboFireGlow {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.8;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
}

/* Super Combo Shake - More Intense */
body.joowons-blast-game.super-combo-shake {
    animation: superComboQuake 0.6s ease-out;
}

@keyframes superComboQuake {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
    10% { transform: translate3d(-8px, -4px, 0) rotate(-1deg); }
    20% { transform: translate3d(8px, 4px, 0) rotate(1deg); }
    30% { transform: translate3d(-6px, 2px, 0) rotate(-0.5deg); }
    40% { transform: translate3d(6px, -2px, 0) rotate(0.5deg); }
    50% { transform: translate3d(-4px, 3px, 0) rotate(-0.3deg); }
    60% { transform: translate3d(4px, -3px, 0) rotate(0.3deg); }
    70% { transform: translate3d(-3px, 1px, 0) rotate(-0.2deg); }
    80% { transform: translate3d(3px, -1px, 0) rotate(0.2deg); }
    90% { transform: translate3d(-1px, 1px, 0) rotate(-0.1deg); }
}

/* Score MEGA Burst for high combos */
#score.score-mega-burst {
    animation: scoreMegaBurst 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scoreMegaBurst {
    0% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
    20% {
        transform: scale(1.8) rotate(-5deg);
        filter: brightness(2);
        text-shadow:
            0 0 20px rgba(255, 215, 0, 1),
            0 0 40px rgba(255, 100, 0, 0.8),
            0 0 60px rgba(255, 50, 0, 0.6);
    }
    40% {
        transform: scale(0.85) rotate(3deg);
    }
    60% {
        transform: scale(1.2) rotate(-1deg);
    }
    80% {
        transform: scale(0.95) rotate(0.5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
}

/* Pulse Ring Effect */
.pulse-ring {
    position: fixed;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1500;
    border: 4px solid var(--pulse-color, rgba(255, 255, 255, 0.7));
    animation: pulseRingExpand 0.7s ease-out forwards;
}

@keyframes pulseRingExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.2);
        opacity: 1;
        border-width: 8px;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
        border-width: 1px;
    }
}

/* Flash Bang Effect for mega clears */
.flash-bang {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2000;
    background: white;
    animation: flashBang 0.4s ease-out forwards;
}

@keyframes flashBang {
    0% {
        opacity: 0.9;
    }
    30% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
    }
}

/* Spectacular line clear with particles */
@keyframes clearExplosion {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }

    20% {
        transform: scale(1.3);
        filter: brightness(2) saturate(1.5);
        box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    }

    50% {
        transform: scale(1.1) rotate(5deg);
        opacity: 0.8;
        filter: brightness(1.8);
    }

    100% {
        transform: scale(0) rotate(15deg);
        opacity: 0;
    }
}

.clearing {
    animation: clearExplosion 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Block placement with satisfying bounce */
@keyframes placeImpact {
    0% {
        transform: scale(0.5);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.15);
        opacity: 1;
    }

    60% {
        transform: scale(0.95);
    }

    80% {
        transform: scale(1.05);
    }

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

.just-placed {
    animation: placeImpact 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Score pop animation */
@keyframes scoreBurst {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.4);
        color: #ffc107;
        text-shadow: 0 0 20px #ffc107, 0 0 40px #ff6b35;
    }

    60% {
        transform: scale(0.9);
    }

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

.score-pop {
    animation: scoreBurst 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Combo display enhanced */
@keyframes comboFire {
    0% {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.3) rotate(5deg);
        opacity: 1;
        text-shadow: 0 0 15px #ff6b35, 0 0 30px #ff3300;
    }

    70% {
        transform: scale(0.9) rotate(-2deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.combo-active {
    display: block;
    animation: comboFire 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Particle burst effect (pseudo-elements on grid) */
@keyframes particleBurst {
    0% {
        opacity: 1;
        transform: scale(0);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.5);
    }

    100% {
        opacity: 0;
        transform: scale(2);
    }
}

.cell.particle-burst::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: particleBurst 0.4s ease-out forwards;
    pointer-events: none;
}

/* Floating Text (Pop-up) */
.floating-text {
    position: fixed;
    /* Relative to viewport */
    pointer-events: none;
    z-index: 1000;
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.5);
    animation: floatUp 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    white-space: nowrap;
}

.floating-combo {
    color: #ff6b35;
    text-shadow: 0 4px 0 #8a2be2, 0 0 30px #ffcc00;
    /* Purple outline for impact */
    font-size: 3rem;
    font-style: italic;
}

.floating-perfect {
    color: #ffd700;
    /* Gold */
    font-size: 4rem;
    background: linear-gradient(to bottom, #fff 0%, #ffd700 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 0 #cc9900);
    /* Use filter for gradient text shadow */
    animation: floatUpBig 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -250%) scale(1);
    }
}

@keyframes floatUpBig {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2) rotate(-10deg);
    }

    30% {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1.5) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -200%) scale(1.2);
    }
}

.cell {
    position: relative;
    overflow: visible;
}

/* Block hover/drag enhancement */
.draggable-block:hover {
    filter: brightness(1.1);
}


/* Responsive */
@media (max-width: 400px) {
    :root {
        --cell-size: 38px;
    }
}

@media (max-width: 360px) {
    :root {
        --cell-size: 34px;
    }

    #score {
        font-size: 2.5rem;
    }
}

/* Spawn Animation */
@keyframes spawnPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.1);
        opacity: 1;
    }

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

.spawn-enter {
    animation: spawnPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.dragging-clone {
    /* CRITICAL: Disable all animations and transitions to prevent flash */
    animation: none !important;
    transition: none !important;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.4));
    pointer-events: none;
    z-index: 1000;
}

body.joowons-blast-game.dragging {
    cursor: grabbing !important;
}

.draggable-block {
    cursor: grab;
}

.draggable-block:active {
    cursor: grabbing;
}

/* Game Over Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.3s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg-gradient-bottom) 100%);
    border: 2px solid var(--grid-border);
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content h2 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-color);
    margin: 0 0 20px 0;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.modal-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 15px;
}

.score-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.score-value {
    font-size: 4rem;
    font-weight: 900;
    color: var(--block-yellow);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.new-best-badge {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--block-yellow);
    margin-bottom: 20px;
    animation: newBestPulse 1s ease-in-out infinite;
}

.new-best-badge.hidden {
    display: none;
}

.play-again-btn {
    background: linear-gradient(135deg, var(--block-green) 0%, #1d8348 100%);
    border: none;
    border-radius: 12px;
    padding: 15px 40px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 4px 0 #1d8348, 0 6px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}

.play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1d8348, 0 8px 20px rgba(0, 0, 0, 0.4);
}

.play-again-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1d8348, 0 4px 10px rgba(0, 0, 0, 0.3);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes newBestPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Game Over Overlay - shows first with board visible */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: pointer;
}

.game-over-overlay.hidden {
    display: none;
}

.game-over-text {
    text-align: center;
    animation: gameOverPulse 1.5s ease-in-out infinite;
}

.game-over-text h1 {
    font-size: 3rem;
    color: var(--block-red);
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.8),
                 0 4px 8px rgba(0, 0, 0, 0.5);
    margin: 0 0 20px 0;
    letter-spacing: 4px;
}

.game-over-score {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 30px;
}

.game-over-score span:last-child {
    color: var(--block-yellow);
    font-weight: bold;
}

.tap-to-continue {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    animation: blink 1s ease-in-out infinite;
}

@keyframes gameOverPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/* Game Over Content - scrollable */
.game-over-content {
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--grid-border) var(--grid-bg);
}

.game-over-content::-webkit-scrollbar {
    width: 6px;
}

.game-over-content::-webkit-scrollbar-track {
    background: var(--grid-bg);
    border-radius: 3px;
}

.game-over-content::-webkit-scrollbar-thumb {
    background: var(--grid-border);
    border-radius: 3px;
}

/* Name Input Section */
.name-input-section {
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.name-input-section.hidden {
    display: none;
}

.name-input-section label {
    display: block;
    margin-bottom: 10px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.name-input-section input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1.1rem;
    border: 2px solid var(--grid-border);
    border-radius: 10px;
    background: var(--grid-bg);
    color: var(--text-color);
    outline: none;
    margin-bottom: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.name-input-section input:focus {
    border-color: var(--block-cyan);
    box-shadow: 0 0 12px rgba(52, 152, 219, 0.4);
}

.name-input-section input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.save-score-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--block-cyan) 0%, var(--block-blue) 100%);
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 4px 0 #1a5276, 0 6px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}

.save-score-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1a5276, 0 8px 20px rgba(0, 0, 0, 0.4);
}

.save-score-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1a5276, 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Leaderboard Section */
.leaderboard-section {
    margin: 20px 0;
    text-align: left;
}

.leaderboard-section h3 {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--block-yellow);
}

.leaderboard {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--grid-border) var(--grid-bg);
}

.leaderboard::-webkit-scrollbar {
    width: 5px;
}

.leaderboard::-webkit-scrollbar-track {
    background: var(--grid-bg);
    border-radius: 3px;
}

.leaderboard::-webkit-scrollbar-thumb {
    background: var(--grid-border);
    border-radius: 3px;
}

.leaderboard-empty {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.leaderboard-entry:last-child {
    margin-bottom: 0;
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-entry.highlight {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.3), rgba(41, 128, 185, 0.2));
    border: 1px solid rgba(52, 152, 219, 0.5);
    animation: highlightPulse 1.5s ease-in-out infinite;
}

.leaderboard-entry.rank-gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 193, 7, 0.15));
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.leaderboard-entry.rank-silver {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(169, 169, 169, 0.1));
    border: 1px solid rgba(192, 192, 192, 0.3);
}

.leaderboard-entry.rank-bronze {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(184, 115, 51, 0.1));
    border: 1px solid rgba(205, 127, 50, 0.3);
}

.leaderboard-entry .rank {
    width: 30px;
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.leaderboard-entry.rank-gold .rank {
    color: var(--block-yellow);
}

.leaderboard-entry.rank-silver .rank {
    color: #c0c0c0;
}

.leaderboard-entry.rank-bronze .rank {
    color: #cd7f32;
}

.leaderboard-entry .name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-entry .score {
    font-size: 1rem;
    font-weight: 700;
    color: var(--block-cyan);
    min-width: 70px;
    text-align: right;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(52, 152, 219, 0.6);
    }
}

/* ========== DEBUG PANEL ========== */
.debug-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.debug-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
}

.debug-toggle:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.85);
}

.debug-content {
    position: absolute;
    top: 50px;
    right: 0;
    width: 280px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.debug-content.hidden {
    display: none;
}

.debug-content h4 {
    margin: 0 0 12px 0;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.debug-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.debug-buttons button {
    padding: 10px 8px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: center;
}

.debug-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.debug-buttons button:active {
    transform: translateY(0);
}

/* Different colors for different effect types */
.debug-buttons button:nth-child(1) { background: linear-gradient(135deg, #f39c12, #e67e22); }
.debug-buttons button:nth-child(2) { background: linear-gradient(135deg, #f1c40f, #f39c12); }
.debug-buttons button:nth-child(3) { background: linear-gradient(135deg, #3498db, #2980b9); }
.debug-buttons button:nth-child(4) { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.debug-buttons button:nth-child(5) { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.debug-buttons button:nth-child(6) { background: linear-gradient(135deg, #1abc9c, #16a085); }
.debug-buttons button:nth-child(7) { background: linear-gradient(135deg, #fd79a8, #e84393); }
.debug-buttons button:nth-child(8) { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.debug-buttons button:nth-child(9) { background: linear-gradient(135deg, #e74c3c, #8e44ad); }
.debug-buttons button:nth-child(10) { background: linear-gradient(135deg, #f39c12, #e74c3c); }
.debug-buttons button:nth-child(11) { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.debug-buttons button:nth-child(12) { background: linear-gradient(135deg, #2ecc71, #1abc9c); }
.debug-buttons button:nth-child(13) { background: linear-gradient(135deg, #f1c40f, #f39c12); }
.debug-buttons button:nth-child(14) { background: linear-gradient(135deg, #9b59b6, #3498db); }
/* Header score tweaks */
.header-current-score {
    width: 100%;
    margin: 0;
}

.header-current-score #score {
    font-size: 2.2rem;
}

.header-current-score .combo-display {
    margin-top: 2px;
}

.modal-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

.modal-title-row h3 {
    font-size: 1.5rem;
    margin: 0;
}

.modal-close-btn {
    border: none;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.8);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.35);
    transform: rotate(4deg);
}

.leaderboard-modal-content {
    max-width: 420px;
}

/* ========== LOADING OVERLAY ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg-gradient-bottom) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    padding: 40px;
}

.loading-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-color);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    animation: loadingPulse 2s ease-in-out infinite;
}

.loading-status {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    min-height: 24px;
}

.loading-bar-container {
    width: 250px;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 15px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--block-cyan), var(--block-green));
    border-radius: 4px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.loading-percent {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--block-cyan);
}

@keyframes loadingPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* Click to Play Button */
.click-to-play-btn {
    position: absolute;
    left: 50%;
    top: 60%;
    translate: -50% -50%;
    padding: 20px 50px;
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--block-green) 0%, var(--block-cyan) 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 30px rgba(46, 204, 113, 0.3);
    transform: scale(0);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

.click-to-play-btn.visible {
    transform: scale(1);
    opacity: 1;
    animation: playBtnPulse 2s ease-in-out infinite;
}

.click-to-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), 0 0 50px rgba(46, 204, 113, 0.5);
}

.click-to-play-btn:active {
    transform: scale(0.95);
}

@keyframes playBtnPulse {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 30px rgba(46, 204, 113, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 50px rgba(46, 204, 113, 0.6);
    }
}

/* ========== USER ACTION EFFECTS (CSS-based) ========== */

/* Pickup Effect - Burst of particles when picking up block */
.pickup-effect {
    position: fixed;
    width: 60px;
    height: 60px;
    pointer-events: none;
    z-index: 1600;
    transform: translate(-50%, -50%);
}

.pickup-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--effect-color, rgba(255, 255, 255, 0.9)) 0%, transparent 70%);
    animation: pickupBurst 0.4s ease-out forwards;
}

.pickup-effect::after {
    content: '';
    position: absolute;
    inset: -10px;
    border: 3px solid var(--effect-color, rgba(255, 255, 255, 0.7));
    border-radius: 50%;
    animation: pickupRing 0.5s ease-out forwards;
}

@keyframes pickupBurst {
    0% {
        transform: scale(0.2);
        opacity: 1;
    }
    60% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes pickupRing {
    0% {
        transform: scale(0.5);
        opacity: 0.9;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Pickup particle dots */
.pickup-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--particle-color, white);
    pointer-events: none;
    z-index: 1610;
    box-shadow: 0 0 6px var(--particle-color, white);
    animation: pickupParticle 0.5s ease-out forwards;
}

@keyframes pickupParticle {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--px, 0px)), calc(-50% + var(--py, 0px))) scale(0.3);
        opacity: 0;
    }
}

/* Drop Success Effect - Impact splash */
.drop-success-effect {
    position: fixed;
    width: 80px;
    height: 80px;
    pointer-events: none;
    z-index: 1600;
    transform: translate(-50%, -50%);
}

.drop-success-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle,
        var(--effect-color, rgba(46, 204, 113, 0.9)) 0%,
        var(--effect-color-mid, rgba(46, 204, 113, 0.5)) 40%,
        transparent 70%);
    animation: dropSuccessBurst 0.5s ease-out forwards;
}

.drop-success-effect::after {
    content: '';
    position: absolute;
    inset: 5px;
    border: 4px solid var(--effect-color, rgba(46, 204, 113, 0.8));
    border-radius: 50%;
    animation: dropSuccessRing 0.6s ease-out forwards;
}

@keyframes dropSuccessBurst {
    0% {
        transform: scale(0.3);
        opacity: 1;
        filter: brightness(1.5);
    }
    50% {
        transform: scale(1.3);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
        filter: brightness(1);
    }
}

@keyframes dropSuccessRing {
    0% {
        transform: scale(0.4);
        opacity: 1;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Drop success sparkle particles */
.drop-success-sparkle {
    position: fixed;
    width: 6px;
    height: 6px;
    pointer-events: none;
    z-index: 1610;
    background: var(--sparkle-color, white);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--sparkle-color, white);
    animation: dropSparkle 0.6s ease-out forwards;
}

@keyframes dropSparkle {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(calc(-50% + var(--sx, 0px) * 0.7), calc(-50% + var(--sy, 0px) * 0.7)) scale(1.3);
        opacity: 0.9;
    }
    100% {
        transform: translate(calc(-50% + var(--sx, 0px)), calc(-50% + var(--sy, 0px))) scale(0);
        opacity: 0;
    }
}

/* Drop Fail Effect - Shake and reject */
.drop-fail-effect {
    position: fixed;
    width: 50px;
    height: 50px;
    pointer-events: none;
    z-index: 1600;
    transform: translate(-50%, -50%);
}

.drop-fail-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(231, 76, 60, 0.8) 0%, transparent 70%);
    animation: dropFailPulse 0.35s ease-out forwards;
}

.drop-fail-effect::after {
    content: '✕';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: rgba(231, 76, 60, 0.9);
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.8);
    animation: dropFailX 0.4s ease-out forwards;
}

@keyframes dropFailPulse {
    0% {
        transform: scale(0.5);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes dropFailX {
    0% {
        transform: scale(0) rotate(-90deg);
        opacity: 0;
    }
    40% {
        transform: scale(1.3) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: scale(0.8) rotate(0deg);
        opacity: 0;
    }
}

/* Button Click Effect - Ripple */
.button-click-effect {
    position: fixed;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 1600;
    transform: translate(-50%, -50%);
}

.button-click-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    animation: buttonClickBurst 0.35s ease-out forwards;
}

.button-click-effect::after {
    content: '';
    position: absolute;
    inset: -5px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: buttonClickRing 0.45s ease-out forwards;
}

@keyframes buttonClickBurst {
    0% {
        transform: scale(0.3);
        opacity: 1;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@keyframes buttonClickRing {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Score Add Effect - Floating number animation */
.score-add-effect {
    position: fixed;
    pointer-events: none;
    z-index: 1600;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--score-color, #ffc107);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 20px var(--score-glow, rgba(255, 193, 7, 0.6));
    transform: translate(-50%, -50%);
    animation: scoreAddFloat 0.8s ease-out forwards;
    white-space: nowrap;
}

@keyframes scoreAddFloat {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -80%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -180%) scale(1);
        opacity: 0;
    }
}

/* ========== DOM-BASED GAME EFFECTS ========== */

.game-effect {
    position: fixed;
    pointer-events: none;
    z-index: 1500;
    transform: translate(-50%, -50%);
}

/* Sparkle Effect */
.sparkle-particle {
    width: 8px;
    height: 8px;
    background: var(--color, #ffd700);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--color, #ffd700), 0 0 20px var(--color, #ffd700);
    animation: sparkleMove 0.4s ease-out forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes sparkleMove {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(0);
        opacity: 0;
    }
}

/* Star Effect */
.star-flash {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(255,215,0,0.5) 50%, transparent 70%);
    border-radius: 50%;
    animation: starFlash 0.25s ease-out forwards;
}

@keyframes starFlash {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.star-particle {
    width: var(--size, 18px);
    height: var(--size, 18px);
    background: var(--color, #ffd700);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: starMove 0.5s ease-out forwards;
}

@keyframes starMove {
    0% {
        transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(0.3) rotate(180deg);
        opacity: 0;
    }
}

/* Diamond Effect */
.diamond-particle {
    width: 12px;
    height: 12px;
    background: var(--color, #00ffff);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    box-shadow: 0 0 8px var(--color, #00ffff);
    animation: diamondFall 0.6s ease-in forwards;
}

@keyframes diamondFall {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--fall-x, 0px)), calc(-50% + 150px)) rotate(var(--rotation, 360deg)) scale(0.5);
        opacity: 0;
    }
}

/* Heart Effect */
.heart-particle {
    width: var(--size, 14px);
    height: var(--size, 14px);
    background: var(--color, #ff69b4);
    transform: translate(-50%, -50%) rotate(-45deg);
    animation: heartMove 0.5s ease-out forwards;
}

.heart-particle::before,
.heart-particle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: 50%;
}

.heart-particle::before {
    top: -50%;
    left: 0;
}

.heart-particle::after {
    top: 0;
    left: 50%;
}

@keyframes heartMove {
    0% {
        transform: translate(-50%, -50%) rotate(-45deg) scale(0.5);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) rotate(-45deg) scale(0.2);
        opacity: 0;
    }
}

/* Firework Effect */
.firework-flash {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, var(--color, #ffd700) 0%, transparent 70%);
    border-radius: 50%;
    animation: fireworkFlash 0.18s ease-out forwards;
}

@keyframes fireworkFlash {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.firework-particle {
    width: 6px;
    height: 6px;
    background: var(--color, #ffd700);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--color, #ffd700);
    animation: fireworkBurst 0.5s ease-out forwards;
}

@keyframes fireworkBurst {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    70% {
        opacity: 0.8;
    }
    100% {
        transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(0);
        opacity: 0;
    }
}

/* Rainbow Effect */
.rainbow-ring {
    width: 20px;
    height: 20px;
    border: 4px solid var(--color, #ff0000);
    border-radius: 50%;
    animation: rainbowExpand 0.4s ease-out forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes rainbowExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* Confetti Effect */
.confetti-particle {
    width: 10px;
    height: 10px;
    background: var(--color, #ff6b6b);
    animation: confettiFall var(--duration, 0.7s) ease-in forwards;
}

@keyframes confettiFall {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--fall-x, 0px)), calc(-50% + 200px)) rotate(var(--rotation, 360deg)) scale(0.5);
        opacity: 0;
    }
}

/* Mega Effect */
.mega-flash {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(255,215,0,0.8) 30%, transparent 70%);
    border-radius: 50%;
    animation: megaFlash 0.3s ease-out forwards;
}

@keyframes megaFlash {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

.mega-ring {
    width: 30px;
    height: 30px;
    border: 5px solid rgba(255, 215, 0, 0.8);
    border-radius: 50%;
    animation: megaRingExpand 0.4s ease-out forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes megaRingExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
        border-width: 5px;
    }
    100% {
        transform: translate(-50%, -50%) scale(5);
        opacity: 0;
        border-width: 2px;
    }
}

.mega-star {
    width: 16px;
    height: 16px;
    background: var(--color, #ffd700);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: megaStarMove 0.6s ease-out forwards;
}

@keyframes megaStarMove {
    0% {
        transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(0.2) rotate(360deg);
        opacity: 0;
    }
}
