/* Layout idea: a midnight venue with ice-blue lights and cool white scorecards on top. */
@font-face { font-family: "Big Shoulders"; font-weight: 700; font-display: swap; src: url("/fonts/big-shoulders-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Big Shoulders"; font-weight: 800; font-display: swap; src: url("/fonts/big-shoulders-display-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("/fonts/barlow-latin-700-normal.woff2") format("woff2"); }

:root {
  --felt: #0b1020;
  --felt-2: #161d36;
  --felt-3: #253058;
  --paper: #f3f6fb;
  --paper-2: #e2e8f2;
  --ink: #0e1424;
  --muted: #56627c;
  --line: #d2dae7;
  --red: #d6105c;
  --brass: #5ee0ff;
  --on-felt: #e8edf8;
  --on-felt-2: #9aa7c7;
  --display: "Big Shoulders", "Arial Narrow", Impact, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--felt);
  color: var(--on-felt);
  font: 500 16px/1.4 var(--body);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
img { max-width: 100%; display: block; }

.shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 92px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font: 800 30px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.brand span { color: var(--brass); }
.brand-sub { color: var(--on-felt-2); font-size: 13px; }
.demo-note { background: var(--brass); color: var(--ink); padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.offline-note { background: var(--felt-3); padding: 8px 12px; border-radius: 8px; font-size: 14px; }

/* Avatars */
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--felt-3); }
.avatar.mono { display: grid; place-items: center; font: 800 18px/1 var(--display); color: var(--ink); }
.avatar.lg { width: 96px; height: 96px; font-size: 40px; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.c0 { background: #5ee0ff; } .c1 { background: #a9b6ff; } .c2 { background: #ff92b9; }
.c3 { background: #7ff2cf; } .c4 { background: #d6bcff; } .c5 { background: #a3d4ff; }

/* Bottom nav */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #070a15; border-top: 1px solid var(--felt-3);
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; color: var(--on-felt-2); font-size: 12px; font-weight: 600; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--brass); }

/* Pills, segmented */
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--felt-2); color: var(--on-felt); font-weight: 600; font-size: 15px; }
.pill.on { background: var(--brass); color: var(--ink); }

.days { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.day { background: var(--felt-2); border-radius: 10px; padding: 8px 0 6px; text-align: center; font-weight: 600; font-size: 13px; color: var(--on-felt-2); }
.day b { display: block; font: 800 25px/1 var(--display); color: var(--on-felt); }
.day.on { background: var(--brass); color: var(--ink); }
.day.on b { color: var(--ink); }

/* Headings on felt */
.title { font: 800 40px/1 var(--display); text-transform: uppercase; text-wrap: balance; }
.lede { color: var(--on-felt-2); }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--brass); letter-spacing: .05em; text-transform: uppercase; }
.section-title { font: 800 25px/1.05 var(--display); text-transform: uppercase; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Paper card */
.card { background: var(--paper); color: var(--ink); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card.flush { padding: 0; overflow: hidden; gap: 0; }
.card h3 { font: 800 23px/1.05 var(--display); text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card a.map { color: var(--felt-2); font-weight: 600; text-underline-offset: 2px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 2px 8px; border-radius: 5px; background: var(--paper-2); color: var(--ink); font-size: 13px; font-weight: 600; }
.tag.red { background: var(--red); color: #fff; }
.tag.green { background: var(--felt-2); color: #fff; }

/* Timeline */
.item { display: grid; grid-template-columns: 62px 1fr; gap: 10px; background: var(--paper); color: var(--ink); border-radius: 12px; padding: 13px; }
.item.next { box-shadow: 0 0 0 3px var(--brass); }
.item-time { font: 800 21px/1.1 var(--display); font-variant-numeric: tabular-nums; color: var(--felt-2); }
.item h3 { font: 700 19px/1.15 var(--body); }
.item-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.link-btn { align-self: flex-start; color: var(--red); font-weight: 700; font-size: 14px; }

/* Leaderboard */
.row { display: grid; grid-template-columns: 26px 40px 1fr auto; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row.me { background: #dff5fc; }
.place { font: 800 22px/1 var(--display); text-align: center; font-variant-numeric: tabular-nums; }
.name { font-weight: 700; overflow-wrap: anywhere; }
.sub { font-size: 13px; color: var(--muted); }
.score { font: 800 30px/1 var(--display); font-variant-numeric: tabular-nums; text-align: right; }
.score.under { color: var(--red); }

/* Scorecard grid */
.grid-wrap { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 15px; }
.grid th, .grid td { padding: 6px 3px; text-align: center; border-bottom: 1px solid var(--line); min-width: 30px; }
.grid th:first-child, .grid td:first-child { position: sticky; left: 0; background: var(--paper); text-align: left; padding-left: 10px; max-width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.grid thead th { background: var(--felt-2); color: #fff; font: 800 16px/1 var(--display); }
.grid thead th:first-child { background: var(--felt-2); }
.grid .par td { background: var(--paper-2); font-weight: 600; }
.grid .par td:first-child { background: var(--paper-2); }
.mark { display: inline-grid; place-items: center; width: 25px; height: 25px; }
.mark.birdie { border: 2px solid var(--red); border-radius: 50%; color: var(--red); font-weight: 700; }
.mark.eagle { border: 2px solid var(--red); border-radius: 50%; outline: 2px solid var(--red); outline-offset: 1px; color: var(--red); font-weight: 700; }
.mark.bogey { border: 2px solid var(--ink); }
.mark.double { border: 2px solid var(--ink); outline: 2px solid var(--ink); outline-offset: 1px; }

/* Score entry */
.holes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.hole-btn { aspect-ratio: 1; background: var(--felt-2); border-radius: 8px; font: 800 21px/1 var(--display); color: var(--on-felt); }
.hole-btn.done { background: var(--felt-3); color: var(--brass); }
.hole-btn.on { background: var(--brass); color: var(--ink); }
.hole-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.par-badge { flex: none; background: var(--felt); color: #fff; border-radius: 8px; padding: 6px 10px; text-align: center; font: 800 26px/1 var(--display); }
.par-badge small { display: block; font: 700 11px/1.2 var(--body); letter-spacing: .05em; }
.hazard { background: #fce6ef; border-left: 4px solid var(--red); padding: 8px 10px; border-radius: 0 8px 8px 0; font-size: 15px; }
.entry { padding: 11px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.entry.me { background: #dff5fc; }
.entry-top { display: flex; align-items: center; gap: 10px; }
.entry-top .name { flex: 1; }
.entry-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper label, .stepper .lbl { font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 3px; text-transform: uppercase; }
.step { width: 40px; height: 40px; border-radius: 8px; background: var(--felt); color: #fff; font: 700 23px/1 var(--body); }
.step:disabled { opacity: .3; }
.step-val { min-width: 32px; text-align: center; font: 800 27px/1 var(--display); font-variant-numeric: tabular-nums; }
.ghost { padding: 8px 11px; border-radius: 8px; background: var(--paper-2); font-weight: 600; font-size: 14px; color: var(--ink); }
.ghost.danger { color: var(--red); }
.ghost.active { background: var(--red); color: #fff; }

/* Forms and buttons */
.btn { display: block; width: 100%; padding: 13px; border-radius: 10px; background: var(--brass); color: var(--ink); font: 800 21px/1 var(--display); text-transform: uppercase; text-align: center; }
.btn:disabled { opacity: .5; }
.btn.dark { background: var(--felt); color: #fff; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.field input, .field select, .field textarea { padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 17px; font-weight: 500; width: 100%; }
textarea { resize: vertical; font: inherit; }
.edit-start { align-self: flex-start; }
.search { padding: 11px 13px; border-radius: 10px; border: 0; background: var(--paper); color: var(--ink); width: 100%; font-size: 16px; }
.err { color: var(--red); font-weight: 600; font-size: 15px; }
.join { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 24px 16px; max-width: 460px; margin: 0 auto; }
.join-title { font: 800 72px/.9 var(--display); text-transform: uppercase; }
.join-title span { color: var(--brass); display: block; }
.photo-pick { display: flex; align-items: center; gap: 14px; }
input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.ghost { cursor: pointer; }
.file-btn { padding: 10px 14px; border-radius: 8px; background: var(--felt); color: #fff; font-weight: 600; cursor: pointer; }
.switch { color: var(--on-felt-2); text-align: center; text-decoration: underline; }

/* Tournament */
.event-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; width: 100%; text-align: left; }
.rules { display: flex; flex-direction: column; gap: 5px; font-size: 15px; }
.rules li { padding-left: 15px; position: relative; }
.rules li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; background: var(--red); border-radius: 50%; }
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 9px; background: var(--paper-2); width: 100%; text-align: left; font-weight: 600; color: var(--ink); }
.rank-item.placed { background: var(--felt); color: #fff; }
.rank-n { width: 22px; text-align: center; font: 800 21px/1 var(--display); }
.bracket { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.round { flex: none; width: 152px; display: flex; flex-direction: column; justify-content: space-around; gap: 8px; }
.round h4 { margin: 0; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.match { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.side { display: flex; align-items: center; gap: 6px; padding: 6px 7px; width: 100%; text-align: left; font-size: 14px; font-weight: 600; min-height: 40px; color: var(--ink); }
.side + .side { border-top: 1px solid var(--line); }
.side span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side.win { background: var(--felt); color: #fff; }
.side.empty { color: var(--muted); font-weight: 500; }

/* Crew */
.crew { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.crew-p { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.crew-p .avatar { width: 76px; height: 76px; font-size: 32px; }
.profile { flex-direction: row; align-items: center; gap: 14px; }
.profile > div:not(.avatar) { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.admin-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; padding: 7px 0; border-top: 1px solid var(--line); }
.admin-row:first-child { border-top: 0; }
.admin-row input { width: 92px; padding: 7px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 15px; }
.audit { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding: 4px 0; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 30; max-width: 528px; margin: 0 auto; background: var(--red); color: #fff; padding: 11px 14px; border-radius: 10px; font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  .step:active, .btn:active, .pill:active { transform: scale(.96); }
}

/* Ice blue is too light on white cards, so use a deeper blue there. */
.card .eyebrow, .item .eyebrow { color: #0a74a0; }
