:root {
  --bg: #05070d;
  --panel: rgba(12, 16, 28, 0.82);
  --panel-border: rgba(140, 170, 255, 0.18);
  --text: #eef1f8;
  --text2: #a9b2c8;
  --muted: #6f7890;
  --accent: #7fd4ff;
  --photon: #ffd75a;
  --neutrino: #7cf6e4;
  --tau: #ff7a59;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overflow: hidden;
}

canvas { display: block; }

/* ---------- Panel de información ---------- */
.panel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  z-index: 10;
  transition: opacity 0.3s;
}
.panel h1 { font-size: 20px; margin: 0 0 4px; font-weight: 650; }
.panel .sub { color: var(--text2); font-size: 13.5px; margin: 0 0 12px; line-height: 1.4; }
.panel .info { font-size: 13.5px; line-height: 1.5; color: var(--text2); margin: 10px 0; }
.panel .info b { color: var(--text); }
.panel .group { margin: 12px 0 4px; }
.panel .group-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.panel .row { display: flex; flex-wrap: wrap; gap: 6px; }

.btn {
  font: inherit;
  font-size: 13.5px;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn.active { background: var(--accent); color: #04121c; border-color: var(--accent); font-weight: 600; }
.btn kbd { font-size: 10.5px; opacity: 0.6; margin-left: 4px; font-family: inherit; }

.slider { width: 100%; accent-color: var(--accent); }
.slider-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.slider-row span { min-width: 44px; text-align: right; }

.stats { margin-top: 12px; font-size: 13.5px; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; }
.stats .k { color: var(--text2); }
.stats .v { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }

.back {
  display: inline-block;
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 10px;
}
.back:hover { color: var(--text); }

.keys { margin-top: 12px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* ---------- Narración (subtítulo inferior) ---------- */
.caption {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: min(900px, calc(100vw - 32px));
  padding: 12px 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  font-size: 20px;
  line-height: 1.4;
  text-align: center;
  z-index: 10;
  transition: opacity 0.4s;
}
.caption:empty { opacity: 0; }

/* ---------- Etiquetas 3D ---------- */
.label {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  font-size: 15px;
  color: var(--text);
  text-shadow: 0 0 4px #000, 0 0 8px #000;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  z-index: 5;
}
.label.small { font-size: 12.5px; color: var(--text2); }
.label.big { font-size: 19px; font-weight: 600; }

.hidden-ui .panel, .hidden-ui .caption, .hidden-ui .legend { opacity: 0; pointer-events: none; }

.legend {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text2);
  z-index: 10;
}
.legend .bar { width: 200px; height: 10px; border-radius: 5px; margin: 6px 0 4px; }
.legend .ends { display: flex; justify-content: space-between; }

.note { position: fixed; right: 16px; top: 16px; font-size: 12px; color: var(--muted); z-index: 10; text-align: right; }

@media (max-width: 700px) {
  .panel { width: auto; right: 16px; max-height: 45vh; }
  .caption { font-size: 15px; }
}

/* ---------- Propio de esta simulación ---------- */
#unrolled {
  position: fixed; right: 16px; top: 16px; z-index: 10;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 8px 10px 6px; transition: opacity 0.3s;
}
#unrolled .t { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
#unrolled canvas { display: block; }
.hidden-ui #unrolled { opacity: 0; }
