/* =========================================
   1. GAMES MENU (GENEL MENÜ)
========================================= */

.games-menu-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 360px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    z-index: 999998;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .3);
}

.games-menu-header {
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: #111827;
    color: #fff;
}

.games-menu-header span {
    font-size: 15px;
    font-weight: 700;
}

.games-menu-header span i {
    margin-right: 7px;
}

#games-menu-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    cursor: pointer;
}

.games-menu-content {
    padding: 12px;
}

.game-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border-radius: 12px;
    cursor: pointer;
    transition: .2s;
}

.game-item:hover {
    background: #f1f5f9;
}

.game-item-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: #f1f5f9;
    border-radius: 12px;
}

.game-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.game-item-info strong {
    font-size: 14px;
    color: #111827;
}

.game-item-info small {
    font-size: 10px;
    color: #64748b;
}

.game-item > i {
    font-size: 11px;
    color: #94a3b8;
}

.game-disabled {
    opacity: .5;
    cursor: default;
}

.game-coming {
    font-size: 9px;
    padding: 4px 7px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #64748b;
}

@media (max-width: 600px) {
    .games-menu-popup {
        width: calc(100vw - 24px);
    }
}


/* =========================================
   2. SNAKE OYUNU
========================================= */

.snake-game-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 370px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    z-index: 999999;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .35);
}

.snake-game-header {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #111827;
    color: #fff;
}

#snake-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.snake-game-info {
    display: flex;
    justify-content: space-between;
    padding: 10px 18px;
    background: #f8fafc;
}

.snake-game-info div {
    display: flex;
    flex-direction: column;
}

.snake-game-info small {
    font-size: 9px;
    color: #94a3b8;
}

.snake-game-info strong {
    font-size: 18px;
    color: #111827;
}

.snake-board-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 16px auto;
    border-radius: 12px;
    overflow: hidden;
}

#snakeCanvas {
    display: block;
    width: 320px;
    height: 320px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.snake-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    background: rgba(17, 24, 39, .94);
    color: #fff;
}

.snake-big-icon {
    font-size: 42px;
    margin-bottom: 5px;
}

.snake-overlay h3 {
    margin: 0 0 8px;
}

.snake-overlay p {
    margin: 0 0 18px;
    font-size: 11px;
    color: #cbd5e1;
}

.snake-overlay button {
    border: 0;
    border-radius: 10px;
    padding: 11px 20px;
    background: #22c55e;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.snake-controls {
    display: grid;
    grid-template-columns: repeat(3, 48px);
    gap: 7px;
    justify-content: center;
}

.snake-control {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: #111827;
    font-size: 15px;
}

.snake-control:active {
    transform: scale(.92);
}

.snake-control.empty {
    visibility: hidden;
}

.snake-help {
    text-align: center;
    font-size: 9px;
    color: #94a3b8;
    padding: 10px 0 14px;
}

@media (max-width: 600px) {
    .snake-game-popup {
        width: calc(100vw - 24px);
    }

    .snake-board-wrapper {
        width: min(320px, calc(100vw - 55px));
        height: min(320px, calc(100vw - 55px));
    }

    #snakeCanvas {
        width: 100%;
        height: 100%;
    }
}


/* =========================================
   3. QUIZ OYUNU
========================================= */

.quiz-game-content {
    padding: 20px;
    max-width: 650px;
    margin: auto;
}

.quiz-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
}

.quiz-progress {
    width: 100%;
    height: 7px;
    background: rgba(128, 128, 128, .2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 25px;
}

#quiz-progress-bar {
    width: 0;
    height: 100%;
    transition: width .3s ease;
}

.quiz-question {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    margin: 25px 0;
}

.quiz-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quiz-answer {
    border: 1px solid rgba(128, 128, 128, .25);
    background: rgba(128, 128, 128, .08);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    font-size: 15px;
    transition: .2s;
}

.quiz-answer:hover {
    transform: translateY(-2px);
}

.quiz-answer:disabled {
    cursor: default;
}

.quiz-correct {
    background: rgba(40, 180, 80, .25) !important;
    border-color: #28b450 !important;
}

.quiz-wrong {
    background: rgba(220, 50, 50, .25) !important;
    border-color: #dc3232 !important;
}

.quiz-result {
    text-align: center;
    padding: 30px 10px;
}

.quiz-result-icon {
    font-size: 55px;
    margin-bottom: 10px;
}

.quiz-result h3 {
    margin-bottom: 10px;
}

#quiz-final-score {
    display: block;
    font-size: 45px;
    margin: 10px 0 25px;
}

#quiz-restart {
    border: 0;
    cursor: pointer;
}

@media (max-width: 600px) {
    .quiz-game-content {
        padding: 15px;
    }

    .quiz-answers {
        grid-template-columns: 1fr;
    }

    .quiz-question {
        font-size: 18px;
    }
}


/* =========================================
   4. TETRIS OYUNU
========================================= */

.tetris-game-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 20px);
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    z-index: 999999;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
}

#tetris-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    cursor: pointer;
}

.tetris-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8fafc;
    gap: 8px;
}

.tetris-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tetris-info-item small {
    font-size: 9px;
    color: #94a3b8;
}

.tetris-info-item strong {
    font-size: 16px;
    color: #111827;
}

#tetrisNextCanvas {
    display: block;
    margin-top: 2px;
}

.tetris-board-wrapper {
    position: relative;
    width: 55%;
    height: 480px;
    margin: 14px auto;
    border-radius: 12px;
    overflow: hidden;
}

#tetrisCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.tetris-controls {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
    padding: 0 14px 12px;
    justify-content: center;
}

.tetris-control {
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: #111827;
    font-size: 15px;
}

.tetris-control:active {
    transform: scale(.92);
}

/* Tetris Mobil Uyumluluk */
@media (max-width: 600px) {
    .tetris-game-popup {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 40px);
    }

    .tetris-board-wrapper {
        width: min(240px, calc(100vw - 55px));
        height: min(480px, calc(100vh - 300px));
        margin: 10px auto;
    }

    .tetris-controls {
        gap: 5px;
        padding: 0 10px 10px;
    }

    .tetris-control {
        height: 40px;
        border-radius: 10px;
        font-size: 14px;
    }
}

@media (max-width: 600px) and (max-height: 750px) {
    .tetris-game-popup {
        max-height: calc(100vh - 24px);
    }

    .tetris-board-wrapper {
        width: min(313px, calc(100vw - 20px));
        height: 337px;
        margin: 8px auto;
    }

    .tetris-controls {
        gap: 4px;
        padding: 0 8px 8px;
    }

    .tetris-control {
        height: 36px;
        font-size: 13px;
    }
}

@media (max-width: 600px) and (max-height: 650px) {
    .tetris-board-wrapper {
        width: min(180px, calc(100vw - 70px));
        height: min(360px, calc(100vh - 245px));
    }

    .tetris-info {
        padding: 6px 10px;
    }

    .tetris-controls {
        gap: 3px;
        padding: 0 6px 6px;
    }

    .tetris-control {
        height: 32px;
        font-size: 12px;
    }
}


/* =========================================
   5. 2048 OYUNU
========================================= */

.g2048-game-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 370px;
    max-width: calc(100vw - 24px);
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 18px;
    z-index: 999999;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .35);
}

#g2048-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.g2048-info {
    display: flex;
    justify-content: space-between;
    padding: 10px 18px;
    background: #f8fafc;
}

.g2048-info div {
    display: flex;
    flex-direction: column;
}

.g2048-info small {
    font-size: 9px;
    color: #94a3b8;
}

.g2048-info strong {
    font-size: 18px;
    color: #111827;
}

.g2048-board-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 16px auto;
    border-radius: 12px;
    overflow: hidden;
}

#g2048Canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

@media (max-width: 600px) {
    .g2048-game-popup {
        width: calc(100vw - 24px);
    }

    .g2048-board-wrapper {
        width: min(320px, calc(100vw - 55px));
        height: min(320px, calc(100vw - 55px));
    }

    #g2048Canvas {
        width: 100%;
        height: 100%;
    }
}

@media (max-height: 700px) {
    .g2048-board-wrapper {
        width: min(320px, calc(100vh - 260px));
        height: min(320px, calc(100vh - 260px));
    }
}

/* =========================================
   6. TUĞLA KIRMA (BREAKOUT) OYUNU
========================================= */

.breakout-game-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 370px;
    max-width: calc(100vw - 24px);
    max-height: 95vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 18px;
    z-index: 999999;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .35);
}

.breakout-game-header {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #111827;
    color: #fff;
}

#breakout-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    cursor: pointer;
}

.breakout-game-info {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    gap: 6px;
}

.breakout-game-info div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.breakout-game-info small {
    font-size: 9px;
    color: #94a3b8;
}

.breakout-game-info strong {
    font-size: 15px;
    color: #111827;
}

.breakout-board-wrapper {
    position: relative;
    width: 320px;
    height: 420px;
    margin: 14px auto;
    border-radius: 12px;
    overflow: hidden;
}

#breakoutCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: none;
}

.breakout-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 0 16px 12px;
}

.breakout-controls .snake-control {
    width: 100%;
}

@media (max-width: 600px) {
    .breakout-game-popup {
        width: calc(100vw - 24px);
    }

    .breakout-board-wrapper {
        width: min(320px, calc(100vw - 55px));
        height: min(420px, calc(100vh - 260px));
    }

    #breakoutCanvas {
        width: 100%;
        height: 100%;
    }
}

@media (max-height: 720px) {
    .breakout-board-wrapper {
        width: min(320px, calc(100vh - 340px) * (320 / 420));
        height: min(420px, calc(100vh - 340px));
    }
}


/* =========================================
   7. PROFİL - OYUN REKORLARI (2'Lİ GRID)
========================================= */

.profil-game-scores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0 6px;
}

.profil-game-score {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 14px;
    transition: .2s;
    min-width: 0;
}

.profil-game-score:hover {
    background: #eef2f7;
    transform: translateY(-1px);
}

.profil-game-score--wide {
    grid-column: 1 / -1;
}

.profil-game-score__icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    background: #fff;
    border-radius: 11px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.profil-game-score__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profil-game-score__label {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profil-game-score__value {
    font-size: 17px;
    font-weight: 800;
    color: #111827;
    line-height: 1.1;
}

@media (max-width: 420px) {

    .profil-game-scores-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .profil-game-score {
        padding: 8px 10px;
    }

    .profil-game-score__icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
        border-radius: 9px;
    }

    .profil-game-score__label {
        font-size: 9px;
    }

    .profil-game-score__value {
        font-size: 15px;
    }

}