@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

@font-face {
    font-family: "Wanted Sans";
    font-style: normal;
    font-weight: 900;
    src: url("../fonts/wanted-sans/WantedSans-Black.woff2") format("woff2");
}
@font-face {
    font-family: "Wanted Sans";
    font-style: normal;
    font-weight: 700;
    src: url("../fonts/wanted-sans/WantedSans-Bold.woff2") format("woff2");
}
@font-face {
    font-family: "Wanted Sans";
    font-style: normal;
    font-weight: 500;
    src: url("../fonts/wanted-sans/WantedSans-Medium.woff2") format("woff2");
}
@font-face {
    font-family: "Wanted Sans";
    font-style: normal;
    font-weight: 400;
    src: url("../fonts/wanted-sans/WantedSans-Regular.woff2") format("woff2");
}

:root {
    /* ── Premium Color Palette ── */
    --o-deep:    #0d1f3c;
    --o-core:    #142e58;
    --o-bright:  #1a3d73;
    --o-letter:  rgba(220, 235, 255, 0.95);
    --o-letter-active: rgba(220, 235, 255, 0.95);
    --o-glow:    0 0 30px rgba(79, 172, 254, 0.6), 0 0 60px rgba(79, 172, 254, 0.2);
    --o-glow-active: none;

    --x-deep:    #2e0f18;
    --x-core:    #4a1a28;
    --x-bright:  #6b2438;
    --x-letter:  rgba(255, 230, 235, 0.95);
    --x-letter-active: rgba(255, 230, 235, 0.95);
    --x-glow:    0 0 30px rgba(255, 70, 85, 0.6), 0 0 60px rgba(255, 70, 85, 0.2);
    --x-glow-active: none;

    /* ── Animation ── */
    --ease-dramatic: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
    --dur:           1.4s;
    --dur-rotate:    0.6s; /* Faster tilt speed */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Wanted Sans', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui,
        Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo',
        'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
    color: #fff;
    font-family: 'Wanted Sans', 'Pretendard', -apple-system, sans-serif;
}

.quiz {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════
   GRADIENT FLOODS
   ═══════════════════════════════════════════════════
   Each flood is a very wide element (250vw) with a
   gradient that goes from solid color to transparent.
   Initially most of it sits off-screen — only the
   soft transparent tail peeks in, creating an ambient
   glow on the edge. On reveal, translateX slides the
   whole thing in so the solid portion covers the
   entire viewport.                                    */

.flood {
    position: absolute;
    top: -100vh;
    bottom: -100vh;
    width: 300vw;
    z-index: 0;
    will-change: translate, rotate;
}

.flood-o {
    left: -25vw;
    /* Starts straight, slightly more bleed (45->55vw) */
    translate: -220vw 0;
    rotate: 0deg;
    background: linear-gradient(to right,
        var(--o-deep)   0%,
        var(--o-core)   65%,
        var(--o-bright)  80%,
        rgba(26, 61, 115, 0.25) 92%,
        transparent      100%
    );
    transition: translate var(--dur) var(--ease-dramatic),
                rotate var(--dur-rotate) var(--ease-dramatic),
                opacity 0.5s ease;
}

.flood-x {
    right: -25vw;
    /* Starts straight, slightly more bleed (45->55vw) */
    translate: 220vw 0;
    rotate: 0deg;
    background: linear-gradient(to left,
        var(--x-deep)   0%,
        var(--x-core)   65%,
        var(--x-bright)  80%,
        rgba(107, 36, 56, 0.25) 92%,
        transparent      100%
    );
    transition: translate var(--dur) var(--ease-dramatic),
                rotate var(--dur-rotate) var(--ease-dramatic),
                opacity 0.5s ease;
}

/* ═══════════════════════════════════════════════════
   O / X LETTERS
   ═══════════════════════════════════════════════════ */

.ox {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14rem;
    font-weight: 900;
    z-index: 2;
    line-height: 1;
    /* Default (exit) transition: elegant and slow, matching entrance */
    transition: top var(--dur) var(--ease-dramatic),
                left var(--dur) var(--ease-dramatic),
                right var(--dur) var(--ease-dramatic),
                font-size var(--dur) var(--ease-dramatic),
                color var(--dur) var(--ease-dramatic),
                text-shadow var(--dur) var(--ease-dramatic),
                opacity var(--dur) var(--ease-dramatic),
                transform var(--dur) var(--ease-dramatic),
                filter var(--dur) var(--ease-dramatic);
    filter: blur(0px);
}

.ox-o {
    left: 10%;
    color: var(--o-letter);
    text-shadow: var(--o-glow);
    font-weight: 500; /* Thinner to balance with X */
}

.ox-x {
    right: 10%;
    color: var(--x-letter);
    text-shadow: var(--x-glow);
}

/* ═══════════════════════════════════════════════════
   QUESTION TEXT
   ═══════════════════════════════════════════════════ */

.q-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    text-align: center;
    max-width: 45%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    /* Default (exit) transition */
    transition: opacity 0.4s ease,
                transform 0.4s ease,
                filter 0.4s ease;
}

.q-container.hide-text {
    opacity: 0 !important;
    transform: translate(-50%, calc(-50% - 20px)) !important;
    filter: blur(10px);
}

.q-num {
    font-size: 1.2rem;
    font-weight: 800;
    color: #4facfe;
    letter-spacing: 0.1em;
    background: rgba(79, 172, 254, 0.15);
    padding: 0.4rem 1.4rem;
    border-radius: 2rem;
}

.q {
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1.65;
    word-break: keep-all;
    white-space: pre-line;
    color: rgba(255, 255, 255, 0.88);
}

/* ═══════════════════════════════════════════════════
   EXPLANATION TEXT
   ═══════════════════════════════════════════════════ */

.exp {
    position: absolute;
    z-index: 5;
    word-break: keep-all;
    white-space: pre-line;
    max-width: 55%;
    opacity: 0;
    /* Default (exit) transition: smooth and elegant out */
    transition: opacity 0.5s ease,
                transform 0.5s ease,
                filter 0.5s ease;
    filter: blur(10px);
}

/* Position them independently by default so they never jump */
.exp-o {
    top: calc(25% + 18rem);
    left: 10%;
    transform: translateY(25px);
}

.exp-x {
    top: calc(25% + 18rem);
    right: 10%;
    text-align: right;
    transform: translateY(25px);
}

.exp-heading {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.exp-desc {
    font-size: 1.45rem;
    font-weight: 500;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.85);
}

/* ═══════════════════════════════════════════════════
   REVEAL: ANSWER IS O
   ═══════════════════════════════════════════════════ */

/* Flood fills screen from left, tilts safely */
.quiz.show-O .flood-o {
    translate: 10vw 0;
    rotate: -12deg;
}

/* Other flood fades */
.quiz.show-O .flood-x {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* O: stays left, slides UP to top-left (lowered to be more central) */
.quiz.show-O .ox-o {
    top: 25%;
    left: 10%;
    transform: translateY(0);
    font-size: 9rem;
    color: var(--o-letter-active);
    text-shadow: var(--o-glow-active);
    /* Entrance transition: slow & dramatic */
    transition: top var(--dur) var(--ease-dramatic),
                left var(--dur) var(--ease-dramatic),
                font-size var(--dur) var(--ease-dramatic),
                color var(--dur) var(--ease-dramatic),
                text-shadow var(--dur) var(--ease-dramatic),
                transform var(--dur) var(--ease-dramatic);
}

/* X: fade out + slide down + blur */
.quiz.show-O .ox-x {
    opacity: 0;
    transform: translateY(calc(-50% + 40px));
    filter: blur(20px);
}

/* Question: fade out + slide down + blur */
.quiz.show-O .q-container {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 30px));
    filter: blur(15px);
}

.quiz.show-O .exp-o {
    opacity: 1;
    left: 10%;
    transform: translateY(0);
    text-align: left;
    filter: blur(0px);
    /* Entrance: delayed, slides up smoothly */
    transition: opacity 0.9s var(--ease-out) 0.65s,
                transform 0.9s var(--ease-out) 0.65s,
                filter 0.9s var(--ease-out) 0.65s;
}

/* ═══════════════════════════════════════════════════
   REVEAL: ANSWER IS X
   ═══════════════════════════════════════════════════ */

/* Flood fills screen from right, tilts safely */
.quiz.show-X .flood-x {
    translate: -10vw 0;
    rotate: -12deg;
}

/* Other flood fades */
.quiz.show-X .flood-o {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* X: stays right, slides UP to top-right (lowered to be more central) */
.quiz.show-X .ox-x {
    top: 25%;
    right: 10%;
    transform: translateY(0);
    font-size: 9rem;
    color: var(--x-letter-active);
    text-shadow: var(--x-glow-active);
    transition: top var(--dur) var(--ease-dramatic),
                right var(--dur) var(--ease-dramatic),
                font-size var(--dur) var(--ease-dramatic),
                color var(--dur) var(--ease-dramatic),
                text-shadow var(--dur) var(--ease-dramatic),
                transform var(--dur) var(--ease-dramatic);
}

/* O: fade out + slide down + blur */
.quiz.show-X .ox-o {
    opacity: 0;
    transform: translateY(calc(-50% + 40px));
    filter: blur(20px);
}

/* Question: fade out + slide down + blur */
.quiz.show-X .q-container {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 30px));
    filter: blur(15px);
}

.quiz.show-X .exp-x {
    opacity: 1;
    right: 10%;
    transform: translateY(0);
    text-align: right;
    filter: blur(0px);
    transition: opacity 0.9s var(--ease-out) 0.65s,
                transform 0.9s var(--ease-out) 0.65s,
                filter 0.9s var(--ease-out) 0.65s;
}

/* ═══════════════════════════════════════════════════
   REMOTE UI
   ═══════════════════════════════════════════════════ */

body.remote-body {
    background: #f0f2f5;
    color: #333;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
}

.remote-wrap {
    width: 100%;
    max-width: 480px;
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.remote-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.remote-header p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

#qIndex {
    font-weight: 700;
    color: #007bff;
}

.remote-question {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: left;
    border: 1px solid #eef0f2;
}

#remoteQText {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 1rem;
    color: #222;
}

.remote-answer-preview {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #555;
    padding-top: 1rem;
    border-top: 1px dashed #ccc;
}

.remote-answer-preview strong {
    color: #333;
}

/* Controls */
.remote-controls {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.btn {
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

.btn-group-main {
    display: flex;
    gap: 10px;
}

.btn-prev {
    flex: 1;
    background: #e2e6ea;
    color: #495057;
}
.btn-prev:hover { background: #d2d6da; }

.btn-next {
    flex: 2;
    color: #fff;
}

.btn-reveal-mode {
    background: #17a2b8;
}
.btn-reveal-mode:hover { background: #138496; }

.btn-next-mode {
    background: #007bff;
}
.btn-next-mode:hover { background: #0069d9; }

.btn-group-jump {
    display: flex;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #eef0f2;
}

.jump-select {
    flex: 2;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #fff;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

.btn-jump {
    flex: 1;
    background: #6c757d;
    color: white;
    padding: 10px;
    font-size: 1rem;
}
.btn-jump:hover { background: #5a6268; }

.btn-reset {
    background: #fff;
    color: #dc3545;
    border: 1px solid #dc3545;
    margin-top: 0.5rem;
}
.btn-reset:hover {
    background: #dc3545;
    color: #fff;
}
