/* Gravedad y órbitas — maquetación. Tokens y fuentes vienen de /marca.css. */
.sim {
  --espacio: #0E0C2B;
  --hud-fondo: rgba(14, 12, 43, 0.9);
  --hud-borde: rgba(196, 181, 253, 0.28);
  --hud-texto: #ECEAFF;
  --pista-off: #B9B2D9;
  min-height: 100dvh; display: flex; flex-direction: column;
}
@media (prefers-color-scheme: dark) { .sim { --pista-off: #4A5875; } }

/* ── Barra superior */
.barra { display: flex; align-items: center; gap: 0.9rem; min-height: 3.75rem; padding: 0 1.25rem; background: var(--fondo); border-bottom: 2px solid var(--lavanda); flex: none; }
.barra h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miga { width: 1.2rem; height: 0.45rem; background: var(--naranja); transform: skewX(-38deg); flex: none; }
.volver { margin-left: auto; font-weight: 800; font-size: 0.95rem; white-space: nowrap; }

/* ── Rejilla de la app: escena a la izquierda, escenarios + panel a la derecha */
.app { flex: 1; min-height: 0; display: grid; gap: 1rem; padding: 1rem; grid-template-columns: minmax(0, 1fr) 23.5rem; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: 'escena escenarios' 'escena panel'; }
.escenarios { grid-area: escenarios; display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.escena { grid-area: escena; display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; min-height: 0; }
.panel { grid-area: panel; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; padding-right: 0.15rem; }

@media (min-width: 60rem) { .app { height: calc(100dvh - 3.75rem); } .sim { height: 100dvh; } }
@media (max-width: 59.99rem) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: 'escenarios' 'escena' 'panel'; padding: 0.75rem; }
  .escenarios { display: flex; overflow-x: auto; scroll-snap-type: x proximity; margin-inline: -0.75rem; padding-inline: 0.75rem; padding-bottom: 0.25rem; }
  .escenarios .chip { flex: 0 0 auto; min-width: 9.5rem; scroll-snap-align: start; }
  .barra { padding: 0 0.85rem; gap: 0.6rem; }
  .barra h1 { font-size: 1rem; }
  .volver { display: none; }
  .miga { display: none; }
}
@media (max-width: 29.99rem) { .barra .logo { font-size: 1.02rem; } .barra h1 { font-size: 0.95rem; } }

/* ── Chips de escenario */
.chip { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; text-align: left; padding: 0.6rem 0.75rem; min-height: 4.2rem; font: 800 0.92rem/1.15 'Nunito', system-ui, sans-serif; color: var(--tinta); background: var(--fondo); border: 2px solid var(--lavanda); border-radius: var(--radio); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.chip:hover { border-color: var(--violeta); }
.chip[aria-pressed='true'] { border-color: var(--violeta); background: var(--lavanda); }
.chip svg { width: 3.6rem; height: 1.6rem; display: block; }

/* ── Lienzo y HUD */
.caja { position: relative; flex: 1; min-height: 0; background: var(--espacio); border-radius: var(--radio); overflow: hidden; border: 2px solid var(--lavanda); }
.caja::before, .caja::after { content: ''; position: absolute; background-repeat: no-repeat; background-size: contain; pointer-events: none; }
.caja::before { top: -3rem; right: -3.5rem; width: 20rem; height: 13.6rem; opacity: 0.13; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 440 300'%3E%3Cg fill='%236D28D9'%3E%3Cpath d='M78 0h362l-78 60H0z'/%3E%3Cpath d='M178 96h262l-78 60H100z'/%3E%3Cpath d='M278 192h162l-78 60H200z'/%3E%3C/g%3E%3C/svg%3E"); }
.caja::after { bottom: -2rem; left: -3rem; width: 15rem; height: 8rem; opacity: 0.2; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 340 180'%3E%3Cg fill='%23F97316'%3E%3Cpath d='M78 0h184l-78 60H0z'/%3E%3Cpath d='M156 96h184l-78 60H78z'/%3E%3C/g%3E%3C/svg%3E"); }
#lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline-offset: -4px; }
#lienzo.sobre-cuerpo { cursor: pointer; }
#lienzo.arrastrando { cursor: grabbing; }
.caja .hud { position: absolute; z-index: 2; color: var(--hud-texto); font-weight: 800; font-size: 0.8rem; }
.hud-vistas { top: 0.6rem; left: 0.6rem; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.hud-vistas button { font: 800 0.82rem/1 'Nunito', system-ui, sans-serif; color: var(--hud-texto); background: var(--hud-fondo); border: 2px solid var(--hud-borde); border-radius: 999px; padding: 0.55rem 0.9rem; min-height: 2.4rem; cursor: pointer; }
.hud-vistas button[aria-pressed='true'] { background: var(--violeta); border-color: var(--violeta); color: #fff; }
.hud-zoom { top: 0.6rem; right: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.hud-btn { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; color: var(--hud-texto); background: var(--hud-fondo); border: 2px solid var(--hud-borde); border-radius: var(--radio); cursor: pointer; padding: 0; }
.hud-btn:hover { border-color: #C4B5FD; }
.hud-btn svg { width: 1.3rem; height: 1.3rem; }
.hud-escala { left: 0.75rem; bottom: 0.7rem; display: flex; flex-direction: column; gap: 0.25rem; align-items: flex-start; text-shadow: 0 1px 2px #000; }
.hud-escala i { display: block; height: 0.5rem; width: 100px; border: 2px solid #ECEAFF; border-top: 0; }
.hud-escala .cuadro { color: #C4B5FD; font-weight: 700; }
.hud-modo { right: 0.75rem; bottom: 0.7rem; max-width: 55%; text-align: right; background: var(--hud-fondo); border: 2px solid var(--hud-borde); border-radius: 999px; padding: 0.4rem 0.8rem; }
.hud-modo.aviso-real { border-color: var(--naranja); }
.aviso { position: absolute; z-index: 3; left: 50%; bottom: 3.6rem; transform: translateX(-50%); width: max-content; max-width: calc(100% - 1.5rem); text-align: center; background: var(--naranja); color: #1E1B4B; font-weight: 800; padding: 0.6rem 1rem; border-radius: var(--radio); }
@media (max-width: 59.99rem) {
  .caja { flex: none; height: min(58dvh, 31rem); min-height: 19rem; }
  .hud-modo { max-width: 62%; font-size: 0.74rem; }
}

/* ── Barra de control */
.mando { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.6rem 0.75rem; background: var(--lavanda-suave); border: 2px solid var(--lavanda); border-radius: var(--radio); flex: none; }
.btn-ico { width: 3rem; height: 3rem; display: grid; place-items: center; padding: 0; color: var(--tinta); background: var(--fondo); border: 2px solid var(--lavanda); border-radius: var(--radio); cursor: pointer; }
.btn-ico:hover:not(:disabled) { border-color: var(--violeta); }
.btn-ico:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ico svg { width: 1.35rem; height: 1.35rem; }
.btn-ico.grande { width: 3.9rem; height: 3.4rem; background: var(--naranja); border-color: var(--naranja); color: #1E1B4B; }
.btn-ico.grande:hover { background: var(--naranja-hover); border-color: var(--naranja-hover); }
.btn-ico.grande svg { width: 1.7rem; height: 1.7rem; }
.seg { display: inline-flex; border: 2px solid var(--lavanda); border-radius: var(--radio); background: var(--fondo); padding: 0.2rem; margin: 0 0 0 0.4rem; min-width: 0; }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: block; padding: 0.7rem 0.85rem; min-height: 2.75rem; font-weight: 800; font-size: 0.92rem; border-radius: 0.6rem; cursor: pointer; color: var(--tinta); }
.seg input:checked + span { background: var(--violeta); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--naranja); outline-offset: 2px; }
.btn-txt { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.75rem; padding: 0.5rem 0.9rem; font: 800 0.92rem/1 'Nunito', system-ui, sans-serif; color: var(--enlace); background: transparent; border: 2px solid var(--lavanda); border-radius: var(--radio); cursor: pointer; }
.btn-txt:hover { border-color: var(--violeta); }
.btn-txt svg { width: 1.2rem; height: 1.2rem; }
.reloj { margin-left: auto; font-weight: 900; font-size: 1.2rem; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--tinta); }
@media (max-width: 59.99rem) { .reloj { flex-basis: 100%; margin-left: 0; text-align: center; font-size: 1.1rem; } .seg { margin-left: 0; } .seg span { padding-inline: 0.7rem; } }

/* ── Panel */
.tarjeta { background: var(--fondo); border: 2px solid var(--lavanda); border-radius: var(--radio); padding: 0.85rem 1rem; flex: none; }
.tarjeta > summary { font-weight: 900; font-size: 1.02rem; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 1.6rem; }
.tarjeta > summary::-webkit-details-marker { display: none; }
.tarjeta > summary::after { content: ''; width: 0.55rem; height: 0.55rem; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; }
.tarjeta[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.tarjeta[open] > summary { margin-bottom: 0.6rem; }
.gravedad { padding: 0.5rem 1rem; }

/* Interruptor accesible: el <input> sigue siendo el control; la pista es solo dibujo. */
.sw { position: relative; display: flex; align-items: center; gap: 0.7rem; min-height: 2.75rem; cursor: pointer; font-weight: 700; }
.sw input { position: absolute; opacity: 0; width: 2.9rem; height: 1.7rem; margin: 0; cursor: pointer; }
.sw .pista { flex: none; width: 2.9rem; height: 1.7rem; border-radius: 999px; background: var(--pista-off); position: relative; transition: background 0.15s; }
.sw .pista::after { content: ''; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.sw input:checked ~ .pista { background: var(--violeta); }
.sw input:checked ~ .pista::after { transform: translateX(1.2rem); }
.sw input:focus-visible ~ .pista { outline: 3px solid var(--naranja); outline-offset: 3px; }
.sw .txt { flex: 1; line-height: 1.2; }
.sw .muestra { width: 2.1rem; height: 0.75rem; flex: none; }
.grande-sw .txt { display: flex; flex-direction: column; }
.grande-sw .txt b { font-size: 1.05rem; font-weight: 900; }
.grande-sw .txt small { font-size: 0.85rem; color: var(--tinta-suave); font-weight: 700; }
.lista-sw { display: flex; flex-direction: column; }

/* Masas */
.masas { display: flex; flex-direction: column; gap: 0.9rem; }
.masa label { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; font-weight: 800; }
.masa label small { font-weight: 700; color: var(--tinta-suave); font-variant-numeric: tabular-nums; }
.masa .nom { display: inline-flex; align-items: center; gap: 0.45rem; }
.masa .punto { width: 0.8rem; height: 0.8rem; border-radius: 50%; flex: none; }
.masa input[type='range'] { width: 100%; height: 2.75rem; margin: 0; background: transparent; accent-color: var(--violeta); cursor: pointer; }
.masa .marcas { display: flex; justify-content: space-between; font-size: 0.78rem; font-weight: 700; color: var(--tinta-suave); margin-top: -0.5rem; padding-inline: 0.2rem; }

/* Datos */
.datos { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 0.8rem; font-variant-numeric: tabular-nums; }
.datos .k { color: var(--tinta-suave); font-weight: 700; font-size: 0.95rem; }
.datos .v { margin: 0; font-weight: 800; text-align: right; font-size: 0.95rem; }
.datos .grupo { grid-column: 1 / -1; font-weight: 900; padding-top: 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
.datos .grupo:first-child { padding-top: 0; }
.datos .grupo::before { content: ''; width: 0.9rem; height: 0.32rem; background: var(--naranja); transform: skewX(-38deg); flex: none; }

/* Reto de Merk */
.reto { display: flex; gap: 0.85rem; align-items: flex-start; padding: 1rem; background: var(--lavanda); border-radius: var(--radio); border: 2px solid var(--lavanda); flex: none; }
.merk-av { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 0.7rem; background: var(--violeta); color: #fff; display: grid; place-items: center; }
.merk-av svg { width: 1.7rem; height: 1.7rem; }
.reto h2 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.reto p { font-size: 0.97rem; line-height: 1.5; }
.restablecer { align-self: flex-start; }
.ayuda ul { margin: 0; padding-left: 1.1rem; font-size: 0.93rem; display: flex; flex-direction: column; gap: 0.4rem; }
.credito { font-size: 0.82rem; color: var(--tinta-suave); line-height: 1.5; padding-bottom: 0.5rem; }

/* Pantalla completa (proyector): la escena ocupa todo. */
.escena:fullscreen { background: var(--fondo); padding: 0.75rem; }
.escena:fullscreen .caja { flex: 1; height: auto; }
