:root {
    /* Paleta unificada FisicaLab */
    --clr-pink: #FFCFEA;
    --clr-yellow: #FEFFBE;
    --clr-green: #CBFFE6;
    --clr-blue: #AFE9FF;
    --clr-purple: #BFB9FF;
    --sidebar-bg: #1A224D;

    /* Colores del MRU */
    --bg-page: #71c1bd; --surface: #FFFFFF; --surface-accent: #F4F7FE; 
    --accent-primary: #2B3674; --accent-secondary: #E63946; 
    --text-main: #1D233F; --text-muted: #718096;
    --border-soft: 1px solid #E2E8F0; --shadow-soft: 0 15px 35px rgba(0, 0, 0, 0.15);
    --success: #05CD99; --danger: #EE5D50; --warning: #FFCE20;
    --lvl-pollito: #F6E05E; --lvl-medio: #ED8936; --lvl-hard: #E53E3E;
    --report-bg: #FFFFFF; --report-header-bg: #3b5998; 
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; color: var(--text-main); }
body { background-color: var(--bg-page); display: flex; flex-direction: column; align-items: center; min-height: 100vh; padding: 25px 15px; background-image: radial-gradient(circle at 100% 150%, rgba(255,255,255,0.1) 24%, transparent 25%), radial-gradient(circle at 0% 50%, rgba(255,255,255,0.05) 15%, transparent 16%); overflow-x: hidden; }

/* ================= MENÚ DESLIZABLE (SLIDING NAV) ================= */
.nav-toggle-btn {
    position: fixed; top: 20px; left: 20px; z-index: 1000;
    background: var(--surface); color: var(--accent-primary);
    border: none; border-radius: 12px; padding: 15px; font-size: 1.5rem;
    cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}
.nav-toggle-btn:hover { transform: scale(1.1); color: var(--clr-blue); background: var(--sidebar-bg); }

.nav-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1001;
    opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.nav-overlay.active { opacity: 1; visibility: visible; }

.slide-menu {
    position: fixed; top: 0; left: -320px; width: 320px; height: 100%;
    background: var(--sidebar-bg); z-index: 1002;
    box-shadow: 10px 0 30px rgba(0,0,0,0.3); padding: 30px 20px;
    display: flex; flex-direction: column; transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.slide-menu.active { left: 0; }

.slide-menu-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 20px; margin-bottom: 20px; }
.slide-menu-header h3 { color: var(--white); font-size: 1.5rem; display: flex; align-items: center; gap: 10px; }
.slide-menu-header h3 i { color: var(--accent-primary); }
.nav-close-btn { background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: color 0.2s; }
.nav-close-btn:hover { color: var(--danger); }

.slide-menu-links { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.menu-subtitle { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; font-weight: bold; margin-top: 15px; padding-left: 15px; letter-spacing: 1px; }
.slide-menu-links a { color: rgba(255,255,255,0.7); text-decoration: none; padding: 12px 15px; border-radius: 10px; display: flex; align-items: center; gap: 15px; font-weight: bold; transition: all 0.2s; }
.slide-menu-links a i { width: 25px; text-align: center; }
.slide-menu-links a:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.slide-menu-links a.active { border-left: 4px solid var(--clr-yellow); background: linear-gradient(90deg, rgba(156, 59, 59, 0.1) 100%, transparent 100%); color: var(--white); }
.slide-menu-links a.home-link { background: var(--bg-page); margin-bottom: 10px; border: 1px solid rgba(255,255,255,0.2); }
.slide-menu-links a.home-link:hover { background: var(--clr-purple); }

/* ================= ESTRUCTURA PRINCIPAL ================= */
h1 { text-align: center; margin-bottom: 5px; color: #FFFFFF; font-weight: 800; font-size: 2.2rem; text-shadow: 0 2px 10px rgba(0,0,0,0.2); margin-top: 20px;}
.subtitle { text-align: center; color: #ffffff; margin-bottom: 25px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; font-size: 0.95rem; }

/* Ampliado para permitir el diseño lado a lado */
#main-app-grid { display: flex; flex-direction: column; align-items: center; gap: 30px; width: 100%; max-width: 1150px; margin: 0 auto; }
.left-column { width: 100%; display: flex; flex-direction: column; gap: 20px; }

/* ================= SIMULADOR DIVIDIDO EN 2 COLUMNAS ================= */
.simulator-wrapper { 
    background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-soft); padding: 25px; border: var(--border-soft); 
    display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; align-items: stretch; /* Estructura Side-by-Side */
}

/* Columna Izquierda (Animación y datos) */
.sim-visuals { display: flex; flex-direction: column; justify-content: space-between; }

.stats-panel { display: flex; justify-content: space-around; background: var(--surface-accent); padding: 15px; border-radius: 14px; margin-bottom: 20px; border: var(--border-soft); }
.stat-box { text-align: center; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; font-weight: 700; }
.stat-value { font-size: 2rem; font-weight: 800; font-family: 'Courier New', Courier, monospace; color: var(--accent-primary); line-height: 1; }
.stat-unit { font-size: 0.9rem; color: var(--text-muted); font-weight: bold;}

.simulation-container { position: relative; flex-grow: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.simulation-area { position: relative; background-color: #E9EDF7; height: 130px; border-radius: 14px 14px 0 0; border: var(--border-soft); border-bottom: none; overflow: hidden; }
.road-line { position: absolute; top: 50%; width: 100%; border-top: 4px dashed #B0BCE1; transform: translateY(-50%); }
#movil-container { position: absolute; top: 50%; left: 0; transform: translateY(-50%); transform-origin: center; }
#movil { font-size: 3.5rem; transition: transform 0.1s; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.15)); }

.ruler { position: relative; width: 100%; height: 60px; background: #F4F7FE; border: var(--border-soft); border-top: 1px solid #D1D9E6; border-radius: 0 0 14px 14px; }
.ruler-mark { position: absolute; top: 0; width: 2px; height: 12px; background-color: var(--text-muted); }
.ruler-label { position: absolute; top: 16px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; white-space: nowrap; }
.time-label { color: var(--text-main); font-weight: 800; font-size: 0.8rem; line-height: 1; }
.dist-label { color: var(--text-muted); font-size: 0.7rem; line-height: 1; }

/* Columna Derecha (Controles) */
.dashboard { display: flex; flex-direction: column; justify-content: center; gap: 15px; }
.control-group { background: var(--surface-accent); padding: 15px; border-radius: 14px; border: var(--border-soft); }
label { font-weight: 700; display: block; margin-bottom: 8px; font-size: 0.9rem; }
input[type="range"] { width: 100%; margin: 10px 0; accent-color: var(--accent-primary); cursor: pointer; }
input[type="range"]:disabled { opacity: 0.4; cursor: not-allowed; }
select { width: 100%; padding: 10px; border-radius: 8px; border: var(--border-soft); font-size: 0.95rem; background-color: var(--surface); cursor: pointer; font-weight: 600; }
.value-display { color: var(--accent-primary); font-weight: bold; float: right; background: rgba(43, 54, 116, 0.1); padding: 3px 8px; border-radius: 6px; }
.const-badge { display: none; background: var(--accent-secondary); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; margin-left: 10px; vertical-align: middle; }

.buttons { display: flex; justify-content: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
button.btn-sim { flex: 1; padding: 12px 15px; border: none; border-radius: 10px; font-size: 0.9rem; font-weight: bold; cursor: pointer; transition: all 0.2s ease; text-transform: uppercase; color: white; min-width: 100px;}
button.btn-sim:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 15px rgba(0,0,0,0.15); }
button.btn-sim:disabled { opacity: 0.5; cursor: not-allowed; }
#btn-start { background-color: var(--success); } #btn-pause { background-color: var(--warning); color: #4A4A4A; } #btn-reset { background-color: var(--danger); }

/* FÓRMULAS CLAVE */
.formulas-wrapper { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-soft); padding: 20px; border: var(--border-soft); }
.formulas-wrapper h3 { color: var(--accent-primary); margin-bottom: 15px; font-size: 1.2rem; border-bottom: 2px dashed #E2E8F0; padding-bottom: 10px;}
.formulas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; align-items: stretch;}
.formula-box { background: var(--surface-accent); border-radius: 12px; padding: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px solid #E2E8F0;}
.formula-box.img-placeholder { border: 2px dashed #CBD5E1; background: #F8FAFC; min-height: 120px; padding: 10px; }
.placeholder-text { color: #94A3B8; font-size: 0.9rem; font-weight: bold; }

.pyramid-box { display: flex; flex-direction: column; align-items: center; background: #FFFFFF; padding: 10px; border-radius: 12px; border: 2px solid #E2E8F0; text-align: center; width: 80px; margin-bottom: 10px;}
.pyramid-node { font-weight: 900; font-size: 1.2rem; padding: 2px 8px; color: var(--accent-primary); }
.pyramid-divider { width: 80%; height: 3px; background: #CBD5E1; margin: 2px 0; border-radius: 2px;}
.pyramid-row-bottom { display: flex; gap: 10px; }
.formula-caption { font-size: 0.75rem; color: var(--text-muted); line-height: 1.2;}

/* BOTÓN GIGANTE */
.btn-big-action {
    background: linear-gradient(135deg, #FF6A00, #E63946); 
    color: white; font-size: 1.5rem; font-weight: 900; padding: 20px 40px;
    border: none; border-radius: 16px; cursor: pointer; box-shadow: 0 10px 25px rgba(230, 57, 70, 0.4);
    text-transform: uppercase; letter-spacing: 2px; transition: all 0.3s; width: 100%; max-width: 600px;
}
.btn-big-action:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 15px 35px rgba(230, 57, 70, 0.6); }

/* GAMIFICACIÓN Y RETOS */
.challenges-container { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-soft); padding: 30px; border: var(--border-soft); display: flex; flex-direction: column; gap: 20px; width: 100%; animation: fadeInDown 0.6s ease forwards; }

@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

.gami-hud { display: flex; flex-direction: column; gap: 15px; background: var(--sidebar-bg); color: white; padding: 20px; border-radius: 16px; box-shadow: 0 10px 25px rgba(26,34,77,0.3); border: 2px solid rgba(255,255,255,0.1); background-image: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%); }
.gami-rank-container { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 10px; }
.gami-rank-title { font-size: 1.05rem; font-weight: 800; color: #FFFFFF; text-transform: uppercase; letter-spacing: 1px; }
.gami-streak { font-size: 1.1rem; font-weight: bold; color: #FF9A9E; background: rgba(255,255,255,0.1); padding: 4px 10px; border-radius: 20px; }
.gami-puntos-container { text-align: center; }
.gami-puntos-label { font-size: 0.75rem; color: #CBD5E1; font-weight: bold; letter-spacing: 2px; text-transform: uppercase; display: block; margin-bottom: 5px; }
.gami-xp { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; }
.gami-xp-current { font-size: 2.5rem; font-weight: 900; color: #00F2FE; text-shadow: 0 0 10px rgba(0,242,254,0.5); font-family: monospace; }
.gami-xp-meta { font-size: 1.2rem; color: rgba(255,255,255,0.6); font-weight: bold; }
.gami-puntos-bar-bg { width: 100%; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.gami-puntos-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #00F2FE 0%, #4FACFE 100%); border-radius: 4px; transition: width 0.3s; }

.level-selector { display: flex; gap: 10px; background: var(--surface-accent); padding: 10px; border-radius: 16px; border: var(--border-soft); }
.btn-level { flex: 1; padding: 12px 5px; border: none; border-radius: 10px; font-weight: bold; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; background: white; border: 2px solid transparent; color: var(--text-muted); }
.btn-level.active.pollito { background: var(--lvl-pollito); color: #744210; border-color: #D69E2E; box-shadow: 0 4px 10px rgba(237,137,54,0.3); }
.btn-level.active.medio { background: var(--lvl-medio); color: white; border-color: #C05621; box-shadow: 0 4px 10px rgba(237,137,54,0.3); }
.btn-level.active.hard { background: var(--lvl-hard); color: white; border-color: #9B2C2C; box-shadow: 0 4px 10px rgba(229,62,62,0.3); }
.level-hint { background: #EDF2F7; padding: 10px; border-radius: 8px; text-align: center; font-size: 0.9rem; color: #4A5568; font-weight: bold; border-left: 4px solid var(--accent-primary); }

#exercises-list { display: flex; flex-direction: column; gap: 15px; }
.exercise-card { background: var(--surface); border: 2px solid #E2E8F0; border-radius: 16px; padding: 20px; transition: all 0.3s; }
.exercise-text { font-size: 1.05rem; line-height: 1.5; margin-bottom: 15px; color: #334155; }
.exercise-text b { color: var(--accent-primary); font-weight: 800; }
.exercise-text i { color: var(--accent-secondary); font-size: 0.95rem; }
.exercise-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 5px;}
.input-answer { padding: 10px 15px; border: 2px solid #CBD5E1; border-radius: 10px; font-size: 1.05rem; width: 130px; outline: none; background: #F8FAFC; text-align: center; font-weight: bold; color: var(--text-main); }
.input-answer:focus { border-color: var(--accent-primary); background: white; }
.btn-check { background: var(--accent-primary); color: white; border: none; padding: 12px 25px; border-radius: 10px; cursor: pointer; font-weight: bold; transition: all 0.2s; font-size: 1rem; }
.btn-check:hover { background: #1A2352; transform: translateY(-2px); }

.feedback-msg { font-weight: bold; font-size: 0.95rem; padding: 10px 15px; border-radius: 10px; display: none; margin-top: 10px; }
.feedback-msg.success { display: block; background: #E6FFFA; color: #049470; border: 1px solid #81E6D9; }
.feedback-msg.error { display: block; background: #FFF5F5; color: #C53030; border: 1px solid #FEB2B2; }

/* MINI SIMULACIÓN ARCOS Y FLECHAS */
.resolution-container { margin-top: 15px; padding-top: 15px; border-top: 2px dashed #E2E8F0; display: none; }
.mini-simulation { background: #FFFFFF; padding: 25px 15px 15px 15px; border-radius: 12px; border: 2px solid #E2E8F0; margin-top: 10px; }
.graphic-track-container { position: relative; width: 100%; margin-bottom: 10px; }
.arcs-layer { display: flex; width: 100%; justify-content: space-between; margin-bottom: -2px; }
.arc-segment { flex: 1; position: relative; text-align: center; }
.arc-time-label { font-size: 0.75rem; color: var(--accent-secondary); font-weight: bold; margin-bottom: 2px; }
.arc-curve { width: 100%; height: 25px; border-top: 2px solid var(--accent-secondary); border-radius: 50% 50% 0 0; position: relative; }
.arc-arrowhead { position: absolute; right: -4px; top: 20px; color: var(--accent-secondary); font-size: 0.8rem; line-height: 1; }

.mini-track { position: relative; width: 100%; height: 6px; background: #94A3B8; border-radius: 3px; }
.dist-layer { display: flex; width: 100%; justify-content: space-between; margin-top: 5px; }
.dist-segment { flex: 1; text-align: center; font-size: 0.8rem; font-weight: 700; color: var(--text-main); border-left: 2px dashed #CBD5E1; padding-top: 5px; position: relative; }
.dist-end-line { width: 2px; height: 15px; border-left: 2px dashed #CBD5E1; position: absolute; right: 0; top: 0; }

.mini-avatar { position: absolute; top: -24px; left: 0; font-size: 1.8rem; line-height: 1; transform: translateX(-50%); z-index: 10; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.2)); }
.mini-avatar-b { position: absolute; top: -24px; right: 0; font-size: 1.8rem; line-height: 1; transform: translateX(50%); z-index: 10; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.2)); }
.encounter-marker { position: absolute; height: 30px; width: 2px; background: var(--accent-secondary); top: -15px; display: none; z-index: 1; border-radius: 2px; }
.mini-hud { display: flex; justify-content: space-between; font-family: monospace; font-size: 0.9rem; color: #64748B; font-weight: bold; background: #F8FAFC; padding: 8px 12px; border-radius: 8px; margin-top: 15px; }

.btn-generate { display: block; width: 100%; background: transparent; color: var(--accent-primary); border: 2px solid var(--accent-primary); padding: 15px; border-radius: 12px; font-size: 1.05rem; font-weight: bold; cursor: pointer; transition: all 0.3s; }
.btn-generate:hover { background: var(--accent-primary); color: white; box-shadow: 0 10px 20px rgba(43, 54, 116, 0.2); }
.btn-ticket { display: block; width: 100%; background: var(--accent-secondary); color: white; border: none; padding: 15px; border-radius: 12px; font-size: 1.1rem; font-weight: bold; cursor: pointer; transition: all 0.3s; margin-top: -5px; box-shadow: 0 5px 15px rgba(230, 57, 70, 0.3); }
.btn-ticket:hover { background: #D62828; transform: scale(1.02); }

/* TICKET MODAL REPORTE */
#ticket-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.ticket-report { background: var(--report-bg); width: 90%; max-width: 450px; border-radius: 16px; padding: 0; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.4); border-bottom: 10px solid rgba(79, 172, 219, 0.8); display: flex; flex-direction: column; text-align: left; }
.ticket-header-report { background: var(--report-header-bg); padding: 25px 30px; text-align: center; }
.ticket-header-report h2 { color: white; margin: 0; font-size: 1.4rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; line-height: 1.3;}
.ticket-divider-report { width: 100%; height: 2px; border-bottom: 2px dashed rgba(255,255,255,0.3); margin-top: 15px; }
.ticket-body-report { padding: 25px; display: flex; flex-direction: column; gap: 15px; }
.report-row-input { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; }
.report-row-input label { font-size: 0.85rem; color: var(--report-header-bg); font-weight: 700; text-transform: uppercase; white-space: nowrap; flex: 0 0 auto; }
.report-input { flex: 1; width: 100%; padding: 10px; border: 1px solid rgba(226, 232, 240, 0.8); border-radius: 8px; font-weight: 700; text-align: left; font-size: 1rem; color: var(--accent-primary); outline: none; background: rgba(244,247,254,0.5); }
.report-input:focus { border-color: rgba(79, 172, 219, 1); }
.ticket-divider-report.body { border-bottom-color: rgba(226, 232, 240, 0.8); margin: 0; }
.report-data-group { display: flex; flex-direction: column; gap: 12px; }
.report-data-item { display: flex; justify-content: space-between; align-items: center; padding-bottom: 5px; border-bottom: 1px solid rgba(226, 232, 240, 0.5); }
.report-data-label { font-size: 0.95rem; color: rgba(79, 172, 219, 1); font-weight: 700; text-transform: uppercase;}
.report-data-value { font-weight: 800; color: var(--text-main); font-size: 1.2rem;}
.btn-close-ticket-report { margin: 0 25px 25px 25px; background: var(--report-header-bg); color: white; border: none; padding: 15px 30px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: all 0.3s; font-size: 1rem; text-transform: uppercase; }
.btn-close-ticket-report:hover { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

/* FOOTER CLARO */
.main-footer { width: 100%; background: var(--surface-accent); padding: 15px 20px; margin-top: 100px; border-top: 5px solid var(--accent-secondary); text-align: center; box-shadow: 0 -10px 30px rgba(0,0,0,0.05); }
.footer-container { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.footer-title { font-size: 1.15rem; font-weight: 800; letter-spacing: 1.5px; color: var(--accent-primary); text-transform: uppercase; }
.footer-author { font-size: 1.05rem; color: var(--text-muted); }
.footer-author strong { color: #cd0576; font-weight: 900; letter-spacing: 0.5px; }
.footer-links { margin-top: 8px; font-size: 1rem; color: var(--text-muted); }
.footer-links a { color: #227f66; text-decoration: underline; font-weight: bold; transition: all 0.3s ease; }
.footer-links a:hover { color: var(--accent-primary); text-decoration: underline; text-shadow: none; }

/* MEDIA QUERIES PARA ADAPTAR EL GRID */
@media (max-width: 900px) { 
    .simulator-wrapper { grid-template-columns: 1fr; }
}



body { background-color: var(--bg-page); padding: 20px; }

/* ================= MENÚ DESLIZABLE ================= */
.slide-menu { background: var(--clr-green); color: var(--text-dark); /* Fondo pastel morado */ }
.slide-menu-links a { color: var(--sidebar-bg); }

/* ================= DISEÑO SIDE-BY-SIDE ================= */
.simulator-wrapper { 
    background: var(--white);
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 15px rgba(0,0,0,0.05);
}

.sim-visuals { background: var(--clr-blue); padding: 20px; border-radius: 15px; } /* Fondo azul pastel */
.dashboard { background: var(--clr-yellow); padding: 20px; border-radius: 15px; } /* Fondo amarillo pastel */

/* Ajustes de botones */
.btn-sim.start { background: var(--clr-green); color: var(--text-dark); border: none; padding: 10px; border-radius: 8px; }
.btn-sim.reset { background: var(--clr-pink); color: var(--text-dark); border: none; padding: 10px; border-radius: 8px; }

.simulation-area { background: white; height: 150px; border-radius: 10px; position: relative; overflow: hidden; }
