:root {
    --bg-color: #000;
    --text-color: #dbeafe;
    --primary: #00d2ff;
    --primary-dim: #007799;
    --secondary: #00ff9d;
    --danger: #ff3366;
    --warning: #ffcc00;
    --card-bg: rgba(13, 19, 31, 0.6);
    /* More transparent */
    --border-color: rgba(0, 210, 255, 0.3);
    --font-main: "Orbitron", monospace;
    /* Reverted to Cyber font */
    --font-value: 'DS-Digital', sans-serif;
    /* Dedicated value font */
    --font-ui: "Inter", sans-serif;
    --overlay-bg: rgba(0, 0, 0, 0.85);
}

@font-face {
    font-family: 'DS-Digital';
    font-style: normal;
    font-weight: 700;
    src: url('https://fonts.cdnfonts.com/s/15049/DS-DIGIB.woff') format('woff');
}

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-ui);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    /* Remove padding to be full screen */
    background-image: url('assets/images/vr_cyber_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Container adapts to be full screen or centered HUD */
.container {
    width: 100%;
    height: 100vh;
    /* Full screen */
    max-width: none;
    /* Remove limit */
    min-height: auto;
    background: transparent;
    /* Transparent */
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    /* Vignette effect */
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
}

/* Header */
.header {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-main);
}

.brand {
    color: var(--primary);
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 1.2rem;
    text-shadow: 0 0 8px var(--primary-dim);
}

.user-display {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.8;
}

/* Screens */
.screen {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen>* {
    animation: fadeInUp 0.5s ease-out;
}

/* Holo Window - Central Card */
.holo-window {
    background: rgba(13, 19, 31, 0.7);
    border: 1px solid rgba(0, 210, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.2), inset 0 0 20px rgba(0, 210, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    position: relative;
    z-index: 10;
    margin-bottom: 150px;
    /* Space for meters */
}

/* HUD Meters */
.hud-meter {
    position: absolute;
    bottom: 20px;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    /* Let clicks pass through if needed */
}

.meter-left {
    left: 20px;
}

.meter-right {
    right: 20px;
}

.meter-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1;
    mix-blend-mode: screen;
    /* Makes black background transparent */
}

/* Stop rotation if it's not a full circle or looks weird, maybe slow pulse is better */
@keyframes hudPulse {
    0% {
        opacity: 0.5;
        transform: scale(0.98);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }

    100% {
        opacity: 0.5;
        transform: scale(0.98);
    }
}

.meter-left .meter-img {
    /* Color handled by image content */
}

.meter-right .meter-img {
    /* Color handled by image content */
}

/* Circular Neon Glow Animation using Pseudo-element */
.hud-meter::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.6;
}

.meter-left::before {
    box-shadow: 0 0 30px var(--primary), inset 0 0 15px var(--primary);
    animation: hudPulse 3s infinite ease-in-out;
}

.meter-right::before {
    box-shadow: 0 0 30px #ff00ff, inset 0 0 15px #ff00ff;
    animation: hudPulse 3s infinite ease-in-out;
}

.meter-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.meter-label {
    position: absolute;
    /* Position label independently */
    top: -30px;
    /* Move above the center value */
    font-family: var(--font-ui);
    font-size: 1.5rem;
    /* Increased size further */
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    width: 100%;
}

.meter-value {
    font-family: var(--font-value);
    font-size: 5rem;
    /* Boosted size slightly */
    font-weight: 700;
    text-shadow: 0 0 10px currentColor;
    line-height: 1;
    margin-top: 10px;
    /* Slight offset to align visual center */
}

#timer-text {
    color: var(--primary);
}

#score-text {
    color: #ff00ff;
    /* Magenta */
}

/* Start Screen override to center it */
#screen-start {
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    /* Darken start screen bg */
}

/* Start Screen */
h1 {
    font-family: var(--font-main);
    color: var(--primary);
    margin: 0 0 15px 0;
    text-align: center;
    font-size: 3.5rem;
    /* Intermediate (was 5.0) */
    letter-spacing: 5px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(0, 210, 255, 0.6);
}

.subtitle {
    text-align: center;
    margin-bottom: 50px;
    color: #64748b;
    font-size: 1.2rem;
    /* Intermediate (was 1.5) */
    letter-spacing: 2px;
}

.input-group {
    width: 100%;
    max-width: 420px;
    /* Intermediate (was 500) */
    margin-bottom: 40px;
}

input[type="text"] {
    width: 100%;
    padding: 20px;
    /* Intermediate (was 25) */
    background: #090e15;
    border: 2px solid var(--border-color);
    color: var(--primary);
    font-family: var(--font-main);
    text-align: center;
    font-size: 1.5rem;
    /* Intermediate (was 2.0) */
    outline: none;
    transition: all 0.3s;
    border-radius: 4px;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.3);
}

.instruction {
    font-size: 1rem;
    /* Intermediate (was 1.2) */
    margin-bottom: 20px;
    color: #64748b;
    letter-spacing: 2px;
}

.difficulty-buttons {
    display: flex;
    gap: 20px;
    /* Intermediate (was 30) */
}

.reset-row {
    margin-top: 20px;
}

/* Buttons */
.btn {
    padding: 16px 32px;
    /* Intermediate (was 20/40) */
    font-family: var(--font-main);
    font-weight: bold;
    cursor: pointer;
    border: none;
    background: transparent;
    border-radius: 4px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1.2rem;
    /* Intermediate (was 1.5) */
    border: 1px solid transparent;
}

.btn-diff {
    border: 1px solid var(--border-color);
    color: #64748b;
    min-width: 100px;
}

.btn-diff:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-diff[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #334155;
    color: #475569;
}

.btn-diff[disabled]:hover {
    background: transparent;
    box-shadow: none;
    color: #475569;
}

/* Difficulty Colors */
.btn-easy {
    border-color: #00ff9d;
    color: #00ff9d;
}

/* Green */
.btn-easy:hover {
    background: rgba(0, 255, 157, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.3);
}

.btn-normal {
    border-color: #00d2ff;
    color: #00d2ff;
}

/* Blue */
.btn-normal:hover {
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.btn-hard {
    border-color: #ff3366;
    color: #ff3366;
}

/* Red */
.btn-hard:hover {
    background: rgba(255, 51, 102, 0.1);
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.3);
}

.btn-primary {
    background: rgba(0, 210, 255, 0.1);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

.btn-secondary {
    border: 1px solid var(--text-color);
    color: var(--text-color);
    opacity: 0.7;
}

.btn-secondary:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    color: #64748b;
    border: 1px solid #334155;
}

.btn-sm:hover {
    color: white;
    border-color: white;
}

/* Game Screen layout */
.status-bar,
.info-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-family: var(--font-main);
    font-size: 1rem;
    /* Slightly bigger */
    color: var(--primary);
    letter-spacing: 1px;
}

.info-bar {
    font-size: 0.8rem;
    color: #64748b;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.question-card {
    background: rgba(0, 210, 255, 0.02);
    border-left: 3px solid var(--primary);
    padding: 20px 30px;
    width: 100%;
    margin-bottom: 30px;
    font-size: 1.2rem;
    line-height: 1.6;
    min-height: 120px;
}

.choices-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.choice-btn {
    flex: 1;
    min-width: 120px;
    padding: 20px;
    background: #0f1623;
    border: 2px solid var(--border-color);
    color: #94a3b8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.2s;
    text-align: center;

    /* Added to prevent text overflow */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    /* Ensure a good height */
}

/* 2 Choices: Larger and bolder */
.grid-2 .choice-btn {
    min-width: 300px;
    padding: 30px;
    font-size: 1.4rem;
}

/* 3 Choices: Balanced size */
.grid-3 .choice-btn {
    min-width: 200px;
    padding: 25px;
    font-size: 1.2rem;
}

.choice-btn:hover {
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Choice Colors - GENERIC NAMES */
.choice-green {
    border-color: #00ff9d;
    /* Green */
    color: #00ff9d;
}

.choice-green:hover {
    background: rgba(0, 255, 157, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.3);
}

.choice-red {
    border-color: #ff3366;
    /* Red */
    color: #ff3366;
}

.choice-red:hover {
    background: rgba(255, 51, 102, 0.1);
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.3);
}

.choice-yellow {
    border-color: #ffcc00;
    /* Yellow */
    color: #ffcc00;
}

.choice-yellow:hover {
    background: rgba(255, 204, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
}

.game-controls {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    backdrop-filter: blur(4px);
}

#pause-overlay h2 {
    color: var(--text-color);
    letter-spacing: 4px;
    margin-bottom: 40px;
}

.feedback-content {
    background: var(--card-bg);
    padding: 40px;
    border: 1px solid var(--border-color);
    max-width: 600px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.feedback-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    font-family: var(--font-main);
}

.correct {
    color: var(--secondary);
    text-shadow: 0 0 15px var(--secondary);
}

.incorrect {
    color: var(--danger);
    text-shadow: 0 0 15px var(--danger);
}

.feedback-explanation {
    margin-bottom: 30px;
    line-height: 1.6;
    letter-spacing: 1px;
}

.actions {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.review-area {
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: #090e15;
    border: 1px solid var(--border-color);
    padding: 10px;
    margin-top: 20px;
}

.review-item {
    padding: 10px;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 5px;
}

.review-correct {
    border-left: 3px solid var(--secondary);
}

.review-incorrect {
    border-left: 3px solid var(--danger);
}

.review-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 5px;
}

.review-text {
    font-size: 0.9rem;
    color: white;
    margin: 0 0 5px 0;
}

.review-ans {
    font-size: 0.8rem;
    color: #94a3b8;
    display: flex;
    gap: 15px;
}

/* Scrollbar for Review */
.review-area::-webkit-scrollbar {
    width: 8px;
}

.review-area::-webkit-scrollbar-track {
    background: #090e15;
}

.review-area::-webkit-scrollbar-thumb {
    background: #334155;
}

/* Badge */
.badge {
    display: inline-block;
    background: #ff3366;
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
    vertical-align: middle;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* EXPERT MODE THEME */
body.theme-expert {
    --primary: #ff3366;
    /* Red */
    --primary-dim: #990022;
    --text-color: #ffeef2;
    --bg-color: #1a0505;
    background-image:
        linear-gradient(rgba(255, 51, 102, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 51, 102, 0.05) 1px, transparent 1px);
}

body.theme-expert .container {
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.2);
    border-color: #4d0b0b;
}

body.theme-expert .question-card {
    background: rgba(255, 51, 102, 0.05);
}

body.theme-expert .header {
    background: rgba(50, 0, 0, 0.6);
}

body.theme-expert h1 {
    text-shadow: 0 0 20px rgba(255, 51, 102, 0.6);
}

/* Result Screen Split Layout */
.result-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Align Top */
    gap: 50px;
    margin: 30px 0;
    width: 100%;
}

.rank-section,
.score-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Start from top */
}

.rank-section {
    border-right: 2px solid var(--primary-dim);
    padding-right: 20px;
}

.rank-label,
.score-label {
    font-family: var(--font-ui);
    font-size: 2rem;
    font-weight: bold;
    /* Bold labels */
    color: var(--primary);
    letter-spacing: 3px;
    margin-bottom: 20px;
    /* More space */
    min-height: 40px;
    /* Ensure alignment */
}

.rank-large {
    font-family: var(--font-main);
    font-size: 10rem;
    /* Adjusted slightly to fit */
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 20px currentColor;
}

.score-big {
    font-size: 10rem;
    /* Match Rank Size */
    font-family: var(--font-main);
    font-weight: bold;
    margin: 0;
    text-shadow: 0 0 30px rgba(0, 210, 255, 0.4);
    line-height: 1;
}

/* Rank Colors */
.rank-s {
    color: #ffd700;
    text-shadow: 0 0 30px #ffd700;
}

/* Gold */
.rank-a {
    color: #00d2ff;
    text-shadow: 0 0 30px #00d2ff;
}

/* Cyan */
.rank-b {
    color: #00ff9d;
    text-shadow: 0 0 30px #00ff9d;
}

/* Green */
.rank-c {
    color: #ffcc00;
    text-shadow: 0 0 30px #ffcc00;
}

/* Yellow */
.rank-d {
    color: #ff3366;
    text-shadow: 0 0 30px #ff3366;
}

/* Red */
/* Responsive Design for Mobile/Tablet */
@media (max-width: 768px) {

    /* Start Screen */
    h1 {
        font-size: 2.5rem !important;
        margin-bottom: 30px;
    }

    .subtitle {
        font-size: 1rem !important;
        margin-bottom: 30px;
    }

    .input-group {
        max-width: 90% !important;
        margin-bottom: 30px;
    }

    input[type='text'] {
        padding: 15px !important;
        font-size: 1.2rem !important;
    }

    .btn {
        padding: 15px 25px !important;
        font-size: 1rem !important;
    }

    .difficulty-buttons {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn-diff {
        flex: 1;
        min-width: 80px;
    }

    /* Game Screen */
    .holo-window {
        width: 95%;
        padding: 20px;
    }

    .hud-meter {
        width: 150px;
        height: 150px;
        bottom: 10px;
    }

    .meter-left {
        left: 5px;
    }

    .meter-right {
        right: 5px;
    }

    .meter-value {
        font-size: 2.5rem;
    }

    .meter-label {
        font-size: 0.8rem;
        top: -20px;
    }

    .score-big,
    .rank-large {
        font-size: 5rem !important;
    }

    /* Force resize */
    .rank-label,
    .score-label {
        font-size: 1.2rem !important;
        margin-bottom: 10px;
    }

    .result-container {
        gap: 10px;
        align-items: flex-start;
    }

    .rank-section {
        padding-right: 10px;
        border-right: 1px solid var(--primary-dim);
    }

    .choices-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .choice-btn {
        min-width: 100%;
        min-height: 45px;
        padding: 10px;
        font-size: 0.9rem;
    }

    /* Fix for Easy Mode (2-grid) overflow */
    .grid-2 .choice-btn {
        min-width: 100% !important;
        /* Override desktop 300px */
        font-size: 0.9rem;
        /* Match mobile size */
        padding: 10px;
    }
}