/* =========================================
   Snake Game Styling
   ========================================= */

/* Dark Mode Background for Snake Game */
.tzq-game-snake {
    background: #1a1a2e;
    color: #e2e8f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    min-height: 500px;
    position: relative;
    width: 100%;
}

/* Header & Stats */
.tzq-game-snake__header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.tzq-game-snake__header h2 {
    font-size: 1.5rem;
    color: #ffd700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.tzq-game-snake__stats {
    display: flex;
    gap: 15px;
}

/* Canvas Container */
.tzq-game-snake__canvas-container {
    position: relative;
    padding: 4px;
    border-radius: 8px;
    background: #16213e;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    border: 2px solid #30475e;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1; /* Keep it square */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

canvas#snakeCanvas {
    display: block;
    border-radius: 4px;
    width: 100% !important;
    height: 100% !important;
}

/* Start Screen Overlay */
.tzq-snake-start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

.tzq-snake-start-content {
    text-align: center;
    color: white;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
}

.tzq-snake-start-content h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #4ade80;
}

.tzq-snake-instruction {
    color: #94a3b8;
    margin: 1rem 0 2rem;
    font-size: 0.9rem;
}

/* Controls Section */
.tzq-game-snake__controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    justify-content: center;
}

.tzq-game-snake__controls p {
    margin: 0;
    margin-right: auto;
    color: #64748b;
    font-size: 0.9rem;
}

/* =========================================
   Sorting Game Styling
   ========================================= */

/* Main Container Reset */
.tzq-game-sorting {
    background: #ffffff; /* Clean white background */
    padding: 0; /* Remove padding to fit container perfectly */
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
}

/* Specific Header for Sorting Game - Overrides Generic Headers */
.tzq-game-sorting .tzq-game-header {
    position: relative;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    z-index: 2;
    pointer-events: auto; /* Ensure header is interactive */
}

.tzq-game-sorting h2 {
    font-size: 1.25rem;
    color: #1e293b;
    margin: 0;
    font-weight: 700;
}

/* Sorting Game Specific Stats (Using shared badged but scoped) */
.tzq-game-sorting .tzq-game-stats {
    display: flex;
    gap: 0.75rem;
}

.tzq-game-sorting .tzq-stat-badge {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tzq-game-sorting .tzq-stat-value {
    color: #3b82f6;
    font-weight: 800;
}

/* Sorting Content Area */
.tzq-game-content-sorting {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto; /* Allow scrolling for long lists */
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
}

.tzq-task-info {
    text-align: center;
    background: #eff6ff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #dbeafe;
}

.tzq-task-info h3 {
    font-size: 1.1rem;
    color: #1e40af;
    margin-bottom: 0.25rem;
}

.tzq-task-info p {
    color: #3b82f6;
    font-size: 0.95rem;
    margin: 0;
}

/* Sortable List */
.tzq-sort-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #f1f5f9; /* Light gray track */
    padding: 0.75rem;
    border-radius: 12px;
    border: 2px dashed #cbd5e1;
}

.tzq-sort-item {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    border: 2px solid transparent;
    user-select: none;
}

.tzq-sort-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}

.tzq-sort-item.tzq-dragging {
    opacity: 0.6;
    background: #e2e8f0;
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    z-index: 10;
}

.tzq-sort-item.tzq-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.tzq-sort-item.tzq-correct-item {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.tzq-sort-item.tzq-wrong-item {
    background: #fee2e2;
    border-color: #ef4444;
    animation: tzqShake 0.4s;
}

.tzq-sort-handle {
    color: #94a3b8;
    cursor: grab;
    font-size: 1.25rem;
    padding: 0.25rem;
}

.tzq-sort-text {
    font-weight: 600;
    color: #334155;
    flex: 1;
    font-size: 1rem;
}

.tzq-game-controls-sorting {
    display: flex;
    justify-content: center;
    padding: 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    gap: 1rem;
}

/* =========================================
   Memory Game Styling
   ========================================= */

.tzq-memory-game {
    background: transparent; /* Canvas handles background */
    position: relative;
    overflow: hidden;
    height: 100%;
}

.tzq-memory-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    .tzq-game-snake {
        padding: 10px;
        min-height: 400px;
    }
    
    .tzq-game-snake__header h2 {
        font-size: 1.2rem;
    }
    
    .tzq-game-snake__controls {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .tzq-game-snake__controls p {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 10px;
    }
    
    .tzq-btn {
        flex: 1;
        justify-content: center;
    }

    /* Sorting Game Mobile */
    .tzq-game-sorting .tzq-game-header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .tzq-game-sorting .tzq-game-stats {
        width: 100%;
        justify-content: space-between;
    }

    .tzq-game-content-sorting {
        padding: 1rem;
    }

    .tzq-sort-item {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
}
