﻿body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f4f7;
    margin: 0;
    padding: 15px;
    text-align: center;
    color: #333;
    box-sizing: border-box;
}

.hud-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    font-weight: bold;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    background: #e4e4e7;
    font-size: 0.85em;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.timer-val {
    font-size: 1.3em;
    color: #111;
}

    .timer-val.warning {
        color: #e21b3c;
        animation: pulse 1s infinite;
    }

/* Force continuous paragraph & MathJax text flow (prevents equation column splitting) */
.question-display {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    min-height: 70px;
    display: block !important;
    align-content: center;
    text-align: center;
    font-size: 1.25em;
    font-weight: 700;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    line-height: 1.6;
    word-wrap: break-word;
    white-space: normal !important;
}

/* --- STUDENT GAMEPAD RESPONSIVE ADAPTABILITY --- */
.pad-container {
    display: grid;
    gap: 10px !important;
    max-width: 550px;
    margin: 0 auto;
    grid-template-columns: 1fr !important;
}

/* On laptops, tablets >= 640px, or landscape mode: adapt to 2 columns */
@media (min-width: 640px) or (orientation: landscape) {
    .pad-container {
        grid-template-columns: 1fr 1fr !important;
        max-width: 850px;
    }
}

.answer-card {
    display: flex;
    align-items: center;
    border: 1px solid #e4e4e7;
    border-left: 10px solid transparent;
    border-radius: 10px;
    color: #333;
    background: #fff;
    padding: 8px 12px !important; /* Reduced padding for compact mobile fit */
    font-size: clamp(0.85rem, 2.2vw, 1.1rem);
    font-weight: 700;
    min-height: 48px !important; /* Reduced from 75px to fit 8 choices on mobile screens */
}

    .answer-card:active {
        transform: scale(0.97);
    }

.char-badge {
    color: #fff;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    margin-right: 12px;
    font-size: 1.05em;
    flex-shrink: 0;
    transition: background-color 0.2s, color 0.2s;
}

@media (orientation: landscape) {
    .pad-container {
        grid-template-columns: 1fr 1fr;
        max-width: 800px;
    }
}

@keyframes pulse {
    50% {
        opacity: 0.4;
    }
}

/* Sleek diagonal rainbow gradient submit button for student gamepad */
.btn-submit-rainbow {
    background: #aaaaaa linear-gradient(135deg, rgba(226,27,60,0.45) 0%, rgba(230,126,34,0.45) 20%, rgba(216,158,0,0.45) 40%, rgba(38,137,12,0.45) 60%, rgba(19,104,206,0.45) 80%, rgba(142,68,173,0.45) 100%) !important;
    color: #ffffff !important;
    font-weight: 900 !important;
    letter-spacing: 1px !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25) !important;
    transition: all 0.2s ease !important;
}

    .btn-submit-rainbow:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
    }

    .btn-submit-rainbow:disabled {
        background: #a1a1aa !important;
        border: none !important;
        box-shadow: none !important;
        transform: none !important;
        opacity: 0.7 !important;
    }

/* Ensure FunctionPlot SVG graphs scale fluidly on mobile gamepads */
.dynamic-graph-box {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

    .dynamic-graph-box svg {
        max-width: 100% !important;
        height: auto !important;
    }

/* Prevent MathJax equations from breaking/wrapping mid-equation */
mjx-container, .MathJax {
    display: inline-block !important;
    white-space: nowrap !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

mjx-math {
    white-space: nowrap !important;
}

/* Prevent MathJax & FunctionPlot SVG elements from intercepting clicks on answer cards */
mjx-container, mjx-container *, .MathJax, .MathJax * {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.dynamic-graph-box, .dynamic-graph-box * {
    pointer-events: none !important;
}