:root {
  --bg: #0e1116;
  --card: #161b24;
  --edge: #232b3a;
  --text: #eef2f8;
  --muted: #8b95a8;
  --accent: #3b82f6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
}

main { width: 100%; max-width: 680px; }
h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 14px; margin: 6px 0 26px; }

.card {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 26px 22px;
  margin-bottom: 14px;
}

#number {
  font-family: "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  font-weight: 700;
  font-size: 22px;
  text-align: center;
  /* Una sola línea siempre: el tamaño lo ajusta fit() según el largo del número. */
  white-space: nowrap;
  overflow-x: auto;
  line-height: 1.35;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: all;
}
#number.empty { color: var(--muted); font-weight: 500; font-size: 17px; }
/* La separación de a dos es puro margen: no hay espacios en el texto, así que
   al copiar (o al seleccionar a mano) el número sale entero y sin cortes. */
#number .pair + .pair { margin-left: 0.4em; }

#meta { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }

#drop {
  border: 2px dashed var(--edge);
  border-radius: 14px;
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
#drop.hot { border-color: var(--accent); background: rgba(59, 130, 246, .08); color: var(--text); }
#drop kbd {
  background: var(--edge);
  border-radius: 6px;
  padding: 2px 7px;
  font: 600 13px/1 inherit;
  color: var(--text);
}

#preview {
  display: none;
  max-width: 100%;
  max-height: 150px;
  margin: 16px auto 0;
  border-radius: 8px;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 18px 0 10px; }

button {
  font: 600 14px/1 inherit;
  color: var(--text);
  background: var(--edge);
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  transition: filter .15s;
}
button:hover { filter: brightness(1.25); }
button.primary { background: var(--accent); color: #fff; }
button[hidden] { display: none; }

#status { text-align: center; color: var(--muted); font-size: 14px; min-height: 22px; }
#status.ok { color: var(--ok); }
#status.warn { color: var(--warn); }
#status.err { color: var(--err); }

#history { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
#history span {
  background: var(--edge);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: "SF Mono", Menlo, monospace;
}
#history span:hover { filter: brightness(1.3); }

.watch { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }
.watch b { color: var(--text); font-weight: 600; }
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
}
.dot.on { background: var(--ok); }

/* Micro-animaciones -------------------------------------------------------
   Todo dura menos de medio segundo: la idea es confirmar que algo pasó, no
   llamar la atención. Se apagan si el sistema pide menos movimiento. */

.card { transition: border-color .45s ease, box-shadow .45s ease; }

/* Al leer: la tarjeta del número da un latido azul y los dígitos entran de a uno. */
@keyframes cardPulse {
  from { box-shadow: 0 0 0 0 rgba(59, 130, 246, .30); }
  to { box-shadow: 0 0 0 16px rgba(59, 130, 246, 0); }
}
.card.pulse { animation: cardPulse .55s ease-out; }

@keyframes pairIn {
  from { opacity: 0; transform: translateY(4px); }
}
#number .pair { display: inline-block; animation: pairIn .26s ease-out backwards; }

/* Al copiar: el borde se tiñe de verde y vuelve solo. */
@keyframes cardCopied {
  from { box-shadow: 0 0 0 0 rgba(52, 211, 153, .35); }
  to { box-shadow: 0 0 0 16px rgba(52, 211, 153, 0); }
}
.card.copied { border-color: var(--ok); animation: cardCopied .6s ease-out; }

@keyframes tap { 50% { transform: scale(.955); } }
button.tapped { animation: tap .2s ease-out; }

@keyframes previewIn { from { opacity: 0; transform: scale(.985); } }
#preview.fresh { animation: previewIn .32s ease-out; }

@keyframes statusIn { from { opacity: 0; transform: translateY(-2px); } }
#status.changed { animation: statusIn .24s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .card, .card.pulse, .card.copied, #number .pair,
  button.tapped, #preview.fresh, #status.changed,
  #paywall, #paywall .modal {
    animation: none !important;
    transition: none !important;
  }
}

/* Modal de broma ---------------------------------------------------------- */

#paywall {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, .72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
  animation: fade .18s ease-out;
}
#paywall[hidden] { display: none; }

#paywall .modal {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 28px 26px 22px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: rise .22s ease-out;
}
#paywall .tag {
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
#paywall h2 { margin: 0; font-size: 20px; }
#paywall .price {
  font-size: 34px;
  font-weight: 800;
  margin: 14px 0 4px;
  letter-spacing: -0.02em;
}
#paywall .price span { font-size: 14px; font-weight: 500; color: var(--muted); }
#paywall .perks {
  list-style: none;
  padding: 0;
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}
#paywall .perks li::before { content: "✓"; color: var(--ok); margin-right: 8px; }
#paywall .perks li + li { margin-top: 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#paywall .joke { color: var(--muted); font-size: 12px; margin: 16px 0 0; line-height: 1.45; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 520px) {
  body { padding: 24px 14px; }
  .card { padding: 20px 16px; }
  #drop { padding: 24px 14px; }
}
