﻿/* KaBoomz - Player Join (Batch 3): the Combined Card.
   Scoped STRICTLY to body.player-join-live (added by player.js only
   while #view-join is the active view, removed for idle/activity/
   photo/full/kicked/leave/ended and identity restoration): the join
   styling can never leak into gameplay or Photo Dedication.
   The light tunnel belongs to the Host Lobby - this is the plain
   house-identity coral stage. Typography remains the provisional
   project stack until an approved font ships. */

body.player-join-live {
  margin: 0;
  padding: 0;
  background: #FF6B4A;
  color: #20242C;
  font-family: var(--font-body);
}

/* gentle coral depth + edge glow, NEVER a light tunnel */
body.player-join-live::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%,
      rgba(255, 138, 80, 0.55) 0%, rgba(255, 122, 68, 0) 42%),
    radial-gradient(circle at 50% 108%,
      rgba(200, 52, 20, 0.5) 0%, rgba(200, 52, 20, 0) 46%);
  z-index: 0;
}

/* ---------- scoped join view ---------- */

body.player-join-live .player #app,
body.player-join-live #app {
  /* base.css's .player #app padding (1.25rem) shrinks the column on the
     hidden views only; the join stage owns the full viewport width */
  padding: 0;
}
body.player-join-live #view-join {
  position: relative;
  z-index: 1;
  /* override base.css's .view max-width:26rem — the join stage owns the
     full viewport width (the card caps itself at the target %) */
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* override base.css's .view text-align:center - the reference has
     LEFT-aligned field labels (the heading/helper center on their own) */
  text-align: left;
  padding:
    calc(env(safe-area-inset-top, 0px) + 16px)
    0
    calc(env(safe-area-inset-bottom, 0px) + 20px);
  box-sizing: border-box;
}

body.player-join-live .pj-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 440px;
}

/* genuine title logo: aspect preserved, never redrawn */
body.player-join-live .pj-logo {
  display: block;
  width: clamp(140px, 54vw, 264px);
  height: auto;
  filter: drop-shadow(0 6px 16px rgba(120, 22, 4, 0.4));
  margin-bottom: clamp(12px, 3vh, 22px);
}

/* ---------- the combined card ---------- */

body.player-join-live .pj-card {
  /* phone: 88-92% of the viewport; caps at 440px on tablet/desktop */
  width: min(91%, 440px);
  box-sizing: border-box;
  background: #FFF7ED;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 30px;
  box-shadow: 0 16px 36px rgba(140, 28, 8, 0.4);
  padding: 26px 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body.player-join-live .pj-title {
  margin: 0 0 14px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #20242C;
  text-align: center;
}

body.player-join-live .pj-label {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #20242C;
  margin: 6px 0 6px 2px;
}

/* fields: one rectangular input each, icon inside on the left */
body.player-join-live .pj-inputwrap {
  position: relative;
  display: block;
}
body.player-join-live .pj-ico {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 21px;
  height: 21px;
  color: rgba(32, 36, 44, 0.75);
  pointer-events: none;
}
body.player-join-live .pj-input {
  box-sizing: border-box;
  width: 100%;
  height: 60px;
  padding: 0 16px 0 46px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  color: #20242C;
  background: #FFFCF4;
  border: 1.5px solid rgba(32, 36, 44, 0.35);
  border-radius: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.player-join-live .pj-input::placeholder {
  color: rgba(32, 36, 44, 0.45);
  font-weight: 500;
}
body.player-join-live .pj-input:focus {
  border-color: #20242C;
  box-shadow: 0 0 0 3px rgba(255, 212, 59, 0.65), 0 0 0 5px rgba(32, 36, 44, 0.25);
}
body.player-join-live .pj-input[aria-invalid="true"] {
  border-color: #C23A17;
  box-shadow: 0 0 0 3px rgba(255, 122, 68, 0.35);
}
/* Chrome autofill must never paint an off-brand yellow/blue surface */
body.player-join-live .pj-input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 60px #FFFCF4 inset;
  -webkit-text-fill-color: #20242C;
  caret-color: #20242C;
}
body.player-join-live .pj-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 60px #FFFCF4 inset, 0 0 0 3px rgba(255, 212, 59, 0.65);
}

/* helper line + lime heart */
body.player-join-live .pj-helper {
  margin: 2px 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(32, 36, 44, 0.75);
}
body.player-join-live .pj-heart {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* ---------- Join Game: the one visible action ---------- */

body.player-join-live .pj-join {
  appearance: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 68px;
  margin-top: 2px;
  box-sizing: border-box;
  border: 3px solid #FFFFFF;
  border-radius: 17px;
  background: #FFD43B;
  color: #20242C;
  font-family: inherit;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  box-shadow:
    0 5px 0 #F2A93B,
    0 12px 22px rgba(140, 28, 8, 0.35),
    inset 0 -4px 0 rgba(255, 146, 43, 0.5);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}
body.player-join-live .pj-join:hover:not(:disabled) { filter: brightness(1.05); }
body.player-join-live .pj-join:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 #F2A93B,
    0 6px 12px rgba(140, 28, 8, 0.3),
    inset 0 -4px 0 rgba(255, 146, 43, 0.5);
}
body.player-join-live .pj-join:focus-visible {
  outline: 3px solid #20242C;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.85);
}
/* never translucent: muted yellow, lowered contrast, flat depth */
body.player-join-live .pj-join:disabled {
  cursor: default;
  opacity: 1;
  filter: saturate(0.45) brightness(0.97);
  color: rgba(32, 36, 44, 0.6);
  box-shadow:
    0 2px 0 rgba(170, 118, 30, 0.35),
    0 4px 10px rgba(140, 28, 8, 0.2),
    inset 0 -4px 0 rgba(255, 146, 43, 0.3);
}
body.player-join-live .pj-join .pj-join-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* one clean loading message: spinner only, label hidden visually
   (opacity - never removed, never through button opacity), geometry
   fixed in every state */
body.player-join-live .pj-join.loading .pj-join-label { opacity: 0; }
body.player-join-live .pj-join .pj-join-busy {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
body.player-join-live .pj-join.loading .pj-join-busy { display: inline-flex; }
body.player-join-live .pj-spinner {
  width: 28px;
  height: 28px;
  border: 4px solid rgba(32, 36, 44, 0.22);
  border-top-color: #20242C;
  border-radius: 50%;
  animation: pj-spin 0.8s linear infinite;
}
@keyframes pj-spin { to { transform: rotate(360deg); } }

/* inline error region - stays inside the card, never a toast */
body.player-join-live .pj-error {
  margin: 10px 2px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #FFE4D9;
  border: 1.5px solid rgba(194, 58, 23, 0.5);
  color: #8E2B10;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
}
body.player-join-live .pj-error.hidden { display: none; }

/* ---------- controlled confetti (edges only, quiet motion) ---------- */

body.player-join-live .pj-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
body.player-join-live .pj-bit {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: clamp(8px, 2.4vw, 16px);
  height: clamp(8px, 2.4vw, 16px);
  transform: rotate(var(--rot, 0deg)) scale(var(--s, 1));
}
body.player-join-live .pj-bit.hex {
  background: var(--c);
  clip-path: polygon(25% 6%, 75% 6%, 98% 50%, 75% 94%, 25% 94%, 2% 50%);
}
body.player-join-live .pj-bit.dot { background: var(--c); border-radius: 50%; }
body.player-join-live .pj-bit.bar {
  background: var(--c);
  border-radius: 2px;
  width: clamp(4px, 1.4vw, 9px);
  height: clamp(12px, 4vw, 24px);
}
body.player-join-live .pj-bit.rect {
  background: var(--c);
  border-radius: 2px;
  width: clamp(10px, 3vw, 20px);
  height: clamp(6px, 1.8vw, 12px);
}
body.player-join-live .pj-bit.circle {
  background: transparent;
  border: 3px solid var(--c);
  border-radius: 50%;
}

/* ---------- responsive: phone first, tablet/desktop a centred column ---------- */

@media (min-width: 700px) {
  body.player-join-live .pj-logo { width: 264px; }
  body.player-join-live .pj-card { padding: 30px 30px 34px; }
  body.player-join-live .pj-title { font-size: 31px; }
}

@media (max-height: 620px) {
  /* very short screen (or an open phone keyboard): allow scrolling,
     never trap content */
  body.player-join-live #view-join { align-items: flex-start; }
  body.player-join-live .pj-logo { width: clamp(110px, 38vw, 170px); margin-bottom: 10px; }
  body.player-join-live .pj-card { padding: 20px 22px 24px; border-radius: 24px; }
  body.player-join-live .pj-title { font-size: 25px; margin-bottom: 8px; }
  body.player-join-live .pj-input { height: 52px; font-size: 16px; }
  body.player-join-live .pj-join { height: 58px; font-size: 19px; }
}

/* ---------- reduced motion ---------- */

/* Owner correction 2026-09-22b: the spinner STOPS (it used to only slow
   to 1.6s). The static ring keeps its shape and contrast, so the join
   busy state remains understandable without movement. */
@media (prefers-reduced-motion: reduce) {
  body.player-join-live .pj-spinner { animation: none; }
}
