/* DropinList — one stylesheet, phone first. */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --accent: #0f766e;        /* buttons, links (AA on white) */
  --accent-logo: #0d9488;
  --accent-soft: #ccfbf1;
  --on-accent: #ffffff;
  --ball: #f97316;
  --green: #15803d;  --green-soft: #dcfce7;
  --amber: #a16207;  --amber-soft: #fef3c7;
  --red: #b91c1c;    --red-soft: #fee2e2;
  --radius: 12px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --card: #111a2e; --text: #f1f5f9; --muted: #a3b1c6; --line: #22304a;
    --accent: #2dd4bf; --accent-logo: #2dd4bf; --accent-soft: #134e4a; --on-accent: #042f2e;
    --ball: #fb923c;
    --green: #4ade80; --green-soft: #14532d;
    --amber: #fbbf24; --amber-soft: #422006;
    --red: #f87171;   --red-soft: #450a0a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 4px 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Frame ---------------------------------------------------------------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.has-tabs .app { padding-bottom: calc(var(--tabbar) + var(--safe-b) + 24px); }
.has-action .app { padding-bottom: calc(var(--tabbar) + var(--safe-b) + 96px); }
main { padding: 8px 16px 24px; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  min-height: 56px; padding: 0 8px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid transparent;
}
.topbar h1 { flex: 1; font-size: 18px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 10px; color: var(--text); background: none; border: 0; cursor: pointer;
}
.icon-btn:hover { background: var(--line); text-decoration: none; }
.icon-btn svg { width: 22px; height: 22px; }

.brand { display: flex; align-items: center; gap: 0; padding: 0 8px; flex: 1; font-family: Outfit, Inter, system-ui, sans-serif; font-size: 22px; letter-spacing: -.4px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 700; }
.brand span { font-weight: 500; color: var(--accent-logo); }
.brand svg { width: 28px; height: 28px; margin-right: 8px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabbar nav { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); height: var(--tabbar); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }
.tabbar a:hover { text-decoration: none; color: var(--text); }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; }

.action-bar {
  position: fixed; left: 0; right: 0; z-index: 15; bottom: calc(var(--tabbar) + var(--safe-b));
  padding: 12px 16px; background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.action-bar > * { max-width: 448px; margin: 0 auto; }

/* --- Pieces ---------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

a.card { display: block; color: inherit; }
a.card.row { display: flex; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tools .btn { flex: 1 1 auto; }
a.card:hover { text-decoration: none; border-color: var(--accent); }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 0; list-style: none; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 56px; }
.list > li + li { border-top: 1px solid var(--line); }
.list .num { width: 22px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list a.rowlink { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; min-height: 44px; }
.list .chip { flex: none; }
.list a.rowlink:hover { text-decoration: none; }

.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; line-height: 1; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.chip.in { background: var(--green-soft); color: var(--green); }
.chip.wait { background: var(--amber-soft); color: var(--amber); }
.chip.warn { background: transparent; color: var(--amber); border: 1.5px solid var(--amber); }
.chip.off { background: var(--red-soft); color: var(--red); }
.chip.plain { background: var(--line); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 56px; font-size: 18px; border-radius: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-outline { background: var(--card); border-color: var(--red); color: var(--red); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.google { background: var(--card); color: var(--text); }
.btn svg { width: 20px; height: 20px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }

.pay { min-width: 52px; min-height: 36px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1.5px solid var(--red); background: transparent; color: var(--red); cursor: pointer; }
.pay.paid { border-color: var(--green); background: var(--green-soft); color: var(--green); }

/* Forms */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-size: 16px; /* 16px stops iOS zoom */
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; border-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 0; cursor: pointer; }
.toggle input { width: 24px; height: 24px; accent-color: var(--accent); }
.error { color: var(--red); font-size: 14px; margin-top: 4px; }

/* Messages */
.flash { margin: 8px 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-weight: 600; }
.flash.bad { background: var(--red-soft); color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty .btn { margin-top: 12px; }

/* Game page */
.game-head h1 { font-size: 26px; }
.game-meta { display: grid; gap: 6px; margin-top: 8px; color: var(--muted); }
.game-meta .row { gap: 8px; }
.game-meta svg { width: 18px; height: 18px; flex: none; }
.spots { margin-top: 16px; }
.spots .bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px; }
.spots .bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.spots .bar i.full { background: var(--amber); }

/* Event cards on lists */
.event-card .when { font-weight: 650; }
.event-card .sub { color: var(--muted); font-size: 14px; }
.daylabel { margin: 20px 4px 8px; font-size: 14px; font-weight: 650; color: var(--muted); }

/* Menu (<details>) */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-items {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 220px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.15); padding: 6px;
}
.menu-items a, .menu-items button {
  display: flex; width: 100%; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.menu-items a:hover, .menu-items button:hover { background: var(--bg); text-decoration: none; }
.menu-items .danger { color: var(--red); }
.menu-items form { margin: 0; }
.menu-items hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* Drag and drop (organizers) */
.drag-handle { touch-action: none; cursor: grab; color: var(--muted); flex: none; }
.drag-handle:active { cursor: grabbing; }
[data-drag-item].dragging { background: var(--accent-soft); opacity: .85; }
[data-drag-list] { min-height: 56px; }
body.is-dragging { user-select: none; -webkit-user-select: none; }

/* Teams */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.team h3 { font-size: 15px; display: flex; justify-content: space-between; margin-bottom: 8px; }
.team ol { margin: 0; padding-left: 20px; }
.team li { padding: 2px 0; }

/* Auth pages */
.hero { text-align: center; padding: 48px 8px 24px; }
.hero .logo { display: inline-flex; align-items: center; gap: 0; font-family: Outfit, Inter, system-ui, sans-serif; font-size: 36px; letter-spacing: -1px; }
.hero .logo svg { width: 48px; height: 48px; margin-right: 10px; }
.hero .logo b { font-weight: 700; }
.hero .logo span { font-weight: 500; color: var(--accent-logo); }
.hero p { color: var(--muted); margin-top: 8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 20px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.tabbar .side-brand { display: none; }
.lists-2 > div > h2:first-child { margin-top: 24px; }

/* --- Laptop and desktop: sidebar, wider pages, side-by-side lists --------------- */
@media (min-width: 900px) {
  body.has-tabs { padding-left: 232px; }
  .app { max-width: 620px; }
  body.wide .app { max-width: 1120px; }
  main { padding: 8px 24px 32px; }
  .topbar { padding: 0 16px; }
  .has-tabs .app { padding-bottom: 48px; }
  .has-action .app { padding-bottom: 120px; }
  .has-tabs .topbar .brand { display: none; }

  .tabbar { top: 0; right: auto; width: 232px; border-top: 0; border-right: 1px solid var(--line); padding: 20px 12px; }
  .tabbar nav { display: flex; flex-direction: column; gap: 4px; height: auto; max-width: none; margin: 0; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 16px; min-height: 48px; padding: 0 14px; border-radius: 10px; }
  .tabbar a[aria-current="page"] { background: var(--accent-soft); }
  .tabbar .side-brand { display: flex; gap: 0; padding: 4px 14px 20px; min-height: 0; flex: none; font-size: 22px; }
  .tabbar .side-brand:hover { background: none; }

  .has-tabs .action-bar { left: 232px; bottom: 0; }
  .action-bar > * { max-width: 420px; }

  .game-grid { display: grid; grid-template-columns: minmax(280px, 320px) 1fr; gap: 28px; align-items: start; }
  .game-side { position: sticky; top: 64px; }
  .lists-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 20px; align-items: start; }
  .lists-2 > div:empty { display: none; }
  .teams-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 24px; align-items: start; }
  .cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; align-items: start; }
  .cards-grid > .card + .card { margin-top: 0; }
  .flash { margin: 8px 24px 0; }
}

/* Place suggestions under a field */
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; padding: 10px 14px; min-height: 48px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer; }
.suggest button:hover, .suggest button.on { background: var(--line); }
.suggest button strong { display: block; font-weight: 600; }
.suggest button span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-by { padding: 6px 14px; font-size: 11px; color: var(--muted); text-align: right; }

/* Player rows: full name wraps instead of being cut off; details on a second line */
.list li .name { white-space: normal; overflow-wrap: anywhere; }
.list li .name .meta { display: block; font-size: 13px; color: var(--muted); }
.list li .pay { flex: none; }
@media (max-width: 420px) {
  .list li { gap: 6px; }
  .list li .pay { padding-left: 10px; padding-right: 10px; }
}
.suggest.up { top: auto; bottom: 100%; margin: 0 0 4px; }
