/* ============================================================
   THEORY PLAY SCENE
   ============================================================ */


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

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

    display: flex;
    flex-direction: column;

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

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

    color: #002b3b;

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


/* ============================================================
   TOP BAR
   Matches PlayScene
   ============================================================ */

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

    padding: 14px 16px;

    background: #0a2a43;
    color: white;

    flex-shrink: 0;
}


/* Back button */

.play-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;

    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}

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

    transform: translateY(-1px);
}

.play-back-btn:active {
    transform: translateY(0);
}


/* Center title */

.play-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;

    margin: 0;
}


/* Calculator */

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

    background: #123c5a;

    border: none;
    border-radius: 8px;

    padding: 6px 10px;

    font-size: 16px;

    color: white;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}

.play-calc-btn:hover {
    background: #06325b;

    transform: translateY(-1px);
}

.play-calc-btn:active {
    transform: translateY(0);
}


/* ============================================================
   TIMER + SUBMIT
   Matches PlayScene
   ============================================================ */

.play-header {
    display: flex;

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

    padding: 8px 12px;

    position: sticky;
    top: 0;

    z-index: 20;

    background: #cfd8e7;

    flex-shrink: 0;
}


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

    background: #ffffff;

    color: #0a2a43;

    border: 2px solid #0a2a43;

    padding: 6px 10px;

    border-radius: 16px;

    font-size: 22px;
}


.submit-btn {
    background: #0a2a43;

    color: white;

    border: none;

    padding: 6px 12px;

    border-radius: 14px;

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

    font-size: 18px;

    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}

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

    transform: translateY(-1px);
}

.submit-btn:active {
    transform: translateY(0);
}


/* ============================================================
   PROGRESS
   Matches PlayScene
   ============================================================ */

.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;

    flex-shrink: 0;
}


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

/* Static notebook page */

.qa-stage {
    position: relative;

    flex: 1 1 auto;

    width: 100%;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background-color: #fffef7;

    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 27px,
            #d8e1ed 28px,
            transparent 29px
        );
}

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

.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;
}

/* ============================================================
   ANIMATED PAGE
   ============================================================ */

.qa-container {
    position: relative;

    z-index: 2;

    width: 100%;
    height: 100%;

    flex: 1 1 auto;

    min-height: 0;

    padding: 0;
    margin: 0;

    perspective: 1600px;

    transform-style: preserve-3d;

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

    border-radius: 0;

    box-shadow: none;

    overflow: hidden;

    display: flex;
    flex-direction: column;
}


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

.qa-scroll {
    flex: 1;

    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;

    justify-content: flex-start;

    overflow-y: auto;

    padding: 0;
    margin: 0;

    -webkit-overflow-scrolling:
        touch;
}


/* Scrollbar */

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

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

    border-radius: 6px;
}


/* ============================================================
   CURL LIGHTING
   ============================================================ */

.qa-container::before {
    content: "";

    position: absolute;

    inset: 0;

    background:
        linear-gradient(
            to right,
            rgba(0, 0, 0, 0.25),
            rgba(255, 255, 255, 0.05)
        );

    pointer-events: none;

    opacity: 0;

    transition:
        opacity 0.3s ease;

    z-index: 5;
}


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

.question-box {
    background: white;

    color: #002b3b;

    width: 100%;
    max-width: none;

    padding: 12px;

    margin: 0;

    border-radius: 0;

    box-shadow: none;

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

    position: relative;
}


/* Question number */

.question-number {
    text-align: center;

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

    font-weight: 700;

    font-size: 18px;

    color: #0a2a43;

    padding-bottom: 10px;

    margin-bottom: 12px;

    border-bottom:
        2px solid #cfd8e7;

    display: block;
}


/* Question text */

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

    margin-bottom: 8px;

    line-height: 1.6;
}

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

    margin-top: 8px;

    line-height: 1.6;
}


/* Question image */

.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;
}


/* ============================================================
   THEORY PARTS
   ============================================================ */

.parts-container {
    display: flex;

    flex-direction: column;

    gap: 0;

    width: 100%;
    max-width: none;

    margin: 0;
}


.theory-part {
    background: white;

    color: #00354a;

    width: 100%;

    margin: 0;

    border-radius: 0;

    padding: 14px;

    box-shadow: none;

    border:
        1px solid
        rgba(
            120,
            180,
            220,
            0.24
        );
}


/* Part header */

.part-header {
    font-family: "Inter", sans-serif;

    font-size: 14px;

    margin-bottom: 8px;

    color: #0a2a43;
}


/* Part prompt */

.part-prompt {
    font-family: "Inter", sans-serif;

    margin-bottom: 12px;

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

    line-height: 1.6;
}


/* Part text B */

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

    margin-bottom: 12px;

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

    line-height: 1.6;
}


/* Part question image */

.part-question-image {
    display: block;

    width: 100%;

    max-width: 500px;

    margin: 12px auto;

    border-radius: 10px;

    cursor: zoom-in;
}


/* ============================================================
   TEXTAREAS
   ============================================================ */

.theory-textarea {
    width: 100%;

    min-height: 100px;

    resize: vertical;

    border-radius: 10px;

    border:
        2px solid
        #a3b8dc;

    padding: 10px;

    background: #ffffff;

    color: #00354a;

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

    font-size: 14px;

    outline: none;

    transition:
        border 0.2s ease,
        box-shadow 0.2s ease;
}

.theory-textarea:focus {
    border-color: #00c853;

    box-shadow:
        0 0 0 2px
        rgba(
            0,
            200,
            83,
            0.12
        );
}


/* ============================================================
   FILE UPLOAD
   ============================================================ */

.theory-upload {
    margin-top: 8px;

    width: 100%;

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

    font-size: 13px;

    color: #0a2a43;
}


.upload-preview {
    display: block;

    margin-top: 12px;

    max-width: 200px;

    width: 100%;

    border-radius: 10px;

    border:
        1px solid
        #a3b8dc;
}


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

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

    padding: 6px 10px;

    display: flex;

    justify-content: space-between;

    gap: 8px;

    flex-shrink: 0;
}


.nav-btn {
    background: #0a2a43;

    color: white;

    border: none;

    border-radius: 10px;

    padding: 6px 14px;

    cursor: pointer;

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

    font-size: 14px;

    font-weight: 700;

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

    transition:
        transform 0.15s ease,
        filter 0.15s ease;

    min-width: 0;
}

.nav-btn:hover {
    background: #06325b;

    transform: translateY(-1px);
}

.nav-btn:active {
    transform: translateY(0);
}


/* Disabled navigation */

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

    cursor: not-allowed;

    box-shadow: none;

    opacity: 0.7;

    transform: none;
}

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

    transform: none;
}


/* Jump To */

.jump-btn {
    background: #0a2a43;
}

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


/* Next */

#nextBtn {
    background: #00c853;

    font-weight: 700;
}

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


/* ============================================================
   SHARED PLAY-SCENE FONT RULE
   ============================================================ */

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

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


/* ============================================================
   PAGE CURL ANIMATION
   ============================================================ */

.curl-next {
    transform-origin: left center;

    transform:
        translateZ(80px)
        rotateY(-95deg);
}

.curl-next::before {
    opacity: 0.45;
}


.curl-prev {
    transform-origin: right center;

    transform:
        translateZ(80px)
        rotateY(95deg);
}

.curl-prev::before {
    opacity: 0.45;
}


.curl-reset {
    transform:
        translateZ(0)
        rotateY(0deg);
}


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

.theory-jump-overlay {
    position: fixed;

    inset: 0;

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

    display: flex;

    justify-content: center;

    align-items: center;

    z-index: 999999;
}


.theory-jump-box {
    width: 90%;

    max-width: 500px;

    max-height: 80vh;

    background: white;

    border-radius: 16px;

    display: flex;

    flex-direction: column;

    overflow: hidden;
}


.theory-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;

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


#theory-jump-close {
    background: none;

    border: none;

    color: white;

    font-size: 20px;

    cursor: pointer;
}


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

    display: grid;

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

    gap: 8px;

    overflow-y: auto;
}


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

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 8px;

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

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    border: 2px solid transparent;
}


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

    background: #e8f5e9;
}


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

    color: #555;
}


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

    background: #e3f2fd;
}


/* ============================================================
   IMAGE ZOOM
   ============================================================ */

#image-zoom-overlay {
    position: fixed;

    inset: 0;

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

    display: flex;

    justify-content: center;

    align-items: center;

    z-index: 999999;

    padding: 20px;

    animation:
        fadeIn 0.2s ease;
}


.zoomed-question-image {
    max-width: 95vw;

    max-height: 92vh;

    object-fit: contain;

    border-radius: 12px;

    background: white;

    padding: 8px;

    box-shadow:
        0 0 25px
        rgba(0, 0, 0, 0.5);

    cursor: zoom-out;

    animation:
        zoomIn 0.2s ease;
}


/* ============================================================
   TABLES
   ============================================================ */

.table-wrapper {
    margin-top: 16px;

    background: #eef3f8;

    padding: 14px;

    border-radius: 14px;

    border:
        1px solid
        #a3b8dc;
}


.table-settings {
    display: flex;

    flex-wrap: wrap;

    align-items: center;

    gap: 10px;

    margin-bottom: 14px;
}


.table-settings label {
    font-family: "Inter", sans-serif;

    font-size: 14px;

    color: #0a2a43;

    display: flex;

    align-items: center;

    gap: 6px;
}


.table-settings input[type="number"] {
    width: 65px;

    padding: 6px;

    border-radius: 8px;

    border:
        1px solid
        #a3b8dc;

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

    font-size: 15px;

    text-align: center;

    background: #fff;
}


.generate-table-btn {
    background: #0a2a43;

    color: #fff;

    border: none;

    padding: 8px 18px;

    border-radius: 8px;

    cursor: pointer;

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

    font-size: 13px;

    font-weight: 700;

    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}


.generate-table-btn:hover {
    background: #06325b;

    transform: translateY(-1px);
}


.generate-table-btn:active {
    transform: translateY(0);
}


.table-container {
    overflow-x: auto;
}


.theory-table {
    border-collapse: collapse;

    width: 100%;

    min-width: 600px;

    background: #ffffff;
}


.theory-table th,
.theory-table td {
    border:
        1px solid
        #0a2a43;

    padding: 6px;

    overflow: hidden;
}


.theory-table th {
    background: #cfd8e7;

    text-align: center;

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

    font-weight: 600;

    color: #0a2a43;
}


.sn-cell {
    width: 70px;

    text-align: center;
}


.row-number {
    text-align: center;

    background: #eef3f8;

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


.column-label {
    width: 100%;

    border-radius: 6px;

    border:
        1px solid
        #a3b8dc;

    background: #fff;

    text-align: center;

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

    font-weight: 600;

    padding: 4px;

    box-sizing: border-box;
}


.theory-table input {
    width: 100%;

    height: 36px;

    padding: 6px 8px;

    border-radius: 6px;

    border:
        1px solid
        #a3b8dc;

    background: #ffffff;

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

    font-size: 15px;

    box-sizing: border-box;
}


.theory-table input:focus {
    outline: none;

    border-color: #00c853;
}


/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


@keyframes zoomIn {
    from {
        transform: scale(0.9);

        opacity: 0;
    }

    to {
        transform: scale(1);

        opacity: 1;
    }
}


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

@media (max-width: 768px) {

    .play-header {
        padding:
            8px 12px;
    }

    .qa-container {
        padding: 0;
    }

    .qa-scroll {
        padding: 0;
    }

    .question-box {
        padding: 12px;
    }

    .theory-part {
        padding: 12px;
    }

    .nav-row {
        padding:
            6px 10px;

        gap: 7px;
    }

    .submit-btn,
    .nav-btn {
        padding:
            8px 10px;

        font-size: 12px;
    }

    .theory-textarea {
        min-height: 80px;
    }
}


/* ============================================================
   SMALL SCREENS
   ============================================================ */

@media (max-width: 400px) {

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

    .play-back-btn {
        padding:
            5px 10px;

        font-size: 13px;
    }

    .play-calc-btn {
        padding:
            5px 9px;

        font-size: 15px;
    }

    .timer-box {
        font-size: 15px;

        padding:
            6px 9px;
    }

    .submit-btn {
        padding:
            6px 9px;

        font-size: 11px;
    }
}


/* ============================================================
   VERY SMALL SCREENS
   ============================================================ */

@media (max-width: 380px) {

    .nav-row {
        gap: 5px;
    }

    .nav-btn {
        padding:
            8px 4px;

        font-size: 10px;
    }

    .question-number {
        font-size: 16px;
    }

    .part-header {
        font-size: 13px;
    }

    .table-settings {
        gap: 7px;
    }

    .generate-table-btn {
        width: 100%;
    }
}