/* Saturday Grid — a night game under the lights: chalk-striped turf, varsity
   lettering, cream "jersey patch" squares that flip to green when you land a
   pick, and pennant-shaped school rows. Scoped under .sg; the search sheet,
   toast and confetti live outside .sg, so the tokens sit on :root. */
:root {
  --sg-turf: #0d3320; --sg-turf-2: #124a2e; --sg-chalk: #f4f1e6; --sg-cream: #fff8e8;
  --sg-ink: #1d1a14; --sg-gold: #ffcc4d; --sg-red: #e8473d; --sg-green: #1f8a4c; --sg-muted: #9cc4ab;
  --sg-varsity: 'Graduate', Georgia, serif; --sg-body: 'Nunito', system-ui, sans-serif;
}
.sg-page {
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(255,255,255,.035) calc(10% - 2px) 10%),
    repeating-linear-gradient(180deg, rgba(255,255,255,.025) 0 60px, transparent 60px 120px),
    radial-gradient(80% 40% at 50% 0%, rgba(255,204,77,.12), transparent 70%), var(--sg-turf);
  padding-bottom: 24px;
}
.sg {
  max-width: 560px; margin: 0 auto; padding: 16px 16px 28px; color: var(--sg-chalk);
  font-family: var(--sg-body); text-align: left; -webkit-tap-highlight-color: transparent;
}
.sg *, .sg *::before, .sg *::after, .sg-sheet *, .sg-sheet *::before, .sg-sheet *::after { box-sizing: border-box; }
.sg [hidden], .sg-sheet[hidden] { display: none !important; }
.sg button, .sg-sheet button { font-family: var(--sg-body); cursor: pointer; margin: 0; }
.sg button:focus-visible, .sg input:focus-visible, .sg-sheet button:focus-visible { outline: 3px solid var(--sg-gold); outline-offset: 2px; }

.sg-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.sg-title { font: 400 34px/0.95 var(--sg-varsity); margin: 0; color: var(--sg-cream); letter-spacing: .01em; text-shadow: 0 3px 0 #06190f; }
.sg-title small { display: block; font: 900 12px var(--sg-body); color: var(--sg-gold); letter-spacing: .18em; text-transform: uppercase; margin-bottom: 4px; text-shadow: none; }
.sg-score { text-align: right; }
.sg-score .big { font: 400 30px/1 var(--sg-varsity); color: var(--sg-cream); }
.sg-score .lab { font-weight: 800; font-size: 12px; color: var(--sg-muted); }
.sg-how { margin: 12px 0 14px; font-weight: 800; font-size: 14px; color: var(--sg-muted); line-height: 1.4; }
.sg-how b { color: var(--sg-cream); }

.sg-banner { background: linear-gradient(90deg, rgba(255,204,77,.2), rgba(255,204,77,.06)); border: 1px solid rgba(255,204,77,.4); border-radius: 14px; padding: 10px 14px; font-weight: 800; font-size: 15px; margin-bottom: 12px; }
.sg-banner b { color: var(--sg-gold); }
.sg-mode { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; font-weight: 900; font-size: 14px; }
.sg-mode button { font: 900 14px var(--sg-body); color: var(--sg-gold); background: none; border: 0; text-decoration: underline; padding: 0; }

/* the grid */
.sg-grid { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 7px; min-height: 300px; }
.sg-loading { grid-column: 1 / -1; text-align: center; font-weight: 800; color: var(--sg-muted); align-self: center; }
.sg-corner { display: flex; align-items: center; justify-content: center; font-size: 26px; }
.sg-head { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 64px; padding: 6px 3px; border-radius: 12px; line-height: 1.1; }
.sg-head.col { background: rgba(255,255,255,.07); border: 1px dashed rgba(244,241,230,.28); }
.sg-head .k { font: 900 9.5px var(--sg-body); letter-spacing: .12em; text-transform: uppercase; color: var(--sg-muted); margin-bottom: 3px; }
.sg-head .v { font: 400 clamp(10.5px, 3.05vw, 15px) var(--sg-varsity); color: var(--sg-cream); }
.sg-head.row { background: var(--c, #7a1f1f); clip-path: polygon(0 0, 100% 12%, 100% 88%, 0 100%); padding: 6px 9px 6px 8px; align-items: flex-start; text-align: left; box-shadow: inset 4px 0 0 rgba(255,255,255,.25); }
.sg-head.row .v { color: #fff; font-size: clamp(10.5px, 3vw, 14px); overflow-wrap: normal; word-break: normal; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.sg-head.row .k { color: rgba(255,255,255,.78); }

.sg-cell {
  position: relative; aspect-ratio: 1; border-radius: 14px; border: 0; padding: 6px;
  background: var(--sg-cream); color: var(--sg-ink);
  box-shadow: 0 4px 0 #b9b19a, 0 10px 18px rgba(0,0,0,.28);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  transition: transform .12s ease;
}
.sg-cell:not(.done):not(.missed):hover { transform: translateY(-2px); }
.sg-cell:not(.done):active { transform: translateY(2px); box-shadow: 0 2px 0 #b9b19a, 0 6px 12px rgba(0,0,0,.25); }
.sg-cell .plus { font: 400 30px var(--sg-varsity); color: #c9c0a6; }
.sg-cell.done { background: linear-gradient(160deg, #1f8a4c, #156b3a); color: #fff; box-shadow: 0 4px 0 #0b4424, 0 10px 18px rgba(0,0,0,.28); cursor: default; }
.sg-cell.done.fresh { animation: sg-pop .35s cubic-bezier(.2,1.6,.4,1); }
.sg-cell .nm { font: 900 13px/1.1 var(--sg-body); overflow-wrap: anywhere; }
.sg-cell .meta { font: 800 10.5px var(--sg-body); opacity: .8; margin-top: 3px; }
.sg-cell .pct { position: absolute; top: 5px; right: 6px; font: 900 10px var(--sg-body); background: rgba(0,0,0,.25); padding: 2px 6px; border-radius: 99px; }
.sg-cell.rare .pct { background: var(--sg-gold); color: var(--sg-ink); }
.sg-cell.miss { animation: sg-shake .4s; }
.sg-cell.missed { background: #234a35; color: var(--sg-muted); box-shadow: none; }
.sg-cell.missed .ans { font: 800 11px/1.25 var(--sg-body); }
.sg-cell.missed .ans b { display: block; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--sg-gold); margin-bottom: 3px; }
@keyframes sg-pop { 0% { transform: scale(.85); } 100% { transform: scale(1); } }
@keyframes sg-shake { 0%,100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

.sg-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; gap: 10px; }
.sg-downs { display: flex; gap: 5px; align-items: center; font-weight: 900; font-size: 13px; color: var(--sg-muted); }
.sg-downs i { width: 14px; height: 22px; border-radius: 7px; background: var(--sg-gold); box-shadow: 0 2px 0 #a37a10; display: inline-block; transition: opacity .3s, transform .3s; }
.sg-downs i.used { opacity: .18; transform: scale(.8); box-shadow: none; }
.sg-btn { font: 900 14px var(--sg-body); color: var(--sg-chalk); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 9px 14px; }
.sg-btn:disabled { opacity: .4; cursor: default; }

/* search sheet */
.sg-sheet { position: fixed; inset: 0; background: rgba(4,20,12,.72); display: flex; align-items: flex-start; justify-content: center; padding: 70px 14px 14px; z-index: 1000; font-family: var(--sg-body); }
.sg-panel { width: 100%; max-width: 460px; background: var(--sg-cream); color: var(--sg-ink); border-radius: 18px; padding: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.5); animation: sg-rise .2s ease; }
@keyframes sg-rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.sg-panel .q { font: 800 13px var(--sg-body); color: #6c6450; margin-bottom: 8px; line-height: 1.35; }
.sg-panel .q b { color: var(--sg-ink); }
.sg-panel input { width: 100%; font: 800 18px var(--sg-body); padding: 12px 14px; border-radius: 12px; border: 2px solid #d8cfb5; background: #fff; color: var(--sg-ink); outline: none; }
.sg-panel input:focus { border-color: var(--sg-green); }
.sg-results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 46vh; overflow: auto; }
.sg-results li button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; padding: 11px 10px; border: 0; border-bottom: 1px solid #eee4cb; background: none; font: 800 15px var(--sg-body); color: var(--sg-ink); }
.sg-results li button:hover, .sg-results li button.on { background: #f3ecd6; }
.sg-results li button small { font-weight: 800; font-size: 12px; color: #857b62; white-space: nowrap; }
.sg-results li button:disabled { opacity: .4; cursor: default; }
.sg-results .none { padding: 12px 10px; color: #857b62; font-weight: 800; font-size: 14px; }
.sg-cancel { display: block; margin: 10px auto 0; font: 800 14px var(--sg-body); color: #6c6450; background: none; border: 0; padding: 6px 12px; }

.sg-toast { position: fixed; left: 50%; top: 18px; transform: translate(-50%, -200%); visibility: hidden; background: var(--sg-red); color: #fff; font: 900 15px var(--sg-body); padding: 10px 16px; border-radius: 12px; z-index: 1100; box-shadow: 0 10px 24px rgba(0,0,0,.35); transition: transform .25s ease, visibility .25s; max-width: calc(100vw - 32px); text-align: center; pointer-events: none; }
.sg-toast.show { transform: translate(-50%, 0); visibility: visible; }
.sg-toast.good { background: var(--sg-green); }
.sg-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1050; }

/* the final card */
.sg-final { margin-top: 18px; background: var(--sg-cream); color: var(--sg-ink); border-radius: 18px; padding: 18px; text-align: center; box-shadow: 0 6px 0 #b9b19a; }
.sg-final h2 { font: 400 28px var(--sg-varsity); margin: 0 0 4px; color: var(--sg-ink); }
.sg-final .sub { font-weight: 800; color: #6c6450; margin-bottom: 10px; }
.sg-final .sub b { color: var(--sg-ink); }
.sg-final .emoji { font-size: 26px; line-height: 1.05; letter-spacing: 2px; margin-bottom: 10px; }
.sg-vs { font: 900 16px var(--sg-body); color: var(--sg-green); margin: 0 0 10px; }
.sg-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; }
.sg-chips span { font: 800 12.5px var(--sg-body); background: #efe6cc; border-radius: 99px; padding: 5px 10px; }
.sg-name { display: flex; flex-direction: column; gap: 6px; text-align: left; font-weight: 800; font-size: 13px; color: #6c6450; }
.sg-name input { font: 800 16px var(--sg-body); padding: 10px 12px; border-radius: 12px; border: 2px solid #d8cfb5; background: #fff; color: var(--sg-ink); }
.sg-final .big { display: block; width: 100%; font: 900 17px var(--sg-body); color: #fff; background: var(--sg-green); border: 0; border-radius: 14px; padding: 14px; box-shadow: 0 4px 0 #0b4424; margin-top: 10px; }
.sg-final .big:active { transform: translateY(2px); box-shadow: 0 2px 0 #0b4424; }
.sg-final .big.alt { background: #e9dfc2; color: var(--sg-ink); box-shadow: 0 4px 0 #b9b19a; }
.sg-final .note { font-size: 12px; font-weight: 800; color: #857b62; margin: 10px 0 0; line-height: 1.45; }

/* content cards below the game */
.sg-content { max-width: 760px; margin: 8px auto 0; padding: 0 16px; display: grid; gap: 16px; color: #e3efe6; font-family: system-ui, sans-serif; }
.sg-card { background: #0a2818; border: 1px solid #1b4a31; border-radius: 12px; padding: 16px 18px; }
.sg-card h2 { margin: 0 0 8px; font-size: 1.3rem; color: #fff; }
.sg-card h3 { margin: 14px 0 6px; font-size: 1.05rem; color: #fff; }
.sg-card p, .sg-card li { color: #bcd2c3; line-height: 1.6; }
.sg-card a { color: var(--sg-gold); }
.sg-card ol, .sg-card ul { margin: 6px 0 0 20px; padding: 0; }
.sg-card details { background: #0c2f1d; border: 1px solid #1b4a31; border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.sg-card summary { cursor: pointer; font-weight: 700; color: #fff; }

@media (max-width: 380px) {
  .sg-title { font-size: 29px; }
  .sg-cell .nm { font-size: 11.5px; } .sg-grid { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { .sg *, .sg-sheet *, .sg-toast { animation: none !important; transition: none !important; } }
