:root {
  --bg: #0b0d12;
  --surface: #141821;
  --surface-2: #1c2130;
  --border: #2a3142;
  --text: #eef1f7;
  --muted: #8a93a8;
  --accent: #ffb020;
  --accent-ink: #1a1200;
  --danger: #ff6b6b;
  --ok: #3ddc97;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, sans-serif;
}
h1, h2, h3 { font-family: 'Space Grotesk', Inter, sans-serif; margin: 0; line-height: 1.1; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.accent { color: var(--accent); }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.test-banner {
  background: #3b2a00; color: #ffd27a; text-align: center;
  font-size: 0.88rem; padding: 8px 16px; border-bottom: 1px solid rgba(255, 176, 32, 0.4);
}

/* Hero */
.hero {
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(255, 176, 32, 0.18), transparent 60%),
    radial-gradient(600px 300px at 0% 100%, rgba(80, 120, 255, 0.12), transparent 60%);
  border-bottom: 1px solid var(--border);
}
.nav { max-width: 1100px; margin: 0 auto; padding: 20px 16px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: 0.02em; }
.nav-link { color: var(--text); text-decoration: none; font-weight: 500; }
.nav-link:hover { color: var(--accent); }
.hero-inner { max-width: 1100px; margin: 0 auto; padding: 72px 16px 96px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--accent); margin: 0 0 12px; font-weight: 600; }
.hero h1 { font-size: clamp(2.8rem, 9vw, 5.5rem); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 520px; margin: 20px 0 32px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
  font: 600 0.95rem Inter, sans-serif; cursor: pointer; text-decoration: none;
  transition: transform 0.1s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ffc04d; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); padding: 8px 16px; }
.btn-ghost:hover { border-color: var(--muted); }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; }
.icon-btn:hover { color: var(--text); }

.nav-links { display: flex; gap: 20px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.steps { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; max-width: 760px; }
.steps li { background: rgba(20, 24, 33, 0.7); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: 0.92rem; }
.steps strong { color: var(--text); display: block; margin-bottom: 2px; }

/* Sections */
main { padding-top: 56px; padding-bottom: 56px; }
main section { margin-bottom: 64px; scroll-margin-top: 16px; }

/* Passes */
.card.pass { position: relative; }
.card.pass.featured { border-color: var(--accent); background: linear-gradient(180deg, rgba(255, 176, 32, 0.08), var(--surface) 60%); }
.badge { position: absolute; top: 16px; right: 16px; background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.price { margin: 0; }
.price strong { font: 700 2rem 'Space Grotesk', sans-serif; }
.card p { margin: 0; }
.games { color: var(--muted); opacity: 0.8; }

.notice {
  background: rgba(255, 176, 32, 0.1); border: 1px solid rgba(255, 176, 32, 0.4); color: var(--text);
  border-radius: var(--radius); padding: 12px 16px; margin: 0 0 20px;
}
.btn-primary:disabled { cursor: not-allowed; background: var(--surface-2); color: var(--muted); opacity: 1; }

.grid.passes { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); max-width: 760px; }
.fee-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.fee-list li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border); padding-bottom: 6px; color: var(--muted); }
.fee-list strong { color: var(--text); }

/* Sport picker in the payment dialog */
.sport-group { margin-bottom: 12px; }
.sport-group-head { margin: 0 0 6px; color: var(--muted); }
.sport-group-head strong { color: var(--text); }
.sport-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.sport-option {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 0.9rem;
}
.sport-option:has(input:checked) { border-color: var(--accent); background: rgba(255, 176, 32, 0.08); }
.sport-option input { width: auto; accent-color: var(--accent); margin: 0; }
.sport-option .owned { display: none; margin-left: auto; font-size: 0.72rem; color: var(--ok); }
.sport-option.is-owned { opacity: 0.6; cursor: default; }
.sport-option.is-owned .owned { display: inline; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
#premium-hint { margin: 4px 0 8px; }

.lookup { margin-top: 24px; max-width: 520px; }
.lookup-row { display: flex; gap: 8px; margin-top: 6px; }
.lookup-row .btn { padding: 8px 18px; }
#lookup-result { min-height: 1.2em; margin: 8px 0 0; }

/* Events */
.section-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.section-head h2 { font-size: 1.8rem; }
.tabs { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 999px; overflow-x: auto; }
.tab { background: none; border: 0; color: var(--muted); padding: 8px 16px; border-radius: 999px; font: 500 0.9rem Inter, sans-serif; cursor: pointer; white-space: nowrap; }
.tab[aria-selected='true'] { background: var(--surface-2); color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-icon { font-size: 2rem; }
.card h3 { font-size: 1.3rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); color: var(--muted); font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; }
.card .btn { margin-top: auto; }

.footer { border-top: 1px solid var(--border); padding-top: 24px; padding-bottom: 40px; font-size: 0.9rem; }
.footer p { margin: 4px 0; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }

/* Dialog */
dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(3px); }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 20px 12px; border-bottom: 1px solid var(--border); }
.dialog-head h3 { font-size: 1.5rem; }
.dialog-head p { margin: 4px 0 0; }
.dialog-body { padding: 16px 20px; overflow-y: auto; }
.dialog-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.dialog-foot > div { display: flex; flex-direction: column; }
.total { font-size: 1.4rem; font-family: 'Space Grotesk', sans-serif; }

fieldset { border: 0; padding: 0; margin: 16px 0 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 0.85rem; color: var(--muted); }
input {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font: 0.95rem Inter, sans-serif;
}
input:focus { outline: none; border-color: var(--accent); }
input.upper { text-transform: uppercase; }
input.upper::placeholder { text-transform: none; }

.member { display: grid; grid-template-columns: 28px 1fr 32px; gap: 8px; align-items: start; margin-bottom: 8px; }
.member .num, .member .icon-btn { padding-top: 10px; }
.member .num { color: var(--muted); font-size: 0.85rem; text-align: center; }
.member-field { display: flex; flex-direction: column; gap: 4px; }
.roll-status:empty { display: none; }
.roll-status.ok { color: var(--ok); }
.roll-status.bad { color: var(--danger); }

.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; font-size: 0.9rem; }

.success { padding: 40px 24px; text-align: center; }
.success .tick {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  background: rgba(61, 220, 151, 0.15); color: var(--ok); font-size: 2rem;
  display: grid; place-items: center;
}
.success h3 { font-size: 1.6rem; margin-bottom: 8px; }

@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; gap: 0; }
  .member { grid-template-columns: 20px 1fr 32px; }
  .dialog-foot .btn { padding: 12px 16px; }
  .nav-links { gap: 14px; }
}

/* Rulebook additions: requirement chips, rules viewer, gender select, faculty */
.chip-accent { background: rgba(255, 176, 32, 0.14); color: var(--accent); }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .btn { flex: 1; }
.card-actions .btn-ghost { flex: 0 0 auto; padding: 10px 16px; }
select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font: 0.95rem Inter, sans-serif;
}
select:focus { outline: none; border-color: var(--accent); }
.field-note { align-self: end; margin: 0 0 14px; }
.error-text { color: var(--danger); }
.link-btn.small { font-size: 0.85rem; margin-top: 6px; }

.rules-wrap { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
.rules-body section + section { margin-top: 16px; }
.rules-body h4 { margin: 0 0 6px; font: 600 0.95rem 'Space Grotesk', Inter, sans-serif; color: var(--accent); }
.rules-body ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: #c9cfdc; font-size: 0.92rem; }
.tabs { max-width: 100%; }
/* On short screens scroll the whole rules window (footer sticks to the bottom) instead of squeezing the text */
.rules-wrap { overflow-y: auto; }
.rules-wrap .rules-body { overflow: visible; }
.rules-wrap .dialog-foot { position: sticky; bottom: 0; }
