/* games.css - Akıllı Tahta Uyumlu Tek Kişilik Zeka & Refleks Oyunları */

/* Oyun Modülü Aktifken Konteyner Genişletme */
body.games-active #app-container {
    max-width: 960px;
    transition: max-width 0.3s ease;
}

/* Oyunlar Ana Başlık ve Navigasyon */
.games-hub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 12px;
}

.games-title-group h2 {
    color: var(--primary-color);
    font-size: 26px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.games-title-group p {
    color: #64748b;
    font-size: 14px;
    margin-top: 4px;
}

.games-nav-btns {
    display: flex;
    gap: 10px;
}

.btn-game-nav {
    background: #fff;
    border: 2px solid var(--card-bg);
    color: var(--text-color);
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.btn-game-nav:hover, .btn-game-nav:active {
    background: var(--card-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Oyun Seçim Lobisi Izgarası */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.game-card {
    background: #fff;
    border-radius: 24px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(17, 45, 78, 0.06);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 30px rgba(63, 114, 175, 0.16);
    border-color: var(--primary-color);
}

.game-card:active {
    transform: scale(0.97);
}

.game-card-icon {
    width: 75px;
    height: 75px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 16px;
    color: #fff;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.game-card-icon.chimp { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.game-card-icon.schulte { background: linear-gradient(135deg, #10b981, #047857); }
.game-card-icon.simon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.game-card-icon.memory { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.game-card-icon.mastermind { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.game-card-icon.watersort { background: linear-gradient(135deg, #ec4899, #be185d); }

.game-card h3 {
    font-size: 19px;
    color: var(--text-color);
    margin-bottom: 8px;
    font-weight: 800;
}

.game-card p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 15px;
    flex-grow: 1;
}

.game-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
}

/* Oyun Sahnesi Ortak Çerçeve */
.game-screen {
    display: none;
    background: #fff;
    border-radius: 26px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(17, 45, 78, 0.08);
    border: 1px solid var(--card-bg);
}

.game-screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Oyun Üst Paneli */
.game-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.score-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 15px;
    background: #f8fafc;
    color: var(--text-color);
    border: 2px solid #e2e8f0;
}

.score-tag b {
    color: var(--primary-color);
    font-size: 18px;
}

/* Lider Tablosu Butonu */
.btn-game-leaderboard {
    background: #fef3c7;
    border: 2px solid #fde68a;
    color: #b45309;
    font-weight: 800;
    padding: 7px 14px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.btn-game-leaderboard:hover, .btn-game-leaderboard:active {
    background: #fde68a;
    color: #92400e;
    transform: translateY(-1px);
}

/* =========================================
   2. MAYMUN HAFIZA TESTİ (CHIMP TEST)
   ========================================= */
.chimp-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.chimp-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 8px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 22px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    max-width: 450px;
    width: 100%;
    aspect-ratio: 1 / 1;
    user-select: none;
    touch-action: manipulation;
}

.chimp-cell {
    background: transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 900;
    transition: all 0.15s;
    user-select: none;
}

.chimp-cell.active-card {
    background: #fff;
    border: 3px solid #3b82f6;
    color: #1e3a8a;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
    cursor: pointer;
}

.chimp-cell.active-card:active {
    transform: scale(0.92);
}

.chimp-cell.covered {
    background: #3b82f6;
    color: transparent;
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.chimp-cell.solved {
    visibility: hidden;
}

/* =========================================
   3. HIZLI SAYI AVI (SCHULTE 1-25)
   ========================================= */
.schulte-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.schulte-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 10px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 22px;
    border: 2px solid #e2e8f0;
    max-width: 460px;
    width: 100%;
    aspect-ratio: 1 / 1;
    user-select: none;
    touch-action: manipulation;
}

.schulte-btn {
    background: #fff;
    border: 2px solid var(--card-bg);
    border-radius: 14px;
    font-size: 24px;
    font-weight: 900;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.schulte-btn:active {
    transform: scale(0.92);
    background: #f1f5f9;
}

.schulte-btn.completed {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
    opacity: 0.4;
    pointer-events: none;
    transform: scale(0.95);
}

.schulte-btn.wrong-flash {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #dc2626 !important;
    animation: shake 0.3s;
}

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

/* =========================================
   4. SIMON DİYOR Kİ (SIMON SAYS)
   ========================================= */
.simon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.simon-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    background: #1e293b;
    padding: 24px;
    border-radius: 50%;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
    max-width: 420px;
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    user-select: none;
    touch-action: manipulation;
}

.simon-pad {
    cursor: pointer;
    transition: all 0.12s;
    opacity: 0.65;
    user-select: none;
    touch-action: manipulation;
}

.simon-pad.green {
    background: #22c55e;
    border-top-left-radius: 100%;
}

.simon-pad.red {
    background: #ef4444;
    border-top-right-radius: 100%;
}

.simon-pad.yellow {
    background: #eab308;
    border-bottom-left-radius: 100%;
}

.simon-pad.blue {
    background: #3b82f6;
    border-bottom-right-radius: 100%;
}

.simon-pad.active-flash {
    opacity: 1;
    filter: brightness(1.5);
    box-shadow: 0 0 30px currentColor;
    transform: scale(0.96);
}

.simon-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110px;
    height: 110px;
    background: #0f172a;
    border: 6px solid #334155;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.simon-center span {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 800;
    text-transform: uppercase;
}

.simon-center b {
    font-size: 26px;
    color: #fff;
}

/* =========================================
   5. HAFIZA KARTLARI (MEMORY MATCH)
   ========================================= */
.memory-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 24px;
    border: 2px solid #e2e8f0;
    max-width: 440px;
    width: 100%;
    aspect-ratio: 1 / 1;
    user-select: none;
    touch-action: manipulation;
}

.memory-card {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.memory-card.flipped {
    background: #ffffff;
    border-color: #3b82f6;
    transform: rotateY(180deg);
}

.memory-card.matched {
    background: #dcfce7;
    border-color: #22c55e;
    cursor: default;
    animation: matchPop 0.3s ease;
}

@keyframes matchPop {
    0% { transform: scale(0.9); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* =========================================
   6. MASTERMIND (KOD KIRICI)
   ========================================= */
.mastermind-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    max-width: 480px;
    margin: 0 auto;
}

.mm-board {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    background: #f8fafc;
    padding: 16px;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
    max-height: 380px;
    overflow-y: auto;
}

.mm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.mm-row.current-row {
    border: 2px solid #3b82f6;
    background: #eff6ff;
}

.mm-pegs-row {
    display: flex;
    gap: 8px;
}

.mm-peg {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.15);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.4), 0 2px 5px rgba(0,0,0,0.1);
}

.mm-peg-slot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px dashed #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s;
}

.mm-peg-slot:hover {
    transform: scale(1.08);
}

.mm-clues-row {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.mm-clue-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e2e8f0; /* Renk kodda yok */
    border: 1.5px solid #cbd5e1;
    transition: all 0.2s ease;
}

.mm-clue-dot.exact {
    background: #10b981; /* 🟢 Yeşil: Tam renk & tam yer */
    border-color: #059669;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.mm-clue-dot.color {
    background: #f97316; /* 🟠 Turuncu: Doğru renk ama yanlış yer */
    border-color: #ea580c;
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.6);
}

.mm-picker-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: #ffffff;
    padding: 14px;
    border-radius: 18px;
    border: 2px solid #e2e8f0;
}

.mm-current-guess {
    display: flex;
    gap: 12px;
}

.mm-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.mm-color-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.15s;
}

.mm-color-btn:hover, .mm-color-btn:active {
    transform: scale(1.15);
}

/* =========================================
   7. RENKLİ SIVI SIRALAMA (WATER SORT)
   ========================================= */
.watersort-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.ws-tubes-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 20px 10px;
    max-width: 520px;
}

.ws-tube {
    width: 54px;
    height: 170px;
    border: 3px solid #334155;
    border-top: none;
    border-radius: 0 0 26px 26px;
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
    background: rgba(241, 245, 249, 0.6);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 6px 12px rgba(0,0,0,0.06);
    user-select: none;
    position: relative;
}

.ws-tube.selected {
    transform: translateY(-16px);
    border-color: #3b82f6;
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.3);
}

.ws-liquid-unit {
    width: 100%;
    height: 25%;
    transition: height 0.25s ease;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* =========================================
   LİDER TABLOSU (TOP 10) & MODAL STİLLERİ
   ========================================= */
.game-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 45, 78, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.game-modal-card {
    background: #fff;
    padding: 30px 22px;
    border-radius: 28px;
    text-align: center;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.game-modal-card h3 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-color);
}

.game-modal-card p {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 18px;
}

.leaderboard-save-box {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 20px;
}

.leaderboard-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    font-size: 14px;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}

.leaderboard-input:focus {
    border-color: #2563eb;
}

.btn-save-score {
    background: #10b981;
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-save-score:hover {
    background: #059669;
}

.game-modal-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Top 10 Listesi Modal Özel Tasarım */
.leaderboard-modal-card {
    max-width: 460px;
    text-align: left;
}

.close-leaderboard-btn {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}

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

.leaderboard-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 600;
}

.leaderboard-row.rank-1 {
    background: linear-gradient(135deg, #fef3c7, #fef9c3);
    border-color: #facc15;
    color: #854d0e;
}

.leaderboard-row.rank-2 {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-color: #cbd5e1;
    color: #334155;
}

.leaderboard-row.rank-3 {
    background: linear-gradient(135deg, #ffedd5, #fed7aa);
    border-color: #fb923c;
    color: #9a3412;
}

.leaderboard-rank {
    width: 28px;
    font-weight: 800;
    font-size: 15px;
}

.leaderboard-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}

.leaderboard-score {
    font-weight: 800;
    color: #2563eb;
    font-size: 15px;
}

.btn-clear-scores {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-clear-scores:hover {
    background: #fee2e2;
}
