/* Prevent pull-to-refresh on iOS */
html, body {
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
#root {
  width: 100%;
  height: 100%;
}
/* Prevent iOS bounce/rubber-band scrolling at document level */
html {
  position: fixed;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
body {
  position: fixed;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
#root {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Instant boot splash — shown before React/Babel loads app.js */
.app-boot-splash {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  background: linear-gradient(to bottom right, rgb(240 253 244), rgb(220 252 231));
}

.app-boot-splash__inner {
  text-align: center;
  max-width: 20rem;
  width: 100%;
}

/* Club / buyer logo — fixed display box on login, main menu, loading */
.club-logo {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: min(16rem, 100%);
  max-height: 6.5rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

.app-boot-splash__logo {
  margin: 0 auto 1.25rem;
}

.app-boot-splash__title {
  margin: 0 0 0.5rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: rgb(31 41 55);
}

.app-boot-splash__status {
  margin: 0 0 1.25rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9375rem;
  color: rgb(75 85 99);
  min-height: 1.25rem;
}

.app-boot-splash__spinner {
  width: 2rem;
  height: 2rem;
  margin: 0 auto;
  border: 3px solid rgb(187 247 208);
  border-top-color: rgb(22 163 74);
  border-radius: 50%;
  animation: app-boot-spin 0.85s linear infinite;
}

@keyframes app-boot-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Leaderboard “Goto Scoring”: darker hover only with mouse/trackpad — avoids stuck :hover on touch (Safari) */
@media (hover: hover) and (pointer: fine) {
  .goto-scoring-leaderboard-btn:hover {
    background-color: #15803d !important;
  }
}

/* Subtle frosted glass on main panels so background shows through slightly */
.app-frosted {
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* TeeSheet event cards: forecast row below date/tee header */
.teesheet-weather-line {
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-align: center;
}

.teesheet-weather-row {
  margin: 0;
  white-space: nowrap;
}

.teesheet-weather-row--with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.teesheet-weather-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.teesheet-weather-row + .teesheet-weather-row {
  margin-top: 0.2rem;
}

/* Create New Event — touch-friendly pickers (no phone keyboard) */
.create-event-stepper-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 48px;
  font-size: 18px;
  font-weight: bold;
  background: #f3f4f6;
  color: #1f2937;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: manipulation;
}

.create-event-stepper-btn--disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.create-event-strip-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  font-size: clamp(15px, 4.2vw, 20px);
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  padding: 0 2px;
  border: 2px solid #16a34a;
  background: #16a34a;
  color: #fff;
  touch-action: manipulation;
}

.create-event-strip-btn--selected {
  border-color: #15803d;
  background: #dcfce7;
  color: #166534;
}

.create-event-choice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid #16a34a;
  background: #16a34a;
  color: #fff;
  touch-action: manipulation;
}

/* Side-by-side Event Date + First Tee Time on Create Event (mobile portrait) */
.create-event-date-tee-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 10px;
  align-items: start;
}

.create-event-date-tee-row > div {
  min-width: 0;
}

.create-event-date-tee-row .create-event-field-btn {
  width: 100%;
  font-size: 14px;
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.create-event-date-tee-row label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.create-event-date-tee-row .create-event-date-input {
  font-size: 14px;
  min-height: 44px;
}

.create-event-date-tee-row .create-event-date-placeholder {
  font-size: 12px;
  left: 8px;
  right: 28px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.create-event-field-btn--placeholder {
  color: #6b7280;
  font-weight: 600;
}

.create-event-fourballs-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.create-event-fourballs-btn {
  flex: 0 0 auto;
  min-width: 3.25rem;
  max-width: 4.5rem;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  border: 2px solid #d1d5db;
  background: #f9fafb;
  color: #1f2937;
  touch-action: manipulation;
}

.create-event-fourballs-btn:active {
  background: #f3f4f6;
}

.create-event-fourballs-hint {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid #16a34a;
  background: #f0fdf4;
  color: #166534;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
}

/* Starting Tee Time — AM/PM slide selector */
.create-event-ampm-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.create-event-ampm-label {
  min-width: 2.5rem;
  padding: 6px 4px;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 700;
  color: #9ca3af;
  cursor: pointer;
  touch-action: manipulation;
}

.create-event-ampm-label--active {
  color: #166534;
}

.create-event-ampm-track {
  position: relative;
  flex: 0 0 88px;
  width: 88px;
  height: 40px;
  padding: 0;
  border: 2px solid #16a34a;
  border-radius: 999px;
  background: #dcfce7;
  cursor: pointer;
  touch-action: manipulation;
}

.create-event-ampm-track--pm {
  background: #16a34a;
}

.create-event-ampm-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: left 0.18s ease;
  pointer-events: none;
}

.create-event-ampm-track--pm .create-event-ampm-thumb {
  left: calc(100% - 33px);
}

.create-event-choice-btn--selected {
  border-color: #15803d;
  background: #dcfce7;
  color: #166534;
}

.create-event-field-btn {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  border: 2px solid #d1d5db;
  background: #f9fafb;
  color: #1f2937;
  touch-action: manipulation;
}

.create-event-field-btn:active {
  background: #f3f4f6;
}

/* Empty date field: hide native mm/dd/yyyy so helper text can show inside the box */
.create-event-date-wrap {
  position: relative;
}

.create-event-date-input--empty {
  color: transparent;
}

.create-event-date-input--empty::-webkit-datetime-edit {
  color: transparent;
}

.create-event-date-placeholder {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
}

.add-player-keypad-display {
  font-size: clamp(28px, 9vw, 40px);
  font-weight: bold;
  text-align: center;
  color: #16a34a;
  min-height: 1.25em;
  margin: 12px 0 16px;
  letter-spacing: 0.02em;
  line-height: 1.15;
  word-break: break-all;
  padding: 8px 4px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 2px solid #bbf7d0;
}

.player-directory-sticky-header {
  flex-shrink: 0;
  background: linear-gradient(rgba(240, 253, 244, 0.97), rgba(220, 252, 231, 0.97));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(34, 197, 94, 0.2);
  padding: 0.25rem 0.75rem 0.75rem;
  margin-bottom: 0.5rem;
}

.player-directory-shell {
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.player-directory-inner {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.player-directory-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overflow-anchor: none;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-bottom: max(4.5rem, env(safe-area-inset-bottom, 0px));
}

/* Scramble / warm-tint panels (replaces bg-orange-50 + frost) */
.app-frosted-warm {
  background: rgba(255, 247, 237, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* Admin → Players: #root is the scroll container; disable scroll anchoring so expanding a row
   does not jump unpredictably; scrollIntoView in app.js aligns the expanded card to the viewport. */
.admin-players-accordion-list,
.admin-player-accordion-card {
  overflow-anchor: none;
}

/* Admin-configured banners (Leaderboard / TeeSheet) — matches DahBoys clubhouse ticker colors */
.app-banner {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.96), rgba(245, 158, 11, 0.94));
  color: #1e293b;
  border-bottom: 2px solid rgba(180, 83, 9, 0.35);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.app-banner__track {
  display: inline-flex;
  width: max-content;
  gap: 0;
  animation: app-banner-scroll linear infinite;
  padding: 0.35rem 0;
  will-change: transform;
}

.app-banner__text {
  display: inline-block;
  padding: 0;
  margin: 0;
  font-size: clamp(0.9375rem, 2.4vw, 1.125rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.25;
  white-space: nowrap;
}

@keyframes app-banner-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* Admin History — view switcher (By Event / By Player / By HCP) */
.admin-history-view-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.375rem;
  margin-bottom: 1rem;
  width: 100%;
}

.admin-history-view-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.375rem 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  border-radius: 0.5rem;
  touch-action: manipulation;
}

@media (min-width: 640px) {
  .admin-history-view-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
  }
}

.admin-history-panel {
  padding-bottom: max(4rem, calc(env(safe-area-inset-bottom, 0px) + 2.5rem));
}

.history-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: clip;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.history-hcp-table tbody tr.history-hcp-totals-row {
  scroll-margin-bottom: max(3rem, env(safe-area-inset-bottom, 0px));
}

/* By Event table — single outer frame; group dividers on header/totals only */
.history-by-event-wrap {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 0.5rem;
}

/* My History — center table within the card (horizontal scroll if needed on narrow screens) */
.my-history-table-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.my-history-table-wrap {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* My History — no sticky date column; even green outer frame on all sides */
.my-history-table.history-by-event-table {
  border: 3px solid #15803d;
}

.my-history-table thead .history-hcp-th-rotate:first-child {
  box-shadow: none;
}

.my-history-table tbody tr.history-hcp-totals-row td:first-child {
  box-shadow: none;
}

.my-history-table tbody tr.history-hcp-totals-row td {
  border-bottom: none;
}

/* My History — Gross column: centered finish labels for Scramble (no tabular-nums) */
.my-history-table .my-history-gross-cell {
  text-align: center;
  vertical-align: middle;
  min-width: 2.25rem;
  font-variant-numeric: normal;
  letter-spacing: normal;
}

/* My History — very light brand-orange tint on Scramble rows */
.my-history-table tbody tr.my-history-scramble-row td {
  background: #fffaf5;
}

.my-history-table tbody tr.my-history-scramble-row:hover td {
  background: #fff7ed;
}

.history-by-event-table {
  border: 2px solid #15803d;
}

.history-by-event-table .history-by-event-grp-r {
  border-right: 3px solid #15803d;
}

.history-by-event-table .history-by-event-orange-l {
  border-left: 3px solid #ea580c;
}

.history-by-event-table .history-by-event-orange-r {
  border-right: 3px solid #ea580c;
}

.history-by-event-table tbody tr.history-hcp-data-row td.history-hcp-sticky-date {
  border-left: none;
}

.history-by-event-table thead .history-hcp-sticky-date {
  border-left: none;
}

.history-by-event-table tr.bg-green-50 .history-hcp-sticky-date {
  background: #f0fdf4;
}

.history-by-event-table tbody tr.history-hcp-totals-row td {
  border-bottom: none;
}

/* Admin History tables — compact columns, vertical headers (By Event, By Player, By Handicap) */
.history-hcp-table {
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.6875rem;
  line-height: 1.2;
}

.history-hcp-table td,
.history-hcp-table th {
  white-space: nowrap;
}

.history-hcp-table .history-hcp-td {
  padding: 0.2rem 0.2rem;
}

.history-hcp-table thead {
  overflow: visible;
}

.history-hcp-table .history-hcp-th-rotate {
  width: 1.35rem;
  max-width: 1.75rem;
  padding: 0.25rem 0.125rem;
  vertical-align: middle;
  text-align: center;
  line-height: 1;
  overflow: hidden;
}

.history-hcp-table thead tr:nth-child(2) .history-hcp-th-rotate {
  height: 2.35rem;
}

.history-hcp-table thead tr:nth-child(2) .history-hcp-th-rotate-span2 {
  height: 4.5rem;
}

.history-hcp-table .history-hcp-th-rotate-rowspan {
  height: 6.25rem;
}

.history-hcp-table .history-hcp-analysis-h {
  padding: 0.25rem 0.2rem;
  vertical-align: middle;
  text-align: center;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.15;
  color: #9a3412;
  white-space: nowrap;
}

.history-hcp-table thead tr:nth-child(3) .history-hcp-th-rotate {
  height: 4.25rem;
  width: 1.65rem;
  max-width: 2.25rem;
}

.history-hcp-table .history-hcp-th-rotate-stacked {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(-90deg);
  transform-origin: center center;
  line-height: 1.1;
  gap: 0.125rem;
}

.history-hcp-table .history-hcp-th-rotate-stacked > span {
  display: block;
  white-space: nowrap;
  font-size: 0.5625rem;
  font-weight: 600;
  color: #374151;
}

.history-hcp-table .history-hcp-th-orange .history-hcp-th-rotate-stacked > span {
  color: #9a3412;
}

.history-hcp-table .history-hcp-analysis-band-title {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.3rem 0.15rem;
}

.history-hcp-table .history-hcp-analysis-pair-l {
  border-left: 1px solid #fdba74;
}

.history-hcp-table .history-hcp-analysis-pair-r {
  border-right: 1px solid #fdba74;
}

.history-hcp-table tbody tr.history-hcp-data-row td {
  border-bottom: 1px dotted #d1d5db;
}

.history-hcp-table tbody tr.history-hcp-data-row:hover td {
  border-bottom-color: #d1d5db;
}

.history-hcp-table tbody tr.history-hcp-totals-row td {
  border-bottom: none;
}

.history-hcp-table .history-hcp-th-rotate > span {
  display: inline-block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.1;
  color: #374151;
}

.history-hcp-table .history-hcp-grp-title {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.25rem 0.125rem;
  line-height: 1.15;
  vertical-align: middle;
}

.history-hcp-table .history-hcp-grp-title-orange {
  background: #ffedd5;
  color: #7c2d12;
}

.history-hcp-table .history-hcp-th-orange {
  background: #ffedd5;
}

.history-hcp-table .history-hcp-th-orange > span {
  color: #9a3412;
}

.history-hcp-table .history-hcp-td-orange {
  background: #fff7ed;
}

.history-hcp-table tr:hover .history-hcp-td-orange {
  background: #ffedd5;
}

.history-hcp-table .history-hcp-td-orange-totals {
  background: #ffedd5;
}

.history-hcp-table {
  --history-hcp-date-w: 2.75rem;
  --history-hcp-day-w: 2rem;
}

.history-hcp-table .history-hcp-sticky-date {
  position: sticky;
  left: 0;
  z-index: 8;
  background: #fff;
  box-shadow: 1px 0 0 #e5e7eb;
}

.history-hcp-table .history-hcp-sticky-day {
  position: sticky;
  left: var(--history-hcp-date-w);
  z-index: 8;
  background: #fff;
  box-shadow: 1px 0 0 #e5e7eb;
}

.history-hcp-table thead .history-hcp-sticky-date,
.history-hcp-table thead .history-hcp-sticky-day {
  z-index: 10;
  background: #dcfce7;
}

.history-hcp-table tr:hover .history-hcp-sticky-date,
.history-hcp-table tr:hover .history-hcp-sticky-day {
  background: #f9fafb;
}

.history-hcp-table .history-hcp-sticky-totals.history-hcp-sticky-date {
  background: #f0fdf4;
}

.history-hcp-table tr.bg-green-50 .history-hcp-sticky-date,
.history-hcp-table tr.bg-green-50 .history-hcp-sticky-day {
  background: #f0fdf4;
}

.history-hcp-table .history-hcp-sticky-player {
  position: sticky;
  left: 0;
  z-index: 8;
  background: #fff;
  box-shadow: 1px 0 0 #e5e7eb;
  min-width: 5.5rem;
  width: max-content;
  max-width: 9rem;
}

.history-hcp-table thead .history-hcp-sticky-player {
  z-index: 10;
  background: #dcfce7;
}

.history-hcp-table tr:hover .history-hcp-sticky-player {
  background: #f9fafb;
}

.history-hcp-table .history-hcp-sticky-totals.history-hcp-sticky-player {
  background: #f0fdf4;
}

.history-hcp-table tr.bg-green-50 .history-hcp-sticky-player {
  background: #f0fdf4;
}

.scroll-to-top-fab {
  position: fixed;
  z-index: 45;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 163, 74, 0.96);
  color: #fff;
  border: 2px solid rgba(21, 128, 61, 0.95);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.scroll-to-top-fab:hover {
  background: rgb(21, 128, 61);
  transform: translateY(-2px);
}

.scroll-to-top-fab:active {
  transform: translateY(0);
}
