.layout{
  flex: 1;
  min-height: 0;
  position: relative;
}
.stage {
  display: flex;
  align-items: center;
}
.balanceContainer {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.balanceScaler {
  transform-origin: top center;
}

.balanceWrap {
  position: relative;
  border-radius: 12px;

  padding: 18px 14px 10px;
  margin: auto;
}

.beamGroup {
  will-change: transform;
  background-image: url('/images/ReglaFondo.png');

  height: 113px;
  transform: translateZ(0);
  backface-visibility: hidden;
  padding: 0px 30px;
  transition: transform 220ms ease;
}

.hangersRow {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 8px;
  padding-top:10px;
}

.hanger {
  display:flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 35px;
}
.hanger.center {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  position: relative;

}
.hanger.center .weightSingle{
  position: absolute;
  z-index:  50;
}
.hanger-pin {
  width: 26px;
  height: 26px;
  background-image: url('/images/Chinche.png');
  background-size: cover;
  position: absolute;
  top: 70px;
  z-index: 3;
}


.weights {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  top:70px;
  left:50%;
  margin-left:-13px;
  width: 26px;
  height: 26px;
}

.weight {
  touch-action: none; /* clave para drag en móvil */
}

/* Botones de peso */
.boton-peso {
  display: flex;
  gap: 3px;
}

.peso {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px !important;
  height: 20px !important;
  border-radius: 5px;
  border: 1px solid rgba(100,100,100,0.2);
  background: rgba(100,100,100,0.1);
  font-size: 12px;
  font-weight: bold;
}

/* Numeros de la escala */
.scale {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 8px;
  margin-top: 45px;
  padding: 0 6px;
}
.tick {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
}

.tickLabel {
  font-size: 14px;
  font-weight: 700;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Elemento de arrastre */
.dragGhost {
  position: fixed;
  width: 50px;
  height: 84px;
  background-image: url('/images/Peso.png');
  background-repeat: no-repeat;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 9999;
}
.hanger.hover {
  transform: scale(1.1);
  background: rgba(0,0,0,0.1);
}

.weightSingle {
  width: 50px;
  height: 84px;
  background-image: url('/images/Peso.png');
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: grab;
  position: absolute;
}

.weightCount {
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;

  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.balanceRotator {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  transform-origin: center;
  transition: transform 220ms ease;
}

@media (min-width: 768px) {
  .layout {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .layout > .stage {
    flex: 0 0 75%;
    max-width: 75%;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .stats-sidebar {
    flex: 0 0 25%;
    max-width: 25%;
    border-left: 1px solid #e7e7e7;
    overflow-y: auto;
  }

  .sidebar-inner {
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .sidebar-lang {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    justify-content: flex-end;
  }

  .sidebar-title {
    font-weight: 800;
    margin-bottom: 8px;
  }

  .sidebar-check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 8px;
  }

  .sidebar-check {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    cursor: pointer;
  }

  .sidebar-check input {
    margin: 0;
    width: 13px;
    height: 13px;
  }

  .sidebar-disabled-msg {
    font-size: 13px;
    color: #999;
    font-style: italic;
    padding: 4px 0;
  }

  .statsBox {
    margin-top: 0;
    padding: 0;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* Datos brutos */
  .stat-dataset {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 6px 8px;
  }

  .stat-dataset-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #aaa;
  }

  .stat-dataset-values {
    font-size: 12px;
    color: #555;
    word-break: break-all;
    line-height: 1.4;
  }

  /* Tarjetas N / Mín / Máx */
  .stat-cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f0f7ff;
    border: 1px solid #d6eaff;
    border-radius: 8px;
    padding: 6px 4px;
    gap: 2px;
  }

  .stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6fa8dc;
  }

  .stat-value {
    font-size: 16px;
    font-weight: 800;
    color: #2c5f8a;
  }

  /* Filas de estadísticos */
  .stat-rows {
    display: flex;
    flex-direction: column;
  }

  .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background 0.15s;
  }

  .stat-row:nth-child(odd) {
    background: #fafafa;
  }

  .stat-row-label {
    font-size: 12px;
    color: #888;
    font-weight: 500;
  }

  .stat-row-value {
    font-size: 14px;
    font-weight: 700;
    color: #222;
  }

  /* Empty state */
  .stats-empty {
    font-size: 12px;
    color: #bbb;
    font-style: italic;
    text-align: center;
    padding: 12px 0;
  }

  .layout > .panel {
    display: none !important;
  }

  .stats-footer-col {
    display: none !important;
  }
}

@media (max-width: 767.98px) {
  .stats-sidebar {
    display: none !important;
  }
}

/* Overlay orientación portrait */
.rotate-overlay {
  display: none;
}

@media (orientation: portrait) {
  .rotate-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #fff;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
  }

  .rotate-content {
    max-width: 320px;
  }

  .rotate-icon {
    font-size: 72px;
    animation: rotate-hint 1.8s ease-in-out infinite;
    display: inline-block;
    margin-bottom: 16px;
    line-height: 1;
  }

  .rotate-content p {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.5;
  }
}

@keyframes rotate-hint {
  0%   { transform: rotate(0deg); }
  40%  { transform: rotate(90deg); }
  60%  { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}