/* ============================================================
   PLAY SCREEN
   ============================================================ */

#play-screen.ps-screen {
    position: absolute;
    inset: 0;

    background: linear-gradient(
        135deg,
        #cfd8e7,
        #a3b8dc
    );

    padding: 0;

    display: flex;
    flex-direction: column;

    box-sizing: border-box;
    overflow: hidden;

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


/* ============================================================
   TOP BAR
   ============================================================ */

.ps-topbar {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 14px 16px;

    background: #0a2a43;
    color: white;
}


/* Back button */

.ps-back-btn {
    flex-shrink: 0;

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

    background: #123c5a;
    border: none;
    border-radius: 8px;

    padding: 6px 12px;

    color: white;
    font-size: 14px;

    cursor: pointer;
}


/* Title */

.ps-title {
    font-family: "Sora", sans-serif;

    flex: 1;

    text-align: center;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    font-size: 18px;
    font-weight: 700;

    letter-spacing: 0.5px;
}


/* Calculator */

.ps-calc-btn {
    flex-shrink: 0;

    background: #123c5a;
    border: none;
    border-radius: 8px;

    padding: 6px 10px;

    font-size: 16px;
    color: white;

    cursor: pointer;
}


/* Small screens */

@media (max-width: 400px) {

    .ps-title {
        font-size: 16px;
    }

    .ps-back-btn {
        padding: 5px 10px;
        font-size: 13px;
    }
}


.ps-back-btn:hover {
    background: #06325b;
}


/* ============================================================
   TIMER / SUBMIT ROW
   ============================================================ */

.ps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 8px 12px;

    position: sticky;
    top: 0;

    z-index: 20;

    background: #cfd8e7;
}


.ps-timer-box {
    font-family: "Oxanium", sans-serif;

    background: #ffffff;
    color: #0a2a43;

    border: 2px solid #0a2a43;

    padding: 6px 10px;

    border-radius: 16px;

    font-size: 22px;
}


.ps-submit-btn {
    background: #0a2a43;
    color: white;

    border: none;

    padding: 6px 12px;

    border-radius: 14px;

    font-size: 18px;

    cursor: pointer;

    transition: 0.15s ease;
}


.ps-submit-btn:hover {
    background: #06325b;
}


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

.ps-progress-text {
    font-family: "Oxanium", sans-serif;

    margin-bottom: 6px;

    font-size: 14px;

    color: #0a2a43;

    text-align: center;

    position: sticky;
    top: 58px;

    background: #cfd8e7;

    z-index: 15;
}


/* ============================================================
   NOTEBOOK / PAGE STAGE
   ============================================================ */

.ps-qa-stage {
    position: relative;

    width: 100%;
    height: 100%;

    min-height: 0;

    flex: 1 1 auto;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    /*
     * Notebook backing.
     *
     * The actual page completely covers this during
     * normal viewing. It becomes visible when the
     * page flips away.
     */
    background-color: #fffef7;

    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 27px,
            rgba(80, 120, 160, 0.18) 28px,
            transparent 29px
        );
}


/* ============================================================
   ATP GAME STUDIO NOTEBOOK BRANDING
   ============================================================ */

.ps-qa-stage::before {
    content: "ATP Game Studio";

    position: absolute;

    /* Exact center of the qa-stage */
    left: 50%;
    top: 50%;

    z-index: 0;

    font-family: "Sora", sans-serif;
    font-size: clamp(24px, 6vw, 58px);
    font-weight: 700;
    letter-spacing: 2px;
    white-space: nowrap;

    color: rgba(10, 42, 67, 0.10);

    /*
     * Move the element's own center to the
     * center of the qa-stage, then rotate.
     */
    transform:
        translate(-50%, -50%)
        rotate(-35deg);

    transform-origin: center center;

    pointer-events: none;
    user-select: none;
}


/* ============================================================
   ACTUAL QUESTION PAGE
   ============================================================ */

.ps-qa-container {
    position: relative;

    z-index: 2;

    width: 100%;
    height: 100%;

    min-height: 0;

    flex: 1 1 auto;

    padding: 0;
    margin: 0;

    background: #ffffff;

    border-radius: 0;

    box-shadow: none;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    /*
     * 3D page-flip setup
     */
    perspective: 1600px;
    transform-style: preserve-3d;

    /*
     * Keep the white page visually stable during
     * the 3D transformation.
     */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    transition:
        transform 0.3s
        cubic-bezier(
            0.4,
            0,
            0.2,
            1
        );
}


/* ============================================================
   SCROLLABLE CONTENT
   ============================================================ */

.ps-qa-scroll {
    width: 100%;
    height: 100%;

    flex: 1 1 auto;

    min-height: 0;

    display: flex;
    flex-direction: column;
    justify-content: flex-start;

    overflow-y: auto;

    padding: 0;
    margin: 0;

    -webkit-overflow-scrolling: touch;

    /*
     * Keep the content on the same white page
     * during 3D rotation.
     */
    background: #ffffff;
}


/* Hide scrollbar visually */

.ps-qa-scroll::-webkit-scrollbar {
    width: 6px;
}

.ps-qa-scroll::-webkit-scrollbar-thumb {
    background: rgba(
        0,
        0,
        0,
        0.25
    );

    border-radius: 6px;
}


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

.ps-question-box {
    width: 100%;
    max-width: none;

    background: #ffffff;
    color: #002b3b;

    padding: 12px;
    margin: 0;

    border-radius: 0;

    box-shadow: none;

    font-size: clamp(
        14px,
        2vw,
        18px
    );

    position: relative;
}


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

    margin-bottom: 8px;
}


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

    margin-top: 8px;
}


/* ============================================================
   QUESTION ENTRANCE ANIMATIONS
   ============================================================ */

/*
 * Question text:
 *
 * Soft upward movement combined with a fade.
 * This gives the impression that the content is
 * settling naturally onto the page.
 */

.ps-question-enter {
    animation:
        ps-question-rise
        0.42s
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        )
        both;
}


@keyframes ps-question-rise {

    from {
        opacity: 0;

        transform:
            translateY(16px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}


/*
 * Question image:
 *
 * Slight fade + scale gives images a softer
 * entrance without making them feel oversized.
 */

.ps-question-image-enter {
    animation:
        ps-question-image-rise
        0.48s
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        )
        0.08s
        both;
}


@keyframes ps-question-image-rise {

    from {
        opacity: 0;

        transform:
            translateY(10px)
            scale(0.97);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/*
 * Answer options:
 *
 * JavaScript supplies the stagger delay through
 * --ps-option-delay.
 */

.ps-option-enter {
    animation:
        ps-option-rise
        0.42s
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        )
        var(--ps-option-delay, 0s)
        both;
}


@keyframes ps-option-rise {

    from {
        opacity: 0;

        transform:
            translateY(14px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}


/*
 * Respect reduced-motion preferences.
 *
 * The quiz remains completely usable for users
 * who prefer less animation.
 */

@media (prefers-reduced-motion: reduce) {

    .ps-question-enter,
    .ps-question-image-enter,
    .ps-option-enter {
        animation: none;
        opacity: 1;
        transform: none;
    }
}


/* ============================================================
   QUESTION IMAGE
   ============================================================ */

.ps-question-image {
    width: 100%;

    display: block;

    margin: 15px auto;

    border-radius: 10px;

    max-width: 100%;
    height: auto;

    cursor: zoom-in;

    transition:
        transform 0.25s ease,
        max-width 0.25s ease,
        max-height 0.25s ease,
        box-shadow 0.25s ease;
}


/* Question image zoom button */

.ps-image-zoom-btn {
    position: absolute;

    right: 10px;
    bottom: 10px;

    width: 36px;
    height: 36px;

    border: none;
    border-radius: 50%;

    background: rgba(
        0,
        0,
        0,
        0.7
    );

    color: white;

    display: flex;

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

    cursor: pointer;

    z-index: 5;
}


.ps-image-zoom-btn:hover {
    background: rgba(
        0,
        0,
        0,
        0.9
    );
}


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

.ps-options-container {
    width: 100%;
    max-width: none;

    margin: 0;

    padding: 0;

    display: flex;
    flex-direction: column;

    gap: 12px;
}


.ps-option-row {
    display: flex;
    align-items: center;

    width: 100%;

    background: #ffffff;
    color: #00354a;

    padding: 10px;

    border-radius: 12px;

    cursor: pointer;

    box-shadow:
        0 3px 6px
        rgba(
            0,
            0,
            0,
            0.15
        );

    font-size: clamp(
        13px,
        1.8vw,
        16px
    );

    transition:
        background 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;

    position: relative;
}


.ps-option-row:hover {
    background: #eafff7;
}


.ps-option-row.selected {
    background: #dff7eb;

    border: 2px solid #00c853;
}


.ps-option-circle {
    flex: 0 0 20px;

    width: 20px;
    height: 20px;

    border: 2px solid #00d590;

    border-radius: 50%;

    margin-right: 15px;

    box-sizing: border-box;
}


.ps-option-circle.active {
    background: #00d590;
}


.ps-option-text b {
    font-size: clamp(
        14px,
        2vw,
        17px
    );
}


/* Option images */

.ps-option-image {
    display: block;

    width: 100%;

    object-fit: contain;

    margin-top: 10px;

    border-radius: 10px;

    cursor: zoom-in;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}


/* ============================================================
   NAVIGATION
   ============================================================ */

.ps-nav-row {
    margin-top: 6px;

    padding: 6px 10px;

    display: flex;
    justify-content: space-between;
}


.ps-nav-btn {
    background: #0a2a43;
    color: white;

    border: none;
    border-radius: 10px;

    padding: 6px 14px;

    cursor: pointer;

    font-size: 14px;

    box-shadow:
        0 2px 5px
        rgba(
            0,
            0,
            0,
            0.3
        );

    transition: 0.15s ease;
}


.ps-nav-btn:hover {
    font-family: "Orbitron", sans-serif;

    background: #06325b;
}


/* Disabled navigation buttons */

.ps-nav-btn.disabled {
    background: #9aa7b2;

    cursor: not-allowed;

    box-shadow: none;

    opacity: 0.7;
}


.ps-nav-btn.disabled:hover {
    background: #9aa7b2;
}


/* ============================================================
   BUTTON FONTS
   ============================================================ */

.ps-timer-box,
.ps-submit-btn,
.ps-nav-btn,
.ps-back-btn,
.ps-calc-btn {
    font-family: "Sora", sans-serif;

    font-size: clamp(
        12px,
        1.5vw,
        16px
    );
}


/* ============================================================
   NEXT BUTTON
   ============================================================ */

#nextBtn {
    background: #00c853;

    font-weight: 700;
}


#nextBtn:hover {
    background: #00a844;
}


/* ============================================================
   PAGE-FLIP LIGHTING
   ============================================================ */

.ps-qa-container::after {
    content: "";

    position: absolute;

    inset: 0;

    /*
     * Keep this lighting layer neutral so it does
     * not introduce a new page colour.
     */
    background:
        linear-gradient(
            to right,
            rgba(
                0,
                0,
                0,
                0.20
            ),
            rgba(
                255,
                255,
                255,
                0.03
            )
        );

    pointer-events: none;

    opacity: 0;

    transition:
        opacity 0.3s ease;

    z-index: 10;
}


/* ============================================================
   FORWARD PAGE FLIP
   ============================================================ */

.ps-qa-container.curl-next {
    transform-origin: left center;

    transform:
        translateZ(20px)
        rotateY(-95deg);

    /*
     * Explicitly preserve the page surface.
     */
    background: #ffffff;
}


.ps-qa-container.curl-next::after {
    opacity: 0.45;
}


/* ============================================================
   BACKWARD PAGE FLIP
   ============================================================ */

.ps-qa-container.curl-prev {
    transform-origin: right center;

    transform:
        translateZ(20px)
        rotateY(95deg);

    /*
     * Explicitly preserve the page surface.
     */
    background: #ffffff;
}


.ps-qa-container.curl-prev::after {
    opacity: 0.45;
}


/* ============================================================
   PAGE-FLIP RESET
   ============================================================ */

.ps-qa-container.curl-reset {
    transform:
        translateZ(0)
        rotateY(0deg);

    background: #ffffff;
}


/* ============================================================
   JUMP TO MODAL
   ============================================================ */

.ps-jump-overlay {
    position: fixed;
    inset: 0;

    background: rgba(
        0,
        0,
        0,
        0.6
    );

    display: flex;

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

    z-index: 999999;
}


.ps-jump-box {
    width: 90%;
    max-width: 500px;

    max-height: 80vh;

    background: white;

    border-radius: 16px;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}


.ps-jump-header {
    position: sticky;
    top: 0;

    background: #0a2a43;

    color: white;

    padding: 12px 16px;

    font-weight: 600;

    display: flex;

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


#ps-jump-close {
    background: none;

    border: none;

    color: white;

    font-size: 20px;

    cursor: pointer;
}


.ps-jump-grid {
    padding: 12px;

    display: grid;

    grid-template-columns:
        repeat(10, 1fr);

    gap: 8px;

    overflow-y: auto;
}


.ps-jump-item {
    aspect-ratio: 1 / 1;

    display: flex;

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

    border-radius: 8px;

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

    cursor: pointer;

    border: 2px solid transparent;
}


.ps-jump-item.answered {
    border-color: #00c853;

    background: #e8f5e9;
}


.ps-jump-item.unanswered {
    background: #f1f1f1;

    color: #555;
}


.ps-jump-item.current {
    border-color: #2962ff;

    background: #e3f2fd;
}


/* ============================================================
   IMAGE OVERLAY
   ============================================================ */

.ps-image-overlay {
    position: fixed;
    inset: 0;

    background: rgba(
        0,
        0,
        0,
        0.68
    );

    display: flex;

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

    z-index: 999999;
}


.ps-image-overlay img {
    max-width: 95vw;
    max-height: 92vh;

    object-fit: contain;

    border-radius: 12px;

    background: white;

    padding: 8px;
}


.ps-image-close {
    position: absolute;

    top: 15px;
    right: 15px;

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 50%;

    background: white;

    font-size: 24px;

    cursor: pointer;

    display: flex;

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


/* ============================================================
   RESPONSIVE SAFETY
   ============================================================ */

@media (max-width: 600px) {

    .ps-qa-container {
        padding: 0;
        margin: 0;
    }

    .ps-qa-scroll {
        padding: 0;
        margin: 0;
    }

    .ps-question-box {
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .ps-options-container {
        width: 100%;
        max-width: none;
        margin: 0;
    }
}