/* ============================================================================
 * style.css — Q·Lab. Diseño oscuro de instrumento de laboratorio.
 * Paleta validada (contraste y visión del color) sobre superficie #1a1a19.
 * ==========================================================================*/

:root {
  color-scheme: dark;
  --bg:       #0d0d0d;   /* plano de página */
  --surface:  #1a1a19;   /* paneles */
  --surface2: #232322;   /* elevación ligera */
  --border:   rgba(255, 255, 255, 0.10);
  --grid:     #2c2c2a;
  --axis:     #383835;
  --ink:      #ffffff;
  --ink2:     #c3c2b7;
  --muted:    #898781;

  --blue:     #3987e5;   /* Pauli + barras/vectores (acento secuencial) */
  --aqua:     #199e70;   /* superposición (H, √X) */
  --violet:   #9085e9;   /* fases (S, T, P, Z^t) */
  --orange:   #d95926;   /* rotaciones y puertas ^t */
  --yellow:   #c98500;   /* displays */
  --magenta:  #d55181;   /* postselección */
  --green:    #0ca30c;   /* medición */
  --red:      #e66767;   /* avisos */

  --cell: 56px;
  --tile: 46px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}

button {
  font: inherit;
  color: var(--ink);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 11px;
  cursor: pointer;
}
button:hover { background: #2e2e2c; }
button:disabled { opacity: 0.4; cursor: default; }

select, input[type="text"], input[type="number"] {
  font: inherit;
  color: var(--ink);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ------------------------------------------------------------------ layout */

#topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;  /* una sola fila: la altura de main cuenta con ello */
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#topbar .brand { font-size: 15px; margin-right: 6px; white-space: nowrap; }
#topbar .brand .sub { color: var(--muted); font-size: 12px; margin-left: 6px; }
#topbar .sep { width: 1px; height: 22px; background: var(--border); }
#topbar .spacer { flex: 1; }

#q-count { display: inline-block; min-width: 20px; margin: 0 6px; text-align: center; font-weight: 600; }

#time-controls { display: inline-flex; align-items: center; gap: 8px; }
#time-controls input[type="range"] { width: 120px; accent-color: var(--orange); }
#time-label { color: var(--ink2); font-family: ui-monospace, monospace; font-size: 12px; min-width: 58px; }

main {
  display: grid;
  grid-template-columns: var(--col-left, 280px) minmax(0, 1fr) var(--col-right, 364px);
  height: calc(100vh - 53px);
  transition: grid-template-columns 0.28s ease;
}
main.tb-collapsed  { --col-left: 36px; }
main.ins-collapsed { --col-right: 36px; }

/* ------------------------------------------------------ paneles plegables */

.panel-toggle {
  flex: 0 0 auto;
  align-self: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
}
.panel-toggle:hover { color: var(--ink); }

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  opacity: 1;
  transition: opacity 0.2s ease 0.08s, visibility 0s linear 0s;
}
/* Ancho interior fijo: al animar el panel el contenido se recorta en vez de
 * recolocarse; el ancho debe coincidir con la columna menos el padding. */
#toolbox .panel-body { min-width: 256px; }
#inspector .panel-body { min-width: 336px; }

/* Pista vertical del panel encogido; fuera de flujo para no mover el resto. */
.panel-vlabel {
  position: absolute;
  top: 46px;
  left: 50%;
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

aside.collapsed { padding: 8px 4px; cursor: pointer; }
aside.collapsed .panel-body {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0s linear 0.12s;
}
aside.collapsed .panel-vlabel {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease 0.12s, visibility 0s linear 0.12s;
}
aside.collapsed:hover .panel-vlabel { color: var(--ink2); }

/* ----------------------------------------------------------------- toolbox */

#toolbox {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  padding: 12px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  transition: padding 0.28s ease;
}

#toolbox h3 {
  margin: 14px 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
#toolbox h3:first-child { margin-top: 0; }

/* Tarjeta «Puerta» fija sobre la paleta: queda fuera de .panel-body, así que
 * el scroll de las fichas no la mueve. Mismo ancho interior fijo que la caja
 * para que el plegado recorte en vez de recolocar. */
#gate-info {
  flex: 0 0 auto;
  min-width: 256px;
  height: 250px;   /* altura constante: cambiar de puerta no recoloca la paleta */
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  opacity: 1;
  transition: opacity 0.2s ease 0.08s, visibility 0s linear 0s;
}
aside.collapsed #gate-info {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0s linear 0.12s;
}

.tile-row { display: flex; flex-wrap: wrap; gap: 7px; }

/* ------------------------------------------------------- fichas de puertas */

.tile, .gate {
  width: var(--tile);
  height: var(--tile);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1.5px solid var(--gc, var(--ink2));
  background: var(--gb, var(--surface2));
  font-weight: 700;
  font-size: 15px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  line-height: 1.1;
}
.tile:active, .gate:active { cursor: grabbing; }

.tile small, .gate small {
  font-weight: 500;
  font-size: 9px;
  color: var(--ink2);
  font-family: ui-monospace, monospace;
}

.cat-super  { --gc: var(--aqua);    --gb: rgba(25, 158, 112, 0.16); }
.cat-pauli  { --gc: var(--blue);    --gb: rgba(57, 135, 229, 0.16); }
.cat-fase   { --gc: var(--violet);  --gb: rgba(144, 133, 233, 0.16); }
.cat-rot    { --gc: var(--orange);  --gb: rgba(217, 89, 38, 0.16); }
.cat-tiempo { --gc: var(--orange);  --gb: rgba(217, 89, 38, 0.16); }
.cat-medida { --gc: var(--green);   --gb: rgba(12, 163, 12, 0.16); }
.cat-post   { --gc: var(--magenta); --gb: rgba(213, 81, 129, 0.16); }
.cat-disp   { --gc: var(--yellow);  --gb: rgba(201, 133, 0, 0.14); border-style: dashed; }
.cat-ctrl   { --gc: var(--ink2);    --gb: rgba(255, 255, 255, 0.06); }
.cat-custom { --gc: var(--ink);     --gb: rgba(255, 255, 255, 0.10); }

/* ficha «+» y borrado de la paleta de puertas personalizadas */
.tile { position: relative; }
.tile .tile-del {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 17px;
  height: 17px;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  border-radius: 50%;
  color: var(--ink2);
  display: none;
}
.tile:hover .tile-del { display: block; }
.tile .tile-del:hover { border-color: var(--red); color: var(--red); }

.tile .tile-edit {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 17px;
  height: 17px;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  border-radius: 50%;
  color: var(--ink2);
  display: none;
}
.tile:hover .tile-edit { display: block; }
.tile .tile-edit:hover { border-color: var(--aqua); color: var(--aqua); }

.tile-new {
  border-style: dashed;
  border-color: var(--muted);
  background: none;
  color: var(--muted);
  font-size: 20px;
  font-weight: 400;
}
.tile-new:hover { color: var(--ink); border-color: var(--ink2); }

/* Controles y SWAP se dibujan sin caja dentro del circuito */
.gate.bare {
  border: none;
  background: none;
  font-size: 20px;
  color: var(--ink);
}

/* Puerta-subcircuito: ocupa varias filas desde su celda superior */
.gate.tall {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 5;
}
.gate.bare.anti { color: var(--ink); }

/* --------------------------------------------------------------- circuito */

#circuit-wrap {
  overflow: auto;
  padding: 18px 22px 40px;
  position: relative;
}

#example-banner {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink2);
  max-width: 720px;
}
#example-banner strong { color: var(--ink); }
#example-banner[hidden] { display: none; }

#circuit {
  position: relative;
  display: flex;       /* columna de etiquetas (sticky) + tablero */
  width: max-content;
  padding-top: 22px;   /* hueco para la regla de columnas */
}

#ruler {
  position: absolute;
  top: 0;
  left: var(--labels-w, 76px);
  display: flex;
  height: 20px;
}
#ruler .rcol {
  width: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
}
#ruler .rcol:hover { background: var(--surface2); color: var(--ink2); }
#ruler .rcol.pinned { background: var(--surface2); color: var(--blue); font-weight: 700; }

/* botones de insertar/eliminar columna, visibles solo al pasar el cursor */
#ruler .rops { display: none; gap: 2px; }
#ruler .rcol:hover .rops { display: inline-flex; }
#ruler .rop {
  flex: 0 0 auto;
  padding: 0;
  width: 17px;
  height: 16px;
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  border-radius: 5px;
  font-family: ui-monospace, monospace;
  color: var(--ink2);
}
#ruler .rop.ins:hover { border-color: var(--aqua); color: var(--aqua); }
#ruler .rop.del:hover { border-color: var(--red); color: var(--red); }

/* Sticky: con scroll horizontal los nombres quedan fijos al borde izquierdo,
 * tapando el tablero que pasa por debajo (fondo opaco y z-index por encima
 * de las puertas). --labels-w la fija app.js midiendo el nombre más largo. */
#qubit-labels {
  position: sticky;
  left: 0;
  z-index: 10;
  flex: 0 0 auto;
  width: calc(var(--labels-w, 76px) - 4px);
  margin-right: 4px;
  background: var(--bg);
}
#qubit-labels .qlabel {
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding-right: 10px;
  color: var(--ink2);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 8px;
}
#qubit-labels .qlabel:hover { background: var(--surface2); color: var(--ink); }
#qubit-labels .qlabel.named .qname-lab { color: var(--ink); font-weight: 700; }
#qubit-labels .qlabel .ket-init { color: var(--muted); }
#qubit-labels .qlabel:hover .ket-init { color: var(--ink); }
#qubit-labels .qlabel.custom .ket-init { color: var(--aqua); font-weight: 700; }

#board { position: relative; }

/* lógica booleana del circuito, a la derecha de cada cable */
#logic-labels {
  position: absolute;
  left: 100%;
  top: 0;
  padding-left: 12px;
}
#logic-labels:empty { display: none; }
#logic-labels .logic-row {
  height: var(--cell);
  display: flex;
  align-items: center;
  color: var(--aqua);
  font-size: 12px;
  white-space: nowrap;
  cursor: default;
}

#wires { position: absolute; inset: 0; pointer-events: none; }
#wires line.wire { stroke: var(--axis); stroke-width: 2; }
#wires line.cwire { stroke: var(--axis); stroke-width: 1.4; }
#wires line.link { stroke: var(--ink2); stroke-width: 2; }

#cells { position: relative; }

.cell {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.cell.drop-ok { outline: 2px dashed var(--blue); outline-offset: -6px; }
.cell.hovercol { background: rgba(255, 255, 255, 0.03); }
.cell.sel { background: rgba(57, 135, 229, 0.14); }
.cell.warn .gate { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }

/* menú contextual de la selección */
.sel-menu {
  position: fixed;
  z-index: 70;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.sel-menu[hidden] { display: none; }
.sel-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 6px 10px;
  border-radius: 6px;
}
.sel-menu button:hover { background: #2e2e2c; }

/* displays incrustados */
.gate.display-live { padding: 3px; font-size: 9px; font-weight: 500; }
.gate.display-live svg { display: block; }
.gate .chance-num { font-size: 10px; font-weight: 700; color: var(--ink); }
.gate .chance-bar { width: 32px; height: 5px; border-radius: 3px; background: var(--grid); overflow: hidden; margin-top: 3px; }
.gate .chance-bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }

/* --------------------------------------------------------------- inspector */

#inspector {
  padding: 14px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: padding 0.28s ease;
}

#inspector .panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#inspector section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

#inspector h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#post-banner {
  border: 1px solid var(--magenta);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(213, 81, 129, 0.12);
}
#post-banner[hidden] { display: none; }

#warn-list { display: flex; flex-direction: column; gap: 6px; }
#warn-list:empty { display: none; }
.warn-item {
  border: 1px solid var(--red);
  border-radius: 10px;
  padding: 7px 10px;
  background: rgba(230, 103, 103, 0.10);
  color: var(--ink);
  font-size: 13px;
}

/* conmutador de dos posiciones (big-endian / little-endian, en ⚙ Opciones) */
.seg-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.seg-toggle button {
  border: none;
  border-radius: 0;
  background: none;
  padding: 3px 8px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--muted);
}
.seg-toggle button + button { border-left: 1px solid var(--border); }
.seg-toggle button:hover { color: var(--ink); }
.seg-toggle button.active { background: var(--surface2); color: var(--aqua); }

#initial-ket {
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--ink2);
  word-break: break-word;
}
#initial-expr {
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--ink2);
  margin-top: 6px;
  word-break: break-word;
}
#initial-expr:empty { display: none; }

#state-expr {
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--ink2);
  margin-bottom: 10px;
  word-break: break-word;
}
#state-expr:empty { display: none; }
#state-expr b { color: var(--ink); }

.amp-row {
  display: grid;
  grid-template-columns: auto 1fr 52px 22px;
  align-items: center;
  gap: 8px;
  padding: 2.5px 0;
}
.amp-row .ket { font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--ink2); }
.amp-row .bar { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.amp-row .bar i { display: block; height: 100%; background: var(--blue); border-radius: 4px; min-width: 0; }
.amp-row .val { font-family: ui-monospace, monospace; font-size: 11px; color: var(--ink2); text-align: right; font-variant-numeric: tabular-nums; }
.amp-row .phase svg { display: block; }
.amps-note { color: var(--muted); font-size: 12px; margin-top: 8px; }

.qubit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.qubit-row .qname {
  font-family: ui-monospace, monospace;
  color: var(--ink2);
  min-width: 26px;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qubit-row .qp { font-family: ui-monospace, monospace; font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.qubit-row .qm { font-size: 11px; color: var(--green); border: 1px solid var(--green); border-radius: 6px; padding: 0 5px; }

#gate-info-body { color: var(--ink2); font-size: 13px; }
#gate-info-body .gi-name { color: var(--ink); font-weight: 700; margin-bottom: 4px; }
#gate-info-body .gi-logic { color: var(--aqua); font-size: 12px; margin-top: 6px; word-break: break-word; }
#gate-info-body table {
  border-collapse: collapse;
  margin-top: 8px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
#gate-info-body td {
  border: 1px solid var(--grid);
  padding: 4px 9px;
  text-align: center;
  color: var(--ink);
  min-width: 64px;
}

/* ----------------------------------------------------- fantasma de arrastre */

#ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  opacity: 0.85;
  transform: translate(-50%, -50%);
}
#ghost[hidden] { display: none; }

/* ---------------------------------------------------------------- popover */

#param-pop {
  position: absolute;
  z-index: 50;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  width: 240px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
#param-pop[hidden] { display: none; }
#param-pop h4 { margin: 0 0 8px; font-size: 13px; }
#param-pop .pp-val { font-family: ui-monospace, monospace; color: var(--orange); }
#param-pop input[type="range"] { width: 100%; accent-color: var(--orange); }
#param-pop .presets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
#param-pop .presets button { padding: 2px 8px; font-size: 12px; font-family: ui-monospace, monospace; }

#init-pop {
  position: absolute;
  z-index: 50;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  width: 230px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
#init-pop[hidden] { display: none; }
#init-pop h4 { margin: 0 0 8px; font-size: 13px; }
#init-pop .ip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--ink2);
}
#init-pop .ip-row input {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
#init-pop .ip-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
#init-pop .presets { display: flex; flex-wrap: wrap; gap: 5px; }
#init-pop .presets button { padding: 3px 9px; font-size: 13px; font-family: ui-monospace, monospace; }
#init-pop .presets button.active { border-color: var(--aqua); color: var(--aqua); font-weight: 700; }
#init-pop .ip-desc { margin-top: 8px; color: var(--muted); font-size: 12px; min-height: 2.8em; }

/* ------------------------------------------------------------------ modal */

#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#modal-overlay[hidden] { display: none; }
#modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 760px;
  max-height: 84vh;
  overflow-y: auto;
  padding: 20px 24px;
  width: 100%;
}
#modal h2 { margin: 0 0 10px; font-size: 17px; }
#modal h3 { font-size: 14px; margin: 16px 0 6px; color: var(--ink); }
#modal p, #modal li { color: var(--ink2); font-size: 13.5px; }
#modal-close { float: right; }

/* modal de opciones (⚙) */
.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
}
.opt-row .opt-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.opt-row .opt-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* diálogo de puerta personalizada */
.cg-tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.cg-tabs button.active { border-color: var(--aqua); color: var(--aqua); font-weight: 600; }
.cg-pane[hidden] { display: none; }
.cg-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 10px; }
.cg-row label { display: flex; align-items: center; gap: 8px; color: var(--ink2); font-size: 13px; }
.cg-row input { font-family: ui-monospace, monospace; }
#cg-symbol { width: 52px; }
#cg-name { width: 200px; }
.cg-num { width: 76px; }
.cg-row input[type="number"] { width: 62px; }
.cg-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-width: 360px;
  margin: 10px 0;
}
.cg-matrix input {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  text-align: center;
  padding: 7px 8px;
}
#cg-status { font-size: 13px; min-height: 1.5em; margin: 6px 0 12px; font-family: ui-monospace, monospace; }
#cg-status.ok { color: var(--aqua); }
#cg-status.bad { color: var(--red); }

/* miniatura del rango elegido en «Desde circuito» */
#cg-circ-preview { margin: 6px 0 2px; overflow-x: auto; }
#cg-circ-preview:empty { display: none; }
svg.cg-prev { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
svg.cg-prev line.pw { stroke: var(--axis); stroke-width: 1.6; }
svg.cg-prev line.pl { stroke: var(--ink2); stroke-width: 1.6; }
svg.cg-prev circle.pc { fill: var(--ink); }
svg.cg-prev circle.pa { fill: var(--bg); stroke: var(--ink); stroke-width: 1.6; }
svg.cg-prev text.px { fill: var(--ink); font-size: 13px; }
svg.cg-prev rect.pg { fill: var(--surface2); stroke: var(--ink2); stroke-width: 1.2; }
svg.cg-prev text.pt { fill: var(--ink); font-size: 10px; font-weight: 700; }
svg.cg-prev text.pvi { fill: var(--ink2); font-size: 10px; font-family: ui-monospace, monospace; }
svg.cg-prev text.pvo { fill: var(--aqua); font-size: 10px; font-family: ui-monospace, monospace; }
.cg-logic-note { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ------------------------------------------------------------------ toast */

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s;
}
#toast[hidden] { display: none; }

/* ------------------------------------------------------------- pantallitas */

svg.bloch .frame { stroke: var(--grid); fill: none; }
svg.bloch .axis { stroke: var(--axis); stroke-width: 1; }
svg.bloch .vec { stroke: var(--blue); stroke-width: 2.4; stroke-linecap: round; }
svg.bloch .tip { fill: var(--blue); }
svg.bloch text { fill: var(--muted); font-family: ui-monospace, monospace; } /* tamaño: atributo font-size en unidades del viewBox */

svg.phase-dial circle { stroke: var(--grid); fill: none; }
svg.phase-dial line { stroke: var(--ink2); stroke-width: 1.6; stroke-linecap: round; }

.dens-grid { display: grid; grid-template-columns: 17px 17px; gap: 2px; }
.dens-grid i { display: block; width: 17px; height: 17px; border-radius: 3px; background: var(--blue); }
