:root {
  --bg: #f4f4f5;
  --bg-alt: #ededee;
  --ink: #131316;
  --muted: #6c6c74;
  --accent: #d83a1c;
  --accent-d: #b92f16;
  --green: #1faa53;
  --border: rgba(18, 18, 24, .12);
  --border-strong: rgba(18, 18, 24, .28);
  --card: #ffffff;
  --radius: 14px;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-head: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(18, 18, 24, .04), 0 8px 24px rgba(18, 18, 24, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  text-align: center;
  padding: 40px 16px 20px;
}
.topbar h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  margin: 0;
  letter-spacing: -.02em;
}
.topbar h1 .hl { color: var(--accent); }
.topbar .sub { margin: 8px 0 0; color: var(--muted); font-size: 1rem; }
.topbar::after {
  content: ""; display: block; width: 48px; height: 4px;
  background: var(--accent); border-radius: 4px; margin: 18px auto 0;
}

.container { max-width: 640px; margin: 0 auto; padding: 8px 16px 56px; }

.status { display: flex; gap: 12px; justify-content: center; margin: 22px 0; flex-wrap: wrap; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 20px; text-align: center; min-width: 96px;
}
.stat-num { display: block; font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; display: block; }

.banner {
  background: var(--card); border: 1px solid var(--border-strong);
  padding: 14px 16px; border-radius: var(--radius); margin: 8px 0 16px;
  text-align: center; font-weight: 600;
}
.banner.win { border-color: var(--accent); background: #fdf1ee; color: var(--accent-d); }

.legend { display: flex; gap: 18px; justify-content: center; font-size: .82rem; color: var(--muted); margin: 8px 0 16px; flex-wrap: wrap; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 5px; }
.dot.free { background: var(--card); border: 1px solid var(--border-strong); }
.dot.taken { background: var(--bg-alt); border: 1px solid var(--border); }
.dot.sel { background: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.cell {
  aspect-ratio: 1 / 1; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--card); color: var(--ink);
  font-family: var(--font-head); font-weight: 600; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s ease, background .15s ease, color .15s ease, border-color .15s ease;
  font-variant-numeric: tabular-nums;
}
.cell:hover:not(:disabled) { background: var(--bg-alt); transform: translateY(-2px); }
.cell.selected { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 12px rgba(216, 58, 28, .3); }
.cell.taken { background: var(--bg-alt); color: #b4b4bb; border-color: var(--border); cursor: not-allowed; text-decoration: line-through; }
.cell:disabled { cursor: not-allowed; }

@media (max-width: 430px) {
  .grid { gap: 6px; }
  .cell { font-size: .82rem; border-radius: 8px; }
}

.selection-bar {
  margin: 18px 0 8px; padding: 12px 16px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600;
}

.cta {
  display: block; width: 100%; margin-top: 16px; padding: 15px;
  background: var(--ink); color: #fff; border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 1rem; font-weight: 700; cursor: pointer; text-align: center;
  text-decoration: none; transition: background .15s ease, opacity .15s ease;
}
.cta:hover:not(:disabled) { background: #000; }
.cta:disabled { background: var(--bg-alt); color: var(--muted); cursor: not-allowed; border: 1px solid var(--border); }
.cta.wa { background: var(--green); }
.cta.wa:hover { background: #178f45; }

.link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: .9rem; text-decoration: underline; font-family: inherit; }

.modal { position: fixed; inset: 0; background: rgba(18, 18, 24, .5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: var(--card); border-radius: 18px; padding: 26px; width: 100%; max-width: 400px; position: relative; box-shadow: var(--shadow); }
.modal-card h2 { font-family: var(--font-head); margin: 0 0 4px; font-weight: 700; }
.modal-sub { color: var(--muted); margin: 0 0 18px; font-size: .92rem; }
.close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-card.success { text-align: center; }

form label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .88rem; }
form input {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  border: 1.5px solid var(--border-strong); border-radius: 10px; font-size: 1rem; font-family: inherit; background: var(--card); color: var(--ink);
}
form input:focus { outline: none; border-color: var(--accent); }
.hint { font-size: .82rem; color: var(--muted); margin: 4px 0 16px; }
.error { color: var(--accent); font-weight: 600; margin: 10px 0 0; font-size: .9rem; }

.check { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.amount { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; margin: 6px 0; }
.amount .lbl { color: var(--muted); font-weight: 500; font-size: .85rem; display: block; }

.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px 16px 44px; max-width: 640px; margin: 0 auto; }
.footer strong { color: var(--ink); }
