/* WSHoops — one stylesheet, no framework. Mobile first. */

:root {
  --floor: #f3ebdd;
  --paper: #fffaf1;
  --ink: #1c1813;
  --ink-soft: #3a332a;
  --muted: #74695a;
  --line: #e2d4bd;
  --line-strong: #cbb896;
  --orange: #e2530b;
  --orange-deep: #b53f05;
  --orange-wash: #fde6d6;
  --danger: #b3261e;

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;

  --radius: 14px;
  --shadow: 0 1px 0 rgba(28, 24, 19, .06), 0 10px 30px -18px rgba(28, 24, 19, .35);
  --wrap: 680px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* App-like: no double-tap zoom, no grey tap flash. */
html, body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 400 17px/1.5 var(--body);
  color: var(--ink);
  background-color: var(--floor);
  /* faint floorboards + a center-court circle up top */
  background-image:
    radial-gradient(circle at 50% -140px, transparent 219px, rgba(226, 83, 11, .16) 220px, rgba(226, 83, 11, .16) 222px, transparent 223px),
    repeating-linear-gradient(90deg, transparent 0 119px, rgba(120, 90, 50, .06) 119px 120px);
  background-repeat: no-repeat, repeat;
}

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: .95;
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 18px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.wordmark {
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wordmark .ball {
  width: 20px;
  height: 20px;
  flex: none;
}

.wordmark span { color: var(--orange); }

.topbar nav { display: flex; gap: 4px; }

.topbar nav a {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
}

.topbar nav a:hover { color: var(--ink); background: rgba(28, 24, 19, .06); }

/* ---------- page heading ---------- */

.page-head { padding: 18px 0 22px; }

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--orange-deep);
  margin: 0 0 8px;
}

.page-head h1 { font-size: clamp(44px, 12vw, 68px); }
.page-head h1.h-md { font-size: clamp(34px, 9vw, 50px); }

.page-head .sub {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 18px;
}

.sub strong { font-weight: 600; }

main { flex: 1; padding-bottom: 40px; }

/* ---------- cards & sections ---------- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.card > h2, .section-title {
  font-size: 26px;
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-title .count {
  font-family: var(--body);
  font-size: 15px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

.hint { color: var(--muted); font-size: 15px; margin: -6px 0 16px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

/* ---------- game list ---------- */

.games { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 12px; }

.game {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px 12px 12px;
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}

.game:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.game:active { transform: translateY(0); }

.date-block {
  text-align: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 10px;
  padding: 7px 0 8px;
  line-height: 1;
}

.date-block .dow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--orange);
}

.date-block .day {
  display: block;
  font-family: var(--display);
  font-weight: 900;
  font-size: 34px;
  margin: 3px 0 2px;
}

.date-block .mon {
  display: block;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .7;
}

.game .gym { font-weight: 600; font-size: 18px; line-height: 1.25; }
.game .when { color: var(--muted); font-size: 15px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--orange-wash);
  color: var(--orange-deep);
  margin-top: 6px;
}

.game .go {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  color: var(--line-strong);
  transition: color .15s ease, transform .15s ease;
}

.game:hover .go { color: var(--orange); transform: translateX(3px); }

/* ---------- disclosure (add game / edit game) ---------- */

details.card { padding: 0; }

details.card > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

details.card > summary::-webkit-details-marker { display: none; }

details.card > summary::after {
  content: "+";
  font-size: 30px;
  line-height: 1;
  color: var(--orange);
  transition: transform .2s ease;
}

details[open].card > summary::after { transform: rotate(45deg); }

details.card > .details-body { padding: 0 20px 20px; }

/* ---------- forms ---------- */

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.row { display: grid; gap: 0 12px; }
.height-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 520px) { .row-2 { grid-template-columns: 1fr 1fr; } }

input, select {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231c1813' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(226, 83, 11, .18);
}

.is-invalid { border-color: var(--danger); }
.field-error { display: block; color: var(--danger); font-size: 14px; margin-top: 6px; }

/* ---------- combobox (player picker) ---------- */

.cb { position: relative; }

.cb-trigger {
  width: 100%;
  height: 50px;
  padding: 0 40px 0 14px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231c1813' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.cb-trigger.placeholder { color: var(--muted); }
.cb-trigger:focus-visible, .cb.open .cb-trigger {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(226, 83, 11, .18);
}

.cb-panel {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 24px 50px -20px rgba(28, 24, 19, .45);
  overflow: hidden;
  animation: pop .14s ease both;
  transform-origin: top center;
}

.cb-search { padding: 10px; border-bottom: 1px solid var(--line); }

.cb-search input {
  height: 44px;
  padding-left: 40px;
  background: var(--floor) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2374695a' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center;
  border-color: transparent;
}

.cb-search input:focus { box-shadow: none; border-color: var(--line-strong); background-color: #fff; }
.cb-search input::-webkit-search-cancel-button { display: none; }

.cb-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(340px, 50dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cb-group {
  position: sticky;
  top: -6px;
  background: #fff;
  padding: 12px 10px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.cb-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
}

.cb-option.active { background: var(--orange-wash); }
.cb-option[aria-selected="true"] .cb-name { font-weight: 600; }
.cb-option[aria-selected="true"]::after { content: "✓"; color: var(--orange); font-weight: 700; }
.cb-option[aria-selected="true"] .cb-meta { margin-left: auto; }

.cb-meta {
  font-size: 13px;
  color: var(--muted);
  background: var(--floor);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.cb-action { color: var(--orange-deep); font-weight: 600; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }

.cb-empty { padding: 14px 12px; color: var(--muted); font-size: 15px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  font: 600 16px/1 var(--body);
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, transform .1s ease;
}

.btn:hover { background: var(--ink-soft); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.btn-accent { background: var(--orange); }
.btn-accent:hover { background: var(--orange-deep); }

.btn-ghost {
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--line-strong);
}
.btn-ghost:hover { background: rgba(28, 24, 19, .05); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8c1d17; }

.btn-block { width: 100%; }

.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }

/* ---------- roster ---------- */

.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: roster;
  display: grid;
  gap: 0 20px;
}

@media (min-width: 520px) { .roster { grid-template-columns: 1fr 1fr; } }

.roster li {
  counter-increment: roster;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  min-height: 52px;
}

.roster li::before {
  content: counter(roster, decimal-leading-zero);
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  color: var(--orange);
  width: 30px;
  flex: none;
}

.roster .name { flex: 1; font-weight: 500; }

.you {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--orange);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: 2px;
}

.remove {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.remove:hover { background: #fbe9e7; border-color: var(--danger); }

/* ---------- team picker ---------- */

.segmented {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.segmented label {
  display: grid;
  place-items: center;
  height: 46px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  cursor: pointer;
  border-left: 1.5px solid var(--line-strong);
  transition: background .15s ease, color .15s ease;
}

.segmented label:first-of-type { border-left: 0; }
.segmented input:checked + label { background: var(--ink); color: var(--paper); }
.segmented input:focus-visible + label { box-shadow: inset 0 0 0 3px var(--orange); }

.btn-pair { display: grid; gap: 10px; }
@media (min-width: 520px) { .btn-pair { grid-template-columns: 1fr 1fr; } }

.teams-result:empty { display: none; }
.teams-result { margin-top: 22px; }

.matchup {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  animation: rise .35s ease both;
}

@media (min-width: 520px) {
  .matchup { grid-template-columns: 1fr auto 1fr; align-items: stretch; }
}

.team {
  border-radius: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--ink);
}

.team h3 { font-size: 22px; margin-bottom: 8px; display: flex; justify-content: space-between; }
.team h3 small { font-family: var(--body); font-size: 12px; font-weight: 600; letter-spacing: .12em; opacity: .7; }
.team ol { margin: 0; padding-left: 20px; }
.team li { padding: 2px 0; }
.team .ht { opacity: .6; font-size: 14px; }

.team.light { background: #fff; }
.team.dark { background: var(--ink); color: var(--paper); }

.vs {
  align-self: center;
  justify-self: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  color: var(--orange);
  text-transform: uppercase;
}

/* ---------- login ---------- */

.login {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.login-box { width: 100%; max-width: 380px; text-align: center; }

.login-box .ball { width: 64px; height: 64px; margin-bottom: 18px; }

.login-box h1 { font-size: 64px; }
.login-box h1 span { color: var(--orange); display: block; }

.login-box p { color: var(--muted); margin: 12px 0 26px; }

.login-box input {
  text-align: center;
  font-size: 20px;
  letter-spacing: .08em;
  margin-bottom: 12px;
}

/* ---------- footer ---------- */

footer {
  padding-top: 18px;
  padding-bottom: 28px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }

/* ---------- dialog ---------- */

dialog {
  width: min(92vw, 380px);
  padding: 24px;
  border: 0;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
}

dialog::backdrop { background: rgba(28, 24, 19, .55); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .18s ease both; }
dialog h2 { font-size: 30px; margin-bottom: 8px; }
dialog p { margin: 0 0 20px; color: var(--ink-soft); }
dialog .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog .actions.single { grid-template-columns: 1fr; }

/* ---------- motion ---------- */

.stagger > * { animation: rise .4s ease both; animation-delay: calc(var(--i, 0) * 50ms); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- no-show toggle (admin, on the game roster) ---------- */

.no-show {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font: 600 13px/1 var(--body);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.no-show svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.no-show .no-show-label { display: none; }
.no-show:hover { color: var(--danger); border-color: var(--danger); }
.no-show.is-marked { background: var(--danger); border-color: var(--danger); color: #fff; }
.no-show.is-marked .no-show-label { display: inline; }

/* ---------- admin (/panel) ---------- */

.wrap-wide { max-width: 1180px; }

.table-card { padding: 20px 0 8px; }
.table-card > .section-title { padding: 0 20px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 15px; }

.admin-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1.5px solid var(--line-strong);
  white-space: nowrap;
}

/* Sortable headers: the button inherits the th look; arrow shows direction. */
.admin-table th .sort {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.admin-table th .sort::after { content: "↕"; opacity: .35; font-size: 11px; }
.admin-table th[aria-sort="ascending"] .sort::after { content: "▲"; opacity: 1; color: var(--orange); }
.admin-table th[aria-sort="descending"] .sort::after { content: "▼"; opacity: 1; color: var(--orange); }
.admin-table th[aria-sort="ascending"], .admin-table th[aria-sort="descending"] { color: var(--ink); }
.admin-table th .sort:hover { color: var(--ink); }
.admin-table th .sort:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 4px; }

.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th:first-child, .admin-table td:first-child { padding-left: 20px; }
.admin-table th:last-child, .admin-table td:last-child { padding-right: 20px; }
.admin-table tbody tr:hover { background: rgba(226, 83, 11, .04); }
.admin-table a { text-decoration: none; }
.admin-table a:hover { color: var(--orange-deep); }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table tr.past td { color: var(--muted); }
.admin-table code { font-size: 14px; background: var(--floor); padding: 2px 6px; border-radius: 6px; }
.admin-table .muted { color: var(--muted); text-align: center; padding: 24px; }
.admin-table .pill { margin: 0 0 0 6px; }

/* Inline-editable cells look like text until you touch them. */
.editable td { position: relative; }
.editable input.cell, .editable .cell-height select {
  height: 38px;
  min-width: 90px;
  padding: 0 8px;
  font-size: 15px;
  background: transparent;
  border-color: transparent;
  border-radius: 8px;
}
.editable input.cell[data-field="email"] { min-width: 220px; }
.editable input.cell[data-field="phone"] { min-width: 130px; }
.editable input.cell:hover, .editable .cell-height select:hover { border-color: var(--line); background: #fff; }
.editable input.cell:focus, .editable .cell-height select:focus { background: #fff; }
.cell-height { display: inline-flex; gap: 2px; }
.editable .cell-height select { min-width: 58px; padding-right: 22px; background-position: right 6px center; }

.editable td.saving { opacity: .55; }
.editable td.saved::after, .editable td.error::after {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  pointer-events: none;
}
.editable td.saved::after { content: "✓"; color: #2e7d32; }
.editable td.error::after { content: "!"; color: var(--danger); }

.badge-danger {
  display: inline-block;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  text-align: center;
}

.table-more { padding: 14px 20px 10px; text-align: center; }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.actions-cell { white-space: nowrap; text-align: right; }
.actions-cell form { display: inline; }
.actions-cell .btn + form { margin-left: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

[hidden] { display: none !important; }
