* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    overflow: hidden;
    height: 100%;
}

:root {
    --bg-primary: #e8f4fc;
    --bg-secondary: #d0e8f5;
    --bg-gradient: linear-gradient(135deg, #e0f0ff 0%, #f0e8ff 50%, #ffe8f0 100%);
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --accent-color: #667eea;
    --accent-light: #7c94f4;
    --cell-bg: rgba(255, 255, 255, 0.6);
    --cell-border: rgba(255, 255, 255, 0.8);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --modal-bg: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --accent-color: #7c94f4;
    --accent-light: #a0b4ff;
    --cell-bg: rgba(255, 255, 255, 0.1);
    --cell-border: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --modal-bg: rgba(26, 26, 46, 0.95);
}

[data-theme="zen"] {
    --bg-primary: #e8f5e9;
    --bg-secondary: #c8e6c9;
    --bg-gradient: linear-gradient(135deg, #e8f5e9 0%, #dcedc8 50%, #f1f8e9 100%);
    --text-primary: #2e7d32;
    --text-secondary: #558b2f;
    --accent-color: #66bb6a;
    --accent-light: #81c784;
    --cell-bg: rgba(255, 255, 255, 0.5);
    --cell-border: rgba(129, 199, 132, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.08);
    --modal-bg: rgba(232, 245, 233, 0.95);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
    transition: background 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('assets/backgrounds/light.png');
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: -1;
    transition: opacity 0.3s ease;
}

[data-theme="dark"] body::before {
    background-image: url('assets/backgrounds/dark.png');
    opacity: 0.5;
}

[data-theme="zen"] body::before {
    background-image: url('assets/backgrounds/zen.png');
    opacity: 0.4;
}

.hidden {
    display: none !important;
}

/* Screens */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Splash Screen */
#splash-screen {
    background: var(--bg-gradient);
}

.splash-content {
    text-align: center;
}

.logo {
    width: 280px;
    max-width: 80vw;
    height: auto;
    margin-bottom: 40px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px var(--shadow-color));
}

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

.loading-bar {
    width: 200px;
    height: 8px;
    background: var(--cell-bg);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 15px;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    border-radius: 4px;
    animation: loading 2s ease-out forwards;
}

@keyframes loading {
    0% { width: 0%; }
    100% { width: 100%; }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Main Menu */
.menu-content {
    text-align: center;
}

.branding-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 6px 12px;
    margin-top: 20px;
    display: inline-block;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .branding-label {
    color: var(--text-secondary);
    opacity: 0.6;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.btn {
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

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

.btn-secondary {
    background: var(--cell-bg);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    border: 2px solid var(--cell-border);
}

.btn-secondary:hover {
    background: var(--cell-border);
    transform: translateY(-2px);
}

.btn-reward {
    background: linear-gradient(135deg, #ff9800, #ff5722);
    color: white;
    box-shadow: 0 5px 20px rgba(255, 152, 0, 0.4);
    animation: pulse-reward 2s infinite;
}

.btn-reward:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.5);
}

@keyframes pulse-reward {
    0%, 100% { box-shadow: 0 5px 20px rgba(255, 152, 0, 0.4); }
    50% { box-shadow: 0 5px 30px rgba(255, 152, 0, 0.7); }
}

.highscore-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    background: var(--cell-bg);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.trophy-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

#menu-highscore {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--modal-bg);
    padding: 30px;
    border-radius: 25px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px var(--shadow-color);
}

.modal-content h2 {
    margin-bottom: 25px;
    font-size: 28px;
    color: var(--text-primary);
}

/* Settings */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--cell-border);
}

.setting-item:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}

.theme-buttons {
    display: flex;
    gap: 8px;
}

.theme-btn {
    padding: 8px 15px;
    border: 2px solid var(--cell-border);
    background: transparent;
    border-radius: 15px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.theme-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Switch Toggle */
.switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--cell-bg);
    transition: 0.3s;
    border-radius: 26px;
    border: 2px solid var(--cell-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* How to Play */
.howto-content {
    max-width: 450px;
}

.howto-steps {
    text-align: left;
    margin-bottom: 25px;
}

.howto-step {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.step-number {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.howto-step p {
    color: var(--text-secondary);
    font-size: 14px;
}

.block-evolution {
    background: var(--cell-bg);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.block-evolution h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.evolution-chain {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.evolution-chain img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.evolution-chain .arrow {
    color: var(--accent-color);
    font-weight: bold;
}

.evolution-chain .more {
    color: var(--text-secondary);
}

/* Game Screen */
#game-screen {
    flex-direction: column;
    padding: 10px;
    gap: 10px;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    padding: 10px;
}

.icon-btn {
    width: 45px;
    height: 45px;
    border: none;
    background: var(--cell-bg);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.icon-btn svg {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
}

.icon-btn:hover {
    background: var(--cell-border);
    transform: scale(1.05);
}

.score-container {
    display: flex;
    gap: 15px;
}

.score-box {
    background: var(--cell-bg);
    padding: 8px 20px;
    border-radius: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.score-label {
    display: block;
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 1px;
}

.score-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--accent-color);
}

.multiplier {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #333;
    padding: 5px 12px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
    animation: pulse 1s ease-in-out infinite;
}

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

/* Game Board */
.game-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 18px;
    background: linear-gradient(145deg, rgba(255,255,255,0.8), rgba(255,255,255,0.4));
    border-radius: 24px;
    backdrop-filter: blur(15px);
    box-shadow:
        0 15px 50px var(--shadow-color),
        0 0 0 1px rgba(255,255,255,0.5),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

[data-theme="dark"] .game-board {
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    box-shadow:
        0 15px 50px var(--shadow-color),
        0 0 0 1px rgba(255,255,255,0.1),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.cell {
    width: 58px;
    height: 58px;
    background: linear-gradient(145deg, rgba(255,255,255,0.6), rgba(255,255,255,0.3));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(0,0,0,0.05),
        0 2px 8px rgba(0,0,0,0.08);
}

[data-theme="dark"] .cell {
    background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.1),
        inset 0 -2px 4px rgba(0,0,0,0.2),
        0 2px 8px rgba(0,0,0,0.2);
}

.cell.has-block {
    background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(255,255,255,0.6));
    box-shadow:
        0 4px 15px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

[data-theme="dark"] .cell.has-block {
    background: linear-gradient(145deg, rgba(255,255,255,0.2), rgba(255,255,255,0.08));
}

.cell.highlight {
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.4), rgba(102, 126, 234, 0.2));
    transform: scale(1.08);
    box-shadow:
        0 0 20px rgba(102, 126, 234, 0.4),
        inset 0 0 10px rgba(102, 126, 234, 0.2);
}

.cell.invalid {
    background: linear-gradient(145deg, rgba(255, 100, 100, 0.4), rgba(255, 100, 100, 0.2));
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.3);
}

.cell img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.2));
    transition: transform 0.2s ease;
}

.cell:hover img {
    transform: scale(1.05);
}

.cell.merging img {
    animation: merge 0.4s ease-out;
}

@keyframes merge {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.cell.pop img {
    animation: pop 0.3s ease-out forwards;
}

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

.cell.spawn img {
    animation: spawn 0.3s ease-out;
}

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

/* Next Blocks */
.next-blocks-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
    margin-top: 5px;
}

.next-blocks-container h3 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.next-blocks {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 18px 25px;
    background: linear-gradient(145deg, rgba(255,255,255,0.7), rgba(255,255,255,0.3));
    border-radius: 22px;
    backdrop-filter: blur(15px);
    box-shadow:
        0 8px 32px var(--shadow-color),
        inset 0 1px 0 rgba(255,255,255,0.6);
}

[data-theme="dark"] .next-blocks {
    background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
    box-shadow:
        0 8px 32px var(--shadow-color),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.next-block {
    width: 72px;
    height: 72px;
    background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(255,255,255,0.5));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: none;
    box-shadow:
        0 4px 15px rgba(0,0,0,0.1),
        inset 0 2px 4px rgba(255,255,255,0.8),
        inset 0 -2px 4px rgba(0,0,0,0.05);
}

[data-theme="dark"] .next-block {
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    box-shadow:
        0 4px 15px rgba(0,0,0,0.3),
        inset 0 1px 2px rgba(255,255,255,0.1);
}

.next-block:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow:
        0 12px 30px rgba(0,0,0,0.2),
        inset 0 2px 4px rgba(255,255,255,0.8);
}

.next-block:active {
    transform: scale(1.05);
    cursor: grabbing;
}

.next-block.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    cursor: grabbing;
}

.next-block img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.2));
    transition: transform 0.2s ease;
}

.next-block:hover img {
    transform: scale(1.05);
}

.next-block.empty {
    opacity: 0.25;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
}

/* Power-ups */
.powerups-container {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 15px 10px;
}

.powerup-btn {
    width: 62px;
    height: 62px;
    border: none;
    background: linear-gradient(145deg, rgba(255,255,255,0.8), rgba(255,255,255,0.4));
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 15px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

[data-theme="dark"] .powerup-btn {
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    box-shadow:
        0 4px 15px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.powerup-btn:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
    box-shadow:
        0 10px 30px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.powerup-btn:active:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
}

.powerup-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.powerup-btn.active {
    box-shadow:
        0 0 0 3px var(--accent-color),
        0 0 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.2), rgba(102, 126, 234, 0.1));
}

.powerup-btn img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transition: transform 0.2s ease;
}

.powerup-btn:hover:not(:disabled) img {
    transform: scale(1.1);
}

.powerup-count {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Game Over */
.gameover-content {
    padding: 40px 30px;
}

.final-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.trophy-large {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.score-details {
    text-align: left;
}

.final-score-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.final-score-value {
    font-size: 42px;
    font-weight: 800;
    color: var(--accent-color);
    line-height: 1;
}

.new-record {
    color: #ffd700;
    font-weight: 700;
    font-size: 16px;
    animation: pulse 1s ease-in-out infinite;
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Floating Scores */
#floating-scores {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;
}

.floating-score {
    position: absolute;
    font-size: 24px;
    font-weight: 800;
    color: var(--accent-color);
    text-shadow: 0 2px 10px var(--shadow-color);
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(1.2);
    }
}

/* Responsive */
@media (max-width: 420px) {
    .cell {
        width: 52px;
        height: 52px;
    }

    .cell img {
        width: 42px;
        height: 42px;
    }

    .next-block {
        width: 58px;
        height: 58px;
    }

    .next-block img {
        width: 46px;
        height: 46px;
    }

    .game-board {
        gap: 6px;
        padding: 12px;
    }

    .logo {
        width: 200px;
    }

    .btn {
        padding: 12px 35px;
        font-size: 15px;
    }

    .score-box {
        padding: 6px 12px;
    }

    .score-value {
        font-size: 16px;
    }

    .powerup-btn {
        width: 55px;
        height: 55px;
    }

    .powerup-btn img {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 360px) {
    .cell {
        width: 48px;
        height: 48px;
    }

    .cell img {
        width: 38px;
        height: 38px;
    }

    .next-block {
        width: 52px;
        height: 52px;
    }

    .next-block img {
        width: 42px;
        height: 42px;
    }

    .game-board {
        gap: 5px;
        padding: 10px;
    }

    .next-blocks {
        gap: 12px;
        padding: 12px 15px;
    }

    .powerups-container {
        gap: 12px;
    }

    .powerup-btn {
        width: 50px;
        height: 50px;
    }

    .powerup-btn img {
        width: 32px;
        height: 32px;
    }

    .logo {
        width: 180px;
    }
}

@media (max-height: 700px) {
    .cell {
        width: 48px;
        height: 48px;
    }

    .cell img {
        width: 38px;
        height: 38px;
    }

    .next-block {
        width: 52px;
        height: 52px;
    }

    .next-block img {
        width: 42px;
        height: 42px;
    }

    .powerup-btn {
        width: 52px;
        height: 52px;
    }

    .powerup-btn img {
        width: 35px;
        height: 35px;
    }

    .game-header {
        padding: 5px 10px;
    }

    .next-blocks-container {
        margin-top: 0;
    }

    .next-blocks-container h3 {
        margin-bottom: 6px;
        font-size: 11px;
    }

    .powerups-container {
        padding: 5px;
    }
}

@media (max-height: 600px) {
    .cell {
        width: 42px;
        height: 42px;
    }

    .cell img {
        width: 34px;
        height: 34px;
    }

    .game-board {
        gap: 4px;
        padding: 8px;
    }

    .next-block {
        width: 48px;
        height: 48px;
    }

    .next-block img {
        width: 38px;
        height: 38px;
    }

    .next-blocks {
        padding: 10px 15px;
        gap: 10px;
    }

    .powerup-btn {
        width: 48px;
        height: 48px;
    }

    .powerup-btn img {
        width: 32px;
        height: 32px;
    }

    .powerup-count {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

/* Drag ghost element */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.85;
    transform: translate(-50%, -50%);
    width: 55px !important;
    height: 55px !important;
    max-width: 55px !important;
    max-height: 55px !important;
    overflow: hidden;
}

.drag-ghost img {
    width: 55px !important;
    height: 55px !important;
    max-width: 55px !important;
    max-height: 55px !important;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.tutorial-content {
    background: var(--modal-bg);
    border-radius: 25px;
    padding: 30px;
    max-width: 380px;
    width: 90%;
    text-align: center;
}

.tutorial-content h2 {
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 24px;
}

.tutorial-step {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    text-align: left;
    padding: 15px;
    background: var(--cell-bg);
    border-radius: 15px;
}

.tutorial-step-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.tutorial-step p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.tutorial-step strong {
    color: var(--text-primary);
}

.tutorial-demo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: var(--cell-bg);
    border-radius: 15px;
}

.tutorial-demo img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.tutorial-demo .plus {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
}

.tutorial-demo .equals {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
}

.tutorial-btn {
    margin-top: 10px;
}

/* Reward Modal */
.reward-content {
    text-align: center;
}

.reward-content h2 {
    margin-bottom: 15px;
}

.reward-description {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-color);
    margin: 20px 0;
}

.reward-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Tutorial Content from HTML */
.tutorial-content {
    text-align: center;
    padding: 20px;
}

.tutorial-content h2 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.tutorial-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
}

/* Portrait/Landscape body classes for GamePush */
body.portrait .game-board-container {
    max-width: 100%;
}

body.landscape .game-board-container {
    max-width: 50vh;
}

body.landscape .game-header {
    padding: 5px 15px;
}

body.landscape .next-blocks-container {
    padding: 8px;
}

body.landscape .powerups-container {
    padding: 5px;
}

/* RTL Support for Arabic */
body.rtl {
    direction: rtl;
    text-align: right;
}

body.rtl .menu-buttons,
body.rtl .gameover-buttons,
body.rtl .reward-buttons {
    direction: rtl;
}

body.rtl .setting-item {
    flex-direction: row-reverse;
}

body.rtl .theme-buttons {
    flex-direction: row-reverse;
}

body.rtl .score-container {
    flex-direction: row-reverse;
}

body.rtl .howto-step {
    flex-direction: row-reverse;
    text-align: right;
}

body.rtl .evolution-chain {
    flex-direction: row-reverse;
}

body.rtl .arrow {
    transform: scaleX(-1);
}

body.rtl .powerups-container {
    flex-direction: row-reverse;
}

body.rtl .next-blocks {
    flex-direction: row-reverse;
}

body.rtl .game-header {
    flex-direction: row-reverse;
}

/* Extended Tutorial Styles */
.tutorial-content-extended {
    max-width: 340px !important;
    width: 90% !important;
    padding: 20px 15px !important;
    max-height: 80vh;
    overflow-y: auto;
}

.tutorial-content-extended h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 22px;
}

.tutorial-steps-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.tutorial-step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--cell-bg);
    border-radius: 12px;
    text-align: left;
    border: 1px solid var(--cell-border);
}

.tutorial-step-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    min-width: 70px;
    max-width: 70px;
}

.tutorial-step-icon img {
    max-width: 28px !important;
    max-height: 28px !important;
    width: 28px !important;
    height: 28px !important;
    object-fit: contain !important;
}

.tutorial-block-icon {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    object-fit: contain !important;
    animation: tutorialBounce 1s ease-in-out infinite;
}

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

.tutorial-arrow {
    font-size: 16px;
    color: var(--accent-color);
    margin-left: 3px;
    animation: tutorialArrowMove 1s ease-in-out infinite;
}

@keyframes tutorialArrowMove {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(3px); opacity: 0.6; }
}

.tutorial-merge-demo {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
    justify-content: center;
}

.tutorial-merge-demo img {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    object-fit: contain !important;
}

.tutorial-merge-arrow {
    font-size: 12px;
    font-weight: bold;
    color: var(--accent-color);
    margin: 0 2px;
}

.tutorial-result-block {
    animation: tutorialPulse 1s ease-in-out infinite;
}

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

.tutorial-powerups-demo {
    display: flex;
    gap: 5px;
}

.tutorial-powerups-demo img {
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    object-fit: contain !important;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.tutorial-points-demo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-points {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent-color);
    animation: tutorialPointsFloat 1.5s ease-in-out infinite;
}

@keyframes tutorialPointsFloat {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(-3px); opacity: 0.8; }
}

.tutorial-step-text {
    flex: 1;
    min-width: 0;
}

.tutorial-step-text strong {
    display: block;
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 2px;
}

.tutorial-step-text p {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.3;
    margin: 0;
}

.tutorial-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 165, 0, 0.1));
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.tutorial-tip-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.tutorial-tip p {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.3;
    margin: 0;
    font-style: italic;
}

.tutorial-btn {
    width: 100%;
    margin-top: 5px;
    padding: 12px 20px;
    font-size: 15px;
}

/* Tutorial responsive adjustments */
@media (max-height: 600px) {
    .tutorial-content-extended {
        padding: 15px 12px !important;
        max-height: 85vh;
    }

    .tutorial-content-extended h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .tutorial-steps-container {
        gap: 8px;
    }

    .tutorial-step-item {
        padding: 8px 10px;
        gap: 10px;
    }

    .tutorial-step-icon {
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }

    .tutorial-step-icon img,
    .tutorial-block-icon {
        width: 22px !important;
        height: 22px !important;
        max-width: 22px !important;
        max-height: 22px !important;
    }

    .tutorial-merge-demo img {
        width: 14px !important;
        height: 14px !important;
        max-width: 14px !important;
        max-height: 14px !important;
    }

    .tutorial-powerups-demo img {
        width: 18px !important;
        height: 18px !important;
        max-width: 18px !important;
        max-height: 18px !important;
    }

    .tutorial-step-text strong {
        font-size: 12px;
    }

    .tutorial-step-text p {
        font-size: 10px;
    }

    .tutorial-tip {
        padding: 8px 10px;
        margin-bottom: 10px;
    }

    .tutorial-tip-icon {
        font-size: 16px;
    }

    .tutorial-tip p {
        font-size: 10px;
    }

    .tutorial-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Language Selector */
.language-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid var(--accent-color);
    background: var(--cell-bg);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    min-width: 140px;
    transition: all 0.2s ease;
}

.language-select:hover {
    border-color: var(--accent-light);
    background: var(--bg-secondary);
}

.language-select:focus {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.language-select option {
    background: var(--modal-bg);
    color: var(--text-primary);
    padding: 8px;
}

/* RTL Support for Arabic */
body.rtl {
    direction: rtl;
}

body.rtl .game-header {
    flex-direction: row-reverse;
}

body.rtl .score-container {
    flex-direction: row-reverse;
}

body.rtl .howto-step {
    flex-direction: row-reverse;
    text-align: right;
}

body.rtl .tutorial-step-item {
    flex-direction: row-reverse;
    text-align: right;
}

body.rtl .tutorial-tip {
    flex-direction: row-reverse;
    text-align: right;
}

body.rtl .setting-item {
    flex-direction: row-reverse;
}

body.rtl .evolution-chain {
    flex-direction: row-reverse;
}

body.rtl .arrow {
    transform: scaleX(-1);
}
