/* Who played well?: "Floodlight" scheme from the design. Every colour lives in these variables.
   Other schemes from the design, if you want to swap:
   Chalk  --bg:#F3F1EB --surf:#FFFFFF --surf2:#E8E5DD --pitch:#E3E8DA --text:#151412 --sub:#6E6A61 --acc:#D7322A --lo:#2348C9
   Turf   --bg:#0E2419 --surf:#153222 --surf2:#1F4331 --pitch:#1A3D2A --text:#EEF3EA --sub:#9DB7A6 --acc:#F2C14E --lo:#FF7A66
   Night  --bg:#0B1430 --surf:#141F45 --surf2:#1F2B57 --pitch:#13284A --text:#EEF1FA --sub:#98A3C4 --acc:#FF7A59 --lo:#6FD3FF */
:root {
  --bg: #0D0F0E;
  --surf: #181B1A;
  --surf2: #272B29;
  --pitch: #142019;
  --line: rgba(255, 255, 255, .10);
  --text: #F2F4F1;
  --sub: #9AA29D;
  --acc: #C8F03C;
  --acc-ink: #0D0F0E;
  --lo: #FF5A47;
  --lo-ink: #FFFFFF;
  --mid-hi: #8A918C;   /* graded shirt, 6-8 */
  --mid-lo: #4F5552;   /* graded shirt, 3-5 */
  /* Room at the bottom for the "Powered by Netlify" badge Netlify adds on free plans
     (bottom-right, about 64px tall). Set to 0px if the badge is ever turned off. */
  --badge-space: 64px;
  --font: Barlow, system-ui, sans-serif;
  --display: "Barlow Condensed", Barlow, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body { color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { all: unset; cursor: pointer; box-sizing: border-box; }
button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
input::placeholder { color: var(--sub); }

#app {
  max-width: 480px; margin: 0 auto; height: 100dvh; position: relative; overflow: hidden;
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.display { font-family: var(--display); font-weight: 800; }
.italic { font-style: italic; }
.q { color: var(--acc); }
.sub { color: var(--sub); }
.label { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--sub); }
.btn-primary { display: block; width: 100%; height: 56px; border-radius: 18px; text-align: center; line-height: 56px; font-weight: 700; font-size: 17px; background: var(--acc); color: var(--acc-ink); }
.btn-quiet { display: block; width: 100%; height: 56px; border-radius: 18px; text-align: center; line-height: 56px; font-weight: 700; font-size: 16px; background: var(--surf2); color: var(--sub); }
.round { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 22px; background: var(--surf); font-size: 26px; line-height: 1; }
.pill-btn { height: 44px; padding: 0 16px; border-radius: 22px; background: var(--surf); font-weight: 700; font-size: 14px; display: flex; align-items: center; }
.note { margin-top: 18px; font-size: 13px; color: var(--sub); text-align: center; }

/* Matches */
.home { padding: 14px 20px calc(32px + env(safe-area-inset-bottom) + var(--badge-space)); }
.logo { font-size: clamp(30px, 9.4vw, 46px); white-space: nowrap; letter-spacing: -.5px; line-height: 1; margin-top: 12px; }
.tagline { margin-top: 10px; font-size: 17px; line-height: 1.35; }
.match-list { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.match {
  background: var(--surf); border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px 8px;
  transition: transform .12s;
}
.match:active { transform: scale(.98); }
.match .side { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.match .side.away { align-items: flex-end; text-align: right; }
.match .code { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1; }
.match .flag { font-size: 22px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.match .tname { font-size: 13px; color: var(--sub); font-weight: 500; }
.match .score { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1; padding: 6px 10px; border-radius: 10px; background: var(--surf2); }
.match .score.ko { color: var(--acc); }
.match .foot { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--sub); border-top: 1px solid var(--line); padding-top: 10px; }
.match .go { color: var(--acc); font-weight: 700; white-space: nowrap; }

/* Rate header */
.rate-head { flex: none; padding: 4px 16px 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.rate-head .title { text-align: center; }
.rate-head .title .display { font-size: 21px; letter-spacing: .3px; line-height: 1.1; }
.rate-head .title .sub { font-size: 12px; font-weight: 600; }
.progress { margin: 12px 16px 0; height: 4px; border-radius: 2px; background: var(--surf2); overflow: hidden; }
.progress > div { height: 100%; background: var(--acc); border-radius: 2px; transition: width .3s; }
.tabs { margin: 12px 16px 0; padding: 4px; border-radius: 14px; background: var(--surf); display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tabs.flush { margin: 26px 0 0; }
.tabs button { text-align: center; height: 38px; line-height: 38px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs button.on { background: var(--text); color: var(--bg); }

/* Pitch */
.pitch-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 16px 0; gap: 12px; }
.pitch { flex: 1; min-height: 240px; position: relative; border-radius: 24px; background: var(--pitch); overflow: hidden; }
.pitch .ln { position: absolute; left: 0; right: 0; border-top: 2px solid var(--line); }
.pitch .ln.dash { border-top-style: dashed; }
.jersey { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 72px; }
.pitch .jersey { position: absolute; transform: translate(-50%, -24px); }
.jersey .shirt {
  width: 42px; height: 42px; border-radius: 21px; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 22px; box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
  transition: background .2s, transform .1s;
}
.jersey:active .shirt { transform: scale(.92); }
.jersey.open .shirt { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--text); }
.jersey .nm { font-size: 11px; font-weight: 700; max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bench { display: flex; gap: 4px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 2px; scrollbar-width: none; }
.bench .jersey { flex: none; width: 60px; }
.bench .shirt { width: 38px; height: 38px; font-size: 20px; }
.bench .nm { max-width: 60px; }
.pitch-foot { padding: 2px 0 calc(22px + env(safe-area-inset-bottom) + var(--badge-space)); }

/* Bottom sheet */
.sheet-wrap { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-wrap .backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.sheet { position: relative; background: var(--surf); border-radius: 30px 30px 0 0; padding: 10px 20px calc(30px + env(safe-area-inset-bottom) + var(--badge-space)); }
.sheet.anim { animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 18px; }
.who { display: flex; align-items: center; gap: 12px; }
.chip { min-width: 44px; height: 44px; padding: 0 6px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 24px; box-shadow: 0 0 0 1px var(--line); }
.who .name { font-size: 28px; line-height: 1; text-transform: uppercase; }
.who .pos { font-size: 14px; font-weight: 600; margin-top: 3px; }
.word { margin: 16px 0 10px; text-align: center; font-weight: 700; font-size: 16px; }
.keys { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.keys button {
  height: 54px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 26px; background: var(--surf2); transition: transform .1s;
}
.keys button:active { transform: scale(.92); }
.keys .hi { color: var(--acc); }
.keys .lo { color: var(--lo); }
.keys .on { background: var(--text); color: var(--bg); }
.keys .on.hi { background: var(--acc); color: var(--acc-ink); }
.keys .on.lo { background: var(--lo); color: var(--lo-ink); }
.keys .skip { font-family: var(--font); font-size: 14px; border: 1.5px dashed var(--line); background: transparent; color: var(--sub); }
.why-head { display: flex; align-items: center; gap: 14px; }
.big-score { width: 64px; height: 64px; flex: none; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 38px; }
.big-score.hi { background: var(--acc); color: var(--acc-ink); }
.big-score.lo { background: var(--lo); color: var(--lo-ink); }
.why-head .display { font-size: 26px; line-height: 1.05; }
.why-head .sub { font-size: 15px; margin-top: 4px; }
.reasons { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.reasons button { min-height: 44px; padding: 0 16px; display: flex; align-items: center; border-radius: 999px; font-size: 15px; font-weight: 600; background: var(--surf2); }
.reasons button.on { background: var(--text); color: var(--bg); }
.why-note { margin-top: 14px; width: 100%; height: 50px; border-radius: 14px; border: none; padding: 0 14px; font: 500 16px var(--font); background: var(--surf2); color: var(--text); outline: none; user-select: text; -webkit-user-select: text; }
.two { margin-top: 16px; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }

/* Results */
.results { padding: 4px 16px calc(32px + env(safe-area-inset-bottom) + var(--badge-space)); }
.res-top { display: flex; justify-content: space-between; align-items: center; }
.res-top .display { font-size: 19px; }
.headline { font-size: clamp(30px, 9.4vw, 44px); white-space: nowrap; line-height: 1; margin: 18px 4px 0; }
.res-sub { margin: 6px 4px 0; font-size: 15px; }
.stats { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { border-radius: 20px; padding: 16px; background: var(--surf); min-width: 0; }
.stat.acc { background: var(--acc); color: var(--acc-ink); }
.stat .k { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.stat .v { font-size: 46px; line-height: 1; margin-top: 8px; }
.stat .v.sm { font-size: 26px; margin-top: 10px; text-transform: uppercase; overflow-wrap: anywhere; }
.stat .s { font-size: 13px; font-weight: 600; margin-top: 4px; }
.h2 { margin: 24px 4px 0; font-size: 28px; line-height: 1; }
.h2-sub { margin: 4px 4px 0; font-size: 14px; }
.pcards { margin: 12px -16px 0; padding: 0 16px 4px; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 16px; scrollbar-width: none; }
.pcard { flex: none; width: 272px; scroll-snap-align: start; border-radius: 22px; padding: 16px; background: var(--surf); display: flex; flex-direction: column; gap: 14px; }
.pcard .top { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 20px; color: #0D0F0E; }
.pcard .pn { font-weight: 700; font-size: 16px; }
.pcard .pw { font-size: 12px; font-weight: 600; }
.pcard .sync { display: flex; align-items: baseline; gap: 8px; }
.pcard .sync .display { font-size: 44px; line-height: 1; }
.pcard .sync span:last-child { font-size: 13px; font-weight: 600; color: var(--sub); }
.take .k { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.take.first { border-top: 1px solid var(--line); padding-top: 12px; }
.take .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 4px; }
.take .row span:first-child { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.take .row span:last-child { font-size: 12px; font-weight: 600; color: var(--sub); white-space: nowrap; }
.falls { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.fall { border-radius: 18px; padding: 12px 14px; background: var(--surf); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.fall .n { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fall .nums { display: flex; gap: 10px; align-items: baseline; font-size: 12px; font-weight: 600; color: var(--sub); }
.fall .nums .display { font-size: 24px; color: var(--text); }
.fall .line { grid-column: 1 / -1; font-size: 13px; color: var(--sub); }
.mycard { margin-top: 10px; border-radius: 24px; padding: 20px; background: var(--text); color: var(--bg); display: flex; flex-direction: column; gap: 16px; }
.mycard .r1 { display: flex; justify-content: space-between; align-items: center; }
.mycard .r2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mycard .k { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; opacity: .65; }
.mycard .v { font-size: 24px; line-height: 1.05; margin-top: 4px; text-transform: uppercase; }
.mycard .r3 { display: flex; justify-content: space-between; align-items: flex-end; border-top: 1px solid var(--sub); padding-top: 12px; font-size: 14px; font-weight: 600; }
.legend { display: flex; gap: 16px; margin: 14px 4px 8px; font-size: 12px; font-weight: 600; color: var(--sub); }
.legend span { display: flex; align-items: center; gap: 6px; }
.res-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 48px; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.res-row .num { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--sub); text-align: center; }
.res-row .top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 600; }
.res-row .top span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-row .you { font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--sub); }
.res-row .you.hi { color: var(--acc); }
.res-row .you.lo { color: var(--lo); }
.bar { position: relative; margin-top: 7px; height: 6px; border-radius: 3px; background: var(--surf2); }
.bar .crowd { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--sub); opacity: .5; }
.bar .me { position: absolute; top: -3px; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 6px; background: var(--acc); box-shadow: 0 0 0 2px var(--bg); }
.res-row .avg { font-size: 26px; text-align: right; line-height: 1; }
.mt10 { margin-top: 10px; }
.mt22 { margin-top: 22px; }
.toast { position: absolute; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom) + var(--badge-space)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; z-index: 10; }

/* Team of the Week */
.totw-link { margin-top: 22px; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-radius: 22px; background: var(--acc); color: var(--acc-ink); }
.totw-link > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.totw-link .display { font-size: 26px; line-height: 1; }
.totw-link .sub { color: var(--acc-ink); opacity: .75; font-size: 14px; font-weight: 600; }
.totw-link .go { font-size: 30px; font-weight: 700; }
.totw-pitch { flex: none; height: 440px; margin-top: 14px; }
.rank-panel { margin-top: 12px; border-radius: 22px; background: var(--surf); padding: 8px 14px 6px; animation: up .18s ease-out; }
.rank-head { display: flex; align-items: baseline; gap: 8px; padding: 8px 2px 6px; }
.rank-head .display { font-size: 24px; }
.rank-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--line); }
.rank-row .rk { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--sub); text-align: center; }
.rank-row .who2 { min-width: 0; display: flex; flex-direction: column; }
.rank-row .nm2 { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .tm { font-size: 12px; font-weight: 600; }
.rank-row .av { display: flex; flex-direction: column; align-items: flex-end; }
.rank-row .av .display { font-size: 24px; line-height: 1; }
.rank-row .av .sub { font-size: 11px; font-weight: 600; }
.rank-row.lead .rk, .rank-row.lead .av .display { color: var(--acc); }
.rank-row.thin { opacity: .5; }
.stat .s b { font-weight: 800; }

/* Match timing */
.match .score.live { color: var(--lo); text-transform: uppercase; letter-spacing: 1px; }
.match .go.shut { color: var(--sub); font-weight: 600; }
.note .test-reset { display: block; margin: 8px auto 0; color: var(--acc); font-weight: 700; text-decoration: underline; }

/* "Just here for the ratings" link, sitting just above the rating sheet */
.spectate { position: relative; align-self: stretch; margin: 0 16px 14px; padding: 15px 18px; border-radius: 18px; background: var(--acc); color: var(--acc-ink); font-size: 17px; font-weight: 800; line-height: 1.25; text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); }
.spectate.anim { animation: fadein .25s ease both; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* "I didn't watch the game" in the header, in place of Done until something is rated */
.pill-btn.didnt { max-width: 150px; height: auto; min-height: 44px; padding: 6px 14px; line-height: 1.15; text-align: center; font-size: 13px; background: var(--acc); color: var(--acc-ink); }
/* End of the second team: one big lime button to the results */
.big-go { margin-top: 22px; height: 68px; line-height: 68px; font-size: 20px; font-weight: 800; }
