/* =================================================================
   Sports Carnival – points table
   ================================================================= */
/* Fonts are bundled so the board works on venue Wi-Fi without Google Fonts */
@font-face { font-family: 'Russo One'; src: url('fonts/russo-one-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Saira Condensed'; src: url('fonts/saira-condensed-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Saira Condensed'; src: url('fonts/saira-condensed-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Saira Condensed'; src: url('fonts/saira-condensed-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Saira Condensed'; src: url('fonts/saira-condensed-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --navy-950: #030824;
  --navy-900: #061036;
  --navy-800: #0a1a4f;
  --line: rgba(92, 136, 255, .36);
  --gold: #f5c542;
  --gold-hi: #ffe9a3;
  --gold-lo: #8f5c07;
  --green-hi: #45e07a;
  --tick: #d9f25c;
  --ink: #ffffff;
  --muted: #a9b8e8;
  --display: 'Russo One', 'Arial Black', Impact, sans-serif;
  --cond: 'Saira Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--navy-950);
  color: var(--ink);
  font-family: var(--cond);
}
button { font: inherit; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

/* ----------------------------- stage ----------------------------- */
.stage {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
           max(20px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse 55% 38% at 50% 0%, rgba(70, 120, 255, .5), transparent 70%),
    radial-gradient(ellipse 70% 22% at 50% 100%, rgba(60, 110, 255, .38), transparent 70%),
    linear-gradient(180deg, #08185a 0%, #050d38 40%, #030824 72%, #071449 100%);
}
/* crowd sparkle in the stands */
.stage::before {
  content: "";
  position: absolute;
  inset: 0 0 40% 0;
  z-index: -1;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 214, 130, .55) .8px, transparent 1.6px) 0 0 / 17px 13px,
    radial-gradient(circle at 1px 1px, rgba(150, 190, 255, .45) .8px, transparent 1.6px) 8px 6px / 23px 19px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 12%, rgba(0,0,0,.55) 55%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 12%, rgba(0,0,0,.55) 55%, transparent 100%);
  opacity: .55;
}
/* arena floor ring */
.stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -18vw;
  width: 70vw;
  height: 30vw;
  transform: translateX(-50%);
  z-index: -1;
  border-radius: 50%;
  border: 2px solid rgba(245, 197, 66, .28);
  box-shadow: 0 0 0 3vw rgba(40, 80, 200, .08), 0 0 60px rgba(90, 140, 255, .3) inset;
}
.stage.has-photo {
  background:
    linear-gradient(180deg, rgba(3, 8, 36, .25), rgba(3, 8, 36, .6)),
    var(--bg-photo) center top / cover no-repeat,
    var(--navy-950);
}
.stage.has-photo::before, .stage.has-photo::after, .stage.has-photo .lights { display: none; }

/* floodlights */
.lights { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.lights span {
  position: absolute;
  top: clamp(8px, 2.5vw, 36px);
  width: clamp(80px, 13vw, 200px);
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  background:
    radial-gradient(circle, #fff 0 30%, rgba(200, 222, 255, .85) 42%, transparent 58%) 0 0 / 16.66% 25%,
    rgba(20, 40, 110, .6);
  filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 26px rgba(130, 175, 255, .95));
}
.lights span::after {
  content: "";
  position: absolute;
  inset: -120% -140%;
  background: radial-gradient(closest-side, rgba(150, 190, 255, .35), transparent);
}
.lights span:first-child { left: 2vw; transform: rotate(-12deg) skewX(-6deg); }
.lights span:last-child  { right: 2vw; transform: rotate(12deg) skewX(6deg); }

/* ----------------------------- title ----------------------------- */
.hero { position: relative; text-align: center; }
.title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: .9;
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
}
.title-top, .title-main {
  display: block;
  transform: skewX(-9deg);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.title-top {
  font-size: clamp(2.1rem, min(6.6vw, 8.5vh), 5.4rem);
  letter-spacing: .02em;
  background-image: linear-gradient(180deg, #ffffff 0%, #eef2f8 36%, #8a97ad 50%, #f8fafc 63%, #b3bece 100%);
  -webkit-text-stroke: 1px rgba(40, 55, 95, .6);
  filter: drop-shadow(0 2px 0 #2a3a66) drop-shadow(0 4px 0 #0b1233) drop-shadow(0 8px 14px rgba(0, 0, 0, .6));
}
.title-main {
  margin-top: -.06em;
  font-size: clamp(3.2rem, min(12.5vw, 16vh), 9.6rem);
  letter-spacing: .01em;
  background-image: linear-gradient(180deg, #fff6c8 0%, #ffd862 22%, #f0b429 44%, var(--gold-lo) 51%, #e7ab26 60%, #ffe38a 84%, #fff3c4 100%);
  -webkit-text-stroke: 1.5px rgba(96, 58, 0, .85);
  filter: drop-shadow(0 3px 0 #6a4303) drop-shadow(0 6px 0 #2b1a00)
          drop-shadow(0 14px 20px rgba(0, 0, 0, .65)) drop-shadow(0 0 28px rgba(255, 190, 60, .25));
}

/* sub-title banner with gold chevrons */
.ribbon {
  position: relative;
  display: inline-block;
  margin: clamp(4px, 1.2vw, 14px) 0 0;
  padding: 0 clamp(18px, 3vw, 34px);
  font: 800 clamp(.95rem, 3.1vw, 2.35rem)/1 var(--cond);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.ribbon::before, .ribbon::after {
  content: "";
  position: absolute;
  top: 10%;
  width: clamp(8px, 1.3vw, 16px);
  height: 80%;
  background: linear-gradient(180deg, #fff1b0, #e4a91f 50%, #8f5c07);
}
.ribbon::before { left: 0;  clip-path: polygon(55% 0, 100% 0, 45% 100%, 0 100%); }
.ribbon::after  { right: 0; clip-path: polygon(0 0, 45% 0, 100% 100%, 55% 100%); }
.ribbon-edge {
  display: block;
  padding: 2px;
  background: linear-gradient(90deg, #8f5c07, #ffe38a 20%, #c88c12 50%, #ffe38a 80%, #8f5c07);
  clip-path: polygon(1.1em 0, calc(100% - 1.1em) 0, 100% 50%, calc(100% - 1.1em) 100%, 1.1em 100%, 0 50%);
}
.ribbon-text {
  display: block;
  padding: .42em 1.7em .38em;
  color: #fff;
  background: linear-gradient(180deg, #16308a 0%, #081650 55%, #040c35 100%);
  clip-path: polygon(1.08em 0, calc(100% - 1.08em) 0, 100% 50%, calc(100% - 1.08em) 100%, 1.08em 100%, 0 50%);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55);
}

/* ------------------------------ views ----------------------------- */
.tabs { display: none; }
.view-standings, .view-games { display: none; }

/* ------------------------------ board ----------------------------- */
.board {
  position: relative;
  max-width: 1640px;
  margin: clamp(12px, 2vw, 24px) auto 0;
  padding: 3px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffe38a, #b8860b 35%, #6d4a06 60%, #f5c542);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 32px rgba(245, 197, 66, .28), 0 22px 50px rgba(0, 0, 0, .6);
}
.board-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(10, 26, 84, .97), rgba(5, 14, 52, .97));
}

.pt {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.pt col.col-team  { width: 16.5%; }
.pt col.col-total { width: 7.5%; }
.pt th, .pt td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
}
.pt tr > :last-child { border-right: 0; }
.pt tbody tr:last-child > * { border-bottom: 0; }

.pt thead th {
  padding: .55em .25em .45em;
  font-size: clamp(.74rem, 1vw, 1.08rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: .02em;
  text-transform: uppercase;
  vertical-align: bottom;
  background: linear-gradient(180deg, rgba(24, 52, 140, .55), rgba(6, 16, 58, .4));
  border-bottom: 2px solid rgba(245, 197, 66, .75);
}
.g-name, .g-loc { display: block; overflow-wrap: break-word; }
.g-pts {
  display: block;
  margin-top: .45em;
  padding-top: .35em;
  border-top: 1px solid var(--line);
  color: var(--gold);
  font-weight: 800;
}
.pt thead .c-team, .pt thead .c-total {
  vertical-align: middle;
  font-size: clamp(1.2rem, 2vw, 2.1rem);
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 2px 0 #3b2600, 0 0 14px rgba(245, 197, 66, .35);
}

.pt tbody > tr > * { height: clamp(42px, min(3.4vw, 5.8vh), 56px); }
.pt tbody .c-team {
  padding: 0 .5em 0 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(90deg, rgba(14, 34, 105, .95), rgba(9, 22, 76, .95));
}
.rank {
  position: relative;
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  width: 2.5em;
  height: 1.95em;
  margin-left: .35em;
  font-size: clamp(1rem, 1.6vw, 1.6rem);
  font-weight: 800;
  background: linear-gradient(180deg, rgba(48, 92, 220, .75), rgba(12, 30, 96, .75));
  clip-path: polygon(24% 0, 100% 0, 76% 100%, 0 100%);
}
.rank b { position: relative; z-index: 1; font-weight: 800; }
.name {
  margin-left: .45em;
  vertical-align: middle;
  font-size: clamp(1rem, 1.45vw, 1.5rem);
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}

.pt .c-cell { text-align: center; vertical-align: middle; }
.pt .c-total {
  text-align: center;
  vertical-align: middle;
  border-left: 2px solid rgba(245, 197, 66, .45);
}
.pt tbody .c-total {
  font: 400 clamp(1.2rem, 1.9vw, 2rem)/1 var(--display);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55);
}

/* leader row */
.pt tr.leader > * {
  background: linear-gradient(180deg, rgba(40, 160, 70, .95), rgba(14, 92, 40, .95));
  border-top: 2px solid var(--green-hi);
  border-bottom: 2px solid var(--green-hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15);
}
.pt tr.leader > :first-child { border-left: 2px solid var(--green-hi); }
.pt tr.leader > :last-child  { border-right: 2px solid var(--green-hi); }
.pt tr.leader .c-total, .st-row.leader .st-total {
  color: var(--gold);
  text-shadow: 0 2px 0 #3b2600, 0 0 14px rgba(245, 197, 66, .6);
}
.leader .rank, .leader .st-rank { background: none; clip-path: none; box-shadow: none; overflow: visible; }
.leader .rank b, .leader .st-rank b { color: #fff8dc; }
.laurel {
  position: absolute;
  inset: -.35em -.1em -.25em;
  width: calc(100% + .2em);
  height: calc(100% + .6em);
  fill: var(--gold);
  filter: drop-shadow(0 1px 0 #3b2600);
}
.laurel .stem { fill: none; stroke: var(--gold); stroke-width: 1.3; }

/* win marks */
.tick {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  padding: .15em;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font-size: clamp(.78rem, 1.15vw, 1.1rem);
  vertical-align: middle;
}
.tick-icon {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--tick);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .45)) drop-shadow(0 0 6px rgba(217, 242, 92, .55));
  transition: transform .15s ease;
}
button.tick { cursor: pointer; }
button.tick:hover .tick-icon { transform: scale(1.12); }
.cam { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.tick .cam {
  position: absolute;
  right: -.25em;
  bottom: -.1em;
  width: 1.15em;
  height: 1.15em;
  padding: .16em;
  border-radius: 50%;
  background: var(--gold);
  stroke: #231800;
  stroke-width: 2.4;
  box-shadow: 0 0 0 2px var(--navy-900);
}

/* --------------------------- standings --------------------------- */
.standings, .glist {
  list-style: none;
  max-width: 640px;
  margin: 0 auto;
  padding: 0;
  display: grid;
  gap: 8px;
}
.st-row {
  display: grid;
  grid-template-columns: 3.3rem 1fr auto;
  align-items: center;
  gap: 0 .6rem;
  padding: .55rem .9rem .55rem .35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(16, 38, 115, .95), rgba(6, 16, 56, .95));
}
.st-row.leader {
  border: 2px solid var(--green-hi);
  background: linear-gradient(90deg, rgba(40, 160, 70, .96), rgba(14, 90, 38, .96));
  box-shadow: 0 0 24px rgba(69, 224, 122, .3);
}
.st-rank {
  position: relative;
  display: grid;
  place-items: center;
  height: 2.5rem;
  font-size: 1.55rem;
  font-weight: 800;
  background: linear-gradient(180deg, rgba(48, 92, 220, .75), rgba(12, 30, 96, .75));
  clip-path: polygon(24% 0, 100% 0, 76% 100%, 0 100%);
}
.st-rank b { position: relative; z-index: 1; }
.st-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .45);
}
.st-total {
  font: 400 1.75rem/1 var(--display);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}
.st-total small {
  margin-left: .2em;
  font: 600 .8rem var(--cond);
  color: var(--muted);
  text-shadow: none;
}
.leader .st-total small { color: #d7f5df; }
.st-wins {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: .5rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  min-height: 34px;
  padding: .25em .7em;
  border: 1px solid rgba(245, 197, 66, .55);
  border-radius: 999px;
  background: rgba(3, 10, 40, .55);
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.1;
}
.chip small { color: var(--muted); font-weight: 600; }
.chip b { color: var(--gold); }
button.chip { cursor: pointer; }
.chip .cam { width: 1.1em; height: 1.1em; color: var(--gold); }

/* ------------------------------ games ----------------------------- */
.g-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem .75rem;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 20, 70, .92);
}
.g-item.done { border-color: rgba(69, 224, 122, .55); }
.g-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}
.g-title small {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
}
.g-item .g-pts {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.05rem;
  text-transform: uppercase;
}
.g-result {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
}
.g-result .tick-icon { width: 1.5em; height: 1.5em; flex: none; }
.g-result.pending { color: var(--muted); font-weight: 600; text-transform: none; }
button.g-result {
  width: 100%;
  padding: .35rem .6rem .35rem .35rem;
  border: 1px solid rgba(245, 197, 66, .5);
  border-radius: 8px;
  background: rgba(245, 197, 66, .08);
  text-align: left;
  cursor: pointer;
}
button.g-result img {
  width: 60px;
  height: 44px;
  flex: none;
  object-fit: cover;
  border-radius: 6px;
}
button.g-result .cam { width: 1.3em; height: 1.3em; margin-left: auto; color: var(--gold); }

.updated {
  margin: 14px 0 0;
  text-align: center;
  font-size: .95rem;
  color: var(--muted);
}

/* ------------------------------ modal ----------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 24, .84);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .22s ease;
}
.modal-card {
  position: relative;
  width: min(780px, 100%);
  max-height: 100%;
  margin: 0;
  padding: 18px 18px 20px;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 16px;
  background: linear-gradient(180deg, #11287a, #050e3a);
  box-shadow: 0 0 0 1px #000, 0 0 44px rgba(245, 197, 66, .35), 0 30px 80px rgba(0, 0, 0, .7);
  text-align: center;
  opacity: 0;
  transform: scale(.94) translateY(12px);
  transition: transform .22s ease, opacity .22s ease;
}
.modal.open .modal-backdrop { opacity: 1; }
.modal.open .modal-card { opacity: 1; transform: none; }
.modal-kicker {
  margin: 4px 44px 12px;
  font: 400 clamp(1.4rem, 4.2vw, 2.2rem)/1 var(--display);
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff3c4, #f0b429 55%, #b77d0b);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #3b2600);
}
.modal-photo img {
  display: block;
  width: 100%;
  max-height: min(62vh, 580px);
  object-fit: contain;
  border-radius: 10px;
  background: #020617;
}
.modal.no-photo .modal-photo { display: none; }
.modal-card figcaption { display: grid; gap: 4px; margin-top: 14px; }
.modal-team {
  font-size: clamp(1.7rem, 5.5vw, 2.8rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}
.modal-game {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.modal-pts { font: 400 1.25rem var(--display); color: var(--gold); }
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  background: rgba(0, 0, 0, .4);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall 2.8s cubic-bezier(.2, .6, .4, 1) forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--drift), 900px) rotate(var(--spin)); opacity: 0; }
}

/* -------------------------- phones & tablets ------------------------- */
@media (max-width: 899px) {
  .tabs {
    display: flex;
    gap: 4px;
    max-width: 520px;
    margin: 16px auto 12px;
    padding: 4px;
    border: 1px solid rgba(245, 197, 66, .55);
    border-radius: 999px;
    background: rgba(4, 11, 42, .85);
  }
  .tab {
    flex: 1;
    min-height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .tab[aria-selected="true"] {
    background: linear-gradient(180deg, #ffe38a, #e0a51b);
    color: #1d1300;
  }

  .views > section { display: none; }
  .views[data-view="table"] .view-table,
  .views[data-view="standings"] .view-standings,
  .views[data-view="games"] .view-games { display: block; }

  .board { margin-top: 0; }
  .pt { min-width: 1160px; }
  .pt col.col-team { width: 172px; }
  .pt col.col-total { width: 64px; }
  .pt .c-team { position: sticky; left: 0; z-index: 2; }
  .pt thead .c-team { z-index: 3; background: #0d2168; }
  .pt tbody .c-team { background: #0c1f63; box-shadow: 4px 0 8px rgba(0, 0, 0, .35); }
  .pt tr.leader .c-team { background: #1f7a3c; }
  .rank { font-size: 1.05rem; }
  .name { font-size: 1rem; }
}

@media (max-width: 420px) {
  .st-row { grid-template-columns: 2.8rem 1fr auto; padding-right: .7rem; }
  .st-name { font-size: 1.2rem; }
  .st-total { font-size: 1.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
