/* Ziggy & Pam Sports Arena. The games draw themselves on the canvas; this styles the cards,
   scoreboard and touch controls in the Ziggy Games print-shop look Ziggy Dash uses: cream
   stock, ink outlines, overprinted red and blue. */
:root {
  --paper: #f2ead8;
  --paper-2: #e9dfc8;
  --ink: #1b1f1c;
  --ink-2: #4a4f47;
  --green: #1f6b4a;
  --red: #e5452c;
  --blue: #2e63c9;
  --yellow: #f1bd2c;
  --night: #141a33;
  --display: 'Fraunces', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --cond: 'Saira Semi Condensed', 'Arial Narrow', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--night);
  color: var(--ink);
  font: 500 15px/1.5 var(--mono);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.arena {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.k {
  display: inline-block;
  min-width: 1.7em;
  padding: 0 0.4em;
  border: 2px solid var(--ink);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: #fffaf0;
  font-weight: 600;
  font-size: 0.86em;
  line-height: 1.45;
  text-align: center;
}

/* ---- Scoreboard and buttons ----------------------------------------------------------- */
.hud {
  position: absolute;
  top: calc(10px + var(--safe-t));
  left: calc(12px + var(--safe-l));
  right: calc(12px + var(--safe-r));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  pointer-events: none;
  z-index: 5;
}
.hud[hidden] {
  display: none;
}
.scoreboard {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--cond);
}
.team {
  display: flex;
  align-items: center;
  gap: 7px;
}
.face {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: #b9dcf3;
}
.team.right .face {
  background: #f6d8c9;
}
.name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.score {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score i {
  font-style: normal;
  color: var(--ink-2);
  font-size: 24px;
}
.score b.pop {
  animation: pop 420ms cubic-bezier(0.3, 1.6, 0.5, 1);
  color: var(--red);
}
@keyframes pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.6); }
  100% { transform: scale(1); }
}
.clock {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 6px);
  padding: 1px 10px;
  border: 2.5px solid var(--ink);
  border-radius: 9px;
  background: var(--ink);
  color: #fffaf0;
  font: 600 14px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.clock.hurry {
  background: var(--red);
}
.clock.golden {
  background: var(--yellow);
  color: var(--ink);
}
.hud-actions {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}
.icon-btn svg {
  width: 23px;
  height: 23px;
  fill: var(--ink);
}
.icon-btn .wave {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.icon-btn.cam {
  width: auto;
  padding: 0 14px 0 11px;
  border-radius: 23px;
  display: flex;
  gap: 6px;
  font: 800 16px/1 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.icon-btn.cam svg circle {
  fill: var(--paper);
}
[data-mute] .off,
[data-mute].muted .on {
  display: none;
}
[data-mute].muted .off {
  display: inline;
}
.icon-btn.muted .off {
  display: block;
}

/* ---- Big messages ---------------------------------------------------------------------- */
.banner {
  position: absolute;
  left: 50%;
  top: 34%;
  z-index: 6;
  display: grid;
  justify-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  color: var(--red);
  -webkit-text-stroke: 8px #fffaf0;
  paint-order: stroke fill;
  text-shadow: 5px 5px 0 rgba(46, 99, 201, 0.8);
  white-space: nowrap;
  text-align: center;
}
.banner b {
  font-style: italic;
  font-weight: 900;
  font-size: clamp(54px, 12vw, 132px);
  line-height: 1;
}
.banner span {
  margin-top: 8px;
  font: 800 clamp(20px, 3.4vw, 32px)/1.1 var(--cond);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fffaf0;
  -webkit-text-stroke: 5px var(--ink);
  text-shadow: none;
}
.banner.small b {
  font-size: clamp(38px, 7vw, 76px);
}
.banner.show {
  animation: banner 1.9s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.banner.long {
  animation-duration: 3s;
}
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(-3deg); }
  24% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
  82% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.96) rotate(-3deg); }
}

/* ---- Touch controls ---------------------------------------------------------------------- */
.touch[hidden] {
  display: none;
}
.stick {
  position: absolute;
  width: 128px;
  height: 128px;
  margin: -64px 0 0 -64px;
  border-radius: 50%;
  border: 3px solid rgba(255, 250, 240, 0.7);
  background: rgba(20, 26, 51, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 4;
}
.stick.on {
  opacity: 1;
}
.knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(-50%, -50%);
}
.stick-hint {
  position: absolute;
  left: calc(18px + var(--safe-l));
  bottom: calc(26px + var(--safe-b));
  margin: 0;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(20, 26, 51, 0.55);
  color: #fffaf0;
  font: 600 13px/1.3 var(--mono);
  pointer-events: none;
  transition: opacity 400ms ease;
  z-index: 4;
}
.stick-hint.gone {
  opacity: 0;
}
.kick {
  --charge: 0;
  position: absolute;
  right: calc(22px + var(--safe-r));
  bottom: calc(24px + var(--safe-b));
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 4px solid var(--ink);
  background: conic-gradient(var(--yellow) calc(var(--charge) * 360deg), var(--red) 0);
  box-shadow: 4px 4px 0 var(--ink);
  color: #fffaf0;
  font: 800 22px/1 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 4;
  touch-action: none;
}
.kick span {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin: auto;
  border-radius: 50%;
  background: var(--red);
  border: 3px solid rgba(27, 31, 28, 0.35);
}
.kick.down {
  transform: translate(3px, 3px) scale(0.96);
  box-shadow: 1px 1px 0 var(--ink);
}

/* ---- Cards --------------------------------------------------------------------------------- */
.panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  overflow-y: auto;
  touch-action: pan-y;
  background: linear-gradient(180deg, rgba(14, 18, 40, 0.15), rgba(14, 18, 40, 0.55));
}
.panel[hidden] {
  display: none;
}
.card {
  position: relative;
  width: min(100%, 540px);
  padding: 22px 26px 20px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 7px 7px 0 var(--ink);
  text-align: center;
}
.kicker {
  margin: 0;
  font: 600 12px/1.4 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.card h1,
.card h2 {
  margin: 2px 0 4px;
  font-family: var(--display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 rgba(46, 99, 201, 0.85);
}
.card h1 {
  font-size: clamp(52px, 13vw, 84px);
}
.card h2 {
  font-size: clamp(40px, 9vw, 60px);
}
.tag {
  margin: 4px auto 12px;
  max-width: 34em;
  color: var(--ink-2);
}
.pick {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 12px;
}
.who {
  position: relative;
  display: grid;
  justify-items: center;
  width: 150px;
  padding: 6px 6px 8px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fffaf0;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 90ms ease, box-shadow 90ms ease, background 120ms ease;
}
.who canvas {
  width: 112px;
  height: 112px;
}
.who span {
  font: 800 22px/1 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.who small {
  font: 600 12px/1.3 var(--mono);
  color: var(--ink-2);
}
.who[aria-checked='true'] {
  background: var(--yellow);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}
.who[aria-checked='true']::after {
  content: attr(data-badge);
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 9px;
  border: 2.5px solid var(--ink);
  border-radius: 9px;
  background: var(--red);
  color: #fffaf0;
  font: 800 13px/1.3 var(--cond);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.who[data-badge='']::after {
  display: none;
}
.opts {
  display: grid;
  gap: 8px;
  justify-items: center;
}
.seg {
  display: inline-flex;
  border: 3px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #fffaf0;
}
.seg button {
  padding: 5px 14px;
  border: 0;
  border-left: 2px solid var(--ink);
  background: none;
  font: 800 15px/1.3 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.seg button:first-child {
  border-left: 0;
}
.seg button[aria-checked='true'] {
  background: var(--ink);
  color: #fffaf0;
}
.go {
  margin: 16px auto 6px;
  padding: 11px 34px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--red);
  box-shadow: 4px 4px 0 var(--ink);
  color: #fffaf0;
  font: 800 26px/1 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.go:active,
.ghost:active,
.who:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}
.ghost {
  margin: 16px auto 6px;
  padding: 10px 22px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fffaf0;
  box-shadow: 4px 4px 0 var(--ink);
  font: 800 20px/1 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 12px;
}
.how {
  margin: 8px auto 0;
  max-width: 36em;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-2);
}
.how.small {
  font-size: 12px;
}
.record {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-2);
}
.record:empty {
  display: none;
}
.crumbs {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: calc(14px + var(--safe-l));
  display: flex;
  gap: 10px;
}
.crumbs a,
.arena-link a {
  padding: 5px 13px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font: 800 15px/1.3 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.arena-link {
  margin: 14px 0 2px;
}
.foot {
  position: absolute;
  bottom: calc(10px + var(--safe-b));
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
}
.link {
  border: 0;
  background: none;
  color: #fffaf0;
  text-decoration: underline;
  font: 600 13px/1.4 var(--mono);
}
.final {
  margin: 0;
  font: 800 54px/1 var(--cond);
  font-variant-numeric: tabular-nums;
}
.winner {
  width: 150px;
  height: 150px;
  margin: -8px auto -6px;
  display: block;
}
.noscript {
  position: absolute;
  inset: 40% 0 auto;
  text-align: center;
  color: #fffaf0;
}

@media (max-width: 560px) {
  .card {
    padding: 16px 14px 14px;
    box-shadow: 5px 5px 0 var(--ink);
  }
  .who {
    width: 128px;
  }
  .who canvas {
    width: 92px;
    height: 92px;
  }
  .seg button {
    padding: 5px 10px;
    font-size: 14px;
  }
  .go {
    font-size: 22px;
  }
  .name {
    display: none;
  }
  .face {
    width: 34px;
    height: 34px;
  }
  .score {
    font-size: 28px;
  }
  .scoreboard {
    padding: 4px 8px;
    gap: 6px;
  }
  .hud {
    justify-content: flex-start;
  }
  .icon-btn {
    width: 42px;
    height: 42px;
  }
  .icon-btn.cam span {
    display: none;
  }
  .icon-btn.cam {
    width: 42px;
    padding: 0;
    justify-content: center;
  }
  .crumbs a {
    font-size: 13px;
    padding: 4px 10px;
  }
  .panel.title {
    padding-top: calc(52px + var(--safe-t));
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .card {
    padding: 12px 18px 12px;
  }
  .card h1 {
    font-size: 46px;
  }
  .pick {
    margin: 4px 0 6px;
  }
  .who canvas {
    width: 70px;
    height: 70px;
  }
  .opts {
    grid-template-columns: auto auto;
    justify-content: center;
  }
  .go {
    margin-top: 10px;
  }
  .tag {
    margin-bottom: 6px;
  }
  .panel.title .card {
    width: min(100%, 640px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .banner.show {
    animation-name: banner-still;
  }
  .score b.pop {
    animation: none;
  }
}
@keyframes banner-still {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-3deg); }
  8%, 85% { opacity: 1; transform: translate(-50%, -50%) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-3deg); }
}

/* ---- The Sports Arena front page --------------------------------------------------------- */
.hub-page {
  overflow: hidden;
}
.hub {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(64px + var(--safe-t)) calc(16px + var(--safe-r)) calc(20px + var(--safe-b)) calc(16px + var(--safe-l));
  overflow-y: auto;
}
.hub-shade {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(14, 18, 40, 0.2), rgba(14, 18, 40, 0.72));
  pointer-events: none;
}
.hub #stage {
  position: fixed;
}
.hub .crumbs {
  position: fixed;
  z-index: 3;
}
.hub-card {
  position: relative;
  z-index: 2;
  width: min(100%, 760px);
  padding: 22px 26px 24px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--ink);
  text-align: center;
}
.hub-card h1 {
  margin: 4px 0 6px;
  font-family: var(--display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  font-style: italic;
  font-weight: 900;
  font-size: clamp(38px, 7.5vw, 70px);
  line-height: 0.95;
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 rgba(46, 99, 201, 0.85);
}
.hub-card h1 span {
  display: block;
  color: var(--yellow);
}
.sports {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
}
.sport {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  height: 100%;
  padding: 12px 12px 14px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #fffaf0;
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  text-decoration: none;
  transition: transform 90ms ease, box-shadow 90ms ease;
}
a.sport:hover,
a.sport:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}
a.sport:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}
.sport-art {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 420 / 250;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: repeating-linear-gradient(90deg, #4f9a3c 0 14%, #5aa845 14% 28%);
}
.sport-name {
  margin-top: 4px;
  font: 800 30px/1 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sport-note {
  font: 600 13px/1.4 var(--mono);
  color: var(--ink-2);
}
.sport-go {
  margin-top: 8px;
  padding: 6px 26px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--red);
  box-shadow: 3px 3px 0 var(--ink);
  color: #fffaf0;
  font: 800 19px/1.2 var(--cond);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sport.soon {
  align-content: center;
  border-style: dashed;
  background: var(--paper-2);
  box-shadow: none;
  color: var(--ink-2);
}
.soon-art svg {
  width: 110px;
  height: 74px;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0.6;
}
@media (max-width: 620px) {
  .hub-card {
    padding: 16px 14px 18px;
    box-shadow: 5px 5px 0 var(--ink);
  }
  .sports {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .sport.soon {
    grid-template-columns: auto 1fr;
    justify-items: start;
    text-align: left;
    gap: 0 12px;
    padding: 10px 14px;
  }
  .sport.soon .soon-art {
    grid-row: span 2;
  }
  .soon-art svg {
    width: 64px;
    height: 44px;
  }
}
