/* Latecomers: the late draft, catch-up game autoplay and the win/loss animation (public/autoplay.js).
   Colors come from the app theme (--turf, --gold, --red, --panel…), the football from --ball (the same one the loaders
   use) and the big words from --font-display, so every theme gets its own look. Less motion = no movement. */

/* ----- Late draft ----- */
.ld-head { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; }
.ld-count { text-align: center; min-width: 64px; padding: 8px 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.ld-count b { display: block; font-size: 26px; line-height: 1; color: var(--gold); font-family: var(--font-display, Inter), Inter, sans-serif; }
.ld-count span { font-size: 11px; color: var(--muted); }
.ld-needs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.ld-need { font-size: 12px; padding: 3px 8px 3px 3px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.ld-need.ok { color: var(--text); border-color: var(--turf-dim); }
.ld-mine { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.ld-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 3px 4px 3px 3px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); }
.ld-x { background: none; border: 0; color: var(--muted); font-size: 15px; padding: 0 4px; cursor: pointer; min-height: 0; }
.ld-x:hover { color: var(--red); }
.ld-actions { gap: 8px; flex-wrap: wrap; }
.ld-filter { gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ld-table td { vertical-align: middle; }
.ld-wait { margin-top: 10px; }

/* ----- Matchups: my catch-up game ----- */
.late-box { display: grid; gap: 10px; border-left: 3px solid var(--gold); }
.late-g { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.late-g.W .pill { background: color-mix(in srgb, var(--turf) 25%, transparent); }
.late-g.L .pill { background: color-mix(in srgb, var(--red) 22%, transparent); }
.late-sum { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.late-set .late-rules { margin: 8px 0 0 28px; }
.late-code { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ----- The autoplay overlay ----- */
body.ap-open { overflow: hidden; }
.ap { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); animation: ap-in .25s ease both; }
@keyframes ap-in { from { opacity: 0; } }
.ap-card { position: relative; width: min(560px, 100%); padding: 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,.45); overflow: hidden; }
.ap-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.ap-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.ap-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.ap-dots i.now { background: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
.ap-dots i.W { background: var(--turf); } .ap-dots i.L { background: var(--red); } .ap-dots i.T { background: var(--muted); }
.ap-board { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 16px 0 10px; }
.ap-side { text-align: center; padding: 10px 6px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); transition: border-color .3s, box-shadow .3s; min-width: 0; }
.ap-side.won { border-color: var(--turf); box-shadow: 0 0 0 2px color-mix(in srgb, var(--turf) 35%, transparent); }
.ap-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-side.me .ap-name { color: var(--turf); }
.ap-pts { font: 800 34px/1.1 var(--font-display, Inter), Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.ap-pts.bump { animation: ap-bump .35s ease; }
@keyframes ap-bump { 40% { transform: scale(1.16); color: var(--gold); } }
.ap-proj { font-size: 11px; color: var(--muted); }
.ap-mid { text-align: center; }
.ap-clock { font: 700 12px/1 ui-monospace, monospace; padding: 5px 7px; border-radius: 6px; background: #000; color: var(--gold); letter-spacing: .05em; white-space: nowrap; }
.ap-vs { font-size: 12px; color: var(--muted); margin-top: 6px; }
.ap-bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ap-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--turf-dim), var(--turf)); }
.ap-feed { height: 170px; overflow: hidden; margin-top: 10px; display: grid; align-content: start; gap: 4px;
  mask-image: linear-gradient(#000 70%, transparent); -webkit-mask-image: linear-gradient(#000 70%, transparent); }
.ap-play { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 8px; border-radius: 8px; background: var(--panel2); animation: ap-play .35s ease both; }
.ap-play .ap-pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-play b { font-variant-numeric: tabular-nums; color: var(--turf); }
.ap-play.big { border: 1px solid var(--gold); } .ap-play.big b { color: var(--gold); }
.ap-play.dud b { color: var(--muted); }
@keyframes ap-play { from { opacity: 0; transform: translateY(-8px); } }
.ap-btns { justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ap-pen { text-align: center; margin-top: 6px; }

/* ----- Win / loss ----- */
#ap-result:empty { display: none; }
.apr { position: absolute; inset: 0 0 58px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 20px; animation: apr-in .3s ease both; }
.ap-live .apr { position: relative; inset: auto; min-height: 280px; }
@keyframes apr-in { from { opacity: 0; } }
.apr-win { background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--turf) 40%, var(--panel)) 0%, var(--panel) 72%); }
.apr-loss { background: radial-gradient(circle at 50% 40%, color-mix(in srgb, #5d6b78 40%, var(--panel)) 0%, var(--panel) 72%); }
.apr-tie { background: var(--panel); }
.apr-word { font: 900 64px/1 var(--font-display, Inter), Inter, system-ui, sans-serif; letter-spacing: .04em; }
.apr-win .apr-word { color: var(--gold); text-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 30px color-mix(in srgb, var(--gold) 50%, transparent); animation: apr-slam .55s cubic-bezier(.2,1.6,.4,1) both; }
.apr-loss .apr-word { color: #c6d0da; font-size: 44px; animation: apr-sag .9s ease .5s both; }
.apr-tie .apr-word { color: var(--text); }
@keyframes apr-slam { 0% { transform: scale(3.2) rotate(-8deg); opacity: 0; } 60% { transform: scale(.92) rotate(2deg); opacity: 1; } 100% { transform: none; } }
@keyframes apr-sag { to { transform: translateY(4px) rotate(-3deg); } }
.apr-score { display: flex; gap: 10px; align-items: baseline; font: 800 26px/1 var(--font-display, Inter), Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.apr-win .apr-score { animation: apr-slam .5s cubic-bezier(.2,1.6,.4,1) .25s both, apr-shake .3s ease .7s; }
.apr-score span { color: var(--muted); font-size: 18px; }
@keyframes apr-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.apr-line { font-size: 14px; color: var(--muted); animation: apr-up .4s ease .6s both; }
@keyframes apr-up { from { opacity: 0; transform: translateY(8px); } }
.apr-coins { font: 800 22px/1 Inter, system-ui, sans-serif; color: var(--gold); animation: apr-coin 1s cubic-bezier(.2,1.4,.4,1) .7s both; }
@keyframes apr-coin { 0% { transform: translateY(30px) scale(.4); opacity: 0; } 60% { transform: translateY(-10px) scale(1.15); opacity: 1; } 100% { transform: none; } }
.apr-banner { position: absolute; top: 16px; left: -40px; right: -40px; padding: 6px; transform: rotate(-4deg); font: 900 15px/1.2 var(--font-display, Inter), Inter, sans-serif;
  letter-spacing: .14em; color: #111; background: var(--gold); box-shadow: 0 4px 14px rgba(0,0,0,.35); animation: apr-banner .5s cubic-bezier(.2,1.4,.4,1) .4s both; }
.apr-banner.upset { background: linear-gradient(90deg, var(--gold), #ff9d3a, var(--gold)); }
.apr-banner.close { background: #fff; }
.apr-banner.blowout { background: var(--turf); color: var(--on-accent, #0b0d10); }
@keyframes apr-banner { from { transform: rotate(-4deg) translateX(-110%); } }
.apr-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.apr-confetti i { position: absolute; top: -12px; width: 7px; height: 12px; border-radius: 2px; animation: apr-fall linear both; }
@keyframes apr-fall { to { transform: translate(var(--x), 120vh) rotate(var(--r)); } }
/* Loss: the theme's football deflates under a rain cloud. */
.apr-ball { width: 66px; height: 66px; background: var(--ball, url('/balls/classic.svg')) center / contain no-repeat; position: relative; transform-origin: 50% 100%;
  animation: apr-deflate 1.6s ease .2s both; }
@keyframes apr-deflate { 0% { transform: none; } 30% { transform: scale(1.06, .96); } 100% { transform: scale(1.25, .42) translateY(10px); filter: saturate(.5) brightness(.8); } }
.apr-ball .hiss { position: absolute; right: -16px; top: 18px; width: 18px; height: 14px; border-top: 2px solid var(--muted); border-bottom: 2px solid var(--muted); border-radius: 50%;
  opacity: 0; animation: apr-hiss .5s ease 3 .3s; }
@keyframes apr-hiss { 30% { opacity: .8; } to { opacity: 0; transform: translateX(14px); } }
.apr-cloud { position: relative; width: 90px; height: 34px; animation: apr-drift 3s ease-in-out infinite alternate; }
.apr-cloud i { position: absolute; inset: 6px 0 0; border-radius: 30px; background: #8a96a3; }
.apr-cloud i::before, .apr-cloud i::after { content: ''; position: absolute; border-radius: 50%; background: #8a96a3; }
.apr-cloud i::before { width: 38px; height: 38px; left: 14px; top: -18px; } .apr-cloud i::after { width: 30px; height: 30px; left: 42px; top: -12px; }
.apr-cloud b { position: absolute; top: 34px; width: 2px; height: 10px; border-radius: 2px; background: var(--blue); animation: apr-rain .8s linear infinite; }
.apr-cloud b:nth-of-type(1) { left: 18px; } .apr-cloud b:nth-of-type(2) { left: 32px; animation-delay: .3s; } .apr-cloud b:nth-of-type(3) { left: 46px; animation-delay: .15s; }
.apr-cloud b:nth-of-type(4) { left: 60px; animation-delay: .45s; } .apr-cloud b:nth-of-type(5) { left: 74px; animation-delay: .6s; }
@keyframes apr-rain { from { transform: translateY(-4px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(26px); opacity: 0; } }
@keyframes apr-drift { to { transform: translateX(8px); } }
.apr-shake { font-size: 46px; animation: apr-shake .4s ease 3; }
/* Less motion: everything simply appears. */
.apr.still *, .apr.still { animation: none !important; }
.apr.still .apr-ball { transform: scale(1.25, .42); }
@media (prefers-reduced-motion: reduce) { .ap, .ap-play, .ap-pts.bump { animation: none !important; } }

/* ----- Season so far ----- */
.ap-sum { text-align: center; }
.ap-sum h2 { font: 900 40px/1.1 var(--font-display, Inter), Inter, system-ui, sans-serif; margin: 6px 0 2px; }
.ap-weeks { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0; }
.ap-wk { display: grid; place-items: center; width: 42px; padding: 5px 0; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); }
.ap-wk b { font-size: 15px; } .ap-wk small { font-size: 10px; color: var(--muted); }
.ap-wk.W { border-color: var(--turf); } .ap-wk.W b { color: var(--turf); }
.ap-wk.L { border-color: color-mix(in srgb, var(--red) 60%, var(--line)); } .ap-wk.L b { color: var(--red); }
@media (max-width: 520px) {
  .ap-card { padding: 14px; } .ap-pts { font-size: 28px; } .apr-word { font-size: 52px; } .ap-feed { height: 150px; }
}
.late-tag { font-size: 12px; margin-left: 4px; cursor: help; }
/* The result sits over the scoreboard; the buttons stay on top of it. */
.ap-btns, .ap-pen { position: relative; z-index: 6; }
