/* =========================================================
   MULTIPLAYER PLAY SCENE
   Namespace: mps
========================================================= */

/* =========================================================
   ROOT SCREEN
========================================================= */

.mps-screen {
    position: absolute;
    inset: 0;

    display: flex;
    flex-direction: column;

    overflow-x: hidden;
    overflow-y: auto;

    font-family: "Poppins", sans-serif;

    color: #cfd8e7;

    background:
        linear-gradient(rgba(9, 16, 63, 0.88), rgba(9, 16, 63, 0.94)),
        url("/client/assets/images/bg/game_bg_portrait.jpg") center / cover
            no-repeat;

    scrollbar-width: thin;
}

/* =========================================================
   TOPBAR
========================================================= */

.mps-topbar {
    display: grid;

    grid-template-columns:
        50px
        1fr
        50px;

    align-items: center;

    gap: 8px;

    min-height: 58px;

    padding: 8px 12px;

    background: linear-gradient(135deg, #0a2a43, #09103f);

    color: white;

    flex-shrink: 0;

    border-bottom: 1px solid rgba(163, 184, 220, 0.22);

    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.24);
}

/* =========================================================
   BACK BUTTON
========================================================= */

.mps-back-btn,
.mps-calc-btn {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid rgba(163, 184, 220, 0.45);

    border-radius: 8px;

    background: rgba(9, 16, 63, 0.72);

    color: #cfd8e7;

    font-family: "Sora", sans-serif;

    font-size: 18px;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.mps-back-btn:hover,
.mps-calc-btn:hover {
    background: rgba(22, 67, 91, 0.95);

    border-color: #65d6ad;
}

.mps-back-btn:active,
.mps-calc-btn:active {
    transform: scale(0.96);
}

/* =========================================================
   SCOREBOARD
========================================================= */

.mps-scoreboard-table {
    width: 100%;

    max-width: 430px;

    margin: 0 auto;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 4px;

    padding: 4px 8px;

    border: 1px solid rgba(101, 214, 173, 0.5);

    border-radius: 9px;

    background: linear-gradient(
        135deg,
        rgba(10, 42, 67, 0.96),
        rgba(9, 16, 63, 0.96)
    );

    overflow: hidden;
}

.mps-scoreboard-row {
    width: 100%;

    display: flex;

    align-items: center;
    justify-content: center;

    gap: 6px;

    max-width: 100%;

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: none;
}

.mps-scoreboard-row::-webkit-scrollbar {
    display: none;
}

.mps-scoreboard-cell {
    min-width: 48px;
    max-width: 105px;

    padding: 4px 7px;

    border: 1px solid rgba(163, 184, 220, 0.2);

    border-radius: 6px;

    background: rgba(255, 255, 255, 0.07);

    color: #cfd8e7;

    text-align: center;

    font-family: "Oxanium", sans-serif;

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;

    overflow: hidden;
    text-overflow: ellipsis;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

/* CURRENT PLAYER */

.mps-active-player {
    background: linear-gradient(135deg, #65d6ad, #00a878);

    border-color: #65d6ad;

    color: #062d24;

    transform: scale(1.04);
}

/* LOCAL PLAYER */

.mps-my-player {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

/* =========================================================
   QUESTION PROGRESS
========================================================= */

.mps-progress {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 10px;

    padding: 7px 14px 3px;

    text-align: center;

    color: #cfd8e7;

    font-family: "Oxanium", sans-serif;

    font-size: 0.9rem;
    font-weight: 600;
}

.mps-progress-subject {
    padding: 3px 8px;

    border: 1px solid rgba(101, 214, 173, 0.35);

    border-radius: 6px;

    background: rgba(10, 42, 67, 0.72);

    color: #65d6ad;

    font-size: 0.8rem;
    font-weight: 600;
}

/* =========================================================
   TIMER
========================================================= */

.mps-timer {
    width: 94%;

    max-width: 700px;

    margin: 0 auto;

    display: flex;
    flex-direction: column;

    gap: 5px;

    padding: 4px 0 9px;
}

.mps-timer-text {
    display: block;

    text-align: center;

    color: #cfd8e7;

    font-family: "Oxanium", sans-serif;

    font-size: 0.9rem;
    font-weight: 700;
}

.mps-timer-track {
    width: 100%;

    height: 6px;

    overflow: hidden;

    border-radius: 999px;

    background: rgba(163, 184, 220, 0.18);
}

.mps-timer-bar {
    width: 100%;
    height: 100%;

    border-radius: inherit;

    background: linear-gradient(90deg, #00a878, #65d6ad);

    transition: width 0.25s linear;
}

/* =========================================================
   QUESTION BOX
========================================================= */

.mps-question-box {
    width: 94%;

    max-width: 900px;

    flex: 1;

    min-height: 0;

    margin: 8px auto;

    padding: 16px;

    border: 1px solid rgba(163, 184, 220, 0.35);

    border-radius: 12px;

    background: rgba(9, 16, 63, 0.78);

    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);

    overflow: hidden;
}

.mps-question-scroll {
    width: 100%;
    height: 100%;

    max-height: 100%;

    overflow-x: hidden;
    overflow-y: auto;

    padding-right: 4px;

    scrollbar-width: thin;

    scrollbar-color: #65d6ad rgba(255, 255, 255, 0.08);
}

.mps-question-scroll::-webkit-scrollbar {
    width: 5px;
}

.mps-question-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
}

.mps-question-scroll::-webkit-scrollbar-thumb {
    background: #65d6ad;
    border-radius: 999px;
}

/* QUESTION TEXT */

#game-container .mps-question-box {
    font-family: "Inter", sans-serif;

    font-size: 1.14rem;

    line-height: 1.55;

    color: #cfd8e7;
}

.mps-question-text-a,
.mps-question-text-b {
    font-family: "Inter", sans-serif;

    margin-bottom: 10px;
}

/* QUESTION IMAGE */

.mps-question-image-wrap {
    width: 100%;

    display: flex;

    align-items: center;
    justify-content: center;
}

.mps-question-image {
    display: block;

    max-width: 100%;
    max-height: 230px;

    width: auto;
    height: auto;

    margin: 10px auto;

    border-radius: 8px;

    object-fit: contain;
}

/* =========================================================
   OPTIONS
========================================================= */

.mps-options {
    width: 94%;

    max-width: 900px;

    margin: 0 auto;

    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 10px;

    padding: 0 0 10px;
}

.mps-option {
    width: 100%;

    min-height: 58px;

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 12px;

    border: 2px solid rgba(163, 184, 220, 0.3);

    border-radius: 10px;

    background: rgba(10, 42, 67, 0.88);

    color: #cfd8e7;

    font-family: "Poppins", sans-serif;

    font-size: 0.98rem;

    line-height: 1.4;

    text-align: left;

    cursor: pointer;

    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.2);

    transition:
        transform 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        opacity 0.15s ease;
}

.mps-option:hover:not(:disabled) {
    background: rgba(22, 67, 91, 0.96);

    border-color: #65d6ad;

    transform: translateY(-1px);
}

.mps-option:active:not(:disabled) {
    transform: scale(0.99);
}

.mps-option:disabled {
    cursor: default;
}

/* OPTION LETTER */

.mps-option-letter {
    width: 32px;
    height: 32px;

    min-width: 32px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: rgba(163, 184, 220, 0.18);

    color: #cfd8e7;

    font-family: "Oxanium", sans-serif;

    font-size: 0.85rem;
    font-weight: 700;
}

/* OPTION CONTENT */

.mps-option-content {
    flex: 1;

    min-width: 0;
}

/* OPTION IMAGE */

.mps-option-image {
    display: block;

    max-width: 160px;
    max-height: 100px;

    margin-left: auto;

    object-fit: contain;

    border-radius: 7px;
}

/* =========================================================
   ANSWER STATES
========================================================= */

.mps-option-correct {
    background: rgba(18, 94, 70, 0.95);

    border-color: #28a745;

    color: #d4edda;
}

.mps-option-correct .mps-option-letter {
    background: #28a745;

    color: white;
}

.mps-option-wrong {
    background: rgba(114, 37, 46, 0.95);

    border-color: #dc3545;

    color: #f8d7da;
}

.mps-option-wrong .mps-option-letter {
    background: #dc3545;

    color: white;
}

/* =========================================================
   FEEDBACK
========================================================= */

.mps-feedback {
    width: 94%;

    max-width: 900px;

    margin: 0 auto 10px;

    padding: 10px 14px;

    border-radius: 9px;

    text-align: center;

    font-family: "Poppins", sans-serif;

    font-size: 0.9rem;

    line-height: 1.4;

    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.2);
}

.mps-feedback-title {
    font-weight: 700;
}

.mps-feedback-explanation {
    margin-top: 5px;

    line-height: 1.5;
}

/* HIDDEN */

.mps-feedback-hidden {
    display: none !important;
}

/* CORRECT */

.mps-feedback-correct {
    background: rgba(212, 237, 218, 0.96);

    color: #155724;

    border: 1px solid #28a745;
}

/* WRONG */

.mps-feedback-wrong {
    background: rgba(248, 215, 218, 0.96);

    color: #721c24;

    border: 1px solid #dc3545;
}

/* TIME UP */

.mps-feedback-timeup {
    background: rgba(255, 243, 205, 0.96);

    color: #856404;

    border: 1px solid #ffc107;
}

/* OTHER PLAYER'S TURN */

.mps-feedback-turn {
    background: rgba(10, 42, 67, 0.95);

    color: #cfd8e7;

    border: 1px solid #a3b8dc;
}

/* =========================================================
   LOADING
========================================================= */

.mps-loading {
    min-height: 180px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    color: #a3b8dc;

    text-align: center;

    font-family: "Oxanium", sans-serif;

    font-size: 1rem;
}

/* =========================================================
   ERROR
========================================================= */

.mps-error {
    padding: 20px;

    color: #ffb4b4;

    text-align: center;

    font-size: 1rem;
    font-weight: 600;
}

.mps-error-back {
    display: block;

    margin: 0 auto 12px;

    padding: 10px 18px;

    border: 1px solid rgba(163, 184, 220, 0.4);

    border-radius: 8px;

    background: #0a2a43;

    color: #cfd8e7;

    font-family: "Sora", sans-serif;

    font-size: 0.9rem;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.mps-error-back:hover {
    background: #123c5a;

    border-color: #65d6ad;
}

.mps-error-back:active {
    transform: scale(0.97);
}

/* =========================================================
   MOBILE PORTRAIT
========================================================= */

@media (max-width: 600px) {
    .mps-topbar {
        grid-template-columns:
            46px
            1fr
            46px;

        min-height: 54px;

        padding: 7px 9px;
    }

    .mps-back-btn,
    .mps-calc-btn {
        width: 38px;
        height: 38px;

        font-size: 16px;
    }

    .mps-scoreboard-cell {
        min-width: 42px;

        max-width: 85px;

        padding: 3px 6px;

        font-size: 10px;
    }

    .mps-progress {
        padding-top: 6px;

        font-size: 0.82rem;
    }

    .mps-progress-subject {
        font-size: 0.72rem;
    }

    .mps-timer {
        width: calc(100% - 20px);

        padding-bottom: 7px;
    }

    .mps-question-box {
        width: calc(100% - 16px);

        margin: 6px auto;

        padding: 13px;
    }

    #game-container .mps-question-box {
        font-size: 1rem;
    }

    .mps-question-image {
        max-height: 190px;
    }

    .mps-options {
        width: calc(100% - 16px);

        grid-template-columns: 1fr;

        gap: 8px;

        padding-bottom: 8px;
    }

    .mps-option {
        min-height: 54px;

        padding: 11px;

        font-size: 0.94rem;
    }

    .mps-feedback {
        width: calc(100% - 16px);

        margin-bottom: 8px;

        font-size: 0.82rem;
    }
}

/* =========================================================
   VERY SMALL PORTRAIT
========================================================= */

@media (max-width: 400px) {
    .mps-topbar {
        grid-template-columns:
            42px
            1fr
            42px;

        padding: 6px 7px;
    }

    .mps-back-btn,
    .mps-calc-btn {
        width: 35px;
        height: 35px;

        font-size: 15px;
    }

    .mps-scoreboard-row {
        gap: 4px;
    }

    .mps-scoreboard-cell {
        min-width: 36px;

        max-width: 72px;

        padding: 3px 5px;

        font-size: 9px;
    }

    .mps-progress {
        gap: 7px;

        font-size: 0.76rem;
    }

    .mps-progress-subject {
        font-size: 0.68rem;
    }

    .mps-question-box {
        width: calc(100% - 14px);

        margin: 5px auto;

        padding: 11px;
    }

    #game-container .mps-question-box {
        font-size: 0.94rem;
    }

    .mps-question-image {
        max-height: 150px;
    }

    .mps-options {
        width: calc(100% - 14px);

        gap: 7px;
    }

    .mps-option {
        padding: 10px;

        font-size: 0.88rem;
    }

    .mps-option-letter {
        width: 28px;
        height: 28px;

        min-width: 28px;

        font-size: 0.75rem;
    }

    .mps-option-image {
        max-width: 100px;
        max-height: 70px;
    }

    .mps-feedback {
        width: calc(100% - 14px);

        padding: 9px;

        font-size: 0.76rem;
    }
}

/* =========================================================
   LANDSCAPE
========================================================= */

@media (orientation: landscape) and (max-height: 500px) {
    .mps-screen {
        background:
            linear-gradient(rgba(9, 16, 63, 0.88), rgba(9, 16, 63, 0.94)),
            url("/client/assets/images/bg/game_bg_landscape.jpg") center / cover
                no-repeat;
    }

    .mps-topbar {
        min-height: 48px;

        padding: 5px 10px;
    }

    .mps-back-btn,
    .mps-calc-btn {
        width: 34px;
        height: 34px;

        font-size: 15px;
    }

    .mps-scoreboard-cell {
        padding: 2px 6px;

        font-size: 9px;
    }

    .mps-progress {
        padding: 4px 10px 2px;

        font-size: 0.75rem;
    }

    .mps-timer {
        padding: 2px 0 5px;
    }

    .mps-timer-text {
        font-size: 0.75rem;
    }

    .mps-timer-track {
        height: 5px;
    }

    .mps-question-box {
        margin: 5px auto;

        padding: 10px;
    }

    #game-container .mps-question-box {
        font-size: 0.9rem;
    }

    .mps-question-image {
        max-height: 120px;
    }

    .mps-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));

        gap: 6px;

        padding-bottom: 6px;
    }

    .mps-option {
        min-height: 42px;

        padding: 7px;

        font-size: 0.78rem;
    }

    .mps-option-letter {
        width: 25px;
        height: 25px;

        min-width: 25px;

        font-size: 0.7rem;
    }

    .mps-option-image {
        max-width: 90px;
        max-height: 55px;
    }

    .mps-feedback {
        margin-bottom: 5px;

        padding: 6px 10px;

        font-size: 0.72rem;
    }
}

/* =========================================================
   LARGER SCREENS
========================================================= */

@media (min-width: 900px) {
    .mps-question-box {
        margin-top: 10px;
        margin-bottom: 10px;

        padding: 18px;
    }

    .mps-options {
        gap: 12px;
    }

    .mps-option {
        min-height: 62px;

        padding: 13px;

        font-size: 1rem;
    }

    .mps-feedback {
        margin-bottom: 12px;
    }
}
