@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #eef3ef;
  --bg: #0c2a23;
  --bg-deep: #081e19;
  --paper: #f4eedd;
  --paper-dim: #e7ddc2;
  --gold: #e3a33e;
  --gold-deep: #b97e26;
  --green-confirm: #4fae82;
  --green-confirm-deep: #2f7f5a;
  --line: rgba(238, 243, 239, 0.14);
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, rgba(227,163,62,0.08), transparent 45%),
                     radial-gradient(circle at 85% 20%, rgba(79,174,130,0.08), transparent 40%);
  color: var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  line-height: 1.5;
}

a { color: inherit; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--line);
}

.hero .eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 700;
  margin: 0 0 14px;
  max-width: 14ch;
}

.hero p.lede {
  max-width: 56ch;
  font-size: 1.1rem;
  color: rgba(238,243,239,0.82);
  margin: 0 0 28px;
}

.stat-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
}

.stat {
  font-family: 'IBM Plex Mono', monospace;
}

.stat .num {
  font-size: 2rem;
  font-weight: 600;
  display: block;
  line-height: 1;
}

.stat .label {
  font-size: 0.78rem;
  color: rgba(238,243,239,0.6);
}

.progress-track {
  height: 8px;
  border-radius: 5px;
  background: rgba(238,243,239,0.12);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  border-radius: 5px;
  transition: width 0.5s ease;
}

.hero-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: rgba(238,243,239,0.7);
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

/* ---------- Lookup "mis números" ---------- */
.lookup-section {
  padding: 30px 0;
  background: rgba(227,163,62,0.06);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.lookup-section h2 { font-size: 1.1rem; margin: 0 0 4px; }
.lookup-section .hint { font-family: 'IBM Plex Mono', monospace; font-size: 0.82rem; color: rgba(238,243,239,0.6); margin: 0 0 16px; }
.lookup-row { display: flex; gap: 10px; flex-wrap: wrap; }
.lookup-row input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  background: rgba(238,243,239,0.06);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 10px 14px;
  flex: 1;
  min-width: 200px;
}
.lookup-results { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.lookup-results .chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 7px;
  background: var(--paper);
  color: #241705;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lookup-results .chip.confirmed { background: var(--green-confirm); color: #072016; }
.lookup-results .chip .st { font-size: 0.7rem; opacity: 0.75; }
.lookup-results .empty-msg { font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; color: rgba(238,243,239,0.6); }

/* ---------- Search / find bar ---------- */
.finder {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.finder .wrap { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.finder input[type="text"] {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  background: rgba(238,243,239,0.06);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 10px 14px;
  width: 160px;
}
.finder input[type="text"]::placeholder { color: rgba(238,243,239,0.35); letter-spacing: 0.05em; }

.finder button.go {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--gold);
  color: #241705;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
}
.finder button.go:hover { background: #eeb35d; }

.legend { display: flex; gap: 16px; margin-left: auto; font-size: 0.82rem; font-family: 'IBM Plex Mono', monospace; color: rgba(238,243,239,0.7); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.available { background: var(--paper); }
.dot.pending { background: var(--gold); }
.dot.confirmed { background: var(--green-confirm); }

/* ---------- Blocks (series 00-99) ---------- */
.blocks-section { padding: 32px 0 10px; }
.blocks-section h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 6px; }
.blocks-section .hint { font-family: 'IBM Plex Mono', monospace; font-size: 0.82rem; color: rgba(238,243,239,0.55); margin: 0 0 16px; }

.blocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 6px;
  margin-bottom: 40px;
}

.block-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  background: rgba(238,243,239,0.05);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 0;
  cursor: pointer;
  position: relative;
  text-align: center;
}
.block-btn:hover { border-color: var(--gold); }
.block-btn.active { background: var(--gold); color: #241705; border-color: var(--gold); font-weight: 600; }
.block-btn .fill-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--green-confirm); border-radius: 0 0 6px 6px; }

/* ---------- Number grid (ticket stubs) ---------- */
.grid-section { padding: 10px 0 140px; }
.grid-section h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 16px; font-family: 'IBM Plex Mono', monospace; }

.number-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
}

@media (max-width: 640px) {
  .number-grid { grid-template-columns: repeat(5, 1fr); }
}

.ticket {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  aspect-ratio: 1.5 / 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  position: relative;
  background: var(--paper);
  color: #241705;
  transition: transform 0.12s ease;
}
.ticket::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background-image: radial-gradient(circle, var(--bg) 2.5px, transparent 2.6px);
  background-position: -3px 50%;
  background-size: 10px 10px;
  background-repeat: repeat-y;
  opacity: 0.5;
}
.ticket:hover { transform: translateY(-2px); }

.ticket.pending { background: var(--gold); }
.ticket.confirmed { background: var(--green-confirm); color: #072016; }
.ticket.confirmed::after { content: "✓"; position: absolute; top: 3px; right: 6px; font-size: 0.65rem; }
.ticket.highlight { outline: 2px solid #fff; outline-offset: 2px; }
.ticket.selected { background: #241705; color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.ticket.selected::after { content: "✓"; position: absolute; top: 3px; right: 6px; font-size: 0.65rem; color: var(--gold); }
.ticket:disabled { cursor: default; }

/* ---------- Selection bar ---------- */
.selection-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--bg-deep);
  border-top: 1px solid var(--gold);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.selection-bar span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  color: var(--ink);
}
.selection-actions { display: flex; gap: 10px; }
.selection-bar .clear-btn {
  font-family: 'IBM Plex Mono', monospace;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: var(--radius);
  cursor: pointer;
}

.selected-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 110px; overflow-y: auto;
  margin-bottom: 6px;
}
.selected-chips .chip {
  background: #fff; border: 1px solid #cfc2a0; border-radius: 6px;
  padding: 4px 8px; font-size: 0.8rem; font-family: 'IBM Plex Mono', monospace;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,12,10,0.72);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--paper);
  color: #241705;
  border-radius: 14px;
  max-width: 420px;
  width: 100%;
  padding: 28px;
  font-family: 'IBM Plex Mono', monospace;
}
.modal h3 { font-family: 'Fraunces', serif; font-size: 1.5rem; margin: 0 0 4px; }
.modal .sub { font-size: 0.85rem; color: #6b5a35; margin: 0 0 20px; }
.modal label { display: block; font-size: 0.8rem; font-weight: 600; margin: 14px 0 6px; }
.modal input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #cfc2a0;
  font-family: inherit; font-size: 0.95rem; background: #fff;
}
.modal .actions { display: flex; gap: 10px; margin-top: 22px; }
.modal button { flex: 1; padding: 12px; border-radius: 8px; border: none; font-family: inherit; font-weight: 600; cursor: pointer; }
.modal .cancel { background: transparent; border: 1px solid #cfc2a0; color: #6b5a35; }
.modal .confirm { background: var(--gold-deep); color: #fff; }
.modal .error-msg { color: #b3261e; font-size: 0.85rem; margin-top: 10px; }
.modal .bank-box { background: #fff; border: 1px dashed #cfc2a0; border-radius: 8px; padding: 12px; font-size: 0.82rem; margin-top: 6px; white-space: pre-wrap; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--green-confirm-deep); color: #fff; padding: 12px 20px;
  border-radius: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.toast.show { opacity: 1; }

footer {
  border-top: 1px solid var(--line);
  padding: 20px 0 40px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: rgba(238,243,239,0.5);
  text-align: center;
}
