.game-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: var(--medium-width);
    margin: 0 auto;
    padding: 40px 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;
}

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

.difficulty-selector {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.diff-btn {
    padding: 10px 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    color: #a5b4fc;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
}

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

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

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

.game-board {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(4, 1fr);
    justify-content: center;
    align-items: center;
    width: fit-content;
    margin: 0 auto;
}

.tile {
    width: 56px;
    height: 56px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    overflow: hidden;
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.tile:hover:not(.empty):not(.selected)::before {
    left: 100%;
}

.tile:hover:not(.empty):not(.selected) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.tile.selected {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    transform: scale(1.15);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.7);
    z-index: 10;
    animation: selected-pulse 1s ease infinite;
    border-color: transparent;
}

@keyframes selected-pulse {
    0%, 100% { transform: scale(1.15); }
    50% { transform: scale(1.2); }
}

.tile.empty {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    cursor: default;
}

.tile.hint {
    animation: hint-glow 1.5s ease infinite;
    border: 3px solid #8b5cf6;
}

@keyframes hint-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(139, 92, 246, 0.6);
    }
    50% {
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.9), 0 0 45px rgba(139, 92, 246, 0.4);
    }
}

.tile.eliminating {
    animation: eliminate-animation 0.6s ease forwards;
}

@keyframes eliminate-animation {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1.3) rotate(10deg);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1) rotate(-10deg);
        opacity: 0.5;
    }
    100% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
}

.tile.connecting {
    position: relative;
    z-index: 5;
}

.tile.connecting::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 3px solid #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
    animation: connect-flash 0.3s ease;
}

@keyframes connect-flash {
    0% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(1); }
}

.controls-panel {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-secondary {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 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-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 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-info {
    text-align: center;
    margin-top: 10px;
    color: #64748b;
    font-size: 14px;
}

.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);
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #f00;
    animation: confetti-fall 3s linear forwards;
    pointer-events: none;
    z-index: 1001;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

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

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

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

    .game-stats {
        justify-content: center;
    }

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

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

    .tile {
        width: 44px;
        height: 44px;
        font-size: 1.5em;
    }

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

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

    .game-modal-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .tile {
        width: 36px;
        height: 36px;
        font-size: 1.2em;
    }

    .btn {
        padding: 10px 16px;
        font-size: 12px;
    }

    .diff-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}