.game-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: var(--medium-width);
    margin: 0 auto;
    padding: 20px;
}

.game-display {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.game-display::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.game-display-inner {
    position: relative;
    z-index: 1;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.game-title {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(90deg, #e11d48, #f59e0b, #ffffff, #f59e0b, #e11d48);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: colorFlow 3s linear infinite;
    margin: 0;
}

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

.game-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-card {
    min-width: 80px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.stat-label {
    font-size: 12px;
    color: #a5b4fc;
}

.stat-value {
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
}

.target-progress {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.target-title {
    font-weight: 600;
    color: #c4b5fd;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6 0%, #ec4899 100%);
    transition: width 0.5s ease;
}

.game-main-content {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
}

.game-left-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.level-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.level-text {
    font-size: 18px;
    font-weight: 700;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.2);
    padding: 10px 24px;
    border-radius: 25px;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.level-text #currentLevel {
    color: #ffffff;
    font-size: 24px;
    margin: 0 4px;
}

.game-board-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    overflow: auto;
    display: flex;
    justify-content: center;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(10, 44px);
    grid-template-rows: repeat(10, 44px);
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 12px;
    width: fit-content;
    margin: 0 auto;
}

.gem {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.gem::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
    border-radius: 10px;
}

.gem:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.gem.selected {
    animation: selected-gem 0.5s ease infinite;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.8);
    z-index: 10;
}

@keyframes selected-gem {
    0%, 100% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.8);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 30px rgba(139, 92, 246, 1);
    }
}

.gem.matched {
    animation: matched-gem 0.5s ease forwards;
}

@keyframes matched-gem {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.gem.falling {
    animation: falling-gem 0.3s ease;
}

@keyframes falling-gem {
    0% {
        transform: translateY(-50px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.gem.swapping {
    transition: all 0.3s ease;
}

.gem-red { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%); }
.gem-blue { background: linear-gradient(135deg, #4ecdc4 0%, #3db5ac 100%); }
.gem-green { background: linear-gradient(135deg, #a8e6cf 0%, #8dd4b8 100%); }
.gem-yellow { background: linear-gradient(135deg, #ffd93d 0%, #f0c929 100%); }
.gem-purple { background: linear-gradient(135deg, #c44dff 0%, #a33deb 100%); }
.gem-orange { background: linear-gradient(135deg, #ff9f43 0%, #ee8e32 100%); }

.gem.line-h {
    animation: line-h-glow 1s ease infinite;
}

.gem.line-v {
    animation: line-v-glow 1s ease infinite;
}

.gem.bomb {
    animation: bomb-glow 0.8s ease infinite;
}

@keyframes line-h-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(59, 130, 246, 0.5), inset 0 0 10px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), inset 0 0 15px rgba(59, 130, 246, 0.5);
    }
}

@keyframes line-v-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.5), inset 0 0 10px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.8), inset 0 0 15px rgba(239, 68, 68, 0.5);
    }
}

@keyframes bomb-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(245, 158, 11, 0.5), inset 0 0 10px rgba(245, 158, 11, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(245, 158, 11, 0.9), inset 0 0 20px rgba(245, 158, 11, 0.6);
        transform: scale(1.05);
    }
}

.game-right-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    max-width: 40%;
    min-height: 500px;
}

.game-rules-panel {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
}

.panel-title {
    font-size: 14px;
    color: #FFF;
}

.rules-content {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.8;
}

.rules-content ul {
    padding-left: 20px;
    margin: 0;
}

.rules-content li {
    margin-bottom: 8px;
}

.rules-content li:last-child {
    margin-bottom: 0;
}

.rules-content strong {
    color: #c4b5fd;
}

.controls-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn:active:not(:disabled) {
    transform: translateY(-1px);
}

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

.game-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.game-modal {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 24px;
    padding: 48px 40px;
    min-width: 420px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(139, 92, 246, 0.2);
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.game-modal-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

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

.game-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e1b4b;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.game-modal-stats {
    background: #f1f5f9;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.modal-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

.modal-stat-item:last-child {
    border-bottom: none;
}

.modal-stat-label {
    color: #64748b;
    font-weight: 500;
}

.modal-stat-value {
    color: #8b5cf6;
    font-weight: 700;
    font-size: 16px;
}

.game-modal-message {
    font-size: 18px;
    color: #475569;
    line-height: 1.8;
    margin-bottom: 32px;
}

.game-modal-btn {
    padding: 14px 48px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
}

.animate-shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.particle {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1001;
    animation: particle-explosion 0.6s ease forwards;
}

@keyframes particle-explosion {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

.combo-text {
    position: fixed;
    font-size: 3em;
    font-weight: 900;
    color: #ffd93d;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1002;
    animation: combo-animation 1s ease forwards;
}

@keyframes combo-animation {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    20% {
        transform: scale(1.2);
        opacity: 1;
    }
    80% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
        transform: translateY(-50px);
    }
}

@media (max-width: 768px) {
    .game-display {
        padding: 30px 20px;
    }

    .game-header {
        flex-direction: column;
        align-items: center;
    }

    .game-main-content {
        flex-direction: column;
        align-items: center;
    }

    .game-title {
        font-size: 24px;
    }

    .game-board {
        grid-template-columns: repeat(10, 34px);
        grid-template-rows: repeat(10, 34px);
        gap: 3px;
    }

    .gem {
        width: 34px;
        height: 34px;
        font-size: 1.4em;
        border-radius: 6px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 13px;
    }

    .game-modal {
        padding: 30px;
        min-width: 90%;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(10, 30px);
        grid-template-rows: repeat(10, 30px);
        gap: 2px;
    }

    .gem {
        width: 30px;
        height: 30px;
        font-size: 1.2em;
        border-radius: 5px;
    }

    .stat-card {
        padding: 10px 14px;
        min-width: 70px;
    }

    .stat-value {
        font-size: 22px;
    }
}