/* =============================================================
   REVEAL LAYOUT — Shared reveal system for all solo game modes
   
   Usage: <body data-reveal-side="left|right">
   - left  = reveal slides from LEFT  (Hexa, Convert)
   - right = reveal slides from RIGHT (RGB, Invert)
   
   After validation, screen splits 50/50:
   - GUESS SIDE (left): user's color bg + score + input
   - TARGET SIDE (right): target color bg + answer + NEW COLOR
   
   Mobile: GUESS SIDE → TOP, TARGET SIDE → BOTTOM
   ============================================================= */

/* --- Base body --- */
body {
    font-family: 'Archivo Black', sans-serif;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.5s ease;
}

/* --- Close button --- */
.close-button {
    position: fixed;
    top: 35px;
    right: 35px;
    font-size: 36px;
    line-height: 36px;
    text-decoration: none;
    z-index: 100;
    cursor: pointer;
    color: inherit;
}

/* --- Game area (full viewport container) --- */
.game-area {
    position: relative;
    width: 100%;
    height: 100vh;
    z-index: 2;
}

/* --- Mode input wrapper (centered, transitions to guess side) --- */
.mode-input {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 2;
    transition: left 0.8s ease, top 0.8s ease;
}

.game-area.validated .mode-input {
    left: 25%;
}

/* --- Validate button --- */
.validate-btn {
    font-family: 'Archivo Black', sans-serif;
    font-size: 2vw;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    display: block;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.3s ease;
    letter-spacing: 0.1em;
    margin-top: 20px;
    color: inherit;
}

.validate-btn:hover {
    opacity: 0.7;
    transform: scale(1.05);
}

/* --- Error message --- */
.error-msg {
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin: 0;
    color: inherit;
}

/* --- Reveal panel (colored backdrop that slides in) --- */
.reveal-panel {
    position: fixed;
    top: 0;
    width: 50%;
    height: 100%;
    background-color: transparent;
    transition: transform 1s ease;
    z-index: 1;
}

[data-reveal-side="left"] .reveal-panel {
    left: 0;
    transform: translateX(-100%);
}

[data-reveal-side="right"] .reveal-panel {
    right: 0;
    transform: translateX(100%);
}

.reveal-panel.revealed {
    transform: translateX(0);
}

/* --- Score (guess side: left 25%, bottom) --- */
.guess-score {
    position: fixed;
    left: 25%;
    bottom: 10%;
    transform: translateX(-50%);
    font-family: 'Archivo Black', sans-serif;
    font-size: 2vw;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    opacity: 0;
    z-index: 3;
    margin: 0;
    pointer-events: none;
}

.guess-score.visible {
    opacity: 1;
    animation: revealFadeIn 1s forwards;
}

/* --- Target answer (target side: right 25%, center) --- */
.target-answer {
    position: fixed;
    top: 50%;
    right: 25%;
    transform: translate(50%, -50%);
    font-family: 'Archivo Black', sans-serif;
    font-size: 5vw;
    font-weight: bold;
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease;
    z-index: 3;
    margin: 0;
    white-space: nowrap;
    pointer-events: none;
}

.target-answer.visible {
    opacity: 1;
}

/* Secondary answer (convert mode: smaller text above primary) */
.target-answer-secondary {
    position: fixed;
    top: 42%;
    right: 25%;
    transform: translate(50%, -50%);
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(1rem, 2.5vw, 2rem);
    font-weight: bold;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 3;
    margin: 0;
    white-space: nowrap;
    letter-spacing: 0.05em;
    pointer-events: none;
}

.target-answer-secondary.visible {
    opacity: 1;
}

/* --- New color button (target side: right 25%, bottom) --- */
.new-color-btn {
    position: fixed;
    bottom: 10%;
    left: 75%;
    transform: translateX(-50%);
    font-family: 'Archivo Black', sans-serif;
    font-size: 2vw;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    z-index: 3;
    display: none;
    letter-spacing: 0.1em;
    padding: 10px 20px;
    border-radius: 5px;
    transition: opacity 0.5s ease;
}

.new-color-btn.visible {
    display: block;
}

.new-color-btn:hover {
    opacity: 0.7;
}

/* --- RGB display in answer elements --- */
.target-answer.rgb-split,
.target-answer-secondary.rgb-split {
    white-space: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.target-answer.rgb-split {
    font-size: clamp(2rem, 3.5vw, 4rem);
}

.target-answer .rgb-label,
.target-answer-secondary .rgb-label {
    font-size: 0.45em;
    opacity: 0.5;
    letter-spacing: 0.3em;
}

.target-answer .rgb-value,
.target-answer-secondary .rgb-value {
    font-size: 1em;
}

/* --- Animations --- */
@keyframes revealFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes shakeInput {
    0%, 100% { margin-left: 0; }
    20% { margin-left: -6px; }
    40% { margin-left: 6px; }
    60% { margin-left: -4px; }
    80% { margin-left: 4px; }
}

.shake-error {
    animation: shakeInput 0.4s ease !important;
}

/* =========================
   MOBILE (max-width: 768px)
   ========================= */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .close-button {
        top: 12px;
        right: 12px;
        font-size: 1.5em;
        line-height: 1;
    }

    /* Reveal panel: left → slides from top, right → slides from bottom */
    .reveal-panel {
        width: 100%;
        height: 50%;
    }

    [data-reveal-side="left"] .reveal-panel {
        top: 0;
        bottom: auto;
        left: 0;
        transform: translateY(-100%);
    }

    [data-reveal-side="right"] .reveal-panel {
        top: auto;
        bottom: 0;
        right: 0;
        transform: translateY(100%);
    }

    .reveal-panel.revealed {
        transform: translateY(0);
    }

    /* Mode input: stays centered X, moves to top half */
    .game-area.validated .mode-input {
        left: 50%;
        top: 25%;
    }

    /* Score: top area (guess side = top on mobile) */
    .guess-score {
        left: 50%;
        bottom: auto;
        top: 8%;
        font-size: 5vw;
    }

    /* Answer: bottom half (target side = bottom on mobile) */
    .target-answer {
        top: 75%;
        right: 50%;
        font-size: 6vw;
    }

    .target-answer-secondary {
        top: 65%;
        right: 50%;
    }

    /* New color: bottom of screen */
    .new-color-btn {
        left: 50%;
        bottom: 8%;
        font-size: 4vw;
    }

    .validate-btn {
        font-size: 5vw;
    }
}

/* ==========================
   TABLET (769px – 900px)
   ========================== */
@media (min-width: 769px) and (max-width: 900px) {
    .validate-btn {
        font-size: 2.5vw;
    }

    .target-answer {
        font-size: 4vw;
    }

    .target-answer-secondary {
        font-size: clamp(0.8rem, 2vw, 1.5rem);
    }

    .guess-score {
        font-size: 1.8vw;
    }

    .new-color-btn {
        font-size: 1.8vw;
    }
}
