:root {
  --ink: #17231c;
  --muted: #66736b;
  --surface: #ffffff;
  --page: #f3f6f4;
  --line: #dbe3de;
  --green: #1f7046;
  --green-dark: #145035;
  --green-soft: #e7f3eb;
  --amber: #9a5b05;
  --amber-soft: #fff3d9;
  --danger: #a23737;
  --shadow: 0 16px 45px rgba(23, 55, 38, .10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #dcefe3 0, transparent 32rem), var(--page);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; min-height: 44px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.shell { max-width: 1120px; margin: 0 auto; padding: 38px 20px 70px; }
.hero {
  background: linear-gradient(135deg, #123c2b, #246d48);
  color: white;
  padding: clamp(28px, 6vw, 58px);
  border-radius: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-content { position: relative; z-index: 2; }
.hero::after {
  content: "";
  position: absolute;
  width: 270px;
  height: 270px;
  border: 2px solid rgba(255,255,255,.13);
  border-radius: 50%;
  right: -75px;
  top: -100px;
  box-shadow: 0 0 0 36px rgba(255,255,255,.035), 0 0 0 72px rgba(255,255,255,.025);
  z-index: 0;
}
.court-silhouette {
  position: absolute;
  right: clamp(8px, 2vw, 26px);
  bottom: clamp(12px, 2vw, 24px);
  width: clamp(250px, 43vw, 430px);
  opacity: .18;
  pointer-events: none;
  z-index: 1;
}
.court-line,
.court-net-extend,
.court-side-mark {
  fill: none;
  stroke: rgba(255,255,255,.9);
  stroke-width: 4.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}
.court-net-extend { stroke-width: 5; }
.court-side-mark { stroke-width: 4.5; }
.tennis-ball {
  position: absolute;
  right: clamp(82px, 16vw, 180px);
  top: clamp(22px, 5vw, 56px);
  width: clamp(62px, 9vw, 104px);
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.18));
}
.eyebrow { font-size: 12px; letter-spacing: .15em; text-transform: uppercase; font-weight: 800; opacity: .8; }
h1 { font-size: clamp(38px, 7vw, 66px); line-height: 1.02; max-width: 640px; margin: 14px 0 15px; letter-spacing: -.045em; }
.hero p { font-size: 17px; line-height: 1.6; max-width: 610px; color: rgba(255,255,255,.82); margin: 0; }

.policy-banner {
  margin: 20px 2px 0;
  background: var(--amber-soft);
  color: #5f3b08;
  border: 2px solid #e8c477;
  border-left-width: 7px;
  border-radius: 16px;
  padding: 20px 22px;
  font-size: clamp(17px, 2.3vw, 21px);
  line-height: 1.55;
  font-weight: 750;
  box-shadow: 0 8px 24px rgba(154, 91, 5, .10);
}
.policy-banner::before {
  content: "Important cancellation update";
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: .11em;
  text-transform: uppercase;
  font-weight: 900;
  color: var(--amber);
}
.section-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin: 42px 2px 18px; }
.section-head h2 { font-size: 26px; margin: 0; letter-spacing: -.025em; }
.section-head p { margin: 5px 0 0; color: var(--muted); }
.refresh { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 15px; color: var(--ink); font-weight: 750; }
.refresh:disabled { cursor: wait; opacity: .65; }
.events { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.event-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 21px; box-shadow: 0 8px 24px rgba(23,55,38,.055); display: flex; flex-direction: column; min-height: 330px; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; font-size: 12px; font-weight: 800; padding: 6px 9px; background: var(--green-soft); color: var(--green-dark); }
.badge.waitlist { background: var(--amber-soft); color: var(--amber); }
.badge.closed { background: #ecefed; color: #66706a; }
.event-card h3 { font-size: 22px; margin: 17px 0 11px; letter-spacing: -.025em; }
.meta { display: grid; gap: 9px; color: #3d4b43; line-height: 1.35; }
.meta-row { display: flex; gap: 9px; align-items: flex-start; }
.meta-icon { width: 21px; flex: 0 0 21px; text-align: center; }
.notes { margin: 15px 0 0; padding-top: 14px; border-top: 1px solid #edf0ee; color: var(--muted); font-size: 14px; line-height: 1.5; }
.capacity { margin-top: auto; padding-top: 18px; }
.capacity-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.bar { height: 7px; border-radius: 99px; background: #e8ece9; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.event-actions { margin-top: 18px; }
.primary, .secondary { width: 100%; min-height: 48px; border-radius: 11px; padding: 12px 15px; font-weight: 800; transition: .16s ease; }
.primary { border: 0; background: var(--green); color: white; }
.primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.primary:disabled { background: #aeb8b2; transform: none; cursor: not-allowed; }
.secondary { border: 1px solid var(--line); background: #eef2ef; color: var(--ink); }
.secondary:hover { background: #e1e8e3; }
.secondary:disabled { opacity: .6; cursor: not-allowed; }
.weekly-prompt { text-align: left; }
.weekly-prompt .result-icon { text-align: center; }
.weekly-prompt h2, .weekly-prompt > p { text-align: center; }
.weekly-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 18px; }
.weekly-current { margin: 14px 0 0; padding: 11px 13px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); font-size: 14px; font-weight: 750; text-align: center; }
.loading, .empty { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px; text-align: center; color: var(--muted); grid-column: 1 / -1; font-size: 17px; line-height: 1.5; font-weight: 650; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(9,23,15,.58); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.modal-backdrop.open { display: flex; }
.modal { width: min(520px, 100%); max-height: calc(100dvh - 40px); overflow: auto; background: white; border-radius: 22px; padding: 25px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.modal h2 { margin: 0 0 7px; font-size: 25px; }
.modal-sub { color: var(--muted); line-height: 1.45; }
.close { border: 0; background: #edf1ee; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; flex: 0 0 44px; }
form { margin-top: 22px; }
label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 800; }
.optional { font-weight: 500; color: #78837c; }
input { width: 100%; min-height: 48px; border: 1px solid #cbd5cf; border-radius: 10px; padding: 12px 13px; background: white; color: var(--ink); font-size: 16px; }
input:focus { outline: 3px solid rgba(31,112,70,.15); border-color: var(--green); }
.fine { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 14px 0; }
.error { background: #fff0f0; color: var(--danger); border: 1px solid #f0cccc; padding: 11px 12px; border-radius: 10px; font-size: 14px; margin: 12px 0; display: none; }
.error.visible { display: block; }
.result { text-align: center; padding: 14px 6px 4px; }
.result-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 28px; font-weight: 900; }
.result h2 { margin-bottom: 8px; }
.result p { color: var(--muted); line-height: 1.55; }
.result-event { background: var(--page); border-radius: 12px; padding: 14px; margin: 18px 0; text-align: left; line-height: 1.55; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); background: #17231c; color: white; padding: 14px 17px; border-radius: 10px; box-shadow: var(--shadow); display: none; z-index: 20; font-size: 16px; line-height: 1.45; }
.footer { margin-top: 34px; text-align: center; color: var(--muted); font-size: 13px; }
.noscript { padding: 18px; background: #fff0f0; color: var(--danger); text-align: center; }

@media (max-width: 700px) {
  .shell { padding: max(14px, env(safe-area-inset-top)) 12px calc(42px + env(safe-area-inset-bottom)); }
  .hero { border-radius: 20px; padding: 28px 20px 30px; }
  .hero::after { width: 210px; height: 210px; right: -95px; top: -85px; }
  .court-silhouette { width: 246px; right: -20px; bottom: 10px; opacity: .16; }
  .tennis-ball { width: 66px; right: 54px; top: 16px; }
  .eyebrow { font-size: 11px; }
  h1 { font-size: clamp(36px, 11vw, 50px); margin-top: 11px; }
  .hero p { font-size: 16px; line-height: 1.55; max-width: 70%; }
  .policy-banner { margin: 14px 0 0; border-radius: 14px; padding: 18px 17px; font-size: 18px; }
  .section-head { align-items: stretch; flex-direction: column; margin: 30px 2px 15px; gap: 13px; }
  .section-head h2 { font-size: 24px; }
  .refresh { width: 100%; min-height: 46px; }
  .events { grid-template-columns: 1fr; gap: 14px; }
  .event-card { min-height: 0; border-radius: 17px; padding: 18px; }
  .primary, .secondary { min-height: 50px; font-size: 16px; }
  .weekly-choice { grid-template-columns: 1fr; gap: 10px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); }
  .toast { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; }
}

/* Confirmed reservation lookup */
.eyebrow.dark { color: var(--green-dark); opacity: 1; }
.reservation-lookup {
  margin: 24px 2px 0;
  padding: clamp(22px, 4vw, 34px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(23,55,38,.06);
}
.lookup-copy h2 { margin: 7px 0 7px; font-size: clamp(24px, 3.5vw, 32px); letter-spacing: -.03em; }
.lookup-copy p { margin: 0; color: var(--muted); line-height: 1.55; max-width: 760px; }
.lookup-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; margin-top: 20px; }
.lookup-field label { margin-top: 0; }
.lookup-button { width: auto; min-width: 190px; }
.lookup-error { grid-column: 1 / -1; margin: 0; }
.reservation-results { margin-top: 24px; }
.lookup-empty { padding: 20px; background: var(--page); border-radius: 14px; color: var(--ink); }
.lookup-empty p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.lookup-audit-summary { display: flex; gap: 12px; align-items: center; padding: 15px 17px; border-radius: 14px; background: var(--green-soft); color: var(--green-dark); margin-bottom: 16px; }
.lookup-audit-summary div div { margin-top: 3px; font-size: 13px; color: #36614a; }
.audit-check { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 900; flex: 0 0 35px; }
.reservation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(285px, 1fr)); gap: 16px; }
.reservation-card { border: 1px solid var(--line); border-radius: 18px; padding: 19px; background: #fff; }
.reservation-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.audit-reference { font-size: 12px; color: var(--muted); font-weight: 700; }
.reservation-card h3 { font-size: 21px; margin: 15px 0; letter-spacing: -.02em; }
.reservation-details { display: grid; gap: 10px; }
.reservation-details > div { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: baseline; }
.reservation-details span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.confirmation-audit { margin-top: 17px; padding-top: 15px; border-top: 1px solid #edf0ee; }
.confirmation-audit h4 { margin: 0 0 10px; font-size: 14px; }
.confirmation-audit dl { margin: 0; display: grid; gap: 7px; }
.confirmation-audit dl > div { display: grid; grid-template-columns: 92px 1fr; gap: 8px; font-size: 13px; line-height: 1.4; }
.confirmation-audit dt { color: var(--muted); }
.confirmation-audit dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* Confirmed event roster */
.roster-link {
  width: 100%;
  margin-top: 16px;
  min-height: 46px;
  border: 1px solid #b9d4c3;
  border-radius: 11px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.roster-link:hover { background: #d9ecdf; }
.roster-link:disabled { cursor: wait; opacity: .68; }
.event-roster {
  margin-top: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--page);
}
.roster-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.roster-head strong { display: block; color: var(--green-dark); }
.roster-head span { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.roster-head small { color: var(--muted); font-weight: 700; white-space: nowrap; }
.roster-list { margin: 14px 0 0; padding-left: 24px; columns: 2; column-gap: 28px; }
.roster-list li { margin: 0 0 8px; break-inside: avoid; font-weight: 700; }
.roster-loading, .roster-empty { margin: 0; color: var(--muted); }
.roster-error { color: var(--danger); font-weight: 700; }
.roster-privacy { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.45; }

@media (max-width: 760px) {
  .lookup-form { grid-template-columns: 1fr; }
  .lookup-button { width: 100%; }
  .reservation-lookup { margin-top: 16px; border-radius: 18px; padding: 20px 17px; }
}

@media (max-width: 420px) {
  .court-silhouette { width: 210px; right: -22px; bottom: 10px; }
  .tennis-ball { width: 54px; right: 38px; top: 18px; }
  .hero p { max-width: 68%; }
}

@media (max-width: 560px) {
  .roster-head { flex-direction: column; }
  .roster-head small { white-space: normal; }
  .roster-list { columns: 1; }
}
