:root {
  --cyan: #2de2ff;
  --pink: #ff3df2;
  --red: #ff2d55;
  --bg: #05081a;
  --ink: #e9f3ff;
  --sat: env(safe-area-inset-top, 0px);
  --sab: 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(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
canvas#table { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }

.screen {
  position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: calc(24px + var(--sat)) 24px calc(24px + var(--sab)); text-align: center;
  background: radial-gradient(120% 80% at 50% 30%, rgba(20, 30, 80, .82), rgba(3, 5, 18, .94));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 10; touch-action: manipulation;
}
.screen.show { display: flex; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

h1 {
  margin: 6px 0 0; font-size: clamp(52px, 17vw, 84px); line-height: .88; font-weight: 900; letter-spacing: .04em;
  font-style: italic; color: #fff;
  text-shadow: 0 0 10px var(--cyan), 0 0 26px var(--cyan), 0 0 60px rgba(45, 226, 255, .5), 4px 4px 0 var(--pink);
}
h2 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: .02em; text-shadow: 0 0 18px rgba(45, 226, 255, .7); }
.tag { margin: 10px 0 0; font-size: 15px; letter-spacing: .32em; text-transform: uppercase; color: #9fb4ff; }
.hint { margin: 0; color: #b9c6ee; font-size: 16px; line-height: 1.45; }
.hint b { color: #fff; }
.foot { position: absolute; bottom: calc(10px + var(--sab)); margin: 0; font-size: 11px; color: #56628f; }

.brand { display: flex; flex-direction: column; align-items: center; }
.logo { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #26305a, #0b1030 70%); box-shadow: 0 0 0 4px var(--cyan), 0 0 34px var(--cyan); }
.puck-logo { width: 26px; height: 26px; border-radius: 50%; background: #0b0f26; box-shadow: 0 0 0 3px #fff, 0 0 18px #fff; }

.actions { display: flex; flex-direction: column; gap: 12px; width: min(320px, 86vw); }
button { font: inherit; border: 0; cursor: pointer; color: inherit; }
button.big {
  padding: 18px 20px; border-radius: 16px; font-size: 20px; font-weight: 800; letter-spacing: .03em; color: #04122a;
  background: linear-gradient(180deg, #7ff0ff, var(--cyan)); box-shadow: 0 0 0 2px rgba(255,255,255,.25) inset, 0 8px 30px rgba(45, 226, 255, .45);
  transition: transform .08s;
}
button.big.alt { background: linear-gradient(180deg, #ff9df8, var(--pink)); box-shadow: 0 0 0 2px rgba(255,255,255,.25) inset, 0 8px 30px rgba(255, 61, 242, .45); }
button.big:active, button.small:active { transform: scale(.97); }
button.big:disabled { opacity: .55; }
button.small { padding: 12px; border-radius: 12px; font-size: 16px; font-weight: 600; background: rgba(255,255,255,.07); color: #c9d4ff; border: 1px solid rgba(255,255,255,.12); }

input#codeInput {
  width: 230px; text-align: center; font-size: 46px; font-weight: 900; letter-spacing: .3em; padding: 10px 0 10px .3em;
  text-transform: uppercase; border-radius: 16px; border: 2px solid var(--pink); background: rgba(0,0,0,.4); color: #fff;
  outline: none; box-shadow: 0 0 24px rgba(255, 61, 242, .4); font-family: ui-monospace, Menlo, Consolas, monospace;
}
.err { min-height: 20px; margin: 0; color: #ff7b9a; font-size: 15px; }
.code { font: 900 64px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .22em; padding-left: .22em; color: #fff;
  text-shadow: 0 0 14px var(--pink), 0 0 40px var(--pink); }
.code-inline { color: var(--pink); font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; }
#qr { width: 180px; height: 180px; border-radius: 14px; background: #fff; padding: 6px; box-shadow: 0 0 30px rgba(255,255,255,.25); }
.waiting { color: #9fb4ff; margin: 0; }
.dots::after { content: '•'; animation: dots 1.2s steps(3) infinite; display: inline-block; width: 2.2em; text-align: left; }
@keyframes dots { 0% { content: '•'; } 33% { content: '••'; } 66% { content: '•••'; } }

.steps { text-align: left; margin: 0; padding-left: 22px; color: #c7d2f5; font-size: 16px; line-height: 1.5; max-width: 330px; }
.steps b { color: #fff; }
.link-info { margin: 0; font-size: 13px; color: #7f8cc0; }
.link-info.good { color: #6dffb0; }
.ready-info { min-height: 20px; margin: 0; color: #9fb4ff; font-size: 15px; }
.final { font: 900 56px/1 system-ui, sans-serif; letter-spacing: .05em; }

/* Little animations of the phones */
.phones-demo { position: relative; width: 120px; height: 120px; margin: 6px 0; }
.phones-demo .ph { position: absolute; left: 36px; width: 48px; height: 58px; border-radius: 8px; border: 2px solid #8fa3ff;
  background: linear-gradient(#0d1438, #070b22); }
.phones-demo .ph.a { bottom: 0; border-top-left-radius: 4px; border-top-right-radius: 4px; box-shadow: 0 0 14px rgba(45,226,255,.5); }
.phones-demo .ph.b { top: 0; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; box-shadow: 0 0 14px rgba(255,61,242,.5); }
.phones-demo .ph i { position: absolute; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; }
.phones-demo .ph.a i { bottom: 6px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.phones-demo .ph.b i { top: 6px; background: var(--pink); box-shadow: 0 0 10px var(--pink); }
.demo-puck { position: absolute; left: 54px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px #fff;
  animation: rally 1.6s ease-in-out infinite; }
@keyframes rally { 0%, 100% { top: 84px; left: 50px; } 50% { top: 22px; left: 60px; } }

.align-demo { position: relative; width: 160px; height: 190px; }
.align-demo .ph { position: absolute; left: 45px; width: 70px; height: 92px; border-radius: 12px; border: 3px solid; display: grid; place-items: center;
  font-weight: 900; font-size: 13px; letter-spacing: .15em; background: #0a1030; }
.align-demo .ph.you { bottom: 0; border-color: var(--cyan); box-shadow: 0 0 18px rgba(45,226,255,.5); animation: slideUp 2.4s ease-in-out infinite; }
.align-demo .ph.them { top: 0; border-color: var(--pink); box-shadow: 0 0 18px rgba(255,61,242,.5); animation: slideDown 2.4s ease-in-out infinite; }
.align-demo .ph.them span { transform: rotate(180deg); }
.align-demo .seam { position: absolute; left: 30px; right: 30px; top: 94px; height: 2px; background: var(--red); box-shadow: 0 0 12px var(--red); opacity: .8; }
@keyframes slideUp { 0%, 15% { transform: translateY(16px); } 55%, 100% { transform: translateY(0); } }
@keyframes slideDown { 0%, 15% { transform: translateY(-16px); } 55%, 100% { transform: translateY(0); } }

#rotate { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; text-align: center; background: var(--bg);
  font-size: 22px; font-weight: 800; }
#rotate small { font-weight: 400; color: #9fb4ff; font-size: 15px; }
@media (orientation: landscape) and (max-height: 520px) { #rotate { display: grid; } }

#toast { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 40; padding: 12px 18px; border-radius: 12px;
  background: rgba(10, 14, 40, .9); border: 1px solid rgba(255,255,255,.15); font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .3s; }
#toast.show { opacity: 1; }

#btnMenu { position: fixed; z-index: 5; display: none; width: 40px; height: 40px; border-radius: 50%; padding: 11px 9px;
  left: calc(10px + env(safe-area-inset-left, 0px)); bottom: calc(12px + var(--sab));
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); flex-direction: column; justify-content: space-between; }
#btnMenu span { display: block; height: 2px; border-radius: 1px; background: rgba(255,255,255,.55); }
body.playing #btnMenu { display: flex; }
