/* Morning at the park: court green, spruce ink, chalk background, ball yellow for the one main button.
   Layout: one left-aligned column for a phone, tabs along the bottom, every match drawn as a court. */
:root {
  --chalk: #F5FAEE;
  --court: #2F8F6B;
  --kitchen: #56AD8A;
  --ink: #14342B;
  --muted: #4E6A60;
  --soft: #DFF0DA;
  --ball: #E1EE3A;
  --line: #FFFFFF;
  --rule: #CFE3CC;
  --warn: #9B2C1F;
  --display: 'Bricolage Grotesque', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabs-h: 58px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--chalk); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; overflow-x: clip; }
#view {
  display: flex; flex-direction: column; gap: 18px;
  padding-block: calc(22px + env(safe-area-inset-top, 0px)) calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom, 0px));
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
}
#view:focus { outline: none; }

/* type */
h1, h2 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; }
h1 { font-size: 30px; line-height: 1.08; letter-spacing: -.02em; }
h2 { font-size: 19px; line-height: 1.2; }
p { margin: 0; max-width: 60ch; }
.lede { font-size: 17px; color: var(--muted); }
.note { color: var(--muted); font-size: 15px; }
.where { color: var(--muted); font-size: 15px; font-weight: 500; }
section { display: flex; flex-direction: column; gap: 10px; }

/* opening header with the ball */
.hello { position: relative; display: flex; flex-direction: column; gap: 2px; padding-right: 84px; }
.hello small { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.brand { font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--ink); margin-right: 8px; letter-spacing: -.01em; }
.ball, .dots {
  border-radius: 50%; background-color: var(--ball);
  background-image: radial-gradient(circle, var(--chalk) 0 4.5px, transparent 5px); background-size: 22px 22px; background-position: 6px 6px;
}
.ball { position: absolute; right: -34px; top: -40px; width: 104px; height: 104px; }

/* banners: something is waiting on you */
.banner { background: var(--ink); color: var(--chalk); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; font-weight: 600; text-decoration: none; line-height: 1.3; }
.banner .go { flex: 0 0 auto; background: var(--chalk); color: var(--ink); border-radius: 999px; padding: 5px 12px; font-size: 14px; }

/* the court: every match */
.court { display: block; background: var(--court); color: var(--line); border-radius: 18px; padding: 10px; position: relative; text-decoration: none; }
.court + .court { margin-top: 2px; }
.court .lines { border: 2.5px solid var(--line); border-radius: 6px; display: grid; grid-template-rows: 1fr auto auto 1fr; }
.court .half { padding: 12px 12px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; }
.court .nm { font-weight: 700; font-size: 16px; line-height: 1.25; min-width: 0; }
.court .nm small { display: inline-block; font-weight: 600; font-size: 12.5px; margin-left: 8px; padding: 1px 8px; border-radius: 999px; border: 1.5px solid currentColor; vertical-align: 1px; }
.court .half.won .nm small:last-child { background: var(--ball); color: var(--ink); border-color: var(--ball); }
.court .games { display: flex; gap: 10px; font-family: var(--display); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; opacity: .8; }
.court .half.won .games { opacity: 1; }
.court .games b { font-weight: 700; min-width: 1.1em; text-align: right; }
.court .kit { background: var(--kitchen); height: 18px; }
.court .kit.top { border-top: 2.5px solid var(--line); }
.court .kit.bot { border-bottom: 2.5px solid var(--line); }
.court .net { position: absolute; left: 4px; right: 4px; top: 50%; height: 0; border-top: 3px dashed var(--line); display: flex; justify-content: center; pointer-events: none; }
.court .net span { position: relative; top: -15px; height: 27px; background: var(--chalk); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.court.due .net span { background: var(--ball); }
.court.open .net span { background: var(--ink); color: var(--chalk); }
.court.off { background: var(--muted); }
.court.off .kit { background: transparent; }
.court.scoring .ins { display: flex; gap: 6px; flex: 0 0 auto; }
.court.scoring input { width: 46px; height: 46px; border-radius: 10px; border: 0; background: var(--chalk); color: var(--ink); font-family: var(--display); font-size: 22px; font-weight: 700; text-align: center; padding: 0; -moz-appearance: textfield; }
.court.scoring input::-webkit-outer-spin-button, .court.scoring input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.court.scoring input:focus-visible { outline: 3px solid var(--ball); outline-offset: 1px; }

/* free times: days as a week of dots, the time in words beside it */
.free { display: flex; flex-direction: column; gap: 5px; margin-top: 5px; }
.fw { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.wk { display: flex; gap: 3px; }
.wk i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--muted); border: 1.5px solid var(--rule); }
.wk i.on { background: var(--court); border-color: var(--court); color: var(--line); }
.tm { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; }
.tm.none { font-family: var(--body); font-weight: 500; font-size: 13.5px; color: var(--muted); }

/* plain rows: teams and players */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1.5px solid var(--rule); }
.row:first-child { border-top: 0; padding-top: 0; }
.rowmain { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-decoration: none; }
.av { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.who { flex: 1; min-width: 0; font-weight: 600; font-size: 15.5px; line-height: 1.25; }
.who small { display: block; font-weight: 500; font-size: 13.5px; color: var(--muted); }
.pill { flex: 0 0 auto; border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 700; text-decoration: none; background: transparent; color: var(--ink); min-height: 36px; display: inline-flex; align-items: center; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { flex: 0 0 auto; font-size: 13px; font-weight: 700; background: var(--soft); border-radius: 999px; padding: 4px 10px; }

/* wins and losses */
.table { list-style: none; margin: 0; padding: 0; counter-reset: place; }
.table li { counter-increment: place; display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1.5px solid var(--rule); font-weight: 600; font-size: 15.5px; }
.table li:first-child { border-top: 0; }
.table li::before { content: counter(place); flex: 0 0 1.4em; color: var(--muted); font-variant-numeric: tabular-nums; }
.table a { flex: 1; min-width: 0; text-decoration: none; }
.table .wl { font-family: var(--display); font-size: 19px; font-variant-numeric: tabular-nums; }

/* buttons: one yellow one per screen */
.btn, .btn-line, .btn-quiet { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border-radius: 999px; padding: 12px 18px; font: 700 17px/1.2 var(--body); text-align: center; text-decoration: none; cursor: pointer; }
.btn { background: var(--ball); color: var(--ink); border: 0; }
.btn-line { background: transparent; color: var(--ink); border: 2px solid var(--ink); min-height: 48px; font-size: 16px; }
.btn-quiet { background: transparent; color: var(--muted); border: 0; min-height: 44px; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
.btn:active, .btn-line:active, .pill:active, .chip:active { transform: translateY(1px); }
.back { align-self: flex-start; font-size: 14.5px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px 0; }
.back::before { content: "\2039\00a0"; }
.back.center { align-self: center; }
.back.center::before { content: none; }

/* forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label, label.inline { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; }
.form input:not([type=checkbox]):not([type=radio]):not([type=number]), select {
  font: 500 17px/1.2 var(--body); color: var(--ink); background: var(--line); border: 2px solid var(--rule); border-radius: 12px; padding: 12px 14px; width: 100%; min-height: 50px;
}
.form input:focus-visible, select:focus-visible { outline: 3px solid var(--court); outline-offset: 0; border-color: var(--court); }
.hint { font-weight: 500; font-size: 13.5px; color: var(--muted); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.radios { display: flex; flex-direction: column; gap: 4px; }
.radios label, label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; font-size: 15.5px; padding: 6px 0; }
.radios input, .check input { width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--court); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { float: left; width: 100%; }
.chip { font: 600 15px/1 var(--body); color: var(--ink); background: var(--line); border: 2px solid var(--rule); border-radius: 999px; padding: 10px 14px; min-height: 42px; cursor: pointer; }
.chip.on { background: var(--court); border-color: var(--court); color: var(--line); }
.window { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; border-bottom: 1.5px solid var(--rule); }
.fromto { display: flex; gap: 10px; align-items: flex-end; }
.fromto label { flex: 1; }
.fromto .btn-quiet { width: auto; flex: 0 0 auto; min-height: 50px; }
.heads-up { background: var(--soft); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.heads-up h2 { font-size: 17px; }
.heads-up p { font-size: 15px; }
.error { color: var(--warn); font-weight: 600; font-size: 15px; }
.msg { background: var(--soft); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.msg p { overflow-wrap: anywhere; }

/* your code */
.qr { align-items: center; text-align: center; background: var(--court); color: var(--line); border-radius: 22px; padding: 22px 18px;
  background-image: linear-gradient(transparent 0 190px, var(--court) 250px), radial-gradient(circle, var(--kitchen) 0 5px, transparent 5.5px); background-size: auto, 26px 26px; }
.qr .code { background: var(--line); border-radius: 16px; padding: 16px; width: min(230px, 70%); }
.qr .code svg { display: block; width: 100%; height: auto; }
.qr p { font-size: 15px; font-weight: 500; max-width: 30ch; }

/* empty states and preview tools */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 4px 0; color: var(--muted); }
.empty .dots { width: 56px; height: 56px; background-size: 16px 16px; background-position: 4px 4px; background-image: radial-gradient(circle, var(--chalk) 0 3.2px, transparent 3.7px); }
.tools { border: 2px dashed var(--rule); border-radius: 16px; padding: 16px; margin-top: 8px; }
.tools p { font-size: 14.5px; color: var(--muted); }

/* sign-up page: how it works, and a look at a match */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; min-height: 32px; font-size: 15.5px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--court); color: var(--line); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 16px; }
.steps b { font-weight: 700; }
.peek { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.peek figcaption { font-size: 13.5px; color: var(--muted); }
#signup-form { scroll-margin-top: 16px; padding-top: 6px; }

/* who runs this */
.host { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--line); border: 2px solid var(--rule); border-radius: 16px; padding: 10px 14px; font: 700 16px/1.25 var(--body); color: var(--ink); cursor: pointer; }
.host img, #about img { border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.host small { display: block; font-weight: 500; font-size: 13.5px; color: var(--muted); }
.foot { margin-top: 10px; padding-top: 14px; border-top: 1.5px solid var(--rule); }
.link { background: none; border: 0; padding: 6px 0; font: 600 14.5px/1.2 var(--body); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
#about { border: 0; border-radius: 22px; padding: 24px 20px 18px; width: min(360px, calc(100% - 32px)); background: var(--chalk); color: var(--ink); text-align: center; }
#about[open] { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#about::backdrop, #fb-shade { background: rgba(20, 52, 43, .55); }
#about p { font-size: 15.5px; }

/* feedback: a tab on the right edge that slides a short form in from the side */
#fb-tab { position: fixed; right: 0; top: 40%; z-index: 6; writing-mode: vertical-rl; background: var(--ink); color: var(--chalk); border: 0; border-radius: 10px 0 0 10px; padding: 12px 6px; font: 700 13px/1 var(--body); letter-spacing: .02em; cursor: pointer; padding-right: calc(6px + env(safe-area-inset-right, 0px)); }
#fb-shade { position: fixed; inset: 0; z-index: 7; }
#fb { position: fixed; top: 0; right: 0; bottom: 0; z-index: 8; width: min(340px, 90vw); background: var(--chalk); overflow-y: auto; transform: translateX(100%); box-shadow: -8px 0 24px rgba(20, 52, 43, .18);
  padding: calc(22px + env(safe-area-inset-top, 0px)) calc(18px + env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) 18px; }
#fb.open { transform: none; }
.kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.kinds legend { float: left; width: 100%; }
.kinds label { flex-direction: row; gap: 0; position: relative; }
.kinds input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.kinds span { display: inline-flex; align-items: center; min-height: 42px; padding: 10px 14px; border-radius: 999px; border: 2px solid var(--rule); background: var(--line); font-weight: 600; font-size: 15px; }
.kinds input:checked + span { background: var(--court); border-color: var(--court); color: var(--line); }
.kinds input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
textarea { font: 500 16px/1.4 var(--body); color: var(--ink); background: var(--line); border: 2px solid var(--rule); border-radius: 12px; padding: 12px 14px; width: 100%; resize: vertical; }
textarea:focus-visible { outline: 3px solid var(--court); outline-offset: 0; border-color: var(--court); }

/* tabs */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; max-width: 480px; margin: 0 auto; background: var(--chalk); border-top: 1.5px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
#tabs a { flex: 1; height: var(--tabs-h); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; border-top: 3px solid transparent; margin-top: -1.5px; }
#tabs a[aria-current] { color: var(--ink); border-top-color: var(--court); }
#tabs .count { background: var(--ink); color: var(--chalk); border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; display: inline-grid; place-items: center; }

#toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 9; background: var(--ink); color: var(--chalk); border-radius: 999px; padding: 10px 18px; font-size: 15px; font-weight: 600; max-width: calc(100% - 32px); text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .chip, .btn, .btn-line, .pill { transition: transform .08s ease; }
  #fb { transition: transform .2s ease; }
}
