:root {
  color-scheme: light;
  --bg: #eef2f7;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ee;
  --panel: #ffffff;
  --primary: #e11d48;
  --primary-dark: #be123c;
  --court: #f59e0b;
  --navy: #0f172a;
  --green: #16a34a;
  --wait: #7c3aed;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(245, 158, 11, 0.24), transparent 28rem),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 560px);
  min-width: 0;
  max-width: 100vw;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 188px;
  padding: 24px;
  border-radius: 0 0 8px 8px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.76)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.12) 0 1px, transparent 1px 46px),
    linear-gradient(135deg, #1f2937, #0f172a);
  color: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: #fbbf24;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(42px, 13vw, 72px);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.subtitle {
  max-width: 320px;
  margin-bottom: 0;
  color: #dbeafe;
  font-size: 15px;
  line-height: 1.45;
}

.ball-mark {
  position: absolute;
  right: -20px;
  bottom: -24px;
  width: 150px;
  aspect-ratio: 1;
}

.ball-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.35));
}

.lang-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.lang-btn {
  padding: 6px 12px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.lang-btn.ko {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.lang-btn.ko.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.lang-btn.en {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.lang-btn.en.active {
  background: #ea580c;
  color: #fff;
  border-color: #ea580c;
}

.admin-toggle-btn {
  margin-left: auto;
  padding: 5px 9px;
  border: 2px solid #dc2626;
  border-radius: 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.admin-toggle-btn:hover {
  background: #fecaca;
}

.status-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.status-strip > div,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.status-strip > div {
  padding: 14px;
}

.label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#myStatusText {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.mini-status.ok {
  background: #dcfce7;
  color: #15803d;
}

.mini-status.none {
  background: #ffe4e6;
  color: var(--primary-dark);
}

.panel {
  margin-top: 14px;
  padding: 16px;
  min-width: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}

.calendar-head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-head strong {
  text-align: center;
  font-size: 17px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-row {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.calendar-spacer {
  min-height: 62px;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
  min-height: 62px;
  padding: 7px 4px;
  border: 1px solid #edf2f7;
  border-radius: var(--radius);
  background: #f8fafc;
  color: #94a3b8;
  text-align: center;
}

.calendar-day.playable {
  border-color: #fecdd3;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.calendar-day.active {
  border-color: var(--primary);
  background: #fff1f2;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.14);
}

.calendar-day:disabled {
  cursor: default;
}

.day-number {
  font-weight: 900;
}

.day-type,
.day-count {
  display: block;
  overflow: hidden;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-type {
  color: var(--primary);
}

.day-count {
  color: var(--muted);
}

.selected-event-summary {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
}

.selected-event-summary strong {
  color: #9a3412;
}

.selected-event-summary span {
  color: #7c2d12;
  font-size: 13px;
  font-weight: 700;
}

.selected-event-summary small {
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.pill {
  flex: 0 0 auto;
  max-width: 46%;
  overflow: hidden;
  padding: 7px 10px;
  border-radius: 999px;
  background: #ffe4e6;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill.muted {
  background: #ede9fe;
  color: var(--wait);
}

.rsvp-form {
  display: grid;
  gap: 12px;
}

.fee-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
}

.fee-box span {
  color: #9a3412;
  font-size: 13px;
  font-weight: 800;
}

.fee-box strong {
  color: #c2410c;
  font-size: 18px;
}

.account-copy-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: #eff6ff;
}

.account-copy-box > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-copy-box span {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.account-copy-box strong {
  color: #1e3a8a;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.account-copy-box .secondary-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border-color: #93c5fd;
  color: #1d4ed8;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.14);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 50px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
}

#submitBtn.primary-button {
  background: var(--green);
}

#cancelButton.secondary-button {
  border: 0;
  background: var(--primary);
  color: #fff;
}

.people-list {
  display: grid;
  gap: 8px;
}

.people-list.empty {
  color: var(--muted);
  font-size: 14px;
}

.person {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.person-name {
  font-weight: 900;
}

.person-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.team-tag {
  max-width: 120px;
  overflow: hidden;
  padding: 6px 8px;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.event-tables {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.event-table-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.table-event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
}

.table-event-header div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.table-event-header strong {
  color: #9a3412;
  font-size: 15px;
}

.table-event-header span {
  color: #7c2d12;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.table-event-header b {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}

.event-table-block.match .table-event-header {
  border-color: #fed7aa;
  background: #fff7ed;
}

.event-table-block.match .table-event-header strong,
.event-table-block.match .table-event-header span {
  color: #9a3412;
}

.event-table-block.match .table-event-header b {
  background: #ea580c;
}

.event-table-block.pickup .table-event-header {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.event-table-block.pickup .table-event-header strong,
.event-table-block.pickup .table-event-header span {
  color: #1e3a8a;
}

.event-table-block.pickup .table-event-header b {
  background: #2563eb;
}

.payment-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.payment-table th,
.payment-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  word-break: keep-all;
}

.payment-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.payment-table tr:last-child td {
  border-bottom: 0;
}

.payment-table td:last-child {
  font-weight: 800;
}

.payment-table th:first-child,
.payment-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding-left: 10px;
  padding-right: 6px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.payment-table th:nth-child(2),
.payment-table td:nth-child(2) {
  position: sticky;
  left: 36px;
  z-index: 2;
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  padding-left: 6px;
  padding-right: 8px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.payment-table th:first-child,
.payment-table th:nth-child(2) {
  background: #f8fafc;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 5;
  max-width: 520px;
  margin: 0 auto;
  padding: 13px 14px;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.paid-badge,
.paid-toggle {
  display: inline-block;
  min-width: 68px;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.paid-badge {
  border: 1px solid transparent;
}

.paid-toggle {
  border: 1px solid transparent;
  cursor: pointer;
}

.paid-toggle:disabled {
  opacity: 0.6;
  cursor: default;
}

.paid-yes {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.paid-no {
  background: #f1f5f9;
  color: #64748b;
  border-color: var(--line);
}

.cancel-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: #fef2f2;
  display: grid;
  gap: 10px;
}

.cancel-panel h3 {
  margin: 0;
  color: #b91c1c;
  font-size: 15px;
}

.cancel-panel p {
  margin: 0;
  color: #7f1d1d;
  font-size: 13px;
}

.youtube-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  margin-top: 14px;
  border-radius: var(--radius);
  background: #ff0000;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(255, 0, 0, 0.25);
}

.youtube-button:active {
  opacity: 0.9;
}

@media (max-width: 480px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .panel {
    padding: 14px;
  }

  h1 {
    font-size: clamp(36px, 15vw, 60px);
  }

  .action-row {
    gap: 8px;
  }

  .payment-table {
    min-width: 560px;
  }

  .payment-table th,
  .payment-table td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .paid-badge,
  .paid-toggle {
    min-width: 58px;
    font-size: 11px;
    padding: 5px 6px;
  }
}

@media (min-width: 720px) {
  body {
    padding: 26px 0;
  }

  .hero {
    border-radius: var(--radius);
  }
}