/* ============================================
   NEURAL NETWORK PLAYGROUND GAME
   ============================================ */

/* Floating Game Button */
.game-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--gradient);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: gameFabPulse 2s ease-in-out infinite;
}

.game-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.6);
}

.game-fab i {
    font-size: 2rem;
    color: white;
}

.game-fab-tooltip {
    position: absolute;
    right: 80px;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-size: 0.9rem;
}

.game-fab:hover .game-fab-tooltip {
    opacity: 1;
}

@keyframes gameFabPulse {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 8px 35px rgba(99, 102, 241, 0.7), 0 0 0 10px rgba(99, 102, 241, 0.1);
    }
}

/* Game Modal Overlay */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Game Container */
.game-container {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.game-modal.active .game-container {
    transform: scale(1);
}

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.5);
}

.game-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-title h2 {
    font-size: 1.8rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

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

.game-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(236, 72, 153, 0.2);
    color: var(--accent-color);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.game-close:hover {
    background: var(--accent-color);
    color: white;
    transform: rotate(90deg);
}

/* Game Content */
.game-content {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 2rem;
    padding: 2rem;
    overflow-y: auto;
}

/* Left Panel - Challenges */
.game-sidebar-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.challenge-section {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
}

.challenge-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.challenge-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.challenge-item {
    padding: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid transparent;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.challenge-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.challenge-item.active {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.2);
}

.challenge-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.challenge-name {
    font-weight: 600;
    color: var(--light-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.challenge-difficulty {
    font-size: 0.85rem;
    color: var(--gray-text);
}

.challenge-icon {
    font-size: 1.5rem;
}

/* Training Data Section */
.training-data-section {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
}

.training-examples {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.training-example {
    aspect-ratio: 1;
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed var(--glass-border);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 2rem;
}

.training-example:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.2);
}

.add-example-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--gradient);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.add-example-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Center Panel - Neural Network Visualization */
.game-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.network-canvas-container {
    width: 100%;
    flex: 1;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

#networkCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.network-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(15, 23, 42, 0.8);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
}

.network-layer-label {
    font-size: 0.85rem;
    color: var(--gray-text);
    margin-bottom: 0.25rem;
}

/* Training Controls */
.training-controls {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.train-btn {
    padding: 1rem 2rem;
    background: var(--gradient);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.train-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.train-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reset-btn {
    padding: 1rem 2rem;
    background: rgba(236, 72, 153, 0.2);
    border: 2px solid var(--accent-color);
    border-radius: 0.5rem;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Right Panel - Metrics & Info */
.game-sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.metrics-section {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--glass-border);
}

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

.metric-label {
    color: var(--gray-text);
    font-size: 0.9rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.accuracy-bar {
    width: 100%;
    height: 8px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.accuracy-fill {
    height: 100%;
    background: var(--gradient);
    width: 0;
    transition: width 0.5s ease;
}

/* Progress Chart */
.progress-chart {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
}

#progressCanvas {
    width: 100%;
    height: 150px;
}

/* Achievements */
.achievements-section {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.achievement-item {
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.achievement-item.unlocked {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--primary-color);
}

.achievement-item.locked {
    opacity: 0.4;
}

.achievement-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.achievement-name {
    font-size: 0.75rem;
    color: var(--gray-text);
}

/* Success Modal */
.success-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.success-overlay.active {
    opacity: 1;
    visibility: visible;
}

.success-content {
    background: var(--glass-bg);
    padding: 3rem;
    border-radius: 1.5rem;
    border: 1px solid var(--glass-border);
    text-align: center;
    max-width: 500px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.success-overlay.active .success-content {
    transform: scale(1);
}

.success-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: successPop 0.5s ease;
}

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

.success-title {
    font-size: 2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.success-stats {
    margin: 2rem 0;
    display: flex;
    justify-content: space-around;
}

.success-stat {
    text-align: center;
}

.success-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.success-stat-label {
    font-size: 0.9rem;
    color: var(--gray-text);
    margin-top: 0.25rem;
}

.success-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.success-buttons button {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.next-level-btn {
    background: var(--gradient);
    color: white;
}

.share-btn {
    background: rgba(99, 102, 241, 0.2);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .game-content {
        grid-template-columns: 250px 1fr 250px;
        gap: 1rem;
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .game-fab {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }

    .game-fab i {
        font-size: 1.5rem;
    }

    .game-fab-tooltip {
        display: none;
    }

    .game-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .game-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        padding: 1rem;
    }

    .game-sidebar-left,
    .game-sidebar-right {
        order: -1;
    }

    .training-controls {
        flex-direction: column;
    }

    .success-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .success-buttons {
        flex-direction: column;
    }
}

/* Loading State */
.loading-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: loadingDot 1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Tooltip */
.game-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.game-tooltip.visible {
    opacity: 1;
}
