@font-face { font-family: "Items"; src: url("/assets/fonts/ItemsTextCondensed-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Unica"; src: url("/assets/fonts/NeueHaasUnica-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Unica"; src: url("/assets/fonts/NeueHaasUnica-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ink: #1C0E40; --purple: #8264EE; --deep: #6D4DD8; --lilac: #C9BFF2; --paper: #FAFAFA; --gold: #FFD166;
  --soft: #C9C2E3;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: #fff;
  font-family: "Unica", system-ui, -apple-system, "Segoe UI", sans-serif; font-weight: 400;
  overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none;
  -webkit-text-size-adjust: 100%;
}
body { position: fixed; inset: 0; }
canvas#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
.layer { position: absolute; inset: 0; }
.center { display: grid; place-items: center; text-align: center; }

/* ---- while skiing ---- */
#hud { pointer-events: none; }
.hud-top {
  position: absolute; left: 0; right: 0; top: calc(var(--top) + 10px); padding: 0 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  text-shadow: 0 1px 10px rgba(28, 14, 64, .55);
}
.hud-score, .hud-time { font-family: "Items", Georgia, serif; font-size: clamp(34px, 9.5vw, 56px); line-height: .95; }
.hud-time { text-align: right; }
.hud-top small { display: block; font-family: "Unica", sans-serif; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; margin-top: 2px; }
.hud-mult {
  font-family: "Items", Georgia, serif; font-size: clamp(26px, 7vw, 40px); line-height: 1; padding: 6px 14px 8px;
  border-radius: 999px; background: rgba(28, 14, 64, .55); border: 1px solid rgba(201, 191, 242, .45);
  transition: transform .15s ease, background .2s ease;
}
.hud-mult.pop { transform: scale(1.28); background: var(--deep); }
.hud-mult.lost { background: #b3261e; }
.timebar { position: absolute; left: 16px; right: 16px; top: calc(var(--top) + 78px); height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.timebar i { display: block; height: 100%; width: 100%; background: #fff; transform-origin: left center; }
.timebar.low i { background: var(--gold); }
.letters { position: absolute; left: 0; right: 0; top: calc(var(--top) + 92px); display: flex; justify-content: center; gap: 6px; }
.letters b {
  font-family: "Items", Georgia, serif; font-weight: 400; font-size: 18px; width: 28px; height: 30px; display: grid; place-items: center;
  color: rgba(255, 255, 255, .45); background: rgba(28, 14, 64, .4); border: 1px solid rgba(255, 255, 255, .22);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  transition: all .2s ease;
}
.letters b.on { color: var(--ink); background: var(--gold); transform: scale(1.12); }
.letters.power b { color: var(--ink); background: var(--gold); animation: glow .5s ease-in-out infinite alternate; }
@keyframes glow { to { filter: brightness(1.35); transform: scale(1.14); } }

.toast {
  position: absolute; left: 14px; right: 14px; top: 27%; text-align: center;
  font-family: "Items", Georgia, serif; font-size: clamp(24px, 6.6vw, 40px); line-height: 1.08;
  text-shadow: 0 2px 14px rgba(28, 14, 64, .8); opacity: 0; transform: translateY(8px);
}
.toast.show { animation: toast 2.1s ease forwards; }
.toast.good { color: var(--gold); }
.toast small { display: block; font-family: "Unica", sans-serif; font-weight: 500; font-size: 15px; margin-top: 6px; letter-spacing: .02em; }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px) scale(.96); } 10% { opacity: 1; transform: none; } 78% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
.banner {
  position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-family: "Items", Georgia, serif;
  font-size: clamp(38px, 11.5vw, 84px); line-height: 1; letter-spacing: .01em; color: var(--gold);
  text-shadow: 0 0 26px rgba(255, 209, 102, .65), 0 2px 12px rgba(28, 14, 64, .9); opacity: 0;
}
.banner.show { animation: banner 1.9s ease forwards; }
.banner small { display: block; font-family: "Unica", sans-serif; font-weight: 500; font-size: 16px; color: #fff; margin-top: 8px; text-shadow: 0 1px 10px rgba(28, 14, 64, .9); }
@keyframes banner { 0% { opacity: 0; transform: scale(.6); } 14% { opacity: 1; transform: scale(1.06); } 22% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1); } }
.hint {
  position: absolute; left: 20px; right: 20px; bottom: calc(var(--bottom) + 86px); text-align: center;
  font-weight: 500; font-size: 17px; text-shadow: 0 1px 10px rgba(28, 14, 64, .9); opacity: 0; transition: opacity .3s ease;
}
.hint.show { opacity: 1; }
.mute {
  pointer-events: auto; position: absolute; right: 12px; bottom: calc(var(--bottom) + 12px); width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(28, 14, 64, .45); color: #fff; font-size: 20px; line-height: 1;
}
.mute.off { opacity: .45; text-decoration: line-through; }

#count { pointer-events: none; }
#count span { font-family: "Items", Georgia, serif; font-size: 46vw; line-height: 1; text-shadow: 0 4px 40px rgba(28, 14, 64, .7); animation: count .9s ease both; }
@media (min-width: 700px) { #count span { font-size: 300px; } }
@keyframes count { from { transform: scale(1.5); opacity: 0; } 25% { opacity: 1; } to { transform: scale(.9); opacity: .85; } }

/* ---- start and result ---- */
.sheet {
  display: grid; place-items: center; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  padding: calc(var(--top) + 18px) 20px calc(var(--bottom) + 18px);
  background: linear-gradient(180deg, rgba(28, 14, 64, .86) 0%, rgba(28, 14, 64, .62) 45%, rgba(28, 14, 64, .9) 100%);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.sheet-in { width: 100%; max-width: 420px; text-align: center; }
.logo { height: 34px; width: auto; opacity: .95; }
h1 { font-family: "Items", Georgia, serif; font-weight: 400; font-size: clamp(50px, 15vw, 76px); line-height: .95; margin: 18px 0 6px; letter-spacing: -.005em; }
.sub { margin: 0 0 26px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; color: var(--lilac); }
form label { display: block; font-size: 14px; color: var(--soft); margin-bottom: 8px; }
input#name {
  width: 100%; height: 56px; border-radius: 14px; border: 1.5px solid rgba(201, 191, 242, .55); background: rgba(255, 255, 255, .08);
  color: #fff; font: 500 20px "Unica", system-ui, sans-serif; text-align: center; outline: none; -webkit-user-select: text; user-select: text;
}
input#name::placeholder { color: rgba(255, 255, 255, .4); }
input#name:focus { border-color: #fff; background: rgba(255, 255, 255, .14); }
.go {
  width: 100%; height: 60px; margin-top: 12px; border: 0; border-radius: 14px; background: var(--purple); color: #fff;
  font: 500 21px "Unica", system-ui, sans-serif; letter-spacing: .01em; touch-action: manipulation;
  box-shadow: 0 10px 30px rgba(130, 100, 238, .45);
}
.go:active { transform: translateY(1px) scale(.99); background: var(--deep); }
.go[disabled] { opacity: .6; }
.pickboast { margin: 20px 0 2px; font-size: 14px; color: var(--soft); }
.go.boast { height: auto; min-height: 56px; padding: 12px 14px; font-size: 19px; line-height: 1.2; margin-top: 10px; }
.go.boast:nth-child(2) { background: var(--deep); }
.go.boast:nth-child(3) { background: rgba(255, 255, 255, .12); border: 1.5px solid rgba(201, 191, 242, .6); box-shadow: none; }
.how { margin: 22px 0 0; font-size: 16px; line-height: 1.4; color: #EDE9FA; }
.how b { font-weight: 500; color: #fff; }
.link { display: inline-block; margin-top: 14px; padding: 10px 14px; background: none; border: 0; color: var(--lilac); font: 400 15px "Unica", system-ui, sans-serif; text-decoration: underline; text-underline-offset: 3px; }
.waith { font-family: "Items", Georgia, serif; font-weight: 400; font-size: clamp(40px, 11vw, 60px); line-height: 1; margin: 0 0 14px; }
.waitp { font-size: 18px; line-height: 1.35; color: #EDE9FA; margin: 0 0 8px; min-height: 1.4em; }

/* the all-hands meeting */
#meeting { pointer-events: none; opacity: 0; transition: opacity .25s ease; background: rgba(28, 14, 64, .5); z-index: 2; align-content: center; }
#meeting.on { opacity: 1; }
.invite { width: min(84vw, 360px); background: #fff; color: var(--ink); border-radius: 16px; padding: 18px 20px 16px; text-align: left; box-shadow: 0 20px 60px rgba(10, 4, 30, .55); transform: translateY(-30px) scale(.9); transition: transform .3s cubic-bezier(.2, 1.4, .4, 1), opacity .25s ease; border-top: 8px solid var(--deep); }
#meeting.on .invite { transform: none; }
#meeting.punch .invite { opacity: 0; transform: translateY(20px) scale(.92); }
.inv-top { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--deep); font-weight: 500; }
.invite h2 { font-family: "Items", Georgia, serif; font-weight: 400; font-size: 34px; line-height: 1.02; margin: 6px 0 6px; }
.inv-when { margin: 0 0 14px; font-size: 15px; color: #55556A; }
.inv-btns { display: flex; gap: 8px; }
.inv-btns span { flex: 1; text-align: center; padding: 9px 0; border-radius: 9px; background: var(--deep); color: #fff; font-weight: 500; font-size: 15px; }
.inv-btns .dim { background: #EDEAF7; color: #B5AFCB; text-decoration: line-through; }
.punch { position: absolute; left: 16px; right: 16px; top: 40%; margin: 0; font-family: "Items", Georgia, serif; font-size: clamp(34px, 9.5vw, 60px); line-height: 1.02; color: #fff; text-shadow: 0 2px 18px rgba(28, 14, 64, .9); opacity: 0; transform: scale(.9); transition: opacity .2s ease .1s, transform .3s ease .1s; }
#meeting.punch .punch { opacity: 1; transform: none; }
.lead { margin: 18px 0 0; font-size: 15px; color: var(--lilac); min-height: 1.2em; }
.msg { margin: 8px 0 0; font-size: 14px; color: var(--gold); min-height: 1.2em; }

.verdict { font-family: "Items", Georgia, serif; font-size: clamp(24px, 6.6vw, 34px); line-height: 1.1; margin: 0 0 14px; color: var(--lilac); }
.big { font-family: "Items", Georgia, serif; font-size: clamp(76px, 24vw, 128px); line-height: .9; }
.big small { display: block; font-family: "Unica", sans-serif; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--lilac); margin-top: 8px; }
.pers { margin: 10px 0 0; font-weight: 500; color: var(--gold); min-height: 1.3em; }
.place { font-family: "Items", Georgia, serif; font-size: clamp(30px, 8.5vw, 44px); margin-top: 14px; line-height: 1; }
.chase { margin: 8px 0 0; font-size: 17px; line-height: 1.3; min-height: 1.3em; }
.chase b { font-weight: 500; color: var(--gold); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 18px 0 4px; border-top: 1px solid rgba(201, 191, 242, .25); border-bottom: 1px solid rgba(201, 191, 242, .25); }
.stats div { padding: 10px 2px; }
.stats dt { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.stats dd { margin: 3px 0 0; font-family: "Items", Georgia, serif; font-size: 26px; line-height: 1; }
.mini { list-style: none; margin: 18px 0 0; padding: 0; text-align: left; font-size: 16px; }
.mini li { display: grid; grid-template-columns: 30px 1fr auto; padding: 8px 2px; border-top: 1px solid rgba(201, 191, 242, .18); }
.mini li.me { color: var(--gold); font-weight: 500; }
.mini li span:first-child { color: var(--soft); }
.mini li span:last-child { font-variant-numeric: tabular-nums; }

#rotate { background: var(--ink); font-family: "Items", Georgia, serif; font-size: 30px; z-index: 5; }

/* wide screens (a PC, a tablet): keep the sheets readable */
@media (min-width: 700px) {
  .hud-top { padding: 0 32px; }
  .timebar { left: 32px; right: 32px; }
}
@media (max-height: 640px) {
  h1 { margin-top: 10px; }
  .sub { margin-bottom: 14px; }
  .how { margin-top: 14px; font-size: 15px; }
  .how li { padding-top: 6px; padding-bottom: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast.show, .banner.show { animation-duration: 2.4s; }
}
