/* Apple style "liquid glass": translucent, heavily blurred, saturated panels with a bright
   specular rim on top and a soft lift shadow. System San Francisco type throughout. */
:root {
  --ink: #12162b;
  --ink-soft: rgba(18, 22, 43, 0.66);
  --accent: #0a84ff;
  --blue: #0a84ff;
  --green: #30d158;
  --glass-tint: linear-gradient(140deg, rgba(255,255,255,0.46), rgba(255,255,255,0.22) 55%, rgba(255,255,255,0.3));
  --glass-blur: blur(26px) saturate(185%);
  --glass-rim: inset 0 1px 0 rgba(255,255,255,0.85), inset 0 -1px 0 rgba(255,255,255,0.25), inset 0 0 0 1px rgba(255,255,255,0.32);
  --glass-lift: 0 12px 34px rgba(8, 14, 44, 0.22), 0 2px 6px rgba(8, 14, 44, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: #202848; color: var(--ink); }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; user-select: none; letter-spacing: -0.01em; }

/* shared glass surface */
.card, .prompt, .throws, .wind, .meter-track, .btn, .privacy, .tip, .moves figure {
  background: var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-rim), var(--glass-lift);
  border: 0;
}

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* camera preview on the right */
#pip {
  position: fixed; right: 16px; top: 92px;
  width: clamp(180px, 18vw, 270px); aspect-ratio: 16 / 9;
  border-radius: 22px; overflow: hidden; z-index: 1; padding: 0;
  /* no backdrop blur here: Chrome can blank a <video> inside a blurred layer */
  background: rgba(255,255,255,0.4); isolation: isolate;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), inset 0 0 0 1px rgba(255,255,255,0.5), 0 12px 34px rgba(8,14,44,0.28);
}
#cam { position: absolute; inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); border-radius: 17px; object-fit: cover; transform: scaleX(-1); background: #141a33; }
#pipHands { position: absolute; inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); }
#pip span { position: absolute; left: 12px; bottom: 11px; font: 600 11px var(--font); color: #fff; background: rgba(0,0,0,0.32); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); padding: 3px 9px; border-radius: 99px; }

.screen {
  position: fixed; inset: 0; display: none; z-index: 2;
  align-items: center; justify-content: center; padding: 16px;
  pointer-events: none;
}
.screen.active { display: flex; }
.screen.top { align-items: flex-start; padding-top: 24px; }
.screen.dim { background: rgba(10, 14, 40, 0.18); pointer-events: auto; }
#landing, #instructions, #error { background: linear-gradient(180deg, rgba(20,30,80,0.05), rgba(10,14,40,0.32)); }

.card {
  pointer-events: auto;
  border-radius: 34px;
  padding: 34px 38px; max-width: 520px; width: 100%;
  text-align: center;
  animation: rise .5s cubic-bezier(.2,.9,.25,1);
}
.card.wide { max-width: 980px; }
.card.slim { max-width: 460px; padding: 22px 26px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.97); } }

.hero .logo { width: 88px; height: 88px; margin: -4px auto 10px; display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255,255,255,0.75), rgba(255,255,255,0.4));
  /* continuous "squircle" corner, the way Apple rounds icons, with a gentler radius */
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%20100%20100%27%20preserveAspectRatio%3D%27none%27%3E%3Cpath%20d%3D%27M100.00%2C50.00%20L99.95%2C67.23%20L99.80%2C72.72%20L99.56%2C76.68%20L99.22%2C79.86%20L98.77%2C82.55%20L98.22%2C84.89%20L97.57%2C86.95%20L96.81%2C88.78%20L95.94%2C90.43%20L94.94%2C91.90%20L93.83%2C93.22%20L92.58%2C94.40%20L91.18%2C95.46%20L89.63%2C96.39%20L87.89%2C97.20%20L85.95%2C97.91%20L83.76%2C98.51%20L81.26%2C99.01%20L78.34%2C99.40%20L74.82%2C99.69%20L70.26%2C99.89%20L63.06%2C99.99%20L36.94%2C99.99%20L29.74%2C99.89%20L25.18%2C99.69%20L21.66%2C99.40%20L18.74%2C99.01%20L16.24%2C98.51%20L14.05%2C97.91%20L12.11%2C97.20%20L10.37%2C96.39%20L8.82%2C95.46%20L7.42%2C94.40%20L6.17%2C93.22%20L5.06%2C91.90%20L4.06%2C90.43%20L3.19%2C88.78%20L2.43%2C86.95%20L1.78%2C84.89%20L1.23%2C82.55%20L0.78%2C79.86%20L0.44%2C76.68%20L0.20%2C72.72%20L0.05%2C67.23%20L0.00%2C50.00%20L0.05%2C32.77%20L0.20%2C27.28%20L0.44%2C23.32%20L0.78%2C20.14%20L1.23%2C17.45%20L1.78%2C15.11%20L2.43%2C13.05%20L3.19%2C11.22%20L4.06%2C9.57%20L5.06%2C8.10%20L6.17%2C6.78%20L7.42%2C5.60%20L8.82%2C4.54%20L10.37%2C3.61%20L12.11%2C2.80%20L14.05%2C2.09%20L16.24%2C1.49%20L18.74%2C0.99%20L21.66%2C0.60%20L25.18%2C0.31%20L29.74%2C0.11%20L36.94%2C0.01%20L63.06%2C0.01%20L70.26%2C0.11%20L74.82%2C0.31%20L78.34%2C0.60%20L81.26%2C0.99%20L83.76%2C1.49%20L85.95%2C2.09%20L87.89%2C2.80%20L89.63%2C3.61%20L91.18%2C4.54%20L92.58%2C5.60%20L93.83%2C6.78%20L94.94%2C8.10%20L95.94%2C9.57%20L96.81%2C11.22%20L97.57%2C13.05%20L98.22%2C15.11%20L98.77%2C17.45%20L99.22%2C20.14%20L99.56%2C23.32%20L99.80%2C27.28%20L99.95%2C32.77%20Z%27/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%20100%20100%27%20preserveAspectRatio%3D%27none%27%3E%3Cpath%20d%3D%27M100.00%2C50.00%20L99.95%2C67.23%20L99.80%2C72.72%20L99.56%2C76.68%20L99.22%2C79.86%20L98.77%2C82.55%20L98.22%2C84.89%20L97.57%2C86.95%20L96.81%2C88.78%20L95.94%2C90.43%20L94.94%2C91.90%20L93.83%2C93.22%20L92.58%2C94.40%20L91.18%2C95.46%20L89.63%2C96.39%20L87.89%2C97.20%20L85.95%2C97.91%20L83.76%2C98.51%20L81.26%2C99.01%20L78.34%2C99.40%20L74.82%2C99.69%20L70.26%2C99.89%20L63.06%2C99.99%20L36.94%2C99.99%20L29.74%2C99.89%20L25.18%2C99.69%20L21.66%2C99.40%20L18.74%2C99.01%20L16.24%2C98.51%20L14.05%2C97.91%20L12.11%2C97.20%20L10.37%2C96.39%20L8.82%2C95.46%20L7.42%2C94.40%20L6.17%2C93.22%20L5.06%2C91.90%20L4.06%2C90.43%20L3.19%2C88.78%20L2.43%2C86.95%20L1.78%2C84.89%20L1.23%2C82.55%20L0.78%2C79.86%20L0.44%2C76.68%20L0.20%2C72.72%20L0.05%2C67.23%20L0.00%2C50.00%20L0.05%2C32.77%20L0.20%2C27.28%20L0.44%2C23.32%20L0.78%2C20.14%20L1.23%2C17.45%20L1.78%2C15.11%20L2.43%2C13.05%20L3.19%2C11.22%20L4.06%2C9.57%20L5.06%2C8.10%20L6.17%2C6.78%20L7.42%2C5.60%20L8.82%2C4.54%20L10.37%2C3.61%20L12.11%2C2.80%20L14.05%2C2.09%20L16.24%2C1.49%20L18.74%2C0.99%20L21.66%2C0.60%20L25.18%2C0.31%20L29.74%2C0.11%20L36.94%2C0.01%20L63.06%2C0.01%20L70.26%2C0.11%20L74.82%2C0.31%20L78.34%2C0.60%20L81.26%2C0.99%20L83.76%2C1.49%20L85.95%2C2.09%20L87.89%2C2.80%20L89.63%2C3.61%20L91.18%2C4.54%20L92.58%2C5.60%20L93.83%2C6.78%20L94.94%2C8.10%20L95.94%2C9.57%20L96.81%2C11.22%20L97.57%2C13.05%20L98.22%2C15.11%20L98.77%2C17.45%20L99.22%2C20.14%20L99.56%2C23.32%20L99.80%2C27.28%20L99.95%2C32.77%20Z%27/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.hero .logo img { width: 58px; transform: rotate(-6deg); }
h1 { font-size: clamp(40px, 7vw, 58px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 8px; }
.lead { color: var(--ink-soft); font-size: 17px; line-height: 1.5; margin: 10px auto 22px; max-width: 42ch; }
.small { color: var(--ink-soft); font-size: 13.5px; line-height: 1.45; margin-top: 12px; }
.tip { border-radius: 18px; padding: 11px 16px; color: var(--ink); font-weight: 500; margin: 18px auto; max-width: 60ch; }

.privacy { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin-top: 22px; padding: 13px 15px; border-radius: 18px; color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
.privacy svg { flex: none; width: 20px; height: 20px; color: var(--blue); margin-top: 1px; }

.btn {
  font: 600 17px var(--font); letter-spacing: -0.01em; cursor: pointer;
  padding: 13px 26px; border-radius: 999px; color: var(--ink);
  transition: transform .18s cubic-bezier(.2,.9,.25,1.3), filter .15s;
  position: relative; overflow: hidden;
}
.btn:hover { filter: brightness(1.06); transform: scale(1.03); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, rgba(40,150,255,0.95), rgba(10,122,245,0.95));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), inset 0 -1px 0 rgba(0,0,0,0.08), 0 10px 26px rgba(10,132,255,0.32);
}
.btn.big { font-size: 20px; padding: 16px 58px; }
.btn.hold::after { content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: calc(var(--hold, 0) * 100%); background: rgba(255,255,255,0.95); }
.link { background: none; border: 0; color: var(--ink-soft); font: 600 14px var(--font); margin-top: 16px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.moves figure { border-radius: 24px; padding: 10px 10px 16px; }
.moves canvas { width: 100%; height: 190px; display: block; }
.moves figcaption { font-size: 15px; line-height: 1.45; color: var(--ink-soft); padding: 0 8px; }
.moves figcaption b { display: block; font: 700 21px var(--font); letter-spacing: -0.02em; color: var(--ink); margin-bottom: 2px; }
@media (max-width: 760px) {
  .moves { grid-template-columns: 1fr; }
  .moves figure { display: grid; grid-template-columns: 130px 1fr; align-items: center; text-align: left; }
  .moves canvas { height: 110px; }
  .card { padding: 24px 20px; }
}

.gauge { height: 12px; border-radius: 99px; background: rgba(18,22,43,0.1); overflow: hidden; margin-top: 4px; }
#calibFill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .1s; }
.gauge-read { margin-top: 8px; color: var(--ink-soft); }
.gauge-read b { font: 700 26px var(--font); color: var(--ink); margin-right: 4px; }
#calibButtons { margin-top: 14px; }

/* HUD */
.hud { display: none; pointer-events: none; }
.hud.active { display: block; }
.hud-tl, .hud-tr { position: absolute; top: 16px; display: flex; gap: 10px; align-items: center; }
.hud-tl { left: 16px; flex-direction: column; align-items: flex-start; }
.hud-tr { right: 16px; }
.chip, .howto {
  height: 44px; padding: 0 20px; border-radius: 100px;
  background: rgba(24, 24, 30, 0.82);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 8px 24px rgba(0,0,0,0.25);
  color: rgba(235, 235, 245, 0.72); font-weight: 400; font-size: 18px; border: 0;
}
.chip { display: flex; gap: 8px; align-items: center; }
.chip b { font-size: 19px; font-weight: 700; color: #fff; }
.throws { display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-radius: 16px; font-size: 14px; font-weight: 600; color: var(--ink); }
.throws em { font-style: normal; white-space: nowrap; }
.throws .dots { display: flex; gap: 6px; }
.throws i { width: 13px; height: 13px; border-radius: 50%; background: rgba(18,22,43,0.14); }
.throws i.hit { background: var(--accent); }
.throws i.miss { background: rgba(18,22,43,0.4); }
.throws i.now { box-shadow: inset 0 0 0 2px var(--blue); background: rgba(10,132,255,0.15); }
.hud-tr { padding: 10px 6px; gap: 34px !important; isolation: isolate; }
.hud-tr::before {
  content: ""; position: absolute; inset: -30px -40px -46px -70px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(14, 18, 46, 0.5), rgba(14, 18, 46, 0.18) 60%, rgba(14, 18, 46, 0));
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  /* fade every edge so there is no visible rectangle */
  -webkit-mask: linear-gradient(180deg, #000 35%, transparent), linear-gradient(90deg, transparent, #000 35%);
  -webkit-mask-composite: source-in;
  mask: linear-gradient(180deg, #000 35%, transparent), linear-gradient(90deg, transparent, #000 35%);
  mask-composite: intersect;
}
.stat { text-align: center; min-width: 0; padding: 0; background: none; color: #fff; text-shadow: 0 1px 8px rgba(8, 12, 40, 0.45); }
.stat > span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: rgba(235, 235, 245, 0.75); }
.stat b { font-size: 28px; font-weight: 600; line-height: 1.15; white-space: nowrap; letter-spacing: 0.01em; color: #fff; }
.stat small { font-size: inherit; color: #fff; }
.stat.streak b { color: #f4ea7a; }
.stat.pop b { display: inline-block; animation: pop .45s cubic-bezier(.2,.9,.25,1.4); }
@keyframes pop { 40% { transform: scale(1.3); } }

.wind { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; padding: 9px 18px; border-radius: 999px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.wind svg { width: 44px; height: 16px; color: var(--blue); transition: transform .3s; }

.meter { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: 34px; gap: 8px; }
.meter-track { position: relative; width: 34px; height: min(44vh, 320px); border-radius: 17px; }
.meter-fill {
  /* a true pill at every height, inset evenly so it sits concentric with the track */
  position: absolute; left: 5px; right: 5px; bottom: 5px; height: 0;
  border-radius: 999px; background: rgba(255,255,255,0.95); box-shadow: 0 0 10px rgba(255,255,255,0.6); z-index: 1;
}
.meter-fill.live { background: #fff; }
.meter-zone { position: absolute; left: -3px; right: -3px; z-index: 2; background: rgba(48,209,88,0.38); box-shadow: inset 0 0 0 3px var(--green), 0 0 16px rgba(48,209,88,0.75); border-radius: 10px; transition: bottom .4s, height .4s; pointer-events: none; }
.zone-label { position: absolute; left: 44px; transform: translateY(50%); z-index: 3; white-space: nowrap; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #fff; background: rgba(36,180,80,0.92); box-shadow: 0 4px 14px rgba(20,120,50,0.35); transition: bottom .4s; }
.meter-title { text-align: center; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.55); letter-spacing: .04em; text-transform: uppercase; }

.prompt { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 13px 24px; border-radius: 999px; font-weight: 600; font-size: 17px; max-width: calc(100% - 32px); text-align: center; transition: opacity .25s; }
.prompt:empty { opacity: 0; }

/* label floating over the paper stack: box and pointer are one shape (same fill, one shadow) */
.pick-hint {
  position: absolute; transform: translate(-50%, calc(-100% - 10px));
  padding: 9px 16px; border-radius: 12px; font-size: 15px; font-weight: 600; color: #fff; white-space: nowrap;
  background: var(--accent);
  filter: drop-shadow(0 6px 14px rgba(8, 14, 44, 0.3));
  animation: bob 1.6s ease-in-out infinite;
}
.pick-hint::after {
  content: ""; position: absolute; left: 50%; top: calc(100% - 1px); transform: translateX(-50%);
  border: 9px solid transparent; border-top-color: var(--accent); border-bottom: 0;
}
@keyframes bob { 50% { margin-top: -6px; } }

.toast { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); font: 700 clamp(28px, 5vw, 46px) var(--font); letter-spacing: -0.03em; color: #fff; text-shadow: 0 2px 0 rgba(10,14,40,0.35), 0 8px 30px rgba(10,14,40,0.5); opacity: 0; white-space: nowrap; text-align: center; }
.toast.show { animation: toast 1.6s ease-out forwards; }
.toast.hit { color: #fff; }
.toast.band { font-size: clamp(20px, 3vw, 28px); }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.9); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%); } }

.big-score { font-size: 84px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--ink); margin: 6px 0; }

@media (max-width: 640px) {
  .hud-tr { top: 12px; right: 12px; left: 12px; justify-content: flex-end; gap: 6px; }
  .hud-tl { top: 76px; left: 12px; gap: 6px; }
  .chip { height: 36px; padding: 0 14px; font-size: 14px; }
  .chip b { font-size: 16px; }
  .throws { font-size: 12px; padding: 6px 10px; }
  .hud-tr { gap: 18px !important; }
  .stat > span { font-size: 9.5px; }
  .stat b { font-size: 18px; }
  .stat small { font-size: 12px; }
  .wind { top: 76px; left: auto; right: 12px; transform: none; font-size: 12.5px; padding: 6px 10px; }
  .wind svg { width: 28px; }
  .meter { left: 12px; }
  .prompt { font-size: 15px; bottom: 64px; padding: 10px 14px; width: calc(100% - 24px); }
  .pick-hint { font-size: 13px; }
  #pip { width: 132px; top: 70px; right: 12px; }
}
@media (prefers-reduced-motion: reduce) { .card, .toast.show, .pick-hint { animation-duration: .01s; } }


.howto { position: absolute; left: 16px; bottom: 22px; cursor: pointer; pointer-events: auto; font-family: var(--font); transition: transform .18s, color .15s; }
.howto:hover { transform: scale(1.04); color: #fff; }
@media (max-width: 640px) { .howto { bottom: 14px; left: 12px; font-size: 14px; height: 36px; padding: 0 14px; } }

/* even line lengths; together with keepTail() no line ends on one or two words */
h1, h2, .lead, .small, .tip, .privacy span, figcaption, .prompt { text-wrap: balance; }

/* practice throw */
#calibIntro .lead { margin: 10px auto 12px; }
#calibIntro .btn { margin-top: 10px; }
.steps { list-style: none; padding: 0; margin: 14px auto 6px; display: grid; gap: 8px; text-align: left; max-width: 380px; }
.steps li { display: flex; gap: 10px; align-items: center; font-size: 15px; color: var(--ink); }
.steps b { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: #fff; background: var(--accent); }
.cam-slot { width: 240px; aspect-ratio: 16 / 9; margin: 14px auto 8px; border-radius: 18px; background: rgba(18,22,43,0.08); }
#pip.docked { position: fixed; right: auto; transform: none; z-index: 3; border-radius: 18px; }
#pip.docked span { display: none; }
#pip.away { visibility: hidden; }
