:root {
    --text: #ae133f;
    --background: #faefef;
    --primary: #ef8fa7;
    --secondary: #f896b7;
    --accent: #6a162c;
    --white: #ffffff;
    --shadow: rgba(174, 19, 63, 0.15);
}

body {
    background-color: var(--background);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0; display: flex; justify-content: center; align-items: center; 
    min-height: 100dvh; overflow: hidden;
    background-image: radial-gradient(circle at 0% 0%, var(--secondary) 0%, transparent 25%),
                      radial-gradient(circle at 100% 100%, var(--primary) 0%, transparent 25%);
}

.scanlines {
    position: fixed; inset: 0; pointer-events: none; z-index: 1000;
    background: linear-gradient(rgba(174, 19, 63, 0) 50%, rgba(106, 22, 44, 0.03) 50%);
    background-size: 100% 4px;
}

#red-alert {
    position: fixed; inset: 0; pointer-events: none; z-index: 99;
    background: radial-gradient(circle, transparent 40%, rgba(174, 19, 63, 0.1) 100%);
    animation: pulse 0.6s infinite alternate;
}
@keyframes pulse { from { opacity: 0; } to { opacity: 1; } }

.app-container { width: 95%; max-width: 750px; height: 90dvh; display: flex; flex-direction: column; transition: transform 0.2s ease; }

.screen {
    background: var(--white);
    padding: 2.5rem; border-radius: 1.5rem;
    border: 1px solid var(--primary);
    box-shadow: 0 15px 35px var(--shadow), inset 0 1px 0 var(--white);
    height: 100%; display: flex; flex-direction: column; text-align: center; box-sizing: border-box; overflow-y: auto;
}

.hidden { display: none !important; }

/* Logo & Branding */
.status-bar { font-family: monospace; font-size: 0.6rem; color: var(--accent); letter-spacing: 2px; margin-bottom: 5px; opacity: 0.8; font-weight: 700; }
.logo { font-size: 3.5rem; font-weight: 800; margin: 0; letter-spacing: -2px; color: var(--accent); position: relative; }
.logo span { color: var(--text); font-weight: 300; }
.tagline { color: var(--accent); font-weight: 600; letter-spacing: 4px; font-size: 0.7rem; margin-top: 5px; opacity: 0.7; }

/* Dashboard Depth */
.dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--primary); border-radius: 1rem; overflow: hidden; margin: 2rem 0; border: 1px solid var(--primary); }
.stat-card { background: var(--white); padding: 1.5rem; box-shadow: inset 0 0 15px var(--background); }
.stat-label { font-size: 0.6rem; color: var(--accent); text-transform: uppercase; letter-spacing: 2px; font-weight: 700; margin-bottom: 0.5rem; opacity: 0.6; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); font-family: monospace; }

/* Professional Tactical Buttons */
.nav-grid { display: grid; gap: 1rem; max-width: 400px; margin: 0 auto; width: 100%; }
button { padding: 1.1rem; border-radius: 0.8rem; font-weight: 800; cursor: pointer; transition: all 0.2s ease; border: none; font-size: 0.95rem; }
.primary-btn { background: var(--accent); color: var(--white); box-shadow: 0 4px 12px var(--shadow); }
.secondary-btn { background: var(--white); color: var(--accent); border: 2px solid var(--primary); }
.accent-btn { background: var(--text); color: var(--white); }
.diff-btn { background: var(--background); color: var(--accent); border: 2px solid var(--primary); }
button:hover { transform: translateY(-3px) scale(1.02); filter: brightness(1.1); box-shadow: 0 8px 20px var(--shadow); }
button:active { transform: translateY(0); }
.back-link { background: none; color: var(--accent); font-size: 0.7rem; position: absolute; top: 1.5rem; left: 1.5rem; border: none; font-weight: bold; cursor: pointer; }

/* Arena UX */
.arena-hud { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-family: monospace; }
.hud-label { font-size: 0.6rem; color: var(--accent); display: block; text-transform: uppercase; font-weight: 800; }
.hud-val { font-weight: 900; color: var(--text); font-size: 1.1rem; }
.timer-rail { background: var(--background); height: 8px; border-radius: 4px; margin-bottom: 2.5rem; overflow: hidden; box-shadow: inset 0 2px 4px var(--shadow); border: 1px solid var(--primary); }
#timer-fill { background: linear-gradient(90deg, var(--text), var(--secondary)); height: 100%; transition: width 0.1s linear; }

#formula-display { 
    font-size: 2.5rem; min-height: 160px; display: flex; align-items: center; justify-content: center; 
    background: var(--background); border-radius: 1.2rem; margin-bottom: 2.5rem; 
    box-shadow: inset 0 2px 15px var(--shadow); border: 1px solid var(--primary);
}
#formula-display mjx-container { font-size: 1.1em !important; font-weight: 800; }

#options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.opt-btn { background: var(--white); border: 2px solid var(--primary); min-height: 110px; color: var(--text); box-shadow: 0 4px 8px var(--shadow); clip-path: none; border-radius: 1rem; }
.opt-btn:hover { border-color: var(--accent); background: var(--background); }

/* Correction Modal */
.overlay { position: fixed; inset: 0; background: rgba(106, 22, 44, 0.4); backdrop-filter: blur(12px); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--white); border: 2px solid var(--text); border-radius: 1.5rem; padding: 2.5rem; max-width: 480px; width: 95%; text-align: center; box-shadow: 0 20px 60px var(--shadow); }
.modal-header { color: var(--accent); font-weight: 900; letter-spacing: 3px; font-size: 0.75rem; margin-bottom: 1.5rem; }
.correction-zone { background: var(--background); border: 1px solid var(--text); padding: 1.5rem; border-radius: 1rem; margin: 1.5rem 0; box-shadow: inset 0 0 10px var(--shadow); }
.correction-label { font-size: 0.65rem; color: var(--accent); font-weight: 900; display: block; margin-bottom: 0.5rem; letter-spacing: 1px; }

/* Vault Styling */
#vault-content { flex: 1; overflow-y: auto; text-align: left; }
.vault-header { color: var(--accent); border-bottom: 2px solid var(--primary); margin-top: 2rem; padding-bottom: 0.5rem; font-size: 1.1rem; font-weight: 900; letter-spacing: 1px; }
.v-table { width: 100%; border-collapse: collapse; }
.v-table td { padding: 1.2rem 0.5rem; border-bottom: 1px solid var(--background); }
.v-ans { text-align: right; color: var(--text); font-weight: 800; }

@media (max-width: 600px) {
    #options-grid { grid-template-columns: 1fr; }
    .logo { font-size: 2.5rem; }
    .screen { padding: 1.5rem; border-radius: 1rem; }
    #formula-display { font-size: 1.8rem; }
}

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(6px); } 75% { transform: translateX(-6px); } }
.panic { animation: shake 0.15s infinite; border-color: var(--text) !important; }
