:root {
  --bg: #f2f1ec;
  --surface: #ffffff;
  --ink: #17181c;
  --ink-soft: #6b6f76;
  --ink-faint: #9a9da3;
  --line: #e3e1da;
  --yellow: #f2c14e;
  --yellow-ink: #1a1a1a;
  --amber: #a6790a;
  --black: #17181c;
  --contrast: #17181c;
  --on-contrast: #ffffff;
  --on-contrast-soft: rgba(255,255,255,.7);
  --pill-bg: #e6ebe4;
  --pill-ink: #445048;
  --green: #1b7a3d;
  --blue: #2f6fed;
  --violet: #7c5cff;
  --red: #c0392b;
  --wash-yellow: #fbf1d8;
  --wash-green: #e3f1e6;
  --wash-blue: #e8eefc;
  --wash-violet: #efeaff;
  --wash-neutral: #ececE6;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --shadow: 0 1px 2px rgba(23,24,28,.05), 0 6px 18px -10px rgba(23,24,28,.12);

  /* per-section accent, set by body[data-section] below */
  --section-accent: var(--yellow);
  --section-wash: var(--wash-yellow);
}

body[data-section="courts"], body[data-section="join"], body[data-section="confirmed"] {
  --section-accent: var(--amber);
  --section-wash: var(--wash-yellow);
}
body[data-section="open-play"] { --section-accent: var(--green); --section-wash: var(--wash-green); }
body[data-section="faqs"] { --section-accent: var(--blue); --section-wash: var(--wash-blue); }
body[data-section="booking"] { --section-accent: var(--violet); --section-wash: var(--wash-violet); }
body[data-section="admin"] { --section-accent: var(--ink-soft); --section-wash: var(--wash-neutral); }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121311;
    --surface: #1c1e1a;
    --ink: #f0f1ec;
    --ink-soft: #a7aba2;
    --ink-faint: #74776f;
    --line: #2b2d28;
    --contrast: #f0f1ec;
    --on-contrast: #17181c;
    --on-contrast-soft: rgba(23,24,28,.6);
    --pill-bg: #23261f;
    --pill-ink: #c3ccbe;
    --green: #4caf70;
    --red: #e0745f;
    --yellow: #f2c14e;
    --yellow-ink: #17181c;
    --amber: #e3ad4c;
    --blue: #7ea2f7;
    --violet: #b09bff;
    --wash-yellow: #2b2313;
    --wash-green: #16281d;
    --wash-blue: #18223a;
    --wash-violet: #241d3a;
    --wash-neutral: #23251f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 22px -12px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
[hidden] { display: none !important; }

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 18px 100px;
  position: relative;
}

/* ---------- headers ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 18px;
}

.logo-lockup { display: flex; align-items: center; gap: 8px; }
.ball-icon { width: 24px; height: 24px; flex-shrink: 0; }
.logo-text {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.25;
}

.top-nav-pills { display: flex; gap: 8px; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.pill-btn svg { width: 16px; height: 16px; }
.pill-btn-dark { background: var(--contrast); color: var(--on-contrast); }
.pill-btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); }

.top-nav-text { display: flex; gap: 16px; }
.top-nav-text a {
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
}
.top-nav-text a:hover { color: var(--ink); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--green);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.back-link svg { width: 17px; height: 17px; }

.join-topbar { padding-bottom: 10px; }
.progress-track {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  margin-bottom: 22px;
  overflow: hidden;
}
.progress-fill { width: 55%; height: 100%; background: var(--contrast); border-radius: 999px; }

/* ---------- date strip ---------- */
.date-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 22px;
  scrollbar-width: none;
}
.date-strip::-webkit-scrollbar { display: none; }
.date-chip {
  flex: 0 0 auto;
  min-width: 54px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 4px 9px;
  text-align: center;
  cursor: pointer;
}
.date-chip .dow {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.date-chip .dom {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
}
.date-chip.is-active { background: var(--contrast); border-color: var(--contrast); color: var(--on-contrast); }
.date-chip.is-active .dow { color: var(--on-contrast-soft); }

/* ---------- generic ---------- */
.view-label, .section-label {
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 12px 2px;
}
.section-label { color: var(--section-accent); margin-top: 26px; }

.stack { display: flex; flex-direction: column; gap: 14px; }

.page-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 6px; }
.page-sub { color: var(--ink-soft); font-size: .92rem; margin: 0 0 20px; }

/* ---------- courts: hour slots ---------- */
.slot-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}
.slot-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.slot-time { font-weight: 700; font-size: .98rem; }
.slot-duration { font-size: .78rem; color: var(--section-accent); font-weight: 700; }
.slot-courts { display: grid; grid-template-columns: 1fr; gap: 10px; }
.admin-setting { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 600; }
.admin-setting input { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--green); }
.court-cell {
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  border: none;
  cursor: pointer;
}
.court-cell .court-name { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 3px; }
.court-cell .court-status { display: block; font-size: .76rem; font-weight: 600; }
.court-cell.is-available { background: var(--pill-bg); color: var(--pill-ink); }
.court-cell.is-available .court-status { color: var(--green); }
.court-cell.is-unavailable {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  cursor: not-allowed;
}
.court-cell.is-unavailable .court-status { color: var(--ink-faint); }

/* ---------- open play: session cards ---------- */
.session-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 16px 18px 18px;
}
.session-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.session-time { font-size: .84rem; color: var(--ink-soft); font-weight: 600; }
.session-price { text-align: right; }
.session-price .amt { font-weight: 800; font-size: 1.05rem; }
.session-price .per { display: block; font-size: .72rem; color: var(--ink-soft); }
.session-name { font-weight: 700; font-size: 1rem; margin: 2px 0 4px; }
.session-status { font-size: .78rem; font-weight: 700; margin: 0 0 10px; }
.session-status.is-full { color: var(--red); }
.session-status.is-open { color: var(--green); }

.confirmed-label { font-size: .7rem; font-weight: 800; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.player-chip {
  background: var(--pill-bg);
  color: var(--pill-ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .76rem;
  font-weight: 600;
}

/* ---------- buttons ---------- */
.btn-cta {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--yellow);
  color: var(--yellow-ink);
  font-weight: 700;
  font-size: .96rem;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn-cta:hover { filter: brightness(1.03); }
.btn-cta:disabled, .btn-cta.is-disabled {
  background: #ecd9a6;
  color: rgba(26,26,26,.55);
  cursor: not-allowed;
  box-shadow: none;
}
.btn-cta-static { text-decoration: none; }

/* ---------- join / booking forms ---------- */
.summary-card {
  background: var(--pill-bg);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 22px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: .88rem;
  padding: 5px 0;
}
.summary-row span { color: var(--pill-ink); }
.summary-row strong { text-align: right; }

.field-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 16px 0 6px;
}
.field-input, .mobile-input input, .field-input-light {
  width: 100%;
  font-family: inherit;
  font-size: .95rem;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.field-input-light { background: var(--surface); }

.mobile-input { display: flex; gap: 8px; }
.mobile-prefix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--pill-bg);
  color: var(--pill-ink);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .92rem;
}
.mobile-input input { flex: 1; background: var(--pill-bg); border-color: var(--pill-bg); }

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--pill-bg);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.stepper-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.stepper-value { font-weight: 800; font-size: 1.05rem; }

#joinForm .btn-cta { margin-top: 26px; }
.form-msg { font-size: .8rem; color: var(--red); text-align: center; margin: 10px 0 0; min-height: 1.1em; }

/* ---------- confirmation ---------- */
.confirm-box { text-align: center; padding-top: 30px; }
.confirm-check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.confirm-sub { color: var(--ink-soft); font-size: .92rem; max-width: 34ch; margin: 0 auto 20px; }
.confirm-id {
  font-family: "Inter", monospace;
  font-weight: 800;
  letter-spacing: .1em;
  font-size: 1.3rem;
  background: var(--pill-bg);
  color: var(--pill-ink);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 26px;
}

/* ---------- FAQs page ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.contact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.contact-card:hover { border-color: var(--yellow); }
.contact-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.contact-icon svg { width: 22px; height: 22px; }
.contact-icon-ig { background: linear-gradient(135deg, #f9ce34, #ee2a7b, #6228d7); color: #fff; }
.contact-icon-fb { background: #1877f2; color: #fff; }
.contact-name { font-weight: 700; font-size: .88rem; }
.contact-sub { font-size: .74rem; color: var(--ink-soft); }

.info-card {
  background: var(--section-wash);
  border-radius: var(--radius-md);
  padding: 16px 16px 14px;
}
.info-row { display: flex; gap: 12px; align-items: flex-start; }
.info-row-top { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.info-icon { width: 20px; height: 20px; color: var(--section-accent); flex-shrink: 0; margin-top: 2px; }
.info-title { font-weight: 700; font-size: .94rem; margin: 0; color: var(--ink); }
.info-sub { font-size: .8rem; color: var(--ink-soft); margin: 2px 0 0; }
.info-desc { font-size: .85rem; color: var(--ink-soft); margin: 12px 0 0; }
.hours-list { font-size: .82rem; color: var(--ink-soft); line-height: 1.7; }
.hours-list div { display: flex; justify-content: space-between; gap: 12px; max-width: 240px; }

.faq-accordion {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  float: right;
  color: var(--section-accent);
  font-weight: 700;
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { font-size: .86rem; color: var(--ink-soft); margin: 10px 0 0; }

.lookup-link { text-align: center; margin: 24px 0 4px; }
.lookup-link a { font-size: .88rem; font-weight: 600; text-decoration: underline; color: var(--ink); }

/* ---------- My booking ---------- */
.segmented {
  display: flex;
  background: var(--pill-bg);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 18px;
}
.segmented-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 700;
  color: var(--pill-ink);
  cursor: pointer;
}
.segmented-btn.is-active { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }

.lookup-card {
  background: var(--section-wash);
  border-radius: var(--radius-md);
  padding: 18px;
}
.lookup-form .btn-cta { margin-top: 18px; }
.lookup-results { margin-top: 18px; }
.lookup-result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.lookup-empty { text-align: center; color: var(--ink-soft); font-size: .88rem; padding: 10px; }

/* flat divided list (admin) */
.flat-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.flat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.flat-row:last-child { border-bottom: none; }
.flat-row-main { flex: 1; min-width: 0; }
.flat-row-id { font-weight: 700; font-size: .82rem; font-family: monospace; letter-spacing: .02em; }
.flat-row-detail { font-size: .78rem; color: var(--ink-soft); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flat-row-status { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
.flat-row-status.is-cancelled { color: var(--ink-faint); }
.flat-row-status.is-active { color: var(--section-accent); }
.flat-row .btn-text-danger { display: inline; width: auto; border: none; margin: 0; padding: 0; flex-shrink: 0; }

.btn-text-danger {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
  color: var(--red);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
}
.cancelled-tag {
  text-align: center;
  border-top: 1px solid var(--line);
  margin: 14px 0 0;
  padding-top: 12px;
  color: var(--ink-faint);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- toast ---------- */
.toast-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 36px);
  max-width: 420px;
  pointer-events: none;
}
.toast {
  background: var(--contrast);
  color: var(--on-contrast);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .88rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--green); color: #fff; }
.toast-danger { background: var(--red); color: #fff; }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* ---------- bottom tab bar ---------- */
.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  width: calc(100% - 36px);
  max-width: 444px;
  display: flex;
  background: var(--surface);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 10px;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.tab-btn svg { width: 19px; height: 19px; }
.tab-btn.is-active { background: var(--contrast); color: var(--on-contrast); }

/* ---------- footer ---------- */
#pageFooter { text-align: center; margin: 34px 0 10px; }
.copy { font-size: .76rem; color: var(--ink-soft); margin: 0 0 4px; }
.legal-links { font-size: .76rem; color: var(--ink-soft); margin: 0; }
.legal-links a { text-decoration: underline; }

@media (max-width: 380px) {
  .contact-grid { gap: 8px; }
  .page-title { font-size: 1.5rem; }
}
