* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0d9488;
    --primary-light: #14b8a6;
    --primary-dark: #0f766e;
    --primary-glow: rgba(13, 148, 136, 0.3);
    --bg-primary: #ffffff;
    --bg-secondary: #f0fdfa;
    --text-primary: #134e4a;
    --text-secondary: #5eead4;
    --border-color: #99f6e4;
    --wall-color: #475569;
    --wall-dark: #334155;
    --wall-light: #64748b;
    --floor-color: #e2e8f0;
    --floor-light: #f1f5f9;
    --box-color: #f59e0b;
    --box-dark: #d97706;
    --box-light: #fbbf24;
    --box-done-color: #10b981;
    --box-done-dark: #059669;
    --box-done-light: #34d399;
    --target-color: #ef4444;
    --target-glow: rgba(239, 68, 68, 0.4);
    --player-color: #3b82f6;
    --player-dark: #2563eb;
    --player-light: #60a5fa;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 50%, #115e59 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ==================== Header ==================== */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.2rem 2rem;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.game-title {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.game-title i {
    color: var(--primary);
    font-size: 2rem;
}

.rules-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.rules-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* ==================== Stats Panel ==================== */
.stats-panel {
    max-width: 1200px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card i {
    font-size: 1.5rem;
    color: var(--primary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.1) 0%, rgba(13, 148, 136, 0.05) 100%);
    border-radius: 10px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* ==================== Level Panel ==================== */
.level-panel {
    max-width: 900px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}

.level-panel h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    justify-content: center;
}

.level-btn {
    aspect-ratio: 1;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.level-btn.current {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
    transform: scale(1.05);
}

.level-btn.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.level-btn.completed::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.6rem;
}

.level-btn:not(.current):not(.completed) {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.level-btn:hover:not(.current) {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* ==================== Game Container ==================== */
.game-container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.game-board {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 16px;
    box-shadow: var(--shadow-lg), inset 0 0 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: inline-block;
    perspective: 800px;
}

.board-inner {
    display: grid;
    gap: 2px;
}

/* ==================== Cell & 3D Elements ==================== */
.cell {
    width: 44px;
    height: 44px;
    position: relative;
    transform-style: preserve-3d;
    transition: none;
}

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

.cell-floor {
    background: linear-gradient(145deg, #d1d5db 0%, #cbd5e1 50%, #e2e8f0 100%);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.cell-floor::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 20px,
            rgba(0, 0, 0, 0.03) 20px,
            rgba(0, 0, 0, 0.03) 21px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 20px,
            rgba(0, 0, 0, 0.03) 20px,
            rgba(0, 0, 0, 0.03) 21px
        );
}

/* 3D Wall */
.wall-3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-5deg) rotateY(-5deg);
}

.wall-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.wall-front {
    background: linear-gradient(180deg, var(--wall-light) 0%, var(--wall-color) 30%, var(--wall-dark) 100%);
    border-radius: 4px;
    transform: translateZ(14px);
    box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.15);
}

.wall-front::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    border-radius: 3px 3px 0 0;
}

.wall-top {
    background: linear-gradient(135deg, var(--wall-light) 0%, var(--wall-color) 100%);
    transform: rotateX(90deg) translateZ(22px);
    transform-origin: top;
    height: 28px !important;
    top: 0;
    border-radius: 4px 4px 0 0;
}

.wall-left {
    background: linear-gradient(90deg, var(--wall-dark) 0%, var(--wall-color) 100%);
    transform: rotateY(-90deg) translateZ(22px);
    transform-origin: left;
    width: 28px !important;
    left: 0;
}

.wall-right {
    background: linear-gradient(270deg, var(--wall-dark) 0%, var(--wall-color) 100%);
    transform: rotateY(90deg) translateZ(22px);
    transform-origin: right;
    width: 28px !important;
    right: 0;
    left: auto;
}

/* 3D Box */
.box-3d {
    width: 34px;
    height: 34px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%) rotateX(-8deg) rotateY(-12deg);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    cursor: default;
}

@media (max-width: 600px) {
    .box-3d {
        width: 26px;
        height: 26px;
    }
}

.box-face {
    position: absolute;
    backface-visibility: hidden;
}

.box-front {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--box-light) 0%, var(--box-color) 40%, var(--box-dark) 100%);
    border-radius: 4px;
    transform: translateZ(10px);
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.box-front::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    height: 45%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, transparent 100%);
    border-radius: 3px 3px 0 0;
}

.box-front::after {
    content: '';
    width: 60%;
    height: 60%;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.box-top {
    width: 100%;
    height: 20px;
    background: linear-gradient(135deg, var(--box-light) 0%, var(--box-color) 100%);
    top: 0;
    left: 0;
    transform: rotateX(90deg) translateZ(17px);
    transform-origin: top;
    border-radius: 4px 4px 0 0;
}

.box-left {
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, var(--box-dark) 0%, var(--box-color) 100%);
    left: 0;
    top: 0;
    transform: rotateY(-90deg) translateZ(17px);
    transform-origin: left;
    border-radius: 0 0 0 4px;
}

.box-right {
    width: 20px;
    height: 100%;
    background: linear-gradient(270deg, var(--box-dark) 0%, var(--box-color) 100%);
    right: 0;
    left: auto;
    top: 0;
    transform: rotateY(90deg) translateZ(17px);
    transform-origin: right;
    border-radius: 0 0 4px 0;
}

/* Box on target (green) */
.box-3d.on-target .box-front {
    background: linear-gradient(180deg, var(--box-done-light) 0%, var(--box-done-color) 40%, var(--box-done-dark) 100%);
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.25), 0 0 12px rgba(16, 185, 129, 0.4);
}

.box-3d.on-target .box-top {
    background: linear-gradient(135deg, var(--box-done-light) 0%, var(--box-done-color) 100%);
}

.box-3d.on-target .box-left {
    background: linear-gradient(90deg, var(--box-done-dark) 0%, var(--box-done-color) 100%);
}

.box-3d.on-target .box-right {
    background: linear-gradient(270deg, var(--box-done-dark) 0%, var(--box-done-color) 100%);
}

/* Target point */
.target-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--target-color) 0%, rgba(239, 68, 68, 0.3) 70%, transparent 100%);
    box-shadow: 0 0 10px var(--target-glow), 0 0 20px var(--target-glow);
    animation: targetPulse 2s ease-in-out infinite;
    z-index: 2;
}

@media (max-width: 600px) {
    .target-marker {
        width: 18px;
        height: 18px;
    }
}

.target-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    opacity: 0.7;
}

@keyframes targetPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.8; }
}

/* 3D Player */
.player-3d {
    width: 32px;
    height: 32px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%) rotateX(-8deg) rotateY(-12deg);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
}

@media (max-width: 600px) {
    .player-3d {
        width: 24px;
        height: 24px;
    }
}

.player-body {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

.player-face {
    position: absolute;
    backface-visibility: hidden;
}

.player-head {
    width: 80%;
    height: 55%;
    background: linear-gradient(180deg, var(--player-light) 0%, var(--player-color) 50%, var(--player-dark) 100%);
    border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
    transform: translateZ(12px);
    left: 10%;
    top: 0;
    box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.25), inset 0 3px 6px rgba(255, 255, 255, 0.3);
}

.player-head::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 30%;
    background: white;
    border-radius: 50%;
    opacity: 0.85;
}

.player-head::after {
    content: '';
    position: absolute;
    top: 28%;
    left: 50%;
    transform: translateX(-50%);
    width: 42%;
    height: 18%;
    background: #1e293b;
    border-radius: 50%;
    display: flex;
    gap: 25%;
    padding: 0 10%;
}

.player-top-face {
    width: 80%;
    height: 18px;
    background: linear-gradient(135deg, var(--player-light) 0%, var(--player-color) 100%);
    border-radius: 50%;
    left: 10%;
    top: 0;
    transform: rotateX(90deg) translateZ(16px);
    transform-origin: top;
}

.player-left-face {
    width: 14px;
    height: 55%;
    background: linear-gradient(90deg, var(--player-dark) 0%, var(--player-color) 100%);
    border-radius: 40%;
    left: 10%;
    top: 22%;
    transform: rotateY(-90deg) translateZ(14px);
    transform-origin: left;
}

.player-right-face {
    width: 14px;
    height: 55%;
    background: linear-gradient(270deg, var(--player-dark) 0%, var(--player-color) 100%);
    border-radius: 40%;
    right: 10%;
    left: auto;
    top: 22%;
    transform: rotateY(90deg) translateZ(14px);
    transform-origin: right;
}

.player-3d.facing-up { transform: translate(-50%, -50%) rotateX(-8deg) rotateY(-12deg); }
.player-3d.facing-down { transform: translate(-50%, -50%) rotateX(-8deg) rotateY(168deg); }
.player-3d.facing-left { transform: translate(-50%, -50%) rotateX(-8deg) rotateY(-78deg); }
.player-3d.facing-right { transform: translate(-50%, -50%) rotateX(-8deg) rotateY(78deg); }

/* ==================== Control Panel ==================== */
.control-panel {
    max-width: 600px;
    margin: 1rem auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.control-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.control-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.control-btn i {
    font-size: 1rem;
    color: var(--primary);
}

.control-btn.undo i { color: #f59e0b; }
.control-btn.restart i { color: var(--primary); }
.control-btn.levels i { color: #8b5cf6; }

/* ==================== Mobile Controls ==================== */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(2, 56px);
    gap: 6px;
}

.mobile-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active {
    transform: scale(0.9);
    background: var(--primary);
    color: white;
}

.mobile-btn[data-dir="up"] { grid-column: 2; grid-row: 1; }
.mobile-btn[data-dir="left"] { grid-column: 1; grid-row: 2; }
.mobile-btn[data-dir="down"] { grid-column: 2; grid-row: 2; }
.mobile-btn[data-dir="right"] { grid-column: 3; grid-row: 2; }

@media (max-width: 768px) {
    .mobile-controls {
        display: grid;
    }
}

/* ==================== Rules Sidebar ==================== */
.rules {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 2rem;
}

.rules.open {
    right: 0;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background: #ef4444;
    color: white;
}

.rules-content h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rules-content h2 i {
    color: var(--primary);
}

.rule-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.3rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.rule-item > i {
    font-size: 1.3rem;
    color: var(--primary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 10px;
    flex-shrink: 0;
}

.rule-item h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.rule-item p {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 0.15rem;
}

.rule-item kbd {
    display: inline-block;
    padding: 2px 7px;
    background: #e2e8f0;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid #cbd5e0;
    box-shadow: 0 2px 0 #cbd5e0;
}

/* ==================== Modal ==================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.35s ease-out;
}

@keyframes modalIn {
    from { transform: scale(0.85) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.2rem;
    font-size: 2rem;
}

.modal-icon.win {
    background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%);
    color: #b45309;
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.4);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.modal-message {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 1.2rem;
}

.modal-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.modal-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-stat span {
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
}

.modal-stat strong {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.modal-buttons {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.modal-btn.secondary {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid #e2e8f0;
}

.modal-btn.secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

/* ==================== Animations ==================== */
@keyframes playerBounce {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.08); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.player-moving {
    animation: playerBounce 0.15s ease-out;
}

@keyframes boxPushed {
    0% { transform: translate(-50%, -50%) rotateX(-8deg) rotateY(-12deg) scale(1); }
    50% { transform: translate(-50%, -50%) rotateX(-8deg) rotateY(-12deg) scale(1.1); }
    100% { transform: translate(-50%, -50%) rotateX(-8deg) rotateY(-12deg) scale(1); }
}

.box-pushed {
    animation: boxPushed 0.2s ease-out;
}

@keyframes victoryShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

.victory-shake {
    animation: victoryShake 0.5s ease-in-out;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .game-header {
        padding: 1rem 1.2rem;
    }

    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 1rem;
    }

    .control-panel {
        gap: 0.6rem;
    }

    .control-btn span {
        display: none;
    }

    .control-btn {
        padding: 0.65rem 1rem;
    }

    body {
        padding-bottom: 140px !important;
    }
}

@media (max-width: 480px) {
    .stat-value {
        font-size: 1.1rem;
    }

    .level-grid {
        grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
        gap: 6px;
    }

    .rules {
        width: 100vw;
        max-width: 100vw;
        border-radius: 20px 0 0 20px;
        right: -100vw;
    }

    .modal-content {
        padding: 1.8rem 1.4rem;
        border-radius: 18px;
    }
}
