/* ============================================
   FACTORS & MULTIPLES GAME STYLES
   Light theme matching site palette
   ============================================ */

/* --- State Sections --- */
.factors-state {
    padding: 2rem 0;
}

/* --- Student Header --- */
.factors-student-header {
    background: linear-gradient(135deg, #4A90E2 0%, #6F42C1 100%);
    padding: 1rem 0;
    color: white;
}

.factors-student-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.factors-student-header .student-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
}

.factors-student-header .session-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-family: monospace;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

.factors-student-header .score-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    position: relative;
}

/* --- Teacher Header --- */
.factors-teacher-header {
    background: linear-gradient(135deg, #4A90E2 0%, #6F42C1 100%);
    padding: 2rem 0;
    color: white;
}

.factors-teacher-header h1 {
    font-size: 2rem;
    margin-top: 0.5rem;
}

.factors-teacher-header .back-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}

.factors-teacher-header .back-link:hover {
    color: white;
}

/* --- Teacher Lobby --- */
.factors-teacher-lobby {
    max-width: 700px;
    margin: 0 auto;
}

/* --- Student Lobby --- */
.factors-lobby {
    max-width: 850px;
    margin: 0 auto;
    text-align: center;
}

/* --- Game Score Header (VS display) --- */
.factors-score-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.factors-player-score {
    text-align: center;
    min-width: 100px;
    position: relative;
}

.factors-player-score .score-name {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.factors-player-score .score-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
}

.factors-player-score.my-score .score-value {
    color: #4A90E2;
}

.factors-player-score.opp-score .score-value {
    color: #6F42C1;
}

.factors-vs {
    font-size: 1.1rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Turn Indicator --- */
.factors-turn-indicator {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    margin: 0.5rem auto;
    max-width: 400px;
    transition: all 0.3s ease;
}

.factors-turn-indicator.my-turn {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.factors-turn-indicator.opp-turn {
    background: #faf5ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

/* --- Timer Bar --- */
.factors-timer-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    max-width: 500px;
    margin: 0.5rem auto;
    overflow: hidden;
}

.factors-timer-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 3px;
    transition: width 1s linear;
}

.factors-timer-fill.warning {
    background: #f59e0b;
}

.factors-timer-fill.danger {
    background: #ef4444;
}

/* --- The 10x10 Grid --- */
.factors-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    max-width: 500px;
    margin: 0.75rem auto;
    padding: 0 0.5rem;
}

.factors-grid .grid-cell {
    aspect-ratio: 1;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.factors-grid .grid-cell:hover:not(.used):not(.my-pick):not(.opponent-pick) {
    background: #eef2ff;
    border-color: #c7d2fe;
    transform: scale(1.05);
    z-index: 1;
}

/* No valid-move highlighting — students figure it out */

.factors-grid .grid-cell.used {
    background: #f1f5f9;
    color: #cbd5e1;
    text-decoration: line-through;
    cursor: default;
    opacity: 0.4;
    border-color: #e2e8f0;
}

.factors-grid .grid-cell.my-pick {
    background: #4A90E2;
    border-color: #3b82f6;
    color: white;
    cursor: default;
}

.factors-grid .grid-cell.opponent-pick {
    background: #6F42C1;
    border-color: #7c3aed;
    color: white;
    cursor: default;
}

.factors-grid .grid-cell.last-move {
    box-shadow: 0 0 0 3px #D4AF37;
    z-index: 2;
}

/* Pick animation */
@keyframes factorsPick {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.factors-grid .grid-cell.just-picked {
    animation: factorsPick 0.3s ease;
}

/* Invalid move shake */
@keyframes factorsShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.factors-grid .grid-cell.invalid-shake {
    animation: factorsShake 0.3s ease;
    border-color: #ef4444 !important;
    background: #fef2f2;
}

/* --- Last Move Info --- */
.factors-last-move-info {
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.factors-last-move-info strong {
    color: #D4AF37;
    font-weight: 700;
}

/* --- Score Popup Animations --- */
@keyframes scoreFloat {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    20% {
        transform: translateY(-10px) scale(1.2);
        opacity: 1;
    }
    80% {
        transform: translateY(-50px) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-70px) scale(0.8);
        opacity: 0;
    }
}

@keyframes scorePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes winBurst {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    40% {
        transform: scale(1.3) rotate(3deg);
        opacity: 1;
    }
    70% {
        transform: scale(0.95) rotate(-1deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.score-float {
    position: absolute;
    font-size: 1.4rem;
    font-weight: 800;
    color: #4A90E2;
    pointer-events: none;
    z-index: 100;
    animation: scoreFloat 1s ease-out forwards;
    text-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.score-float.big {
    font-size: 2rem;
    color: #D4AF37;
    text-shadow: 0 2px 12px rgba(212, 175, 55, 0.4);
}

.score-pulse {
    animation: scorePulse 0.4s ease;
}

/* Header score bump animation */
@keyframes headerScoreBump {
    0% { transform: scale(1); }
    30% { transform: scale(1.25); color: #D4AF37; }
    100% { transform: scale(1); }
}

.score-badge-bump {
    animation: headerScoreBump 0.5s ease;
}

/* --- Matchup Reveal Screen --- */
.factors-matchup {
    max-width: 500px;
    margin: 2rem auto;
    text-align: center;
}

.factors-matchup-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.matchup-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.matchup-players {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.matchup-player {
    text-align: center;
    opacity: 0;
    transform: translateX(-30px);
    animation: matchupSlideIn 0.5s ease forwards;
}

.matchup-player.right {
    transform: translateX(30px);
    animation: matchupSlideInRight 0.5s ease forwards;
    animation-delay: 0.3s;
}

@keyframes matchupSlideIn {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes matchupSlideInRight {
    to { opacity: 1; transform: translateX(0); }
}

.matchup-player-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0 auto 0.5rem;
}

.matchup-player:first-child .matchup-player-avatar {
    background: linear-gradient(135deg, #4A90E2, #3b82f6);
}

.matchup-player.right .matchup-player-avatar {
    background: linear-gradient(135deg, #6F42C1, #7c3aed);
}

.matchup-player-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1e293b;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matchup-vs {
    font-size: 1.5rem;
    font-weight: 800;
    color: #D4AF37;
    opacity: 0;
    animation: matchupVsPop 0.4s ease forwards;
    animation-delay: 0.5s;
}

@keyframes matchupVsPop {
    0% { opacity: 0; transform: scale(0.3); }
    60% { opacity: 1; transform: scale(1.3); }
    100% { opacity: 1; transform: scale(1); }
}

.matchup-ready-btn {
    opacity: 0;
    animation: matchupFadeIn 0.4s ease forwards;
    animation-delay: 0.9s;
    margin-top: 0.5rem;
}

@keyframes matchupFadeIn {
    to { opacity: 1; }
}

.matchup-ready-btn .btn-primary {
    font-size: 1.1rem;
    padding: 0.75rem 3rem;
    border-radius: 12px;
}

.matchup-first-move {
    opacity: 0;
    animation: matchupFadeIn 0.4s ease forwards;
    animation-delay: 0.7s;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1rem;
}

/* --- Game Over Screen --- */
.factors-game-over {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.factors-game-over-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.factors-game-over h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    animation: winBurst 0.6s ease;
}

.factors-game-over .result-win {
    color: #059669;
}

.factors-game-over .result-lose {
    color: #dc2626;
}

.factors-game-over .result-timeout {
    color: #d97706;
}

.factors-game-over .score-breakdown {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.factors-game-over .score-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.factors-game-over .score-row:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.factors-game-over .score-row .label {
    color: #64748b;
}

.factors-game-over .score-row .value {
    color: #1e293b;
    font-weight: 600;
}

.factors-game-over .score-row:last-child .value {
    color: #4A90E2;
}

.factors-game-over .finding-opponent {
    margin-top: 1.5rem;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

/* --- Waiting Activity --- */
.factors-waiting {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.factors-waiting h2 {
    margin-bottom: 1rem;
    color: #1e293b;
}

.factors-waiting .waiting-status {
    color: #64748b;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Practice question card — flashcard style */
.factors-practice-card {
    background: white;
    border-radius: 20px;
    padding: 2rem 2.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.factors-practice-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4A90E2, #50E3C2);
}

/* Card enter animation */
@keyframes practiceCardEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.factors-practice-card.card-enter {
    animation: practiceCardEnter 0.4s ease;
}

.factors-practice-card .practice-prompt {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

.practice-question-counter {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.factors-practice-card .practice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.factors-practice-card .practice-num-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.factors-practice-card .practice-num-btn:hover {
    border-color: #4A90E2;
    background: #eff6ff;
}

.factors-practice-card .practice-num-btn.selected {
    background: #4A90E2;
    border-color: #3b82f6;
    color: white;
}

.factors-practice-card .practice-num-btn.correct {
    background: #059669;
    border-color: #10b981;
    color: white;
}

.factors-practice-card .practice-num-btn.incorrect {
    background: #dc2626;
    border-color: #ef4444;
    color: white;
}

.factors-practice-streak {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #eff6ff, #eef2ff);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    color: #4A90E2;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid #c7d2fe;
}

.practice-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.practice-difficulty-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.practice-difficulty-badge.diff-easy {
    background: #dcfce7;
    color: #166534;
}

.practice-difficulty-badge.diff-medium {
    background: #fef3c7;
    color: #92400e;
}

.practice-difficulty-badge.diff-hard {
    background: #fce7f3;
    color: #9d174d;
}

/* Yes/No buttons */
.practice-yesno {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.practice-yesno-btn {
    flex: 1;
    max-width: 160px;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.practice-yesno-btn:hover {
    border-color: #4A90E2;
    background: #eff6ff;
}

.practice-yesno-btn.selected {
    background: #4A90E2;
    border-color: #3b82f6;
    color: white;
}

.practice-yesno-btn.correct {
    background: #059669;
    border-color: #10b981;
    color: white;
}

.practice-yesno-btn.incorrect {
    background: #dc2626;
    border-color: #ef4444;
    color: white;
}

/* Text input */
.practice-input-wrap {
    margin-bottom: 1.25rem;
}

.practice-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    font-family: inherit;
    background: #f8fafc;
    color: #1e293b;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.practice-input:focus {
    outline: none;
    border-color: #4A90E2;
    background: white;
}

.practice-input.input-correct {
    border-color: #10b981;
    background: #dcfce7;
    color: #166534;
}

.practice-input.input-incorrect {
    border-color: #ef4444;
    background: #fef2f2;
    color: #991b1b;
}

.practice-feedback {
    margin-top: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.practice-feedback.feedback-correct {
    color: #059669;
}

.practice-feedback.feedback-incorrect {
    color: #d97706;
}

/* --- Bot Game Intro --- */
.factors-bot-intro {
    background: white;
    border-radius: 20px;
    padding: 2rem 2.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    text-align: center;
}

.bot-intro-emoji {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.bot-intro-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.bot-intro-desc {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* --- Bot Game Area --- */
.factors-bot-game-wrapper {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.factors-bot-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.75rem;
    border: 1px solid #fcd34d;
}

/* --- Pool Builder (Teacher) --- */
.factors-pool-builder {
    max-width: 900px;
    margin: 0 auto;
}

.factors-pool-builder-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.factors-pool-builder-layout {
    display: flex;
    gap: 1.5rem;
    min-height: 300px;
}

.factors-unassigned-panel {
    flex: 0 0 200px;
    background: white;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.factors-unassigned-panel h3 {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.factors-pools-container {
    flex: 1;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.factors-pool-column {
    flex: 1;
    min-width: 160px;
    max-width: 250px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.factors-pool-header {
    padding: 0.75rem 1rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.factors-pool-header input {
    background: transparent;
    border: none;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    width: 120px;
    outline: none;
}

.factors-pool-header .pool-remove-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 0.25rem;
}

.factors-pool-header .pool-remove-btn:hover {
    color: white;
}

.factors-pool-drop-zone {
    min-height: 100px;
    padding: 0.5rem;
    transition: background 0.2s ease;
}

.factors-pool-drop-zone.drag-over {
    background: rgba(74, 144, 226, 0.08);
}

.factors-pool-drop-zone .drop-hint {
    color: #94a3b8;
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem 0.5rem;
}

.factors-pool-member-count {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
}

.factors-player-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.375rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    transition: all 0.15s ease;
    user-select: none;
}

.factors-player-card:hover {
    border-color: #4A90E2;
    background: #eff6ff;
}

.factors-player-card.dragging {
    opacity: 0.5;
}

.factors-player-card .player-card-name {
    font-size: 0.85rem;
    color: #334155;
}

.factors-player-card .player-card-drag-handle {
    color: #94a3b8;
    font-size: 1rem;
}

.factors-pool-builder-actions {
    margin-top: 1.5rem;
    text-align: center;
}

/* --- Teacher Dashboard --- */
.factors-dashboard {
    max-width: 1100px;
    margin: 0 auto;
}

.factors-dashboard-header {
    background: linear-gradient(135deg, #4A90E2 0%, #6F42C1 100%);
    padding: 0.75rem 0;
    color: white;
}

.factors-dashboard-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.factors-dashboard-header .game-badge {
    background: #ef4444;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.factors-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Dashboard panels */
.factors-panel {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.factors-panel h3 {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.factors-panel .panel-count {
    background: #e2e8f0;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #475569;
}

.factors-pair-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.factors-pair-card .pair-players {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #334155;
}

.factors-pair-card .pair-vs {
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 700;
}

.factors-pair-card .pair-status {
    font-size: 0.8rem;
    color: #64748b;
}

/* Waiting players */
.factors-waiting-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.375rem;
}

.factors-waiting-player .waiting-name {
    color: #334155;
    font-size: 0.9rem;
}

.factors-waiting-player .waiting-time {
    color: #94a3b8;
    font-size: 0.8rem;
}

/* Leaderboard */
.factors-leaderboard {
    width: 100%;
}

.factors-leaderboard table {
    width: 100%;
    border-collapse: collapse;
}

.factors-leaderboard th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

.factors-leaderboard th:last-child,
.factors-leaderboard td:last-child {
    text-align: right;
}

.factors-leaderboard td {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.factors-leaderboard tr:hover td {
    background: #f8fafc;
}

.factors-leaderboard .rank-1 td { color: #D4AF37; font-weight: 600; }
.factors-leaderboard .rank-2 td { color: #94a3b8; font-weight: 600; }
.factors-leaderboard .rank-3 td { color: #cd7f32; font-weight: 600; }

.factors-leaderboard .score-cell {
    font-weight: 700;
    color: #4A90E2;
}

/* Activity Feed */
.factors-activity-feed {
    max-height: 300px;
    overflow-y: auto;
}

.factors-feed-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
    color: #64748b;
}

.factors-feed-item .feed-time {
    color: #94a3b8;
    margin-right: 0.5rem;
    font-size: 0.75rem;
}

.factors-feed-item .feed-highlight {
    color: #1e293b;
    font-weight: 500;
}

.factors-feed-item .feed-prime {
    color: #D4AF37;
}

/* Pool tabs */
.factors-pool-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 0.25rem;
}

.factors-pool-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.factors-pool-tab.active {
    background: white;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.factors-pool-tab:hover:not(.active) {
    color: #334155;
}

/* No items placeholder */
.factors-no-items {
    color: #94a3b8;
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

/* --- Session Ended --- */
.factors-ended-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.factors-ended-card h2 {
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.factors-ended-card .final-score-display {
    font-size: 2rem;
    font-weight: 700;
    color: #4A90E2;
    margin: 1rem 0;
}

/* --- Display on Screen Button --- */
.factors-display-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    font-family: inherit;
}

.factors-display-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.factors-display-btn.small {
    padding: 0.35rem 0.9rem;
    font-size: 0.8rem;
}

.factors-display-btn svg {
    flex-shrink: 0;
}

/* --- Fullscreen Display Overlay --- */
.factors-fullscreen-display {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #4A90E2 0%, #6F42C1 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
}

.factors-fullscreen-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Particles */
.factors-fullscreen-display .fullscreen-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.factors-fullscreen-display .fullscreen-particle {
    position: absolute;
    top: 0;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: factors-particle-fall linear infinite;
}

.factors-fullscreen-display .fullscreen-particle:nth-child(odd) {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
}

.factors-fullscreen-display .fullscreen-particle:nth-child(3n) {
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.6);
}

@keyframes factors-particle-fall {
    0% {
        transform: translateY(-10px) translateX(0);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translateY(100vh) translateX(20px);
        opacity: 0;
    }
}

/* Falling names */
.factors-fullscreen-display .fullscreen-falling-names {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}

.factors-fullscreen-display .falling-name {
    position: absolute;
    right: 20px;
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    animation: factors-name-fall 3s ease-in-out forwards;
    opacity: 0;
}

@keyframes factors-name-fall {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 1; }
    50% { opacity: 1; }
    100% { transform: translateY(20vh); opacity: 0; }
}

/* Close button */
.factors-fullscreen-display .fullscreen-close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.factors-fullscreen-display .fullscreen-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Fullscreen content */
.factors-fullscreen-display .fullscreen-content {
    text-align: center;
    max-width: 900px;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.factors-fullscreen-display .fullscreen-header h1 {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.factors-fullscreen-display .fullscreen-header p {
    font-size: 1.5rem;
    opacity: 0.9;
}

.factors-fullscreen-display .fullscreen-code-section {
    margin: 3rem 0;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    backdrop-filter: blur(10px);
}

.factors-fullscreen-display .fullscreen-instruction {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.factors-fullscreen-display .fullscreen-code-label {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.factors-fullscreen-display .fullscreen-code {
    font-size: 6rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    font-family: monospace;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.factors-fullscreen-display .fullscreen-players-section {
    margin-top: 3rem;
}

.factors-fullscreen-display .fullscreen-players-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* --- Display Leaderboard --- */
.factors-lb-display {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.factors-lb-display::before {
    background-image:
        radial-gradient(ellipse at 30% 50%, rgba(74, 144, 226, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 50%, rgba(111, 66, 193, 0.08) 0%, transparent 50%);
}

.factors-display-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
    max-width: 750px;
    margin: 2rem auto 0;
    z-index: 1;
    position: relative;
}

.factors-dlb-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.3s ease, background 0.3s ease;
    animation: factors-dlb-slide-in 0.5s ease forwards;
    opacity: 0;
}

.factors-dlb-row:nth-child(1) { animation-delay: 0.1s; }
.factors-dlb-row:nth-child(2) { animation-delay: 0.2s; }
.factors-dlb-row:nth-child(3) { animation-delay: 0.3s; }
.factors-dlb-row:nth-child(4) { animation-delay: 0.4s; }
.factors-dlb-row:nth-child(5) { animation-delay: 0.5s; }

@keyframes factors-dlb-slide-in {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.factors-dlb-row.first {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(212, 175, 55, 0.3);
    padding: 1.2rem 1.5rem;
}

.factors-dlb-pos {
    font-size: 1.6rem;
    min-width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}

.factors-dlb-pos-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-weight: 700;
}

.factors-dlb-name {
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    min-width: 140px;
    flex-shrink: 0;
}

.factors-dlb-row.first .factors-dlb-name {
    font-size: 1.35rem;
}

.factors-dlb-record {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 55px;
    flex-shrink: 0;
}

.factors-dlb-bar-bg {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    overflow: hidden;
}

.factors-dlb-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 4px;
}

.factors-dlb-score {
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
}

.factors-dlb-row.first .factors-dlb-score {
    font-size: 1.4rem;
    color: #D4AF37;
}

.factors-dlb-empty {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .factors-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .factors-pool-builder-layout {
        flex-direction: column;
    }

    .factors-unassigned-panel {
        flex: none;
    }

    .factors-pools-container {
        flex-direction: column;
    }

    .factors-pool-column {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .factors-fullscreen-display .fullscreen-header h1 {
        font-size: 2.2rem;
    }

    .factors-fullscreen-display .fullscreen-code {
        font-size: 3.5rem;
    }

    .factors-fullscreen-display .fullscreen-falling-names {
        width: 180px;
    }

    .factors-dlb-record {
        display: none;
    }

    .factors-dlb-name {
        min-width: 80px;
        font-size: 1rem;
    }

    .factors-dlb-score {
        min-width: 60px;
        font-size: 1rem;
    }

    .factors-grid {
        gap: 2px;
    }

    .factors-grid .grid-cell {
        font-size: 0.7rem;
        border-width: 1.5px;
        border-radius: 4px;
    }

    .factors-score-header {
        gap: 1rem;
        padding: 0.75rem;
    }

    .factors-player-score .score-value {
        font-size: 1.4rem;
    }

    .factors-player-score .score-name {
        font-size: 0.75rem;
        max-width: 80px;
    }

    .factors-practice-card {
        padding: 1.5rem 1.25rem;
    }

    .practice-yesno-btn {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .practice-input {
        font-size: 1rem;
        padding: 0.75rem 0.875rem;
    }

    .matchup-players {
        gap: 1rem;
    }

    .matchup-player-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }
}

/* ─── Practice Page Header ──────────────────────── */
.factors-practice-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #0ea5e9 100%);
    color: white;
    padding: 2rem 0;
}

.factors-practice-header .header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.factors-practice-header .back-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.factors-practice-header .back-link:hover {
    color: white;
}

.factors-practice-header .set-for-class-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.factors-practice-header .set-for-class-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.factors-practice-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.factors-practice-header p {
    opacity: 0.9;
    font-size: 1rem;
}

/* ─── Practice Game Layout ──────────────────────── */
.factors-practice-game {
    max-width: 560px;
    margin: 1.5rem auto;
}

/* ─── Practice Game Over Results ─────────────────── */
.factors-game-result {
    text-align: center;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 480px;
    margin: 2rem auto;
}

.factors-result-emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.factors-game-result h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.factors-result-win h2 {
    color: #16a34a;
}

.factors-result-lose h2 {
    color: #6F42C1;
}

.factors-result-scores {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.factors-result-player {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.factors-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #64748b;
}

.factors-result-breakdown {
    font-size: 0.8rem;
    color: #94a3b8;
}

.factors-result-total {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

.factors-result-vs {
    font-weight: 700;
    color: #cbd5e1;
    font-size: 1.2rem;
}

.factors-result-reason {
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

.factors-result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.factors-result-actions .btn-primary {
    padding: 0.75rem 2rem;
}

.factors-result-actions .btn-secondary {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
}
