/* Gzowo Bowling — complete 2D design system: tokens, components, TV + phone screens, animations. */

:root {
  --bg: #FFF6E9;
  --card: #FFFFFF;
  --text: #2B2A4A;
  --text2: #6B6A85;
  --primary: #FF6B6B;
  --secondary: #4CC9F0;
  --success: #3DD68C;
  --warn: #FFD23F;
  --p1: #FF5C7A;
  --p2: #FF9F1C;
  --p3: #FFD23F;
  --p4: #3DD68C;
  --p5: #4CC9F0;
  --p6: #9B5DE5;
  --bg-soft: #FFEFD9;
  --line: rgba(43, 42, 74, .08);
  --overlay: rgba(43, 42, 74, .55);
  --gold: #FFC24B;
  --gold-glow: rgba(255, 194, 75, .55);
  --r-card: 24px;
  --r-btn: 18px;
  --r-pill: 999px;
  --shadow: 0 10px 24px rgba(0, 0, 0, .12);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, .10);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, .16);
  --press-edge: 6px;
  --press-edge-color: #E8DECB;
  --shadow-press: 0 var(--press-edge) 0 0 var(--press-edge-color), 0 10px 20px rgba(0, 0, 0, .14);
  --shadow-pressed: 0 2px 0 0 var(--press-edge-color), 0 4px 8px rgba(0, 0, 0, .10);
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;
  --font: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-hero: clamp(26px, 8vmin, 34px);
  --fs-h1: clamp(20px, 6.2vmin, 26px);
  --fs-h2: clamp(16px, 4.8vmin, 20px);
  --fs-body: clamp(14px, 4.1vmin, 17px);
  --fs-label: clamp(11px, 3.2vmin, 13px);
  --fs-btn: clamp(15px, 4.4vmin, 19px);
  --fs-giant: clamp(52px, 16vmin, 72px);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-spring-big: cubic-bezier(.22, 1.9, .4, 1);
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

body.tv {
  --fs-hero: 88px;
  --fs-h1: 48px;
  --fs-h2: 32px;
  --fs-body: 24px;
  --fs-label: 18px;
  --fs-btn: 28px;
  --fs-giant: 160px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body.tv { overflow: hidden; }
body.phone { touch-action: manipulation; }

h1, h2, h3 { margin: 0 0 var(--s3); line-height: 1.15; }
h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 { font-size: var(--fs-h2); font-weight: 600; }
h3 { font-size: var(--fs-body); font-weight: 600; }
p { margin: 0 0 var(--s3); }

.hidden { display: none !important; }
.muted { color: var(--text2); }
.tabular { font-variant-numeric: tabular-nums; }
.label {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--text2);
}
.label-upper { text-transform: uppercase; }

canvas { display: block; }

#app { min-height: 100vh; min-height: 100dvh; }
body.tv #app { height: 100vh; }

.card {
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: var(--s5);
}
.tv .card { padding: var(--s6); }
.card-lift { box-shadow: var(--shadow-lift); }
.card-flat { box-shadow: none; border: 1px solid var(--line); }

.btn {
  font-family: var(--font);
  font-size: var(--fs-btn);
  font-weight: 600;
  color: var(--text);
  background: var(--bg-soft);
  border: none;
  border-radius: var(--r-btn);
  min-height: 48px;
  padding: var(--s2) clamp(var(--s3), 4vw, var(--s5));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  overflow-wrap: anywhere;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled, .btn.disabled {
  opacity: .4;
  pointer-events: none;
  box-shadow: none;
  animation: none;
}
.btn-primary { background: var(--primary); color: #FFFFFF; }
.btn-secondary { background: var(--secondary); color: var(--text); }
.btn-success { background: var(--success); color: var(--text); }
.btn-warn { background: var(--warn); color: var(--text); }
.btn-pill { border-radius: var(--r-pill); }
.btn-ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text2);
}
.btn-3d {
  box-shadow: var(--shadow-press);
  transition: transform 90ms var(--ease-out), box-shadow 90ms var(--ease-out);
}
.btn-3d.btn-primary { --press-edge-color: #E05555; }
.btn-3d.btn-secondary { --press-edge-color: #35A8CC; }
.btn-3d.btn-success { --press-edge-color: #2FB574; }
.btn-3d.btn-warn { --press-edge-color: #E0B32F; }
.btn-3d:active {
  transform: translateY(var(--press-edge));
  box-shadow: var(--shadow-pressed);
}
.btn-big { min-height: 60px; font-size: var(--fs-btn); width: 100%; }
.btn-icon {
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: var(--r-pill);
  font-size: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px clamp(8px, 2.6vw, 14px);
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--text);
  border: none;
  font-family: var(--font);
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
}
.chip-soft { background: var(--bg-soft); box-shadow: none; }
.chip-warn { background: var(--warn); }
.chip-color { background: var(--pc, var(--bg-soft)); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--warn);
  color: var(--text);
  font-size: var(--fs-label);
  font-weight: 600;
}

.input {
  width: 100%;
  height: 56px;
  border-radius: var(--r-btn);
  background: var(--bg-soft);
  border: 2px solid transparent;
  font-family: var(--font);
  font-size: var(--fs-h2);
  font-weight: 500;
  color: var(--text);
  text-align: center;
  outline: none;
  transition: border-color .2s;
}
.input:focus { border-color: var(--secondary); }
.input::placeholder { color: var(--text2); opacity: .6; }

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  border: none;
}
.slider::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  border: none;
}

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  min-width: 44px;
  border-radius: var(--r-pill);
  background: rgba(43, 42, 74, .18);
  border: none;
  cursor: pointer;
  transition: background .25s;
  padding: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease-spring);
}
.toggle.on { background: var(--warn); }
.toggle.on::after { transform: translateX(18px); }

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlay-fade .25s ease both;
}
.tv .overlay { align-items: center; }
@keyframes overlay-fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card);
  border-radius: var(--r-card) var(--r-card) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--s5);
  animation: sheet-up .45s var(--ease-spring) both;
}
.tv .modal { border-radius: var(--r-card); max-width: 720px; }
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--line);
  margin: 0 auto var(--s4);
}
.sheet-section-title {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text2);
  margin: var(--s4) 0 var(--s2);
}

@keyframes spring-in {
  0% { transform: scale(.3); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  80% { transform: scale(.96); }
  100% { transform: scale(1); }
}
.spring-in { animation: spring-in .45s var(--ease-spring) both; }

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.pop { animation: pop .28s var(--ease-spring); }

@keyframes jiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(3deg); }
  50% { transform: rotate(-3deg); }
  75% { transform: rotate(1.5deg); }
}
.jiggle { animation: jiggle .4s ease-in-out; }
.jiggle-loop { animation: jiggle 1.2s ease-in-out infinite; }
.jiggle-slow { animation: jiggle 2.6s ease-in-out infinite; }

@keyframes banner-in {
  0% { transform: translateY(-60px) scale(.6); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes banner-out {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-30px) scale(.85); opacity: 0; }
}
.banner-in { animation: banner-in .5s var(--ease-spring-big) both; }
.banner-out { animation: banner-out .3s var(--ease-out) both; }

@keyframes crown-float {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}
.crown-float { animation: crown-float 2.2s ease-in-out infinite; }

@keyframes emote-pop {
  0% { transform: translateY(0) scale(.4); opacity: 0; }
  15% { transform: translateY(-30px) scale(1.25); opacity: 1; }
  30% { transform: translateY(-60px) scale(1); }
  100% { transform: translateY(-220px) scale(1) rotate(var(--emote-tilt, 8deg)); opacity: 0; }
}
.emote-pop {
  position: absolute;
  font-size: 64px;
  z-index: 30;
  pointer-events: none;
  animation: emote-pop 1.6s var(--ease-out) both;
}
@keyframes emote-sway {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(14px); }
  75% { transform: translateX(-14px); }
}
.emote-sway {
  display: inline-block;
  animation: emote-sway .8s ease-in-out 2;
}

@keyframes count-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.count-up { animation: count-pulse .3s var(--ease-spring); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.shake { animation: shake .35s ease-in-out; }

@keyframes pulse-soft {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}
.pulse-soft { animation: pulse-soft 2s ease-in-out infinite; }

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin-slow { animation: spin-slow 8s linear infinite; }

@keyframes dash-march { to { stroke-dashoffset: -16; } }

@keyframes chev-up {
  0% { transform: translateY(16px); opacity: 0; }
  30% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateY(-16px); opacity: 0; }
}

@keyframes trophy-drop {
  0% { transform: translateY(-420px) scale(1); opacity: 0; }
  55% { transform: translateY(0) scale(1.1, .88); opacity: 1; }
  75% { transform: translateY(-22px) scale(.97, 1.05); }
  90% { transform: translateY(0) scale(1.02, .98); }
  100% { transform: translateY(0) scale(1); }
}
.trophy-drop { animation: trophy-drop .9s var(--ease-spring-big) both; }

@keyframes confetti-fall {
  0% { transform: translateY(-30px) rotate(0deg); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

@keyframes stamp-in {
  0% { transform: translate(-50%, -50%) rotate(-8deg) scale(3); opacity: 0; }
  55% { opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; }
}

@keyframes flash-fade {
  from { opacity: .9; }
  to { opacity: 0; }
}

@keyframes pin-bounce {
  0%, 100% { transform: translateY(0) rotate(0); }
  40% { transform: translateY(-16px) rotate(-6deg); }
}

@keyframes vignette-pulse {
  0%, 100% { opacity: 0; }
  40% { opacity: 1; }
}

@keyframes hand-drag {
  0%, 100% { transform: translateX(-44px); }
  50% { transform: translateX(44px); }
}
@keyframes hand-arc {
  0%, 100% { transform: translateX(-34px) rotate(-20deg); }
  50% { transform: translateX(34px) rotate(20deg); }
}
@keyframes hand-flick {
  0% { transform: translateY(44px); opacity: 0; }
  20% { opacity: 1; }
  55% { transform: translateY(-64px); opacity: 1; }
  70% { transform: translateY(-64px); opacity: 0; }
  100% { transform: translateY(-64px); opacity: 0; }
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: opacity .4s ease;
}
.splash-inner { text-align: center; }
.splash-logo {
  font-size: 72px;
  animation: jiggle 1.6s ease-in-out infinite;
}
.splash-title {
  font-size: var(--fs-hero);
  font-weight: 700;
  letter-spacing: .06em;
  margin-top: var(--s3);
}
.splash-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: var(--s5);
}
.splash-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse-soft 1.2s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: .2s; background: var(--secondary); }
.splash-dots span:nth-child(3) { animation-delay: .4s; background: var(--success); }
.splash-out { opacity: 0; pointer-events: none; }

.error-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--s5);
}
.error-card {
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow-lift);
}
.error-emoji { font-size: 64px; margin-bottom: var(--s3); }
.error-card h1 { font-size: var(--fs-h1); }
.error-card .btn { margin-top: var(--s4); min-width: 160px; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--s4);
  gap: var(--s4);
}
.tv .screen { padding: var(--s7); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  padding: var(--s4) 0 0;
}
.logo-small {
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: .05em;
}

.progress-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: var(--s2) 0;
}
.progress-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--line);
  transition: all .35s var(--ease-spring);
}
.progress-dots .dot.active {
  width: 28px;
  background: var(--primary);
}

.connect-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s7);
}
.logo-hero {
  font-size: var(--fs-hero);
  font-weight: 700;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: var(--s4);
}
.logo-hero .pin-glyph { display: inline-block; animation: jiggle 2.4s ease-in-out infinite; }
.tagline {
  color: var(--text2);
  font-size: var(--fs-body);
  margin-top: var(--s2);
}
.connect-card {
  display: flex;
  align-items: center;
  gap: var(--s7);
  padding: var(--s7);
  margin: auto;
  box-shadow: var(--shadow-lift);
}
.qr-box {
  background: #FFFFFF;
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  display: grid;
  place-items: center;
}
.qr-box-lg { width: 452px; height: 452px; }
.qr-box img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }
.qr-box canvas { display: none; }
.qr-caption {
  text-align: center;
  margin-top: var(--s3);
  font-size: var(--fs-label);
  color: var(--text2);
}
.code-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s3);
}
.code-tiles { display: flex; gap: var(--s3); }
.code-tile {
  background: var(--bg-soft);
  border-radius: var(--r-btn);
  padding: var(--s3) var(--s4);
  font-size: var(--fs-giant);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}
.code-tiles-sm .code-tile {
  font-size: var(--fs-h1);
  padding: var(--s2) var(--s3);
  border-radius: 12px;
}
.room-url {
  color: var(--text2);
  font-size: var(--fs-body);
  word-break: break-all;
}
.waiting-line {
  margin-top: auto;
  color: var(--text2);
  animation: pulse-soft 2s ease-in-out infinite;
  padding-bottom: var(--s6);
}

.lobby-topbar {
  position: fixed;
  top: var(--s5);
  left: var(--s7);
  display: flex;
  align-items: center;
  gap: var(--s4);
  z-index: 5;
}
.qr-dock {
  position: fixed;
  top: var(--s5);
  right: var(--s7);
  display: flex;
  align-items: center;
  gap: var(--s4);
  z-index: 5;
}
.qr-dock .qr-box { width: 216px; height: 216px; padding: var(--s2); }

.player-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 380px));
  gap: var(--s5);
  justify-content: center;
  align-content: center;
  min-height: 60vh;
  padding: 12vh var(--s7) 0;
}
.player-card {
  position: relative;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: center;
  gap: var(--s4);
}
.player-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--pc, var(--line));
}
.ghost-card {
  border: 3px dashed var(--line);
  border-radius: var(--r-card);
  background: transparent;
  box-shadow: none;
  min-height: 200px;
  display: grid;
  place-items: center;
  color: var(--text2);
  font-size: 48px;
  opacity: .7;
}
.player-card-info {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  min-width: 0;
}
.player-nick {
  font-size: var(--fs-h1);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ball-ring {
  border: 4px solid var(--pc, var(--line));
  border-radius: 50%;
  padding: 4px;
  flex-shrink: 0;
}
.ball-disc {
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .08);
  background: var(--bc, var(--primary));
  display: block;
}
.ball-disc-32 { width: 32px; height: 32px; }
.ball-disc-48 { width: 48px; height: 48px; }
.ball-disc-56 { width: 56px; height: 56px; }
.ball-disc-72 { width: 72px; height: 72px; }
.ball-disc-96 { width: 96px; height: 96px; }
.ball-disc-140 { width: 140px; height: 140px; }
.ball-ghost { opacity: .35; animation: pulse-soft 1.6s ease-in-out infinite; }
.weight-badge {
  display: inline-block;
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  font-size: var(--fs-label);
  font-weight: 600;
  text-align: center;
}
.conn-dot {
  width: 12px;
  height: 12px;
  min-width: 12px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}
.conn-dot.off { background: var(--text2); }

.settings-preview {
  position: fixed;
  left: var(--s7);
  bottom: var(--s6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  z-index: 5;
  max-width: 40vw;
}
.start-hint {
  position: fixed;
  bottom: var(--s6);
  left: 50%;
  transform: translateX(-50%);
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: var(--s2);
  z-index: 5;
  white-space: nowrap;
}
.start-hint .phone-icon { display: inline-block; animation: jiggle 1.8s ease-in-out infinite; }

.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
.hud > * { pointer-events: none; }

.leaderboard {
  position: fixed;
  left: var(--s7);
  top: var(--s7);
  width: 340px;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: var(--s4);
}
.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: var(--s3);
  gap: var(--s2);
}
.leaderboard-row {
  position: relative;
  height: 56px;
  margin-bottom: var(--s2);
  border-radius: var(--r-btn);
  padding: 4px 12px 14px;
  display: flex;
  align-items: center;
  gap: var(--s2);
  border: 2px solid transparent;
  transition: transform .4s var(--ease-spring), background .3s ease, border-color .3s ease, opacity .3s;
}
.leaderboard-row.active {
  transform: scale(1.04);
  background: color-mix(in srgb, var(--pc, #FFFFFF) 14%, white);
  border-color: var(--pc, var(--line));
}
.leaderboard-row.disconnected { opacity: .4; }
.lb-pip {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: var(--r-pill);
  background: var(--pc, var(--text2));
}
.lb-crown { font-size: 16px; animation: crown-float 2.2s ease-in-out infinite; }
.lb-marker { font-size: 14px; animation: jiggle 1.2s ease-in-out infinite; }
.lb-nick {
  font-size: var(--fs-body);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 10ch;
}
.lb-total {
  margin-left: auto;
  font-size: var(--fs-h2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lb-bonus {
  font-size: 12px;
  font-weight: 600;
  background: var(--warn);
  border-radius: var(--r-pill);
  padding: 1px 7px;
}
.leaderboard-bar {
  position: absolute;
  left: 12px;
  bottom: 5px;
  height: 6px;
  max-width: calc(100% - 24px);
  border-radius: var(--r-pill);
  background: var(--pc, var(--secondary));
  transition: width .7s var(--ease-spring);
}

.plaque {
  position: absolute;
  transform: translate(-50%, -100%);
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  background: var(--pc, var(--card));
  color: var(--text);
  border-radius: var(--r-pill);
  padding: var(--s2) var(--s4);
  font-weight: 600;
  font-size: var(--fs-body);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  z-index: 15;
  transition: transform .3s var(--ease-spring), box-shadow .3s ease;
}
.plaque .plaque-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.plaque.active {
  transform: translate(-50%, -100%) scale(1.15);
  box-shadow: var(--shadow-lift);
}
.plaque.leader { box-shadow: 0 0 24px var(--gold-glow), var(--shadow-sm); }
.plaque.active.leader { box-shadow: 0 0 24px var(--gold-glow), var(--shadow-lift); }

.crown {
  position: absolute;
  top: -48px;
  left: 50%;
  margin-left: -20px;
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 0 12px var(--gold-glow));
  animation: crown-float 2.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 16;
}
.crown-alt { animation-delay: -1.1s; }

.banner-slot {
  position: fixed;
  top: var(--s7);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 60;
  pointer-events: none;
}
.banner {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  background: var(--card);
  color: var(--text);
  border-radius: var(--r-pill);
  padding: var(--s4) var(--s7);
  font-size: var(--fs-h1);
  font-weight: 700;
  box-shadow: var(--shadow-lift);
  white-space: nowrap;
}
.banner .banner-letter { display: inline-block; animation: spring-in .4s var(--ease-spring) both; }
.banner-narrow { background: var(--warn); }
.banner-playerTurn { background: var(--pc, var(--secondary)); }
.banner-strike, .banner-turkey {
  background: var(--primary);
  color: #FFFFFF;
  font-size: var(--fs-giant);
  padding: var(--s4) var(--s8);
  line-height: 1;
}
.banner-turkey { transform: scale(1.15); }
.banner-spare { background: var(--success); }
.banner-gutter { background: var(--text2); color: #FFFFFF; }
.banner-suddenDeath { background: var(--text); color: #FFFFFF; }
.banner-mulligan, .banner-skipped, .banner-undo, .banner-newGame { background: var(--card); }
.banner-mulligan .banner-icon, .banner-skipped .banner-icon,
.banner-undo .banner-icon, .banner-newGame .banner-icon { color: var(--secondary); }
.banner-finalFrame-chip {
  background: var(--primary);
  color: #FFFFFF;
  border-radius: var(--r-pill);
  padding: 2px 14px;
  font-size: .5em;
  font-weight: 700;
}
.sd-vignette {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  box-shadow: inset 0 0 180px rgba(255, 92, 92, .8);
  animation: vignette-pulse 1s ease-in-out both;
}

.trick-stamp {
  position: fixed;
  top: 38%;
  left: 50%;
  z-index: 70;
  transform: translate(-50%, -50%) rotate(-8deg);
  animation: stamp-in .45s var(--ease-spring-big) both;
  pointer-events: none;
  text-align: center;
}
.trick-stamp-burst {
  position: relative;
  background: var(--warn);
  padding: var(--s5) var(--s7);
  border-radius: var(--r-btn);
}
.trick-stamp-burst::before, .trick-stamp-burst::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--warn);
  border-radius: var(--r-btn);
  z-index: -1;
}
.trick-stamp-burst::before { transform: rotate(14deg); }
.trick-stamp-burst::after { transform: rotate(-12deg); }
.trick-title {
  font-size: var(--fs-hero);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.trick-sub {
  font-size: var(--fs-h2);
  font-weight: 600;
  color: var(--text);
  margin-top: var(--s2);
}
.flash-overlay {
  position: fixed;
  inset: 0;
  background: #FFFFFF;
  z-index: 69;
  pointer-events: none;
  animation: flash-fade .12s ease-out both;
}

.camera-chip {
  position: fixed;
  right: var(--s7);
  bottom: var(--s7);
  z-index: 25;
}

.letterbox-top, .letterbox-bottom {
  position: fixed;
  left: 0;
  right: 0;
  height: 12vh;
  background: #000000;
  z-index: 50;
  transition: transform .4s var(--ease-in-out);
  pointer-events: none;
}
.letterbox-top { top: 0; transform: translateY(-100%); }
.letterbox-bottom { bottom: 0; transform: translateY(100%); }
.letterbox-top.show, .letterbox-bottom.show { transform: translateY(0); }

.pause-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 80;
  display: grid;
  place-items: center;
  animation: overlay-fade .25s ease both;
}
.pause-card { text-align: center; max-width: 560px; }
.pause-icon { font-size: 96px; line-height: 1; margin-bottom: var(--s3); }
.pause-title { font-size: var(--fs-hero); font-weight: 700; }

.winner-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  gap: var(--s6);
  padding: var(--s7);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}
.winner-left {
  flex: 0 0 55%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s4);
  text-align: center;
  min-width: 0;
}
.winner-right {
  flex: 1 1 45%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.winner-heading { font-size: var(--fs-h1); font-weight: 600; color: var(--text2); }
.trophy { font-size: 180px; line-height: 1; }
.winner-name-row {
  display: flex;
  align-items: center;
  gap: var(--s5);
  justify-content: center;
  flex-wrap: wrap;
}
.winner-name {
  font-size: var(--fs-giant);
  font-weight: 700;
  line-height: 1;
  color: var(--pc, var(--primary));
}
.winner-wins-line { font-size: var(--fs-h1); font-weight: 600; }
.replay-frame {
  width: 640px;
  max-width: 100%;
  height: 360px;
  border-radius: var(--r-card);
  border: 4px solid var(--warn);
  overflow: hidden;
  position: relative;
  background: #000000;
}
.replay-frame-label {
  position: absolute;
  top: var(--s3);
  left: var(--s3);
  z-index: 2;
  display: flex;
  gap: var(--s2);
  align-items: center;
}
.ranking-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: var(--s3);
}
.ranking-row {
  display: flex;
  align-items: center;
  gap: var(--s4);
  min-height: 72px;
  padding: 0 var(--s4);
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--card);
}
.ranking-row.winner-row { background: color-mix(in srgb, var(--pc, #FFFFFF) 14%, white); }
.rank-place {
  font-size: var(--fs-h1);
  font-weight: 700;
  min-width: 56px;
  color: var(--text2);
}
.rank-place.rank-1 { color: var(--gold); }
.rank-place.rank-2 { color: #C7C9D3; }
.rank-place.rank-3 { color: #D9985F; }
.rank-nick {
  font-size: var(--fs-h2);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-total {
  margin-left: auto;
  font-size: var(--fs-h1);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.winner-qr {
  display: flex;
  align-items: center;
  gap: var(--s4);
  margin-top: var(--s4);
}
.winner-qr .qr-box { width: 196px; height: 196px; padding: var(--s2); }
.winner-qr .winner-card-preview { width: 120px; max-width: 120px; margin: 0; }
.winner-footer {
  position: fixed;
  bottom: var(--s5);
  left: 50%;
  transform: translateX(-50%);
  color: var(--text2);
  white-space: nowrap;
}

.confetti-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 95;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  animation: confetti-fall linear infinite;
}

.join-card { width: 100%; }
.swatch-row {
  display: flex;
  gap: var(--s3);
  justify-content: space-between;
  flex-wrap: wrap;
}
.swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .25s var(--ease-spring), border-color .2s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.swatch.selected {
  border-color: var(--text);
  transform: scale(1.15);
}
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
}
.pattern-chip {
  min-height: 64px;
  border-radius: var(--r-btn);
  background: var(--bg-soft);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-family: var(--font);
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--text);
  padding: var(--s2);
  transition: border-color .2s, background .2s;
}
.pattern-chip.selected {
  border-color: var(--text);
  background: var(--card);
}
.pattern-chip canvas, .pattern-chip .pattern-mini { border-radius: 50%; }

.segmented {
  display: flex;
  background: var(--bg-soft);
  border-radius: var(--r-btn);
  padding: 4px;
  gap: 4px;
}
.seg {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  padding: 0 var(--s2);
  border: none;
  border-radius: 14px;
  background: transparent;
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  line-height: 1.1;
  overflow-wrap: anywhere;
  transition: background .2s, color .2s;
}
.seg.selected {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.weight-hint {
  min-height: 22px;
  font-size: var(--fs-label);
  color: var(--text2);
  text-align: center;
  margin-top: var(--s2);
}

.ball-preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-btn);
  background: radial-gradient(circle at 50% 45%, #FFFFFF 0%, var(--bg-soft) 75%);
  overflow: hidden;
  touch-action: none;
}
.ball-preview-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.rotate-hint {
  text-align: center;
  font-size: var(--fs-label);
  color: var(--text2);
  margin-top: var(--s2);
}
.rotate-hint .hand { display: inline-block; animation: jiggle .4s ease-in-out 3; }

.theme-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.theme-card {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: 0 var(--s4);
  border-radius: var(--r-btn);
  background: var(--bg-soft);
  border: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  text-align: left;
  transition: border-color .2s, background .2s;
}
.theme-card.selected {
  border-color: var(--tc, var(--primary));
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.theme-icon { font-size: 40px; line-height: 1; }
.theme-name { font-size: var(--fs-h2); font-weight: 600; flex: 1; }
.radio-dot {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 3px solid var(--line);
  transition: all .2s;
}
.theme-card.selected .radio-dot {
  border-color: var(--tc, var(--primary));
  background: var(--tc, var(--primary));
}

.cta-dock {
  position: sticky;
  bottom: 0;
  padding: var(--s3) 0 var(--s4);
  background: linear-gradient(to bottom, transparent, var(--bg) 40%);
  margin-top: auto;
}
.start-btn {
  width: 100%;
  min-height: 68px;
  font-size: var(--fs-btn);
  font-weight: 700;
  animation: breathe 3s ease-in-out infinite;
}
.char-counter {
  text-align: right;
  font-size: var(--fs-label);
  color: var(--text2);
  margin-top: var(--s1);
}
.nick-error {
  color: var(--primary);
  font-size: var(--fs-label);
  font-weight: 600;
  min-height: 20px;
  text-align: center;
}

.you-card {
  display: flex;
  align-items: center;
  gap: var(--s4);
  position: relative;
  overflow: hidden;
}
.you-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--pc, var(--line));
}
.player-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
}
.player-row .nick { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pins-illustration {
  text-align: center;
  font-size: 40px;
  padding: var(--s6) 0;
}
.pins-illustration span {
  display: inline-block;
  animation: pin-bounce 1.4s var(--ease-spring) infinite;
}
.pins-illustration span:nth-child(2) { animation-delay: .15s; }
.pins-illustration span:nth-child(3) { animation-delay: .3s; }
.pins-illustration span:nth-child(4) { animation-delay: .45s; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) 0;
}
.setting-label { font-weight: 600; }
.setting-desc { font-size: var(--fs-label); color: var(--text2); }

.throwpad {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: var(--s3) var(--s4);
  gap: var(--s3);
}
.status-bar {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.6vw, 12px);
}
.status-bar .status-title { flex: 1 1 0; }
.status-bar .btn-icon {
  width: clamp(38px, 11vw, 48px);
  min-height: clamp(38px, 11vw, 48px);
  flex: none;
}
.status-bar .frame-chip { flex: none; }
.color-strip {
  width: 8px;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--pc, var(--line));
}
.status-title { font-size: var(--fs-h2); font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame-chip { font-variant-numeric: tabular-nums; }

.minilane {
  flex: 8 1 0;
  min-height: clamp(130px, 24vh, 190px);
  position: relative;
  border-radius: var(--r-card);
  background: var(--bg-soft);
  overflow: hidden;
  touch-action: none;
}
.lane-surface {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18%;
  right: 18%;
  background: linear-gradient(to bottom, #F0CE9A 0%, #E9BB80 100%);
  border-radius: 12px;
  transition: left .5s var(--ease-spring), right .5s var(--ease-spring);
}
.minilane.narrow .lane-surface { left: 27%; right: 27%; }
.narrow-chip {
  position: absolute;
  top: var(--s2);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}
.lane-markings {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  opacity: .5;
  font-size: 14px;
  color: #B98B54;
}
.pin-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid #E3C9A0;
  transform: translate(-50%, -50%);
}
.pin-dot.down { opacity: .25; }
.limit-line {
  position: absolute;
  left: 12%;
  right: 12%;
  border-top: 3px dashed rgba(43, 42, 74, .2);
}
.puck {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  background: var(--bc, var(--primary));
  transform: translate(-50%, -50%);
  transition: box-shadow .2s;
  touch-action: none;
  z-index: 2;
}
.puck.drag { box-shadow: var(--shadow-lift); }
.aim-arrow { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.aim-arrow path {
  stroke: var(--pc, var(--primary));
  stroke-width: 4;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 8 8;
  animation: dash-march 1s linear infinite;
}

.spin-dial-wrap {
  flex: 3 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.spin-dial-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.spin-value { font-variant-numeric: tabular-nums; }
.dial-track {
  position: relative;
  height: 64px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  touch-action: none;
}
.dial-track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  bottom: 10px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: var(--r-pill);
  background: var(--line);
}
.dial-knob {
  position: absolute;
  top: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  font-size: 26px;
  touch-action: none;
  z-index: 1;
}
.dial-knob.snap { transition: left .3s var(--ease-spring); }

.flick-zone {
  flex: 8 1 0;
  min-height: clamp(120px, 21vh, 165px);
  position: relative;
  border-radius: var(--r-card);
  background: var(--bg-soft);
  overflow: hidden;
  touch-action: none;
  display: grid;
  place-items: center;
}
.flick-hint {
  color: var(--text2);
  font-size: var(--fs-body);
  z-index: 1;
  text-align: center;
  pointer-events: none;
}
.chevrons {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  opacity: .35;
  pointer-events: none;
}
.chevrons span {
  font-size: 26px;
  animation: chev-up 1.2s linear infinite;
}
.chevrons span:nth-child(2) { animation-delay: .3s; }
.chevrons span:nth-child(3) { animation-delay: .6s; }
.power-bar {
  position: absolute;
  right: 8px;
  top: 8px;
  bottom: 8px;
  width: 10px;
  border-radius: var(--r-pill);
  background: rgba(43, 42, 74, .08);
  overflow: hidden;
  pointer-events: none;
}
.power-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  border-radius: inherit;
  background: linear-gradient(to top, var(--success), var(--warn), var(--primary));
}
.flick-trail {
  position: absolute;
  width: 14px;
  height: 90px;
  border-radius: var(--r-pill);
  background: linear-gradient(to top, transparent, rgba(76, 201, 240, .75));
  pointer-events: none;
  transform: translate(-50%, -100%);
}
.rolling-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  color: var(--text2);
}
.rolling-ball {
  font-size: 48px;
  animation: spin-slow 1.2s linear infinite;
}

.action-row {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.action-row .spacer { flex: 1; }

.emote-bar {
  position: relative;
  display: flex;
  gap: clamp(4px, 1.4vw, 8px);
  padding: var(--s2) 0;
  scrollbar-width: none;
  width: 100%;
}
.emote-bar::-webkit-scrollbar { display: none; }
.emote-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 1;
  max-width: 54px;
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  border: none;
  padding: 0;
  font-size: clamp(17px, 5.2vw, 24px);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: opacity .2s, transform .12s var(--ease-spring);
}
.emote-bar.cooling .emote-btn { opacity: .5; pointer-events: none; }
.emote-bar.cooling .emote-btn::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(var(--secondary) calc(var(--cd, 0) * 1%), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}
.emote-fly {
  position: absolute;
  font-size: 28px;
  pointer-events: none;
  animation: emote-pop 1s var(--ease-out) both;
  z-index: 5;
}

.wait-screen {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  min-height: 100dvh;
  padding: var(--s4);
}
.turn-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  background: var(--pc, var(--bg-soft));
  border-radius: var(--r-pill);
  padding: var(--s2) var(--s4);
  font-size: var(--fs-h2);
  font-weight: 700;
  align-self: center;
  max-width: 100%;
}
.turn-chip .nick { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-card { text-align: center; }
.big-total {
  font-size: var(--fs-hero);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.frame-strip {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--s3);
}
.frame-cell {
  min-width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  font-size: var(--fs-label);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 2px solid transparent;
  padding: 0 4px;
}
.frame-cell.current { border-color: var(--pc, var(--primary)); }
.rank-chip { align-self: center; }
.ticker {
  font-size: var(--fs-label);
  color: var(--text2);
  text-align: center;
  min-height: 20px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.paused-chip { align-self: center; }
.inputs-disabled { opacity: .4; pointer-events: none; }

.host-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
}
.host-tile {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  border-radius: var(--r-btn);
  background: var(--bg-soft);
  border: none;
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.host-tile .tile-icon { font-size: 28px; line-height: 1; }
.host-tile.danger {
  background: color-mix(in srgb, var(--primary) 14%, white);
  color: var(--primary);
}
.player-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) 0;
}
.music-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.music-row .slider { flex: 1; }

.share-block { text-align: center; }
.share-card-img {
  width: 72%;
  max-width: 320px;
  border-radius: var(--r-btn);
  box-shadow: var(--shadow);
  transform: rotate(-2deg);
  display: block;
  margin: var(--s4) auto;
}
.placement-card { text-align: center; }
.placement-big { font-size: var(--fs-hero); font-weight: 700; }

.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  animation: overlay-fade .25s ease both;
}
.tutorial-card {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-radius: var(--r-card) var(--r-card) 0 0;
  padding: var(--s5);
  z-index: 205;
  animation: sheet-up .45s var(--ease-spring) both;
}
.tutorial-close {
  position: absolute;
  top: var(--s3);
  right: var(--s3);
  z-index: 206;
}
.tutorial-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: var(--s4);
}
.step-chip { margin-bottom: var(--s2); }
.spotlit {
  position: relative;
  z-index: 202;
  border-radius: var(--r-btn);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .9), 0 0 0 9999px var(--overlay);
}
.hand-hint {
  position: fixed;
  font-size: 48px;
  z-index: 203;
  pointer-events: none;
}
.hand-drag { animation: hand-drag 1.8s ease-in-out infinite; }
.hand-arc { animation: hand-arc 1.8s ease-in-out infinite; }
.hand-flick { animation: hand-flick 1.8s ease-in infinite; }
.hand-flick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 6px;
  height: 44px;
  border-radius: var(--r-pill);
  background: linear-gradient(to bottom, rgba(76, 201, 240, .7), transparent);
  transform: translateX(-50%);
}
.step-check {
  color: var(--success);
  font-size: 32px;
  font-weight: 700;
}

/* v1.8 — tutorial "My Balls" step: row of demo ball discs, one picked */
.tut-balls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 20px 16px;
}
.tut-ball {
  position: relative;
  border-radius: 50%;
  padding: 4px;
  transition: transform .18s ease;
}
.tut-ball .ball-disc-canvas { display: block; border-radius: 50%; }
.tut-ball.sel {
  transform: scale(1.1);
  box-shadow: 0 0 0 4px var(--primary);
}
.tut-ball-check {
  position: absolute;
  right: -6px;
  top: -6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

/* v1.3 — respect iOS safe-area (home indicator / notch) on phone full-height screens */
.throwpad, .wait-screen { padding-bottom: max(var(--s3), env(safe-area-inset-bottom)); }
body.phone .screen, body.phone .error-wrap { padding-bottom: max(var(--s4), env(safe-area-inset-bottom)); }

/* v1.5 — My Balls manager + turn-start ball picker */
.myballs-overlay, .picker-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.subtitle { color: var(--text2); font-size: var(--fs-body); margin: 4px 0 14px; text-align: center; }
.ball-rows { display: flex; flex-direction: column; gap: var(--s3); margin-bottom: var(--s4); }
.ball-row { display: flex; align-items: center; gap: var(--s3); background: var(--bg-soft); border-radius: var(--r-card); padding: var(--s3); position: relative; }
.ball-disc-canvas { border-radius: 50%; flex: none; box-shadow: var(--shadow-sm); }
.ball-row-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ball-row-weight { font-weight: 700; font-size: var(--fs-h2); }
.ball-row-pattern { color: var(--text2); font-size: var(--fs-label); }
.ball-row-actions { display: flex; gap: var(--s2); flex: none; }
.btn-row-edit, .btn-row-del { width: 46px; min-height: 46px; font-size: 18px; padding: 0; flex: none; }
.btn-add-ball { width: 100%; margin-top: var(--s2); }
.btn-add-ball.is-disabled { opacity: .5; }
.btn-myballs { font-size: var(--fs-body); margin-top: var(--s2); }
.field-hint { color: var(--text2); font-size: var(--fs-label); text-align: center; margin-top: 8px; }
.field-error { color: var(--primary); font-size: var(--fs-label); text-align: center; min-height: 1.2em; margin: 4px 0; font-weight: 600; }
.editor-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
.editor-head h1 { font-size: var(--fs-h1); }
.editor-preview { display: grid; place-items: center; margin: 8px 0 14px; }
.editor-preview-disc { border-radius: 50%; box-shadow: var(--shadow-lift); }
.swatch { position: relative; }
.swatch-taken { opacity: .4; }
.swatch-taken::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.pattern-color-block { margin-top: var(--s2); }
.ball-picker { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s5); padding: var(--s5); background: var(--bg); }
.pick-title { text-align: center; font-size: var(--fs-h1); }
.ball-picker-grid { display: flex; gap: var(--s4); flex-wrap: wrap; justify-content: center; width: 100%; }
.ball-pick-card { display: flex; flex-direction: column; align-items: center; gap: var(--s2); background: var(--card); border: 3px solid transparent; border-radius: var(--r-card); padding: var(--s4); box-shadow: var(--shadow-sm); cursor: pointer; min-width: 118px; }
.ball-pick-card.selected { border-color: var(--primary); transform: translateY(-4px); }
.ball-pick-meta { text-align: center; }
.ball-pick-weight { font-weight: 700; font-size: var(--fs-h2); }
.ball-pick-pattern { color: var(--text2); font-size: var(--fs-label); }

/* v1.6 — My Balls launch button (distinct, pulsing) + back arrow */
.btn-myballs { background: var(--secondary); color: #fff; }
.you-card { flex-wrap: wrap; }
.you-card .btn-myballs { flex-basis: 100%; margin-top: var(--s3); }
.btn-myballs-game { width: 100%; margin-top: var(--s4); }
@keyframes mb-glow { 0%, 100% { box-shadow: var(--shadow-sm); } 50% { box-shadow: 0 0 0 5px rgba(76,201,240,.30), var(--shadow-sm); } }
.btn-myballs { animation: mb-glow 2.2s ease-in-out infinite; }
.topbar-back { justify-content: flex-start; gap: var(--s2); align-items: center; }
.btn-back-arrow { flex: none; }

/* v1.6 — funny host-first connect screen (TV, before anyone joins) */
.connect-hostfirst { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s4); min-height: 100vh; min-height: 100dvh; text-align: center; padding: var(--s7); }
.hostfirst-title { font-size: clamp(34px, 8vw, 88px); font-weight: 700; color: var(--primary); line-height: 1.05; }
.hostfirst-sub { font-size: clamp(17px, 3.4vw, 34px); max-width: min(900px, 92vw); color: var(--text); }
.hostfirst-caption { font-size: clamp(15px, 2.7vw, 28px); margin-top: var(--s2); }
.hostfirst-code { font-size: clamp(14px, 2.3vw, 26px); color: var(--text2); letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.qr-code-mini { font-size: clamp(13px, 1.7vw, 20px); letter-spacing: .18em; text-transform: uppercase; color: var(--text2); opacity: .85; margin-top: 0; }

/* v1.6 — PWA install hint (pad) */
.pwa-hint { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; display: flex; align-items: center; gap: var(--s3); padding: max(var(--s3), env(safe-area-inset-bottom)) var(--s4); background: var(--secondary); color: #fff; box-shadow: 0 -6px 20px rgba(0,0,0,.18); font-size: var(--fs-body); }
.pwa-hint span { flex: 1; }
.pwa-hint button { flex: none; background: rgba(255,255,255,.22); color: #fff; border: none; border-radius: var(--r-pill); padding: var(--s2) var(--s4); font-weight: 600; }

@media (max-width: 480px) {
  .connect-card { flex-direction: column; padding: var(--s5); gap: var(--s5); }
  .qr-box-lg { width: 280px; height: 280px; }
  .winner-screen { flex-direction: column; overflow-y: auto; padding: var(--s4); }
  .winner-left { flex: none; }
  .trophy { font-size: 96px; }
  .replay-frame { height: 200px; }
  .leaderboard { left: var(--s3); top: var(--s3); width: 280px; }
  .player-grid { grid-template-columns: 1fr; padding: var(--s7) var(--s4) 0; }
  .banner { font-size: var(--fs-h2); padding: var(--s3) var(--s5); }
  .banner-strike, .banner-turkey { font-size: var(--fs-hero); padding: var(--s3) var(--s6); }
  .ranking-row { min-height: 56px; }
  .camera-chip { right: var(--s3); bottom: var(--s3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 150ms !important;
    transition-timing-function: linear !important;
  }
}

/* v1.1 — lobby layout fix: docked QR column no longer overlaps player cards */
.qr-dock {
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  width: 200px;
}
.qr-dock .qr-box { width: 168px; height: 168px; padding: var(--s2); }
.qr-dock .code-tiles-sm .code-tile { font-size: var(--fs-h2); padding: var(--s1) var(--s2); }
.player-grid {
  grid-template-columns: repeat(3, minmax(240px, 340px));
  padding: 130px calc(var(--s7) + 220px) 0 var(--s7);
  min-height: 56vh;
}
.settings-preview, .start-hint { padding-right: 220px; }

/* v1.1 — phone join flow fills the screen and centers vertically */
body.phone .join-card {
  margin-top: auto;
  margin-bottom: auto;
  min-height: 56dvh;
  display: flex;
  flex-direction: column;
}
body.phone .join-card > div { display: flex; flex-direction: column; flex: 1; justify-content: center; }
body.phone .join-card .cta-dock { margin-top: auto; padding-top: var(--s4); }
body.phone .screen > .cta-dock { margin-top: auto; }
body.phone .error-wrap { min-height: 100dvh; }

/* v1.1 — weight picker 5–15 lb */
.weight-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s5);
}
.btn-round.weight-step {
  width: 56px;
  height: 56px;
  min-height: 56px;
  border-radius: 50%;
  font-size: 30px;
  font-weight: 700;
  background: var(--secondary);
  color: var(--text);
  --press-edge-color: #35A8CC;
  flex: none;
  padding: 0;
}
.weight-value-wrap { text-align: center; min-width: 96px; }
.weight-value {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.weight-unit { color: var(--text2); font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .08em; }
.weight-slider {
  width: 100%;
  margin: var(--s3) 0 0;
  accent-color: var(--primary);
  height: 32px;
}

/* v1.1 — fullscreen pause screensaver with per-round table over live replays */
.pause-fullscreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s6);
  padding: 4vh 4vw;
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.pause-table { align-self: center; }
.pause-fullscreen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--secondary) 16%, transparent) 0%, transparent 42%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--primary) 14%, transparent) 0%, transparent 45%);
  pointer-events: none;
}
.pause-fullscreen > * { position: relative; }
.pause-header { display: flex; align-items: center; gap: var(--s4); }
.pause-fullscreen .pause-icon { font-size: 64px; margin: 0; }
.pause-fullscreen .pause-title { font-size: var(--fs-hero); }
.pause-table {
  width: min(1100px, 92vw);
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  max-height: 62vh;
  overflow: hidden;
}
.pause-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-btn);
  background: var(--bg-soft);
}
.pause-row-head { background: transparent; font-size: var(--fs-label); color: var(--text2); text-transform: uppercase; letter-spacing: .06em; }
.pause-cell {
  flex: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 0;
}
.pause-cell-name {
  flex: 2.2;
  display: flex;
  align-items: center;
  gap: var(--s2);
  text-align: left;
  justify-content: flex-start;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pause-cell-total { flex: 1.2; font-weight: 700; font-size: var(--fs-h2); }
.pause-footer { display: flex; align-items: center; gap: var(--s4); }

/* v1.1 — canceled game screens */
.canceled-screen { display: grid; place-items: center; }
.canceled-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
}
.canceled-icon { font-size: 110px; line-height: 1; }
.canceled-sub { font-size: var(--fs-h2); color: var(--text2); }
.canceled-pad { justify-content: center; }
.canceled-pad .canceled-icon { font-size: 84px; }

/* v1.1 — host quit confirmation */
.quit-confirm {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s4) 0;
}
.quit-confirm .canceled-icon { font-size: 64px; }
.btn-3d.btn-danger { background: var(--primary); color: #fff; --press-edge-color: #C74040; }

/* v1.1 — ball preview stays a friendly square, never a giant blob */
body.phone .ball-preview-wrap { height: clamp(180px, 30dvh, 260px); flex: none; }
