/* ════════════════════════════════════════════════
   El Muro de los Absurdos — Full-screen canvas
   ════════════════════════════════════════════════ */

:root {
  --bg:         #09090f;
  --glass:      rgba(9,9,15,0.82);
  --glass-lite: rgba(255,255,255,0.035);
  --line:       rgba(255,255,255,0.08);
  --text:       #f2ede4;
  --soft:       #9a9490;
  --muted:      #5a5550;
  --gold:       #f5c542;
  --gold-d:     #c9a030;
  --cyan:       #47d4e8;
  --red:        #e84747;
  --ease:       .2s cubic-bezier(.4,0,.2,1);
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
}

/* ── Canvas principal ─────────────────────────── */

#muro {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, 100vh);
  height: min(100vw, 100vh);
  cursor: crosshair;
  z-index: 1;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Barra superior ───────────────────────────── */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
}

/* Marca */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.tb-icon { font-size: 1.3rem; line-height: 1; }
.tb-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--text);
  white-space: nowrap;
}

/* Stats */
.topbar-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-right: auto;
}
.tb-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.tb-stat strong {
  font-size: .9rem;
  font-weight: 700;
  color: var(--gold);
}
.tb-stat span {
  font-size: .65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.tb-sep {
  width: 1px;
  height: 28px;
  background: var(--line);
  flex-shrink: 0;
}

/* Acciones */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Color swatch */
.color-swatch-label {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--line);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--ease);
}
.color-swatch-label:hover { border-color: rgba(255,255,255,.3); }
.color-swatch-label input[type="color"] {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.color-swatch-preview {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  transition: background var(--ease);
  pointer-events: none;
}

/* Label input */
.label-input {
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  width: 180px;
  transition: border-color var(--ease), background var(--ease);
}
.label-input::placeholder { color: var(--muted); }
.label-input:focus {
  outline: none;
  border-color: rgba(245,197,66,.4);
  background: rgba(255,255,255,.07);
}

/* Pill selección */
.selection-pill {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  font-size: .82rem;
  color: var(--soft);
  white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  flex-shrink: 0;
}
.selection-pill strong {
  color: var(--gold);
  font-size: .9rem;
}
.selection-pill.has-selection {
  background: rgba(245,197,66,.08);
  border-color: rgba(245,197,66,.25);
  color: var(--text);
}

/* Botón comprar */
.btn-buy {
  height: 40px;
  padding: 0 22px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--gold), #f7d96e);
  border: none;
  color: #1a1000;
  font-family: 'Inter', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: 0 6px 24px rgba(245,197,66,.2);
}
.btn-buy:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 32px rgba(245,197,66,.35);
}
.btn-buy:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Botón ayuda */
.btn-help {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--soft);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  line-height: 1;
  font-family: 'Inter', sans-serif;
}
.btn-help:hover {
  background: rgba(255,255,255,.1);
  color: var(--text);
  border-color: rgba(255,255,255,.25);
}

/* Link volver */
.topbar-back {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: .75rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--ease), border-color var(--ease);
}
.topbar-back:hover {
  color: var(--cyan);
  border-color: rgba(71,212,232,.3);
}

/* ── Modal instrucciones ─────────────────────── */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open {
  display: flex;
}
.modal-box {
  position: relative;
  background: #111018;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 40px 36px 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 40px 100px rgba(0,0,0,.8);
  animation: modalIn .2s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn {
  from { opacity:0; transform:translateY(12px) scale(.97); }
  to   { opacity:1; transform:translateY(0)    scale(1);   }
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--soft);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--ease);
}
.modal-close:hover { background: rgba(255,255,255,.12); color: var(--text); }
.modal-icon { font-size: 2.2rem; margin-bottom: 12px; }
.modal-box h2 {
  margin: 0 0 6px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--text);
}
.modal-sub {
  margin: 0 0 24px;
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}
.modal-steps {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.step-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(245,197,66,.12);
  border: 1px solid rgba(245,197,66,.25);
  color: var(--gold);
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.modal-steps li div { display: flex; flex-direction: column; gap: 2px; }
.modal-steps li strong { font-size: .9rem; color: var(--text); font-weight: 600; }
.modal-steps li span  { font-size: .82rem; color: var(--soft); line-height: 1.5; }
.modal-footer-note {
  margin: 0 0 24px;
  font-size: .8rem;
  color: var(--muted);
  padding: 12px 14px;
  background: rgba(255,255,255,.03);
  border-radius: 10px;
  border: 1px solid var(--line);
}
.btn-modal-ok {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--gold), #f7d96e);
  border: none;
  color: #1a1000;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--ease), transform var(--ease);
}
.btn-modal-ok:hover { opacity: .9; transform: translateY(-1px); }

/* ── Tooltip cuadro vendido ───────────────────── */

.sq-tooltip {
  display: none;
  position: fixed;
  z-index: 30;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(9,9,15,.95);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-size: .8rem;
  color: var(--text);
  max-width: 160px;
  line-height: 1.5;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.sq-tooltip strong { font-size: .85rem; color: var(--gold); }
.sq-tooltip small  { color: var(--muted); }
.sq-tooltip .tt-link { color: var(--cyan); font-size: .8rem; }
.sq-tooltip .tt-hint { color: var(--muted); font-size: .75rem; font-style: italic; }

/* ── Toast ─────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 40;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: .88rem;
  font-weight: 500;
  background: rgba(30,28,40,.95);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--ease), transform var(--ease);
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-warn { border-color: rgba(245,197,66,.4); color: var(--gold); }
.toast.toast-err  { border-color: rgba(232,71,71,.4);  color: var(--red); }

/* ── Overlay mensajes (ok/error post-pago) ────── */

.overlay-msg {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9,9,15,.8);
  backdrop-filter: blur(8px);
}
.overlay-inner {
  text-align: center;
  padding: 48px 40px;
  border-radius: 24px;
  background: rgba(20,18,30,.95);
  border: 1px solid var(--line);
  box-shadow: 0 32px 80px rgba(0,0,0,.7);
  max-width: 380px;
  width: calc(100% - 48px);
}
.overlay-icon { font-size: 2.8rem; margin-bottom: 16px; }
.overlay-inner h2 {
  margin: 0 0 12px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  line-height: 1;
}
.overlay-inner p  { margin: 0 0 28px; color: var(--soft); font-size: .95rem; }
.overlay-ok  .overlay-inner { border-color: rgba(71,232,112,.25); }
.overlay-err .overlay-inner { border-color: rgba(232,71,71,.25); }
.overlay-inner button {
  padding: 12px 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease);
}
.overlay-inner button:hover { background: rgba(255,255,255,.1); }

/* ── Responsive ─────────────────────────────────── */

@media (max-width: 900px) {
  .topbar { gap: 12px; padding: 0 16px; height: 60px; }
  .tb-title { display: none; }
  .topbar-stats { gap: 10px; }
  .tb-sep { height: 20px; }
  .label-input { width: 110px; }
  .topbar-back { display: none; }
}

@media (max-width: 640px) {
  .topbar {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
  }
  .topbar-brand { order: 1; flex: 1; }
  .topbar-back  { order: 2; }
  .topbar-stats { order: 3; width: 100%; justify-content: flex-start; gap: 14px; margin-right: 0; }
  .topbar-actions { order: 4; width: 100%; flex-wrap: wrap; gap: 8px; padding-bottom: 2px; }
  .label-input { flex: 1; min-width: 120px; }
  .selection-pill { flex: 1; justify-content: center; }
  .btn-buy { flex: 1; height: 38px; }
}
