/* Savage Slicers: "The Green 'Un" sports-paper. Pale green newsprint, ink, one hot red. */
:root {
  --paper: #dde8c4;
  --paper-2: #cfdcb0;
  --ink: #12220f;
  --ink-2: #2f4228;      /* secondary text, 8:1 on paper */
  --rule: rgba(18, 34, 15, .28);
  --red: #b72619;        /* leader + primary actions only */
  --red-ink: #fff8ec;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Libre Franklin", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--paper); -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 16px calc(92px + env(safe-area-inset-bottom));
}
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
* { scrollbar-color: var(--ink) var(--paper-2); }
[hidden] { display: none !important; }

/* Halftone: two dot grids of different pitch, drifting slowly. Printed-paper texture, not decoration on text. */
.halftone {
  position: fixed; inset: -300px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle, rgba(18, 34, 15, .07) 1.6px, transparent 2.1px) 0 0 / 14px 14px,
    radial-gradient(circle, rgba(18, 34, 15, .05) 2.6px, transparent 3.2px) 7px 7px / 28px 28px;
  animation: print-drift 90s linear infinite;
  will-change: transform;
}
/* Moves by a whole number of dot pitches so the loop is seamless; transform keeps it off the paint path. */
@keyframes print-drift { to { transform: translate(280px, 140px); } }

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

/* Masthead */
.mast { padding: 14px 0 0; border-bottom: 4px double var(--ink); }
.who { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 44px; margin-bottom: 8px; }
.mast h1 {
  margin: 0; font: 900 clamp(3rem, 15vw, 6.2rem)/.84 var(--display);
  text-transform: uppercase; letter-spacing: -.01em; text-wrap: balance;
}
.strap {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 10px 0 0; padding: 6px 0 8px; border-top: 1px solid var(--ink);
  font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2);
}

/* Headlines */
.big {
  margin: 22px 0 6px; padding-top: 10px; border-top: 4px solid var(--ink); font: 900 clamp(2rem, 8.5vw, 3.2rem)/.92 var(--display);
  text-transform: uppercase; letter-spacing: -.005em; text-wrap: balance;
}
h2 { font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 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; }
.empty { padding: 28px 0; color: var(--ink-2); }

/* Admin stamp */
.stamp {
  min-height: 44px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 4px; background: transparent; color: var(--ink);
  font: 800 .78rem/1 var(--body); letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
  transform: rotate(-2deg); transition: background .15s, color .15s, transform .15s;
}
.stamp b { margin-left: 6px; padding: 3px 7px; border-radius: 3px; background: var(--ink); color: var(--paper); }
.stamp:hover { transform: rotate(-2deg) scale(1.03); }
.stamp[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: var(--red-ink); transform: rotate(-3deg); }
.stamp[aria-pressed="true"] b { background: var(--red-ink); color: var(--red); }

/* Bottom tab bar */
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 5; display: flex; justify-content: center; gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--ink);
}
.tabs button {
  flex: 1; max-width: 160px; min-height: 48px; padding: 0 4px; border: 0; border-radius: 4px; background: none; color: #c4d4a8;
  font: 800 .78rem/1 var(--body); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: background .15s, color .15s;
}
@media (max-width: 400px) { .tabs button { font-size: .7rem; letter-spacing: .04em; } }
.tabs button:hover { color: var(--paper); }
.tabs button[aria-current] { background: var(--paper); color: var(--ink); }
.tabs :focus-visible { outline-color: var(--paper); }

/* League table: rules, not panels */
.sheet, .panel { overflow-x: auto; }
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: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); border-bottom: 2px solid var(--ink); }
tbody tr + tr td { border-top: 1px solid var(--rule); }
td.pos { width: 44px; font: 900 1.5rem/1 var(--display); }
td.name { font-weight: 800; white-space: normal; }
td.name small { display: block; margin-top: 2px; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
td small { font-size: .8rem; color: var(--ink-2); }
table.league td { padding-block: 14px; }
table.league td.pts { font: 900 2rem/1 var(--display); }
tr.lead td.pos, tr.lead td.pts { color: var(--red); }
tr.lead td.name { font-size: 1.15rem; }
tr.click { cursor: pointer; }

/* Print-in: rows wipe on, staggered, when a tab is freshly opened */
.fresh tbody tr { animation: print-in .5s cubic-bezier(.2, .8, .2, 1) both; }
.fresh tbody tr:nth-child(2) { animation-delay: .06s; }
.fresh tbody tr:nth-child(3) { animation-delay: .12s; }
.fresh tbody tr:nth-child(4) { animation-delay: .18s; }
.fresh tbody tr:nth-child(5) { animation-delay: .24s; }
.fresh tbody tr:nth-child(n+6) { animation-delay: .3s; }
@keyframes print-in { from { clip-path: inset(0 100% 0 0); opacity: .2; } to { clip-path: inset(0 0 0 0); opacity: 1; } }

/* Events + handicaps lists */
.list { border-top: 2px solid var(--ink); }
details.card { border-bottom: 1px solid var(--ink); }
details.card > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 10px 0; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .t { font: 800 1.4rem/1.05 var(--display); text-transform: uppercase; }
details.card > summary .m { color: var(--ink-2); font-size: .88rem; }
details.card > summary .v { font: 900 2.2rem/1 var(--display); }
details.card[open] > summary { border-bottom: 1px solid var(--rule); }
details.card .body { overflow-x: auto; padding-bottom: 8px; }
.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: 800 1.1rem/1 var(--display); text-transform: uppercase; color: var(--red); }
.winner::before { content: "Winner "; color: var(--ink-2); font-size: .75rem; letter-spacing: .06em; }
.chip {
  display: inline-block; padding: 2px 7px; border: 1.5px solid var(--ink); border-radius: 3px;
  font: 800 .8rem/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; vertical-align: 3px;
}
.chip.major { background: var(--ink); color: var(--paper); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; }

/* Majors */
.majors { display: grid; gap: 0; border-top: 2px solid var(--ink); }
section.major { display: grid; grid-template-columns: minmax(110px, 36%) 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--ink); }
section.major img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border: 2px solid var(--ink); background: var(--paper-2); }
.mname { margin: 0 0 10px; font: 900 clamp(2.2rem, 10vw, 3.6rem)/.88 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: 1px solid var(--rule); }
.roll .yr { font: 900 1.3rem/1 var(--display); }
.roll .nm { font-weight: 800; }
.roll .sc { color: var(--ink-2); font-size: .85rem; }
.roll li:first-child .nm { color: var(--red); }
.none, .soon { margin: 0 0 6px; color: var(--ink-2); font-size: .92rem; }
.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; } }

/* Buttons + fields */
.btn {
  min-height: 44px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 4px; background: transparent; color: var(--ink);
  font: 800 .82rem/1 var(--body); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: background .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--red-ink); }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: var(--red-ink); }
.btn.quiet { border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.btn.quiet:hover { background: none; color: var(--red); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; 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: 0; background: var(--paper); color: var(--ink); overflow: auto; }
dialog::backdrop { background: rgba(18, 34, 15, .72); }
dialog form { display: grid; gap: 14px; padding: 20px; }
dialog h3 { margin: 0; font: 900 2rem/.95 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: .08em; text-transform: uppercase; }
input, select {
  width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; background: rgba(255, 255, 255, .45);
  color: var(--ink); font: 600 1rem var(--body); letter-spacing: 0; text-transform: none; caret-color: var(--red);
}
input::placeholder { color: #5c6f50; }
input.locked, input[readonly] { background: transparent; border-bottom-style: dashed; color: var(--ink-2); cursor: not-allowed; }
.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: .08em; text-transform: uppercase; }
.err { margin: 0; color: var(--red); font-weight: 700; font-size: .9rem; }
.authform { display: grid; gap: 14px; max-width: 380px; padding: 6px 0 0; }
code.key { padding: 3px 8px; border: 1.5px dashed var(--ink); font: 700 .95rem ui-monospace, Consolas, monospace; letter-spacing: .08em; }
.finder { padding: 12px; border: 1.5px dashed var(--ink); }
.finder .bar { margin: 0; flex-wrap: nowrap; }
.finder .sub { margin: 0; }

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