/* Savage Slicers: "The Sticker". Cream paper, thick ink outlines, hard offset shadows, red / green / yellow. */
:root {
  --cream: #fff0cf;
  --cream-2: #ffe4a8;
  --ink: #1b1a17;
  --ink-2: #4a4638;      /* secondary text, 8:1 on cream */
  --rule: rgba(27, 26, 23, .22);
  --green: #1f7a3e;
  --red: #ff4b2b;        /* fills only: logo, stamps. Text uses --red-text */
  --red-text: #b3260e;   /* 5.5:1 on cream and on white */
  --yellow: #ffd23f;
  --card: #fff;
  --out: cubic-bezier(.16, 1, .3, 1);
  --display: "Bowlby One", "Arial Black", Impact, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 4px 4px 0 var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--cream); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink);
  font: 500 16px/1.45 var(--body);
  font-variant-numeric: tabular-nums;
  padding: 0 18px calc(104px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
::selection { background: var(--ink); color: var(--yellow); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
* { scrollbar-color: var(--ink) var(--cream-2); }
[hidden] { display: none !important; }

.mast, main { max-width: 780px; margin-inline: auto; }

/* Masthead */
.mast {
  padding: 10px 0 18px;
  background: radial-gradient(circle at 93% 62%, var(--yellow) 0 3.1rem, transparent 3.15rem);
}
.top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 44px; }
.logo {
  position: relative; margin: .3em 0 6px; transform: rotate(-3deg); transform-origin: 0 100%;
  font: 400 clamp(2.6rem, 14.5vw, 5.4rem)/1.02 var(--display); text-transform: uppercase; letter-spacing: .01em;
  -webkit-text-stroke: .07em var(--ink); paint-order: stroke fill; text-shadow: .05em .06em 0 var(--ink);
}
.logo .l1, .logo .l2 { display: block; white-space: nowrap; }
.l1 { color: var(--red); }
.l2 { color: var(--green); }
.strap {
  margin: 16px 0 0; font-size: .9rem; font-weight: 700;
}
.strap #edition {
  display: inline-block; margin-right: 8px; padding: 3px 10px; border-radius: 99px; background: var(--ink); color: var(--cream);
  font-size: .78rem; font-weight: 800; text-transform: uppercase;
}

/* Headlines */
.big { margin: 20px 0 6px; font: 400 clamp(1.7rem, 7vw, 2.4rem)/1.05 var(--display); text-transform: uppercase; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 400; font-size: 1.35rem; line-height: 1.1; margin: 28px 0 8px; text-transform: uppercase; }
.sub, .muted { color: var(--ink-2); }
.sub { margin: 0 0 16px; max-width: 60ch; font-size: .95rem; font-weight: 600; }
.empty { padding: 28px 0; color: var(--ink-2); font-weight: 600; }

/* Admin stamp */
.stamp {
  min-height: 44px; padding: 0 14px; border: 3px solid var(--ink); border-radius: 99px; background: var(--cream-2); color: var(--ink);
  font: 800 .8rem/1 var(--body); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; box-shadow: 3px 3px 0 var(--ink);
  transition: transform .15s var(--out), box-shadow .15s var(--out), background .15s;
}
.stamp b { margin-left: 6px; padding: 3px 8px; border-radius: 99px; background: var(--ink); color: var(--cream); }
.stamp:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.stamp:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.stamp[aria-pressed="true"] { background: var(--red); }
.stamp[aria-pressed="true"] b { background: var(--ink); color: var(--yellow); }

/* Bottom tab bar: a floating ink pill */
.tabs {
  position: fixed; z-index: 5; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); width: min(760px, calc(100% - 20px));
  transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; background: var(--ink); border-radius: 18px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 1 0 auto; min-width: 0; min-height: 48px; padding: 0 8px; border: 0; border-radius: 12px; background: none; color: var(--cream);
  font: 800 .78rem/1 var(--body); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s;
}
.tabs .short { display: none; }
@media (max-width: 560px) {
  .tabs { gap: 2px; padding: 5px; }
  .tabs button { padding: 0 4px; font-size: .72rem; }
  .tabs .long { display: none; }
  .tabs .short { display: inline; }
}
.tabs button:hover { background: rgba(255, 240, 207, .14); }
.tabs button[aria-current] { background: var(--yellow); color: var(--ink); }
.tabs :focus-visible { outline-color: var(--yellow); outline-offset: -3px; }
.tabs button[data-n]:not([data-n=""])::after { content: attr(data-n); margin-left: .3em; background: var(--red); color: var(--ink); border-radius: 99px; padding: 1px .45em; font-size: .9em; }

/* League table: each row is a sticker */
.sheet, .panel { overflow-x: auto; padding: 0 4px 6px 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 8px; text-align: right; white-space: nowrap; }
th:nth-child(-n+2), td:nth-child(-n+2) { text-align: left; }
th { font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); border-bottom: 3px solid var(--ink); }
tbody tr + tr td { border-top: 1.5px solid var(--rule); }
td.pos { width: 44px; font: 400 1.4rem/1 var(--display); }
td.name { font-weight: 800; white-space: normal; }
td.name small { display: block; margin-top: 2px; font-size: .8rem; font-weight: 700; color: var(--ink-2); }
td small { font-size: .8rem; color: var(--ink-2); }
table.league { border-collapse: separate; border-spacing: 0 10px; margin-top: -6px; }
table.league th { border-bottom: 0; padding-block: 4px; }
table.league tbody tr + tr td { border-top: 3px solid var(--ink); }
table.league td { padding-block: 14px; background: var(--card); border-block: 3px solid var(--ink); }
table.league td:first-child { border-left: 3px solid var(--ink); border-radius: 14px 0 0 14px; }
table.league td:last-child { border-right: 3px solid var(--ink); border-radius: 0 14px 14px 0; }
table.league td.pts { font: 400 1.7rem/1 var(--display); }
table.league tr.lead td { background: var(--yellow); }
tr.lead td.pos, tr.lead td.pts { color: #a81d08; }
tr.lead td.name { font-size: 1.12rem; }
tr.click { cursor: pointer; }

/* Rows slide up in turn when a tab is freshly opened */
.fresh tbody tr { animation: stick-in .5s var(--out) both; }
.fresh tbody tr:nth-child(2) { animation-delay: .05s; }
.fresh tbody tr:nth-child(3) { animation-delay: .1s; }
.fresh tbody tr:nth-child(4) { animation-delay: .15s; }
.fresh tbody tr:nth-child(5) { animation-delay: .2s; }
.fresh tbody tr:nth-child(n+6) { animation-delay: .25s; }
@keyframes stick-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Events, casual rounds and handicaps: one sticker card each */
.list { display: grid; gap: 12px; }
details.card { background: var(--card); border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); }
details.card > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 10px 14px; cursor: pointer; border-radius: 11px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .t { font: 800 1.15rem/1.15 var(--body); }
details.card > summary .m { color: var(--ink-2); font-size: .88rem; font-weight: 600; }
details.card > summary .v { font: 400 1.8rem/1 var(--display); }
details.card[open] { background: var(--cream-2); }
details.card[open] > summary { border-bottom: 3px solid var(--ink); border-radius: 11px 11px 0 0; }
details.card .body { overflow-x: auto; padding: 4px 14px 8px; }
div.card.invite { background: var(--cream-2); border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px 4px; }
.list:has(.invite) { margin-bottom: 14px; }
.invite .t { font: 800 1.15rem/1.15 var(--body); }
.invite .m { color: var(--ink-2); font-size: .88rem; font-weight: 600; }
.body th, .body td { padding: 10px 6px; }
.body td:nth-child(2) { white-space: normal; }
.body .btn { min-height: 44px; min-width: 44px; padding: 0 12px; margin-left: 6px; }
.winner { font: 400 .95rem/1 var(--display); text-transform: uppercase; color: var(--red-text); }
.winner::before { content: "Winner "; color: var(--ink-2); font: 800 .72rem var(--body); letter-spacing: .06em; }
.chip {
  display: inline-block; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 99px; background: var(--yellow);
  font: 800 .72rem/1.4 var(--body); letter-spacing: .06em; text-transform: uppercase; vertical-align: 2px;
}
.chip.major { background: var(--ink); color: var(--yellow); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; }
.etype { font-weight: 600; color: var(--ink-2); }

/* Majors */
.majors { display: grid; gap: 16px; }
section.major { display: grid; grid-template-columns: minmax(110px, 36%) 1fr; gap: 16px; padding: 14px; background: var(--card); border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); }
section.major img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border: 3px solid var(--ink); border-radius: 10px; background: var(--cream-2); }
.mname { margin: 0 0 10px; font: 400 clamp(1.7rem, 8vw, 2.6rem)/.98 var(--display); text-transform: uppercase; }
.roll { margin: 0; padding: 0; list-style: none; }
.roll li { display: grid; grid-template-columns: 3.4rem 1fr auto; gap: 8px; align-items: baseline; padding: 8px 0; border-top: 1.5px solid var(--rule); }
.roll .yr { font: 400 1.1rem/1 var(--display); }
.roll .nm { font-weight: 800; }
.roll .sc { color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.roll li:first-child .nm { color: var(--red-text); }
.none, .soon { margin: 0 0 6px; color: var(--ink-2); font-size: .92rem; font-weight: 600; }
.soon { padding-top: 6px; font-weight: 700; }
.credits { margin: 18px 0 0; font-size: .8rem; color: var(--ink-2); max-width: 70ch; }
@media (min-width: 640px) { section.major { grid-template-columns: 220px 1fr; gap: 24px; } }
.rollhd { margin: 14px 0 4px; color: var(--ink-2); font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.allwin { margin-top: 14px; border-top: 3px solid var(--ink); }
.allwin summary { padding: 12px 0; min-height: 44px; cursor: pointer; font-weight: 800; text-transform: uppercase; font-size: .82rem; letter-spacing: .05em; }
.allwin .roll li { padding: 6px 0; }

/* Notifications */
.notes { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.note { display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; padding: 12px 14px; background: var(--card); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); }
.note time { padding-top: .15rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
@media (max-width: 520px) { .note { grid-template-columns: 1fr; gap: .15rem; } }

/* Buttons + fields */
.btn {
  min-height: 44px; padding: 0 16px; border: 3px solid var(--ink); border-radius: 12px; background: var(--card); color: var(--ink);
  font: 800 .82rem/1 var(--body); letter-spacing: .04em; text-transform: uppercase; cursor: pointer; box-shadow: 3px 3px 0 var(--ink);
  transition: transform .15s var(--out), box-shadow .15s var(--out), background .15s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); background: var(--cream-2); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.btn.primary { background: var(--yellow); }
.btn.primary:hover { background: #ffdf6e; }
.btn.danger { color: var(--red-text); }
.btn.quiet { border-color: transparent; background: none; box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
.btn.quiet:hover { transform: none; background: none; color: var(--green); box-shadow: none; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }

dialog { scrollbar-width: thin; width: min(480px, calc(100vw - 24px)); max-height: 90dvh; padding: 0; border: 3px solid var(--ink); border-radius: 18px; background: var(--cream); color: var(--ink); overflow: auto; box-shadow: 6px 6px 0 var(--ink); }
dialog::backdrop { background: rgba(27, 26, 23, .7); }
dialog form { display: grid; gap: 14px; padding: 20px; }
dialog h3 { margin: 0; font: 400 1.5rem/1.05 var(--display); text-transform: uppercase; }
label.f { display: grid; align-content: end; gap: 6px; color: var(--ink-2); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
input, select {
  width: 100%; min-height: 44px; padding: 0 12px; border: 3px solid var(--ink); border-radius: 10px; background: #fff;
  color: var(--ink); font: 600 1rem var(--body); letter-spacing: 0; text-transform: none; caret-color: var(--green);
}
input::placeholder { color: #6b6554; }
input.locked, input[readonly] { background: var(--cream-2); border-style: dashed; color: var(--ink-2); cursor: not-allowed; }
input:disabled { background: transparent; border-style: dashed; border-color: var(--rule); }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row.two { grid-template-columns: repeat(2, 1fr); }
.res { display: grid; grid-template-columns: 1fr 84px 84px; gap: 8px; align-items: center; }
.res b { font-weight: 800; }
.res.head { color: var(--ink-2); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.err { margin: 0; color: var(--red-text); font-weight: 800; font-size: .9rem; }
.authform { display: grid; gap: 14px; max-width: 380px; padding: 6px 0 0; }
code.key { padding: 3px 8px; border: 2px dashed var(--ink); border-radius: 8px; background: var(--card); font: 700 .95rem ui-monospace, Consolas, monospace; letter-spacing: .06em; }

fieldset.who { display: block; margin: 0; padding: 8px 12px; border: 3px solid var(--ink); border-radius: 12px; background: var(--card); }
fieldset.who legend { padding: 0 6px; color: var(--ink-2); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
fieldset.who label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; }
fieldset.who input[type=checkbox] { width: 22px; min-height: 22px; accent-color: var(--green); }
fieldset.who input:disabled { opacity: .35; }
/* Player picker: name on its own line, then two ticks (WHCP / Manual HCP) and the typed number */
.whorow { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; padding: 4px 0 8px; border-top: 2px dashed var(--rule); }
.whorow:first-of-type { border-top: 0; }
.whorow .pl { flex: 1 0 100%; font-weight: 800; }
.whorow input[type=number] { width: 84px; min-height: 40px; padding: 0 8px; }
fieldset.who label.opt, label.opt { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: .95rem; font-weight: 800; }
.opt small { color: var(--ink-2); font-weight: 700; }
fieldset.who .sub { margin: 6px 0 4px; font-size: .82rem; }
fieldset.who .sub.key { padding: 8px 10px; border-radius: 8px; background: var(--cream-2); color: var(--ink); }

.years { margin-top: 0; }
/* Hole screen: info (distance and map) and scores sit side by side; swipe between them */
.hhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 8px; }
.hhead .big { margin: 0; }
.hstats { display: flex; gap: 8px; margin: 0; }
.hstats div { min-width: 64px; padding: 4px 10px; border: 3px solid var(--ink); border-radius: 10px; background: var(--card); text-align: center; }
.hstats dt { color: var(--ink-2); font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hstats dd { margin: 0; font: 400 1.6rem/1.1 var(--display); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 10px; }
.pager button { min-height: 44px; border: 3px solid var(--ink); border-radius: 10px; background: var(--card); color: var(--ink); font: 800 .95rem var(--body); cursor: pointer; }
.pager button[aria-pressed=true] { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.panes { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; margin-inline: -18px; }
.panes::-webkit-scrollbar { display: none; }
.pane { flex: 0 0 100%; min-width: 0; padding: 0 18px 8px; scroll-snap-align: start; scroll-snap-stop: always; }
.dist { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 3px solid var(--ink); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.big-d b { display: block; font: 400 4.2rem/1 var(--display); }
.big-d span { color: var(--ink-2); font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.fb { display: grid; gap: 6px; margin: 0; }
.fb div { padding: 2px 12px; border: 2.5px solid var(--ink); border-radius: 10px; text-align: center; }
.fb dt { color: var(--ink-2); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.fb dd { margin: 0; font: 400 1.4rem/1.1 var(--display); }
.map { display: block; width: 100%; max-height: 52dvh; margin: 6px 0; border: 3px solid var(--ink); border-radius: 14px; background: #cfe8b5; }
.map .m-green { fill: #7fcf7a; stroke: var(--ink); stroke-width: 2; }
.map .m-line { fill: none; stroke: var(--ink); stroke-width: 3; stroke-dasharray: 2 8; stroke-linecap: round; stroke-linejoin: round; }
.map .m-aim { stroke: var(--red-text); stroke-width: 2.5; stroke-dasharray: 6 6; }
.map .m-tee { fill: var(--ink); }
.map .m-pin { fill: var(--red); stroke: var(--ink); stroke-width: 2; }
.map .m-me { fill: var(--yellow); stroke: var(--ink); stroke-width: 3; }
.prow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 0; border-top: 2px dashed var(--rule); }
.prow:first-child { border-top: 0; }
.prow .nm { min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink); font: 800 1.15rem var(--body); text-align: left; text-decoration: underline dotted; text-underline-offset: 4px; cursor: pointer; }
.prow small { display: block; color: var(--ink-2); font-size: .85rem; font-weight: 700; }
.step3 { display: grid; grid-template-columns: 56px 64px 56px; align-items: center; gap: 8px; }
.step3 .step { min-height: 56px; padding: 0; font: 400 1.8rem/1 var(--display); }
.step3 .val { min-height: 56px; border: 0; background: none; color: var(--ink); font: 400 2.6rem/1 var(--display); text-align: center; cursor: pointer; }
.step3 .val.unset { color: var(--ink-2); }
.cardgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cardgrid label.f small { font-weight: 700; text-transform: none; letter-spacing: 0; }
.center { text-align: center; margin-inline: auto; }
.holes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin: 4px 0 18px; }
.hole { min-height: 44px; border: 2.5px solid var(--ink); border-radius: 10px; background: var(--card); color: var(--ink); font: 800 1rem var(--body); cursor: pointer; }
.hole[data-done] { background: var(--green); color: #fff; }
.hole[aria-current] { outline: 3px solid var(--ink); outline-offset: 2px; background: var(--yellow); color: var(--ink); }
.gpsbox .map { max-height: 56dvh; }
/* Pull-up "Skip to a hole" sheet: only the handle shows until opened */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); }
.scrim[hidden] { display: none; }
.skipsheet { --grab: calc(56px + env(safe-area-inset-bottom, 0px)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; display: flex; flex-direction: column; max-width: 780px; margin-inline: auto; border: 3px solid var(--ink); border-bottom: 0; border-radius: 18px 18px 0 0; background: var(--cream); box-shadow: 0 -4px 0 var(--ink); transform: translateY(calc(100% - var(--grab))); transition: transform .25s ease; }
.skipsheet.open { transform: none; }
.grab { flex: none; min-height: 56px; padding: 0 0 env(safe-area-inset-bottom, 0px); border: 0; border-radius: 15px 15px 0 0; background: var(--yellow); color: var(--ink); font: 400 1.15rem var(--display); letter-spacing: .02em; cursor: pointer; }
.grab::before { content: ""; display: block; width: 44px; height: 5px; margin: 0 auto 4px; border-radius: 3px; background: var(--ink); }
.sheetbody { max-height: calc(78dvh - 56px); padding: 14px 18px 24px; overflow-y: auto; overscroll-behavior: contain; }
body.playing { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
.finder { padding: 12px; border: 3px dashed var(--ink); border-radius: 12px; }
.finder .bar { margin: 0; flex-wrap: nowrap; }
.finder .sub { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .fresh tbody tr { animation: none; }
  .panes { scroll-behavior: auto; }
  * { transition: none !important; }
}
@media (min-width: 768px) {
  th, td { padding-inline: 14px; }
}

/* While scoring, the screen is for the hole: no masthead. */
body.playing .mast { display: none; }
body.playing main { padding-top: 18px; }
