@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg: #f8fafc;
    --surface: rgba(255, 255, 255, 0.7);
    --border: rgba(0, 0, 0, 0.1);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent: #D4AF37;
    --glass-blur: blur(16px);
    --panel-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    --instrument-glow: rgba(212, 175, 55, 0.2);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Quiz Specific Colors */
    --correct-bg: rgba(16, 185, 129, 0.15);
    --correct-border: #10b981;
    --wrong-bg: rgba(239, 68, 68, 0.15);
    --wrong-border: #ef4444;
}

body.dark-theme {
    --bg: #020617;
    --surface: rgba(15, 23, 42, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #D4AF37;
    --panel-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
    --instrument-glow: rgba(212, 175, 55, 0.15);
    --correct-bg: rgba(16, 185, 129, 0.2);
    --wrong-bg: rgba(239, 68, 68, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    transition: background-color var(--transition), color var(--transition);
    min-height: 100vh;
}

/* Background elements */
.grid-overlay {
    position: fixed;
    inset: 0;
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    opacity: 0.5;
}

.horizon-line {
    position: fixed;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.1;
    z-index: -1;
}

/* Header (Sticky Timer) */
header {
    padding: 1rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.logo {
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 15px var(--instrument-glow);
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-warning {
    color: #ef4444;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.btn-danger {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 40px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#theme-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.1rem;
    border-radius: 50%;
}

.theme-toggle:hover {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 15px var(--instrument-glow);
}

/* Main Container */
main {
    padding: 2rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Pre-Start Screen */
#start-screen {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--panel-shadow);
    margin-top: 2rem;
}

#start-screen h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

#start-screen p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.btn-primary {
    background: var(--accent);
    color: #020617;
    border: none;
    padding: 16px 32px;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    border-radius: 40px;
    cursor: pointer;
    margin-top: 2rem;
    box-shadow: 0 0 20px var(--instrument-glow);
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--accent);
}

/* Quiz Container (Tabs & Content) */
#quiz-screen {
    display: none;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 10px;
}

.tab-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 12px 24px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 40px;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn.active {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: inset 0 0 10px var(--instrument-glow);
}

/* Questions */
.subject-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.subject-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    backdrop-filter: var(--glass-blur);
}

.q-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.q-number {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    font-weight: bold;
    font-size: 0.9rem;
}

.q-text {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.options-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0,0,0,0.02);
}

body.dark-theme .option-item {
    background: rgba(255,255,255,0.02);
}

.option-item:hover {
    border-color: var(--accent);
    background: rgba(212, 175, 55, 0.05);
}

.option-item.selected {
    border-color: var(--accent);
    background: rgba(212, 175, 55, 0.15);
}

.option-item input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    outline: none;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.option-item.selected input[type="radio"] {
    border-color: var(--accent);
}

.option-item.selected input[type="radio"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
}

.option-text {
    font-size: 1rem;
    line-height: 1.4;
}

/* Post-submission Review Styling */
.quiz-submitted .option-item {
    pointer-events: none;
}

.quiz-submitted .option-item.correct {
    background: var(--correct-bg);
    border-color: var(--correct-border);
}

.quiz-submitted .option-item.correct input[type="radio"] {
    border-color: var(--correct-border);
}

.quiz-submitted .option-item.correct input[type="radio"]::after {
    background: var(--correct-border);
}

.quiz-submitted .option-item.wrong-selected {
    background: var(--wrong-bg);
    border-color: var(--wrong-border);
}

.quiz-submitted .option-item.wrong-selected input[type="radio"] {
    border-color: var(--wrong-border);
}

.quiz-submitted .option-item.wrong-selected input[type="radio"]::after {
    background: var(--wrong-border);
}

/* Actions Floor */
.quiz-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.btn-submit {
    background: var(--accent);
    color: #020617;
    border: none;
    padding: 14px 28px;
    border-radius: 40px;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 0 15px var(--instrument-glow);
    transition: var(--transition);
}

.btn-submit:hover {
    transform: scale(1.02);
}

/* Results Screen */
#results-screen {
    display: none;
    margin-top: 2rem;
}

.results-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    backdrop-filter: var(--glass-blur);
    margin-bottom: 2rem;
}

.results-summary h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.status-passed { color: var(--correct-border); }
.status-failed { color: var(--wrong-border); }

.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.score-card {
    background: rgba(0,0,0,0.03);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

body.dark-theme .score-card {
    background: rgba(255,255,255,0.03);
}

.score-card h3 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.score-value {
    font-size: 2rem;
    font-weight: 900;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 12px 24px;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    transition: var(--transition);
    margin-top: 2rem;
}

.btn-secondary:hover {
    background: rgba(212, 175, 55, 0.1);
}

@media (max-width: 768px) {
    header { padding: 1rem; flex-direction: column; gap: 15px; }
    main { padding: 1rem; }
    .timer-display { font-size: 1.5rem; }
}

/* --- MODAL SYSTEM --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeInModal 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #ffffff;
    border: 1px solid var(--border);
    max-width: 450px;
    width: 100%;
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    animation: scaleInModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 10001;
}

body.dark-theme .modal-content {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}


@keyframes scaleInModal {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.modal-actions button {
    flex: 1;
    padding: 12px 10px;
    font-size: 0.9rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 40px;
    transition: var(--transition);
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.btn-confirm-stay {
    background: transparent;
    border: 2px solid var(--accent);
    color: #b48c1a; /* Escureci o dourado no modo claro para contraste */
}

body.dark-theme .btn-confirm-stay {
    color: var(--accent);
}

.btn-confirm-stay:hover {
    background: var(--accent);
    color: #000;
}


.btn-confirm-exit {
    background: #ef4444 !important;
    border: none !important;
    color: #ffffff !important; /* Branco para visibilidade total */
}

.btn-confirm-exit:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}


