*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #f2ede4;
  font-family: 'DM Mono', 'Courier New', monospace;
  user-select: none;
  touch-action: none;
}

canvas#c {
  display: block;
  width: 100vw !important;
  height: 100vh !important;
}

/* ─── Barra inferior ───────────────────────────────────────────── */
#ui {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 10;
}

.btn {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  color: rgba(30,30,30,0.55);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-family: inherit;
}
.btn:hover  { background: #ebe5d8; color: #1a1a1a; border-color: rgba(0,0,0,0.50); }
.btn.active { background: #2a2a2a; border-color: #2a2a2a; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.22); }

/* ─── Info esquina superior izquierda ──────────────────────────── */
#info {
  position: fixed; top: 22px; left: 24px; z-index: 10;
  color: rgba(0,0,0,0.50);
  font-size: 0.54rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 2.1;
  pointer-events: none;
}

/* ─── Coordenadas esquina superior derecha ─────────────────────── */
#coords {
  position: fixed; top: 22px; right: 24px; z-index: 10;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 8px;
  padding: 8px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  color: rgba(0,0,0,0.50);
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-align: right;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════
   PANEL DE LOTE
═══════════════════════════════════════════════════════════════════ */
#lot-panel {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 248px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: 16px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.04),
    0 10px 40px rgba(26,68,170,0.10),
    0 20px 60px rgba(0,0,0,0.06);
  z-index: 20;
  font-family: 'DM Mono', 'Courier New', monospace;
  overflow: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#lot-panel.hidden {
  display: none;
}

#lot-panel.visible {
  display: block;
  animation: panelIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(calc(-50% + 12px)) scale(0.97); }
  to   { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* ─ Cabecera ──────────────────────────────────────────────────── */
#lp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 13px;
  background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
  color: white;
}

#lp-title {
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#lp-subtitle {
  font-size: 0.52rem;
  letter-spacing: 0.24em;
  opacity: 0.65;
  text-transform: uppercase;
  margin-top: 3px;
}

#lp-close {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  color: rgba(255,255,255,0.90);
  cursor: pointer;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  font-family: inherit;
}
#lp-close:hover { background: rgba(255,255,255,0.32); }

/* ─ Cuerpo ────────────────────────────────────────────────────── */
#lp-body {
  padding: 14px 16px 10px;
}

#lp-diagram {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
  border-radius: 6px;
  background: #f6f9fd;
}

.lp-metrics { }

.lp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
}

.lp-label {
  font-size: 0.50rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.38);
}

.lp-value {
  font-size: 0.78rem;
  color: rgba(0,0,0,0.72);
  letter-spacing: 0.04em;
}

.lp-divider {
  height: 1px;
  background: rgba(0,0,0,0.07);
  margin: 7px 0 5px;
}

.lp-total .lp-label {
  font-size: 0.54rem;
  color: rgba(0,0,0,0.55);
}
.lp-total .lp-value {
  font-size: 1.05rem;
  color: #1a1a1a;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ─ Pie de página ─────────────────────────────────────────────── */
#lp-footer {
  padding: 10px 16px 12px;
  background: #f0ebe0;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.48rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.30);
  line-height: 1.8;
}

#lp-footer em {
  font-style: normal;
  color: rgba(0,0,0,0.45);
}

.lp-soon-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.30; transform: scale(1); }
  50%       { opacity: 0.70; transform: scale(1.3); }
}

/* ─── Panel en móviles ─────────────────────────────────────────── */
@media (max-width: 420px) {
  #lot-panel {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 84px;
    width: min(92vw, 320px);
    transform: translateX(-50%);
  }

  #lot-panel.visible {
    animation: panelInMobile 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

@keyframes panelInMobile {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
