/* ════════════════════════════════════════════════════
   RESET Y BASE
════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: #0f0f0f;
    color: #d8d8d8;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    min-height: 100vh;
    overflow: hidden;
}

/* ════════════════════════════════════════════════════
   LAYOUT PRINCIPAL
════════════════════════════════════════════════════ */
.app-container {
    display: grid;
    grid-template-columns: 370px 1fr;
    height: 100vh;
    width: 100vw;
}

/* ════════════════════════════════════════════════════
   PANEL DE CONTROL (SIDEBAR)
════════════════════════════════════════════════════ */
.control-panel {
    background-color: #181818;
    border-right: 1px solid #272727;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    height: 100vh;
    z-index: 2;
}
.control-panel > * { flex-shrink: 0; }

.control-panel::-webkit-scrollbar { width: 7px; }
.control-panel::-webkit-scrollbar-thumb { background: #404040; border-radius: 4px; }
.control-panel::-webkit-scrollbar-thumb:hover { background: #555; }
.control-panel::-webkit-scrollbar-track { background: #141414; border-radius: 4px; }

/* ── Header ───────────────────────────────────────── */
header { display: flex; flex-direction: column; gap: 5px; }

.header-top { display: flex; align-items: center; gap: 10px; }
.header-icon-svg { flex-shrink: 0; display: block; }

.header-top h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.header-details { margin-top: 2px; }
.header-details summary {
    font-size: 0.72rem;
    font-weight: 600;
    color: #828282;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
    padding: 2px 0;
}
.header-details summary::-webkit-details-marker { display: none; }
.header-details summary::before {
    content: '▶';
    font-size: 0.58rem;
    color: #444;
    transition: transform 0.18s ease;
    display: inline-block;
}
.header-details[open] summary::before { transform: rotate(90deg); color: #00c8ff; }
.header-details[open] summary { color: #888; }

.header-details-body { display: flex; flex-direction: column; gap: 7px; padding-top: 6px; }

.subtitle {
    font-size: 0.78rem;
    color: #00c8ff;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.section-note { font-size: 0.80rem; color: #888; margin-top: 4px; line-height: 1.5; }

.quick-rule { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.quick-rule span {
    font-size: 0.74rem;
    font-family: monospace;
    padding: 3px 8px;
    border-radius: 5px;
    display: block;
}
.qr-abs  { color: #55aaff; background: #0b1020; border: 1px solid #1a2a50; }
.qr-emi  { color: #ffaa55; background: #1f1005; border: 1px solid #402808; }
.qr-sel  { color: #aa88cc; background: #150d1f; border: 1px solid #2a1840; }

/* ── Divisor ──────────────────────────────────────── */
.divider { border: 0; height: 1px; background: #252525; }

/* ── Selector de modo ─────────────────────────────── */
.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px;
    background: #141414;
    padding: 4px;
    border: 1px solid #272727;
    border-radius: 9px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: transparent;
    border: 1px solid transparent;
    color: #888;
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.mode-btn .mode-sub {
    font-size: 0.60rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #828282;
}
.mode-btn:hover { color: #c0c0c0; }
.mode-btn.active { background: #0e2230; border-color: #00c8ff55; color: #00c8ff; }
.mode-btn.active .mode-sub { color: #4f93aa; }

/* ── Grupos de control ────────────────────────────── */
.control-group { display: flex; flex-direction: column; gap: 10px; }

h2 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: #00c8ff;
    font-weight: 700;
}

/* ── Inputs ───────────────────────────────────────── */
.input-wrapper { display: flex; flex-direction: column; gap: 5px; }

.label-container { display: flex; justify-content: space-between; align-items: center; }

label { font-size: 0.83rem; color: #c0c0c0; }
.label-hint { font-size: 0.72rem; color: #818181; font-weight: 400; }

.value-badge {
    background-color: #202020;
    color: #00c8ff;
    padding: 2px 7px;
    border-radius: 5px;
    font-family: monospace;
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
}

.slider-bounds { display: flex; justify-content: space-between; font-size: 0.70rem; color: #828282; }

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        #00c8ff90 0%,
        #00c8ff90 var(--fill, 40%),
        #1e1e1e var(--fill, 40%)
    );
    outline: none;
    cursor: pointer;
    transition: background 0.1s;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 17px; height: 17px;
    border-radius: 50%;
    background: #00c8ff;
    border: 2.5px solid #111;
    cursor: pointer;
    box-shadow: 0 0 6px #00c8ff66;
}
input[type="range"]::-moz-range-thumb {
    width: 17px; height: 17px;
    border-radius: 50%;
    background: #00c8ff;
    border: 2.5px solid #111;
    cursor: pointer;
}

/* Select */
.custom-select {
    background-color: #202020;
    border: 1px solid #2e2e2e;
    color: #e0e0e0;
    padding: 9px 11px;
    border-radius: 7px;
    font-size: 0.88rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.custom-select:hover { border-color: #00c8ff55; }
.custom-select option { color: #e0e0e0; background: #1e1e1e; }

.field-hint { font-size: 0.73rem; color: #818181; line-height: 1.45; }

/* ── Toggle buttons ───────────────────────────────── */
.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}
.toggle-btn {
    background: #141414;
    border: 1px solid #2a2a2a;
    color: #888;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.80rem;
    font-weight: 600;
    transition: all 0.15s;
    font-family: system-ui, sans-serif;
}
.toggle-btn:hover { color: #c0c0c0; border-color: #444; }
.toggle-btn.active { background: #0e2230; border-color: #00c8ff55; color: #00c8ff; }

/* Barra de color monocromático */
.mono-color-bar {
    height: 8px;
    border-radius: 4px;
    margin-top: 2px;
}

/* ── Botones de acción ────────────────────────────── */
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.btn-primary {
    background: #0e2230;
    border: 1.5px solid #00c8ff55;
    color: #00c8ff;
    padding: 9px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 0.15s;
    font-family: system-ui, sans-serif;
}
.btn-primary:hover { background: #142a3a; border-color: #00c8ff88; }
.btn-primary.paused { background: #142800; border-color: #44cc0055; color: #44cc00; }

.btn-secondary {
    background: #1c1c1c;
    border: 1px solid #2a2a2a;
    color: #888;
    padding: 9px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 0.15s;
    font-family: system-ui, sans-serif;
}
.btn-secondary:hover { color: #c0c0c0; border-color: #444; }

/* ════════════════════════════════════════════════════
   MÉTRICAS
════════════════════════════════════════════════════ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}
.metrics-grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
    background-color: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 9px;
    padding: 10px 11px;
}
.card.card-data {
    background: linear-gradient(140deg, #1c2836 0%, #141d28 100%);
    border-color: #263040;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 3px 8px rgba(0,0,0,0.30);
}
.card h3 {
    font-size: 0.68rem;
    color: #7a8b9b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 5px;
}
.metric {
    font-size: 1.25rem;
    font-weight: 700;
    color: #e8e8e8;
    font-family: monospace;
    line-height: 1.1;
}
.metric small { font-size: 0.70rem; color: #4a5a6a; font-weight: 400; }

.card-estado {
    background: linear-gradient(135deg, #1a2030 0%, #141820 100%);
    border-color: #00c8ff33;
    border-left: 3px solid #00c8ff55;
    padding: 10px 14px;
}
.estado-value {
    font-size: 0.80rem;
    font-weight: 700;
    font-family: monospace;
    color: #00c8ff;
    display: block;
    text-align: center;
    transition: color 0.4s ease;
}

/* ── Panel de acceso energético (modo colisión) ───── */
.energy-access-panel {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 7px;
    padding: 9px 11px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.energy-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
}
.energy-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.energy-label { color: #888; flex: 1; }
.energy-check { font-size: 0.80rem; font-weight: 700; }
.energy-check.yes { color: #44cc00; }
.energy-check.no  { color: #cc4400; }

/* ── Lista de transiciones ────────────────────────── */
.transitions-list { display: flex; flex-direction: column; gap: 5px; }
.transition-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    padding: 4px 6px;
    border-radius: 5px;
    background: #141414;
}
.tr-swatch {
    width: 16px; height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid #333;
}
.tr-info { flex: 1; color: #aaa; }
.tr-wl { font-family: monospace; color: #ccc; font-weight: 600; }
.tr-levels { color: #8a8a8a; }
.energy-access-title { color: #8a9aaa; }
.tr-type { font-size: 0.68rem; color: #828282; text-transform: uppercase; }

/* ════════════════════════════════════════════════════
   PANEL DE SIMULACIÓN
════════════════════════════════════════════════════ */
.simulation-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #111111;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#canvas-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

#canvas-container canvas {
    box-shadow: 0 16px 48px rgba(0,0,0,0.65), 0 0 0 1px #252525;
    border-radius: 10px;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

/* ════════════════════════════════════════════════════
   BOTÓN DE TEMA
════════════════════════════════════════════════════ */
.theme-btn {
    position: absolute;
    bottom: 18px;
    right: 18px;
    z-index: 20;
    width: 38px; height: 38px;
    background: #1a2530;
    border: 1.5px solid #2a3d50;
    color: #607888;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.35s ease;
}
.theme-btn:hover { background: #0e2230; border-color: #00c8ff44; color: #80a8c0; transform: rotate(35deg); }
.theme-btn.active { border-color: #00c8ff; color: #00c8ff; transform: rotate(65deg); }

.theme-panel {
    position: absolute;
    bottom: 66px; right: 18px;
    z-index: 20;
    background: #1a2530;
    border: 1.5px solid #2a3d50;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55);
    opacity: 0;
    pointer-events: none;
    /* Cerrado: fuera del tabulador y de los lectores de pantalla */
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}
.theme-panel.open { opacity: 1; visibility: visible; transition-delay: 0s; pointer-events: all; transform: translateY(0); }
.theme-panel-title { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; color: #7a8b9b; font-weight: 700; }
.theme-options { display: flex; flex-direction: column; gap: 5px; }
.theme-opt {
    display: flex; align-items: center; gap: 8px;
    background: transparent; border: 1px solid #2a3d50;
    color: #8a9aaa; padding: 6px 10px; border-radius: 6px;
    cursor: pointer; font-size: 0.82rem; font-family: system-ui, sans-serif;
    white-space: nowrap; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-opt:hover { background: #0e2230; border-color: #00c8ff44; color: #c0d8e8; }
.theme-opt.active { background: #091a28; border-color: #00c8ff; color: #00c8ff; }

.theme-swatch { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
.dark-swatch     { background: #141414; border: 1.5px solid #555; }
.light-swatch    { background: #f0f2f5; border: 1.5px solid #aaa; }
.contrast-swatch { background: #000000; border: 1.5px solid #ffff00; }

/* ════════════════════════════════════════════════════
   SECCIONES EDUCATIVAS
════════════════════════════════════════════════════ */
.custom-details {
    background-color: #1c1c1c;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    overflow: hidden;
}
.custom-details summary {
    padding: 11px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #909090;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    list-style: none;
    position: relative;
    user-select: none;
}
.custom-details summary::-webkit-details-marker { display: none; }
.custom-details summary::after {
    content: '▶';
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    font-size: 0.70rem;
    color: #444;
    transition: transform 0.2s ease, color 0.2s ease;
}
.custom-details[open] summary::after { transform: translateY(-50%) rotate(90deg); color: #00c8ff; }

.details-content {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    background-color: #161616;
    border-top: 1px solid #232323;
}

.edu-card { padding: 11px 13px; display: flex; flex-direction: column; gap: 8px; }

.formula-list { display: flex; flex-direction: column; gap: 5px; }
.formula {
    display: flex; align-items: baseline; gap: 8px;
    font-family: monospace; font-size: 0.80rem;
    padding: 4px 0; border-bottom: 1px solid #252525;
}
.formula:last-child { border-bottom: none; }
.formula-name { color: #7a8b9b; min-width: 90px; font-size: 0.75rem; }
.formula-eq { color: #a0d0e8; font-weight: 600; }

/* ════════════════════════════════════════════════════
   TEMA CLARO
════════════════════════════════════════════════════ */
body.theme-light { background-color: #eef0f5; color: #1a2030; }
body.theme-light .control-panel { background-color: #ffffff; border-right-color: #cdd2dc; }
body.theme-light .control-panel::-webkit-scrollbar-thumb { background: #b0b8c8; }
body.theme-light .control-panel::-webkit-scrollbar-track { background: #e8ecf2; }
body.theme-light .card { background-color: #f5f6fa; border-color: #d0d5e0; }
body.theme-light .card.card-data { background: linear-gradient(140deg, #e2e8f5 0%, #d8dff0 100%); border-color: #bfcae0; box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 2px 6px rgba(0,0,0,0.08); }
body.theme-light .card.card-estado { background: linear-gradient(135deg, #dce5f5 0%, #d2dcee 100%); border-color: #0088bb44; border-left-color: #0088bb88; }
body.theme-light .card h3 { color: #4a6080; }
body.theme-light .metric { color: #0d1520; }
body.theme-light .metric small { color: #6070a0; }
body.theme-light .estado-value { color: #00628e; }
body.theme-light .simulation-panel { background-color: #c8d4e0; }
body.theme-light #canvas-container canvas { box-shadow: 0 12px 36px rgba(0,0,0,0.22), 0 0 0 1px #a0aabb; }
body.theme-light .custom-details { background-color: #f2f4f8; border-color: #cdd2dc; }
body.theme-light .custom-details summary { color: #5a6070; }
body.theme-light .custom-details summary::after { color: #586881; }
body.theme-light .details-content { background-color: #eaecf2; border-top-color: #d0d5e0; }
body.theme-light .divider { background: #d4d8e4; }
body.theme-light h2 { color: #0077a0; }
body.theme-light .subtitle { color: #0077a0; }
body.theme-light .header-top h1 { color: #0d1520; }
body.theme-light .section-note { color: #5a6a7a; }
body.theme-light label { color: #2a3a4a; }
body.theme-light .label-hint { color: #627394; }
body.theme-light .value-badge { background-color: #d8e2ee; color: #00628e; }
body.theme-light .slider-bounds { color: #627394; }
body.theme-light .field-hint { color: #627394; }
body.theme-light .custom-select { background-color: #f8f9fc; border-color: #c8d0dc; color: #1a2030; }
body.theme-light .custom-select option { background: #f5f6fa; color: #1a2030; }
body.theme-light .formula-name { color: #5a7090; }
body.theme-light .formula-eq { color: #0060a0; }
body.theme-light .formula { border-bottom-color: #d0d5e0; }
body.theme-light .mode-switch { background: #e8ecf4; border-color: #c8d0dc; }
body.theme-light .mode-btn { color: #5a6a7a; }
body.theme-light .mode-btn .mode-sub { color: #586881; }
body.theme-light .mode-btn:hover { color: #1a2a3a; }
body.theme-light .mode-btn.active { background: #c8dcee; border-color: #006ea044; color: #00628e; }
body.theme-light .mode-btn.active .mode-sub { color: #3b6081; }
body.theme-light .header-details summary { color: #707888; }
body.theme-light .header-details summary::before { color: #586881; }
body.theme-light .header-details[open] summary { color: #4a6080; }
body.theme-light .header-details[open] summary::before { color: #00628e; }
body.theme-light .toggle-btn { background: #eaecf2; border-color: #c0c8d8; color: #5a6a7a; }
body.theme-light .toggle-btn:hover { color: #1a2a3a; border-color: #8090a8; }
body.theme-light .toggle-btn.active { background: #c8dcee; border-color: #006ea044; color: #00628e; }
body.theme-light .btn-primary { background: #c8dcee; border-color: #0088bb55; color: #005a8a; }
body.theme-light .btn-secondary { background: #e4e8f0; border-color: #c0c8d8; color: #5a6a7a; }
body.theme-light .energy-access-panel { background: #eaecf2; border-color: #c8d0dc; }
body.theme-light .energy-label { color: #5a6a7a; }
body.theme-light .transition-row { background: #eaecf2; }
body.theme-light .tr-info { color: #5a6a7a; }
body.theme-light .tr-wl { color: #1a2030; }
body.theme-light .tr-levels { color: #5a6a7a; }
body.theme-light .energy-access-title { color: #5a6a7a; }
body.theme-light .tr-type { color: #586881; }
body.theme-light .qr-abs { color: #1155cc; background: #dde8ff; border-color: #aabcee; }
body.theme-light .qr-emi { color: #994400; background: #fff0d8; border-color: #eec888; }
body.theme-light .qr-sel { color: #660088; background: #f0e8ff; border-color: #cca8ee; }
body.theme-light input[type="range"] { background: linear-gradient(to right, #0088bb90 0%, #0088bb90 var(--fill, 40%), #c8d0dc var(--fill, 40%)); }
body.theme-light input[type="range"]::-webkit-slider-thumb { background: #0088bb; border-color: #e8ecf4; }
body.theme-light input[type="range"]::-moz-range-thumb { background: #0088bb; border-color: #e8ecf4; }
body.theme-light .theme-btn { background: #dde5f0; border-color: #a8b8cc; color: #4a6a8a; }
body.theme-light .theme-btn:hover { background: #c8d8ec; border-color: #0088bb44; color: #1a3a5a; }
body.theme-light .theme-panel { background: #dde5f0; border-color: #a8b8cc; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
body.theme-light .theme-panel-title { color: #5a7090; }
body.theme-light .theme-opt { border-color: #b8c8dc; color: #4a6080; }
body.theme-light .theme-opt:hover { background: #c8d8ec; border-color: #0088bb44; color: #1a3a5a; }
body.theme-light .theme-opt.active { background: #b0cce4; border-color: #0088bb; color: #003a70; }

/* ════════════════════════════════════════════════════
   TEMA ALTO CONTRASTE
════════════════════════════════════════════════════ */
body.theme-contrast { background-color: #000000; color: #ffffff; }
body.theme-contrast .control-panel { background-color: #000000; border-right: 2px solid #ffff00; }
body.theme-contrast .control-panel::-webkit-scrollbar-thumb { background: #ffff00; }
body.theme-contrast .control-panel::-webkit-scrollbar-track { background: #000000; }
body.theme-contrast .card { background-color: #000000; border: 1.5px solid #ffff00; }
body.theme-contrast .card.card-data { background: #000000; border-color: #ffff00; box-shadow: none; }
body.theme-contrast .card.card-estado { background: #000000; border-color: #00ffff; border-left: 3px solid #00ffff; }
body.theme-contrast .card h3 { color: #ffff00; }
body.theme-contrast .metric { color: #ffffff; }
body.theme-contrast .metric small { color: #00ffff; }
body.theme-contrast .estado-value { color: #00ffff; }
body.theme-contrast .simulation-panel { background-color: #000000; }
body.theme-contrast #canvas-container canvas { box-shadow: 0 0 0 2px #ffff00; }
body.theme-contrast .custom-details { background-color: #000000; border: 1.5px solid #ffff00; }
body.theme-contrast .custom-details summary { color: #ffff00; }
body.theme-contrast .custom-details summary::after { color: #ffff00; }
body.theme-contrast .custom-details[open] summary::after { color: #00ffff; }
body.theme-contrast .details-content { background-color: #0a0a0a; border-top-color: #ffff00; }
body.theme-contrast .divider { background: #ffff00; height: 2px; }
body.theme-contrast h2 { color: #00ffff; }
body.theme-contrast .subtitle { color: #00ffff; }
body.theme-contrast .header-top h1 { color: #ffffff; }
body.theme-contrast .section-note { color: #cccccc; }
body.theme-contrast label { color: #ffffff; }
body.theme-contrast .label-hint { color: #cccccc; }
body.theme-contrast .value-badge { background-color: #000000; color: #00ffff; border: 1.5px solid #00ffff; }
body.theme-contrast .slider-bounds { color: #cccccc; }
body.theme-contrast .field-hint { color: #cccccc; }
body.theme-contrast .custom-select { background-color: #000000; border: 1.5px solid #ffff00; color: #ffffff; }
body.theme-contrast .custom-select option { background: #000000; color: #ffffff; }
body.theme-contrast .formula-name { color: #ffff00; }
body.theme-contrast .formula-eq { color: #00ffff; }
body.theme-contrast .formula { border-bottom-color: #333300; }
body.theme-contrast .mode-switch { background: #000000; border: 1.5px solid #ffff00; }
body.theme-contrast .mode-btn { color: #cccccc; }
body.theme-contrast .mode-btn .mode-sub { color: #888888; }
body.theme-contrast .mode-btn:hover { color: #ffffff; }
body.theme-contrast .mode-btn.active { background: #001a00; border-color: #00ffff; color: #00ffff; }
body.theme-contrast .toggle-btn { background: #000000; border-color: #ffff00; color: #cccccc; }
body.theme-contrast .toggle-btn:hover { color: #ffffff; border-color: #ffffff; }
body.theme-contrast .toggle-btn.active { background: #001a1a; border-color: #00ffff; color: #00ffff; }
body.theme-contrast .btn-primary { background: #001a00; border-color: #00ffff; color: #00ffff; }
body.theme-contrast .btn-secondary { background: #000000; border-color: #ffff00; color: #cccccc; }
body.theme-contrast .energy-access-panel { background: #000000; border-color: #ffff00; }
body.theme-contrast .energy-label { color: #cccccc; }
body.theme-contrast .transition-row { background: #0a0a0a; border: 1px solid #333; }
body.theme-contrast .tr-info { color: #cccccc; }
body.theme-contrast .tr-wl { color: #ffffff; }
body.theme-contrast .tr-levels { color: #cccccc; }
body.theme-contrast .energy-access-title { color: #cccccc; }
body.theme-contrast .tr-type { color: #888888; }
body.theme-contrast .qr-abs { color: #88ccff; background: #000a1a; border-color: #004488; }
body.theme-contrast .qr-emi { color: #ffcc44; background: #1a0a00; border-color: #884400; }
body.theme-contrast .qr-sel { color: #cc88ff; background: #0a001a; border-color: #440088; }
body.theme-contrast input[type="range"] { background: linear-gradient(to right, #00ffff90 0%, #00ffff90 var(--fill, 40%), #111111 var(--fill, 40%)); }
body.theme-contrast input[type="range"]::-webkit-slider-thumb { background: #00ffff; border-color: #000000; box-shadow: 0 0 8px #00ffff88; }
body.theme-contrast input[type="range"]::-moz-range-thumb { background: #00ffff; border-color: #000000; }
body.theme-contrast .theme-btn { background: #000000; border-color: #00ffff; color: #00ffff; }
body.theme-contrast .theme-panel { background: #0a0a0a; border: 1.5px solid #ffff00; box-shadow: 0 8px 24px rgba(255,255,0,0.15); }
body.theme-contrast .theme-panel-title { color: #ffff00; }
body.theme-contrast .theme-opt { border-color: #333333; color: #cccccc; }
body.theme-contrast .theme-opt:hover { background: #001a00; border-color: #00ffff; color: #ffffff; }
body.theme-contrast .theme-opt.active { background: #001a1a; border-color: #00ffff; color: #00ffff; }
body.theme-contrast .header-details summary::before { color: #ffff00; }
body.theme-contrast .header-details[open] summary::before { color: #00ffff; }

/* ════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .app-container { grid-template-columns: 1fr; }
    body { overflow: auto; }
    .control-panel { height: auto; width: 100%; }
    .simulation-panel { height: 60vh; }
}
@media (max-width: 500px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
