#xfactor-game-view .game-view-main {
    justify-content: flex-start;
}

/* ==========================================
   HEADER, TITLE & SPACING OVERRIDES
   ========================================== */
#xfactor-title {
    color: var(--text-primary);
    margin: 0;
}

/* Strips Title Margin Specifically in Reveal Phase on Desktop */
#xfactor-game-view.in-results-phase .game-view-header {
    margin-bottom: 0 !important;
}

#xfactor-game-view.in-results-phase #xfactor-title {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* ==========================================
   TIMER & COUNTDOWN
   ========================================== */
#xfactor-timer-container {
    position: relative;
    width: 60px;
    height: 60px;
    background-color: var(--bg-primary);
    border-radius: 50%;
}

#xfactor-timer-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

#xfactor-timer-progress-circle {
    fill: none;
    stroke: var(--highlight-primary);
    stroke-width: 10;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear;
}

#xfactor-timer-svg .timer-background {
    fill: var(--bg-secondary);
    stroke: var(--bg-tertiary);
    stroke-width: 10;
}

#xfactor-timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0;
}

#xfactor-subtle-timer {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 2;
}

/* ==========================================
   AUDIO PLAYER & CONTROLS
   ========================================== */
.xfactor-audio-header {
    display: flex;
    align-items: center;
    background: transparent;
    padding: 0;
}

.xfactor-audio-main-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1 1 100%;
    min-width: 0;
}

.xfactor-audio-secondary-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

#xfactor-audio-volume-container {
    display: flex;
    align-items: center;
}

#xfactor-audio-toggle {
    background: var(--highlight-primary);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

#xfactor-audio-mute-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#xfactor-audio-volume {
    width: 80px !important;
    min-width: 60px !important;
    flex: 0 0 80px !important;
    cursor: pointer;
}

.xfactor-timeline-bg {
    flex-grow: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    min-width: 50px;
}

#xfactor-timeline-fill {
    height: 100%;
    width: 0%;
    background: var(--highlight-secondary);
    pointer-events: none;
}

/* ==========================================
   STORY TEXT CONTAINER
   ========================================== */
.xfactor-text-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    font-size: 1.3rem;
    line-height: 1.8;
    background: transparent;
    padding: 0 5px 0 0;
    border: none;
    box-sizing: border-box;
    position: relative; /* Fixed for correct offsetTop calculations in JS */
}

.xfactor-word {
    color: var(--text-secondary);
    transition: color 0.4s ease-in-out;
}

.xfactor-word.past {
    color: var(--text-primary);
}

/* ==========================================
   GAME VIEW DECISION BUTTONS
   ========================================== */
#xfactor-game-view .game-view-controls {
    height: 100px;
    min-height: 100px !important;
    overflow: hidden;
}

#xfactor-controls-area {
    display: flex;
    gap: 20px;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.xfactor-guess-btn {
    flex: 1;
    padding: 20px;
    font-size: 1.5rem;
    border: 1px solid transparent !important;
    box-sizing: border-box;
}

@media (min-width: 769px) and (max-width: 1366px) {
    #xfactor-game-view .game-view-controls {
        height: 70px;
        min-height: 70px !important;
    }
    .xfactor-guess-btn {
        padding: 5px 10px;
        font-size: 1rem;
        min-height: 40px;
    }
}

#xfactor-btn-true.option-popout {
    background: linear-gradient(135deg, var(--success-color), #27ae60);
    box-shadow: 0 0 0 color-mix(in oklab, var(--success-color), black 40%);
}

#xfactor-btn-true.option-popout:hover {
    box-shadow: 0 10px 0 color-mix(in oklab, var(--success-color), rgb(31, 16, 58) 50%);
    transform: translateY(-10px);
}

#xfactor-btn-true.option-popout:active {
    box-shadow: 0 8px 0 color-mix(in oklab, var(--success-color), rgb(31, 16, 58) 50%);
    transform: translateY(-8px);
}

#xfactor-btn-false.option-popout {
    background: linear-gradient(135deg, var(--error-color), #c0392b);
    box-shadow: 0 0 0 color-mix(in oklab, var(--error-color), black 40%);
}

#xfactor-btn-false.option-popout:hover {
    box-shadow: 0 10px 0 color-mix(in oklab, var(--error-color), rgb(31, 16, 58) 50%);
    transform: translateY(-10px);
}

#xfactor-btn-false.option-popout:active {
    box-shadow: 0 8px 0 color-mix(in oklab, var(--error-color), rgb(31, 16, 58) 50%);
    transform: translateY(-8px);
}

#xfactor-btn-true.xfactor-guess-btn.selected {
    border-color: white !important;
    box-shadow: 0 10px 0 color-mix(in oklab, var(--success-color), rgb(31, 16, 58) 50%) !important;
    transform: translateY(-10px);
}

#xfactor-btn-false.xfactor-guess-btn.selected {
    border-color: white !important;
    box-shadow: 0 10px 0 color-mix(in oklab, var(--error-color), rgb(31, 16, 58) 50%) !important;
    transform: translateY(-10px);
}

.xfactor-guess-btn:disabled:not(.selected) {
    opacity: 0.5;
    filter: grayscale(0.8);
    cursor: not-allowed;
    transform: translateY(0);
    box-shadow: 0 0 0 transparent !important;
}

.xfactor-or-divider {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-secondary);
}

/* ==========================================
   RESULTS REVEAL SCREEN
   ========================================== */
#xfactor-results-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    text-align: center;
    gap: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
}

#xfactor-results-combined-row {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 15px;
    align-items: stretch;
    justify-content: center;
    flex: 1; /* Forces container to fill parent height */
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0; /* Remove auto margins to stop collapsing */
    padding-top: 15px; /* Single top padding for the entire row on desktop */
}

#xfactor-results-votes-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
    padding: 15px; /* Restored internal padding */
    margin-top: 0 !important; /* Overrides the unwanted .subpanel top margin */
    box-sizing: border-box;
    overflow-y: auto;
    min-height: 0;
}

#xfactor-results-summary-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1.2;
    padding: 15px; /* Restored internal padding */
    margin-top: 0 !important; /* Overrides the unwanted .subpanel top margin */
    box-sizing: border-box;
    min-height: 0;
}

.xfactor-stamp {
    font-size: 4rem;
    font-weight: 900;
    text-transform: uppercase;
    opacity: 0;
    transform: scale(3) rotate(-15deg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.xfactor-stamp.reveal {
    opacity: 1;
    transform: scale(1) rotate(-5deg);
}

.xfactor-stamp.true { color: var(--success-color); }
.xfactor-stamp.false { color: var(--error-color); }

#xfactor-results-votes {
    display: flex;
    gap: 40px;
    width: 100%;
    justify-content: center;
    margin-top: 20px;
}

.xfactor-vote-col {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    flex: 1;
    max-width: 300px;
}

.xfactor-vote-col h4 { margin-bottom: 15px; color: var(--text-primary); }
.xfactor-vote-col.true-col h4 { color: var(--success-color); }
.xfactor-vote-col.false-col h4 { color: var(--error-color); }

.xfactor-vote-col .avatars {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.xfactor-vote-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid transparent;
}

.xfactor-vote-avatar.correct { border-color: var(--success-color); }
.xfactor-vote-avatar.wrong { border-color: var(--error-color); }

/* Animation utility classes for Reveal Phase */
.xf-anim-fade-in {
    transition: opacity 0.8s ease-in-out;
}

.xf-anim-slide-in {
    transform: translateY(20px);
    transition: opacity 0.4s ease-in-out, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.xfactor-vote-row {
    background: var(--bg-secondary);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
}

/* ==========================================
   DESKTOP RESPONSIVE LAYOUT
   ========================================== */
@media (min-width: 768px) {
    #xfactor-game-view .game-view-timer-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    #xfactor-subtle-timer {
        position: absolute;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        color: var(--text-secondary);
        background: transparent;
        box-shadow: none;
        padding: 0;
        pointer-events: none; /* Prevents text selection from blocking interactions */
        text-align: right;
    }
}

/* ==========================================
   MOBILE RESPONSIVE OVERRIDES
   ========================================== */
@media (max-width: 767px) {
    #xfactor-title {
        margin-top: 15px;
    }

    /* Ensure Even Spacing in Reveal Phase on Mobile */
    #xfactor-game-view.in-results-phase #xfactor-title {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    #xfactor-game-view.in-results-phase .game-view-header {
        margin-bottom: 15px !important; /* Spacing between title and summary */
        padding-top: 0 !important;
    }

    #xfactor-subtle-timer {
        color: var(--bg-primary);
        background: var(--text-secondary);
        padding: 4px 12px;
        border-radius: 20px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.3);
        align-self: center;
    }

    .xfactor-audio-main-controls {
        gap: 10px;
    }
    
    #xfactor-time {
        font-size: 0.9rem;
    }

    #xfactor-audio-volume-container {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 15px;
        background: var(--bg-secondary);
        padding: 10px 15px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.4);
        border: 1px solid var(--border-color);
        z-index: 100;
    }

    /* Show the slider container when expanded class is active */
    .xfactor-audio-secondary-controls.expanded #xfactor-audio-volume-container {
        display: flex;
    }

    .xfactor-text-container {
        font-size: 1.05rem !important;
        max-height: 40vh;
        /* Hides scrollbars entirely on mobile layouts */
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    .xfactor-text-container::-webkit-scrollbar {
        display: none !important; /* Suppress on mobile engines */
    }

    /* Discard inline hidden overflows on parent to guarantee exact heights are respected on mobile */
    #xfactor-results-area {
        display: block !important; 
        overflow-y: auto !important; /* Allow the entire results area to scroll */
        max-height: none !important;
    }

    #xfactor-results-combined-row {
        display: flex !important; /* Explicitly use flexbox for vertical sorting */
        flex-direction: column !important;
        height: auto !important; /* Stop vertical flexing limits */
        max-height: none !important;
        overflow: visible !important;
        padding-top: 0 !important; /* Cleared on mobile so spacing strictly comes from header gap */
        gap: 15px !important; /* Spacing between summary panel and votes panel */
    }

    #xfactor-results-summary-container {
        order: 1 !important; /* Forces Summary to be above Player Votes */
        flex: none !important;
        height: 380px !important; /* STRICT STATIC HEIGHT */
        min-height: 380px !important;
        max-height: 380px !important;
        width: 100% !important;
        margin-bottom: 0 !important;
    }

    #xfactor-results-votes-container {
        order: 2 !important; /* Forces Player Votes to the bottom */
        flex: none !important;
        height: 220px !important; /* STRICT STATIC HEIGHT */
        min-height: 220px !important;
        max-height: 220px !important;
        width: 100% !important;
        margin-bottom: 0 !important;
    }
    
    #xfactor-results-truth-area {
        height: 60px !important;
        flex-shrink: 0 !important;
    }
}