:root {
  color-scheme: light;
  font-family: "Avenir Next", system-ui, sans-serif;
  color: #193237;
  background: #fbf8ef;
  --mint: #d3efdf;
  --teal: #0b5d52;
  --glass-solid: #fafcf7;
  --glass-tint: rgb(250 252 247 / 81%);
  --bottom-inset: max(12px, env(safe-area-inset-bottom));
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-block: 96px 110px; }
html:has(.web-invite) { background: #ffe2c9; }
body {
  margin: 0 auto;
  width: min(100%, 580px);
  padding-block: max(16px, env(safe-area-inset-top)) calc(22px + var(--bottom-inset));
  padding-inline: max(clamp(16px, 4vw, 34px), env(safe-area-inset-left)) max(clamp(16px, 4vw, 34px), env(safe-area-inset-right));
}
.site-header { position: sticky; top: max(12px, env(safe-area-inset-top)); z-index: 2; margin-bottom: 26px; }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; width: fit-content; max-width: 100%; padding: 5px; border-radius: 24px; }
.nav-link { min-height: 44px; display: inline-grid; place-items: center; padding: 6px 12px; border-radius: 999px; color: var(--teal); font-weight: 750; text-decoration: none; }
.nav-link[hidden] { display: none; }
.nav-link[aria-current="page"] { background: var(--mint); }
.invite-tag { width: fit-content; padding: 6px 9px; border-radius: 10px; background: #fff8ed; color: #164437; font-size: 12px; font-weight: 800; }
.web-invite .poster { width: calc(100% - 12px); max-height: 390px; margin: 10px 5px 8px; border: 7px solid #fff8ed; border-radius: 22px; transform: rotate(-3deg); box-shadow: 3px 11px 22px #81553528; }
.note { margin: 0; padding: 10px 11px; border-radius: 12px; background: #def0e7; color: #19564a; font-size: 12px; font-weight: 750; }
.invite-room-code { overflow-wrap: anywhere; letter-spacing: .08em; }
.lobby-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lobby-list .button { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; justify-items: start; }
.lobby-list .button span { font-size: .85em; font-variant-numeric: tabular-nums; }
.brand { display: inline-flex; align-items: center; min-height: 44px; gap: 10px; color: inherit; font-size: 19px; font-weight: 800; text-decoration: none; border-radius: 999px; }
.brand img { background: var(--mint); border-radius: 13px; object-fit: contain; }
.glass {
  background: var(--glass-solid);
  border: 1px solid rgb(73 96 91 / 20%);
  box-shadow: inset 0 1px 0 #fff, 0 7px 24px rgb(21 40 39 / 12%);
}
@supports (backdrop-filter: blur(18px)) {
  .glass { background: var(--glass-tint); backdrop-filter: blur(18px) saturate(140%); }
}
.round-actions {
  position: sticky;
  bottom: var(--bottom-inset);
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px;
  border-radius: 24px;
}
.round-actions > * { flex: 1 0 max-content; max-width: 100%; border-radius: 17px; }
.round-actions > .secondary { flex-grow: 0; }
.round-actions > :only-child { flex-grow: 1; }
@media (max-height: 480px) {
  .site-header, .round-actions { position: static; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .glass { background: var(--glass-solid); backdrop-filter: none; border-color: #75918a; }
}
@media (forced-colors: active) {
  .glass { border-color: CanvasText; }
}
h1, p { margin: 0; }
h1 { font-size: clamp(39px, 8vw, 65px); font-weight: 800; line-height: 1; letter-spacing: -.065em; overflow-wrap: anywhere; }
p { line-height: 1.5; }
#content { display: grid; gap: 17px; }
#message { padding: 12px 14px; margin-top: 13px; border-radius: 12px; background: #ffe1c8; }
button, input { font: inherit; }
button, .button { min-height: 48px; border: 0; border-radius: 14px; background: var(--teal); color: #fff; font-weight: 750; padding: 9px 16px; cursor: pointer; }
button:disabled { opacity: .62; cursor: default; }
.button { display: grid; place-items: center; text-decoration: none; }
.secondary { background: var(--mint); color: #154039; }
:focus-visible { outline: 3px solid #6f4eb9; outline-offset: 4px; }
.poster, video { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 23px; background: #152827; }
video { object-fit: contain; }
video.video-warming { position: absolute; visibility: hidden; pointer-events: none; }
.share { display: grid; gap: 8px; }
.share input { min-width: 0; border: 1px solid #b8cec0; border-radius: 12px; padding: 11px; background: #fffdf6; color: inherit; }
.players, .frames { display: grid; gap: 8px; }
.players { grid-template-columns: 1fr 1fr; }
.players > div { display: grid; gap: 4px; padding: 12px; background: var(--mint); border-radius: 15px; }
.players > div + div { background: #e5e0ff; }
.players strong { font-weight: 800; }
.count { font-size: 76px; font-weight: 800; text-align: center; background: var(--mint); border-radius: 26px; font-variant-numeric: tabular-nums; }
.frames { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.frame { position: relative; min-width: 0; aspect-ratio: 4 / 3; min-height: 54px; display: grid; place-items: center; width: 100%; overflow: hidden; padding: 0; border: 1px solid #b8cec0; border-radius: 12px; color: #12322a; background: var(--mint); }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame span { position: absolute; bottom: 5px; left: 5px; min-width: 25px; padding: 2px 4px; border-radius: 7px; background: #fffdf6; font-size: 14px; text-align: center; }
.score { font-size: 27px; font-weight: 800; }
.result-cat { width: 85px; height: 85px; justify-self: center; object-fit: contain; }

.victory-card {
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-radius: 26px;
  background: #fff0b8;
  overflow: hidden;
  text-align: center;
}
.victory-card h1 { margin-inline: 12px; }
.victory-card .score-podium { background: transparent; padding-top: 0; }
.victory-art {
  position: relative;
  display: grid;
  place-items: end center;
  min-height: 104px;
  background: radial-gradient(circle 48px at center calc(100% - 48px), #ffdf77 98%, transparent);
}
.victory-cat {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  margin-inline: auto;
  width: 112px;
  height: 112px;
  object-fit: contain;
  animation: victory-jump 2.5s cubic-bezier(.33, 0, .38, 1) var(--reveal-delay) both;
}
.victory-star {
  position: absolute;
  color: var(--star-color);
  font-size: var(--star-size);
  font-weight: 900;
  opacity: .68;
  animation: victory-sparkle 2.5s cubic-bezier(.33, 0, .38, 1) var(--reveal-delay) both;
}
.victory-star:nth-child(1) { left: 12%; top: 22px; --star-color: #ac5a3d; --star-size: 24px; --travel: -26px; }
.victory-star:nth-child(2) { left: 25%; top: 63px; --star-color: #8663b0; --star-size: 17px; --travel: -38px; }
.victory-star:nth-child(3) { left: 30%; top: 12px; --star-color: #307858; --star-size: 13px; --travel: -21px; }
.victory-star:nth-child(4) { left: 72%; top: 16px; --star-color: #8663b0; --star-size: 20px; --travel: -30px; }
.victory-star:nth-child(5) { left: 83%; top: 48px; --star-color: #ac5a3d; --star-size: 28px; --travel: -36px; }
.victory-star:nth-child(6) { left: 76%; top: 76px; --star-color: #307858; --star-size: 14px; --travel: -20px; }
@keyframes victory-jump {
  0% { transform: translateY(8px) scale(.86); }
  31% { transform: translateY(-12px) scale(1.08); }
  55% { transform: translateY(2px) scale(.97); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes victory-sparkle {
  0% { transform: translateY(12px); opacity: .34; }
  28% { opacity: 1; }
  52% { transform: translateY(var(--travel)); opacity: .9; }
  100% { transform: translateY(0); opacity: .68; }
}

.score-podium {
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
  gap: 6px;
  padding: 16px;
  border-radius: 24px;
  background: #bde6b4;
}
.score-podium > div, .score-podium > div + div {
  gap: 5px;
  min-width: 0;
  padding: 0;
  background: transparent;
  text-align: center;
}
.score-track {
  position: relative;
  height: 186px;
  margin: 0 10px;
  border-radius: 15px;
  overflow: hidden;
  background: repeating-linear-gradient(to top, #e8f3d8 0 61px, #ccdcbf 61px 62px);
}
.score-fill {
  position: absolute;
  inset: auto 0 0;
  border-radius: 15px;
  background: #b1a3ef;
  transform-origin: center bottom;
  animation: score-rise 2.5s cubic-bezier(.33, 0, .38, 1) both;
}
.score-fill-winner { background: #f6c858; }
.score-value {
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 15px;
  background: #f8f3ff;
  font-variant-numeric: tabular-nums;
}
.score-value-winner { background: #ffe37f; }
.versus {
  display: block;
  width: 46px;
  height: 46px;
  align-self: center;
  animation: versus-enter .38s cubic-bezier(.2, 0, 0, 1) both;
}
@keyframes versus-enter {
  from { transform: scale(.72); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes score-rise {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .score-fill, .versus, .victory-cat, .victory-star { animation: none; }
}
