:root {
  --green-50:  #f1f8f3;
  --green-100: #d8ecdd;
  --green-300: #7abf90;
  --green-500: #2f7d4a;
  --green-700: #1d5a35;
  --green-900: #0f3b22;
  --gold:      #d4a93b;
  --gray-50:   #f7f7f8;
  --gray-100:  #ececef;
  --gray-300:  #cdcdd2;
  --gray-500:  #8a8a92;
  --gray-700:  #4b4b52;
  --gray-900:  #1c1c20;
  --red:       #b53a30;
  --orange:    #d68424;
  --shadow:    0 6px 20px rgba(0,0,0,0.08);
  --radius:    12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-700); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--green-700), var(--green-900));
  color: white;
  padding: 48px 20px 56px;
  text-align: center;
}
.hero-inner { max-width: 800px; margin: 0 auto; }
.hero-logo {
  display: block;
  margin: 0 auto 18px;
  height: 110px;
  width: auto;
  max-width: 80%;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
}
@media (max-width: 480px) {
  .hero-logo { height: 84px; margin-bottom: 14px; }
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  opacity: 0.85;
  margin: 0 0 12px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tagline {
  font-size: 17px;
  opacity: 0.9;
  margin: 0 auto 20px;
  max-width: 560px;
  line-height: 1.5;
}
.price-pill {
  display: inline-block;
  background: var(--gold);
  color: var(--green-900);
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 15px;
  margin: 0;
}

/* ---------- Main ---------- */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---------- Legend ---------- */
.legend {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 18px;
}
.dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-left: 5px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.1);
}
.dot-available { background: white; }
.dot-selected  { background: var(--gold); }
.dot-pending   { background: var(--orange); }
.dot-sold      { background: var(--gray-300); }
.legend-status { margin-left: auto; font-style: italic; color: var(--gray-500); }

.instructions {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--gray-700);
}

/* ---------- Ball grid ---------- */
.ball-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 10px;
}
@media (max-width: 720px) {
  .ball-grid { grid-template-columns: repeat(5, 1fr); }
}

.ball {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, #e6e6ea 75%);
  border: 1px solid var(--gray-300);
  font-weight: 700;
  font-size: 18px;
  color: var(--gray-900);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-family: inherit;
}
.ball:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  border-color: var(--green-500);
}
.ball:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}
.ball.selected {
  background: radial-gradient(circle at 30% 30%, #ffe89e, var(--gold) 80%);
  color: var(--green-900);
  border: 2px solid var(--green-700);
  box-shadow: 0 0 0 3px rgba(212, 169, 59, 0.35), 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}
.ball.selected:hover { transform: translateY(-2px); }
.ball.pending {
  background: radial-gradient(circle at 30% 30%, #ffe6c5, #d68424 90%);
  color: white;
  border-color: var(--orange);
  cursor: not-allowed;
}
.ball.sold {
  background: var(--gray-300);
  color: var(--gray-500);
  cursor: not-allowed;
  text-decoration: line-through;
  box-shadow: none;
}
.ball.sold:hover { transform: none; box-shadow: none; }

/* Leave room at the bottom of the page so the floating action bar
   doesn't cover the last row of balls. */
.ball-grid { padding-bottom: 80px; }
@media (max-width: 720px) {
  .ball-grid { padding-bottom: 92px; }
}

/* ---------- Floating action bar ---------- */
.action-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  background: white;
  border-top: 1px solid var(--gray-100);
  box-shadow: 0 -6px 18px rgba(0,0,0,0.08);
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideUp 0.18s ease;
}
.action-bar-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  margin-right: auto;
}
.action-count {
  font-size: 13px;
  color: var(--gray-700);
  font-weight: 600;
}
.action-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--green-700);
}
.action-clear, .action-buy {
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  padding: 12px 18px;
  transition: background 0.1s, opacity 0.1s;
}
.action-clear {
  background: var(--gray-100);
  color: var(--gray-700);
}
.action-clear:hover { background: var(--gray-300); }
.action-buy {
  background: var(--green-500);
  color: white;
}
.action-buy:hover { background: var(--green-700); }
@media (max-width: 480px) {
  .action-bar { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .action-clear, .action-buy { padding: 10px 14px; font-size: 14px; }
  .action-total { font-size: 16px; }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 30, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
/* The `display: flex` above defeats the browser's default [hidden]
   rule, so re-assert it for the backdrop and any other hidden element. */
.modal-backdrop[hidden],
[hidden] { display: none !important; }
.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 460px;
  padding: 28px 26px 24px;
  position: relative;
  animation: pop 0.18s ease;
}
.modal h2 { margin: 0 0 4px; font-size: 22px; }
.modal-sub { margin: 0 0 20px; color: var(--gray-500); font-size: 14px; line-height: 1.5; }
.modal-balls { color: var(--gray-700); font-weight: 600; }
.modal-sub #modal-total { color: var(--green-700); font-weight: 700; }
.modal-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none;
  border: none;
  font-size: 26px;
  color: var(--gray-500);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--gray-900); }

.tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 18px;
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-700);
  cursor: pointer;
  font-family: inherit;
}
.tab.active {
  background: white;
  color: var(--green-700);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.pane label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
}
.pane input[type=text],
.pane input[type=email],
.pane input[type=password] {
  margin-top: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.pane input:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(47, 125, 74, 0.15);
}

.card-element {
  margin-top: 4px;
  padding: 11px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: white;
}
.card-element.StripeElement--focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(47, 125, 74, 0.15);
}

.form-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin: 4px 0 12px;
}
.cash-note {
  font-size: 13px;
  color: var(--gray-500);
  background: var(--gray-50);
  padding: 8px 10px;
  border-radius: 6px;
  margin: 0 0 16px;
}

.btn-primary, .btn-secondary {
  display: inline-block;
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, opacity 0.1s;
}
.btn-primary {
  background: var(--green-500);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--green-700); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-900);
  margin-top: 12px;
}
.btn-secondary:hover { background: var(--gray-300); }

.success { text-align: center; padding: 8px 0; }
.success-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--green-500);
  color: white;
  font-size: 32px;
  line-height: 56px;
  margin: 0 auto 14px;
}
.success h3 { margin: 0 0 8px; font-size: 20px; }
.success p { color: var(--gray-700); margin: 0 0 16px; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 30px 20px;
  font-size: 13px;
  color: var(--gray-500);
}
.site-footer a { color: var(--gray-500); text-decoration: none; }
.site-footer a:hover { color: var(--green-700); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
