:root {
  --ink: #162038;
  --sky-top: #38bdf8;
  --sky-mid: #0284c7;
  --sky-bot: #1d4ed8;
  --card-bg: #fffdf7;
  --card-soft: #f0f9ff;
  --text: #162038;
  --muted: #475569;
  --lime: #d9f536;
  --lime-shade: #b4d416;
  --court-apron: #2563eb;
  --court-apron-deep: #1e40af;
  --court-play: #10b981;
  --court-play-deep: #059669;
  --kitchen: #0ea5e9;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;
  --shadow-hard: 0 5px 0 var(--ink);
  --shadow-hard-sm: 0 3px 0 var(--ink);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.22) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(217, 245, 54, 0.16) 0%, transparent 40%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-bot) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .mini-brand, .prompt-text, .callout, .btn {
  font-family: "Fredoka", "Nunito", ui-rounded, -apple-system, sans-serif;
}

.hidden { display: none !important; }

/* CHUNKY KRILLION PUFFER PARTY BUTTONS */
.btn {
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 11px 18px;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #eeff6b 0%, var(--lime) 100%);
  color: var(--ink);
}
.btn-secondary {
  background: #ffffff;
  color: var(--ink);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}
.btn-sm { padding: 6px 11px; font-size: 0.8rem; border-radius: 11px; border-width: 2.5px; }
.btn-override {
  background: linear-gradient(180deg, #6ee7b7, #10b981);
  color: var(--ink);
  padding: 7px 14px;
  font-size: 0.88rem;
}

/* HOME VIEW */
.home-view {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
}
.home-card {
  width: 100%;
  max-width: 660px;
  background: var(--card-bg);
  border: 4px solid var(--ink);
  border-radius: 26px;
  padding: 15px 18px 13px;
  box-shadow: 0 8px 0 var(--ink), 0 20px 44px rgba(8, 22, 54, 0.35);
}
.brand-hero { text-align: center; margin-bottom: 10px; }
.hero-mascot {
  width: 84px;
  height: 80px;
  margin: -4px auto 2px;
  animation: idleBob 2s ease-in-out infinite;
}
.eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--lime);
  border: 2.5px solid var(--ink);
  padding: 1px 9px;
  border-radius: 999px;
}
.brand-hero h1 {
  margin: 4px 0 2px;
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.subtitle { margin: 0; color: var(--muted); font-size: 0.85rem; font-weight: 700; line-height: 1.3; }

.home-form label {
  display: block;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 8px 0 4px;
}
.home-form input {
  width: 100%;
  background: #ffffff;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 13px;
  padding: 9px 12px;
  font-size: 0.95rem;
  font-weight: 800;
  outline: none;
  margin-bottom: 4px;
  box-shadow: inset 0 3px 0 rgba(22, 32, 56, 0.08);
}
.home-form input:focus { border-color: #0284c7; background: #f8fdff; }
.home-form .btn-primary { width: 100%; margin-top: 10px; font-size: 1rem; padding: 10px 16px; }

/* CHARACTER PICKER GRID */
.char-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 2px;
}
.char-option {
  background: #f1f5f9;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 4px 4px 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.1s ease, background 0.12s ease;
}
.char-option:hover { transform: translateY(-2px); background: #e0f2fe; }
.char-option.selected {
  background: var(--lime);
  transform: translateY(-2px);
  box-shadow: 0 4px 0 var(--ink);
}
.char-option .char-svg { width: 46px; height: 42px; display: block; }
.char-option-name {
  font-size: 0.63rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.1;
  text-align: center;
}
.char-option-sub {
  font-size: 0.54rem;
  font-weight: 800;
  color: #475569;
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  margin: 10px 0 8px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 2px; background: #cbd5e1; }
.join-row { display: flex; gap: 10px; }
.join-row input {
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  text-align: center;
  width: 46%;
}
.join-row .btn { flex: 1; padding: 9px 14px; }

.home-footer { text-align: center; margin-top: 10px; }
.status-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #64748b;
  text-decoration: none;
}
.status-link:hover { color: var(--ink); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); border: 1.5px solid var(--ink); }

/* ROOM VIEW — 100dvh single-screen fit on MacBook Air & laptops */
.room-view {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.top-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 14px;
  background: rgba(255, 253, 247, 0.94);
  border-bottom: 3.5px solid var(--ink);
  flex-wrap: wrap;
}
.top-left, .top-center, .top-right { display: flex; align-items: center; gap: 8px; }
.mini-brand { font-weight: 700; color: var(--ink); font-size: 1rem; }
.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #e0f2fe;
  border: 2.5px solid var(--ink);
  color: var(--ink);
  border-radius: 11px;
  padding: 4px 9px;
  font-weight: 900;
  font-size: 0.86rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
}
.code-pill:active { transform: translateY(1px); box-shadow: none; }
.copy-hint {
  font-size: 0.66rem;
  letter-spacing: 0;
  font-weight: 900;
  color: var(--ink);
  background: var(--lime);
  border: 2px solid var(--ink);
  padding: 1px 6px;
  border-radius: 7px;
}
.badge {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 2.5px solid var(--ink);
  color: var(--ink);
}
.badge-rally { background: var(--lime); }
.icon-btn {
  background: #ffffff;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
}

.arena-shell {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 8px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
}

/* PROMPT CLOUD BANNER (Compact inline on laptops) */
.prompt-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  text-align: center;
  background: var(--card-bg);
  border: 3.5px solid var(--ink);
  border-radius: 18px;
  padding: 7px 16px;
  box-shadow: 0 4px 0 var(--ink);
}
.prompt-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
  background: #0284c7;
  border: 2px solid var(--ink);
  padding: 2px 10px;
  border-radius: 999px;
}
.prompt-text {
  font-size: clamp(1.1rem, 2.5vw, 1.55rem);
  font-weight: 700;
  color: var(--ink);
}
.prompt-text.syllable {
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  letter-spacing: 0.24em;
  color: #0284c7;
}

/* CARTOON PICKLEBALL COURT — flexes to fill remaining viewport height cleanly */
.court-wrapper {
  width: 100%;
  flex: 1 1 auto;
  min-height: 270px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
}
.court {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 270px;
  background: linear-gradient(180deg, #3b82f6 0%, var(--court-apron) 55%, var(--court-apron-deep) 100%);
  border-radius: 24px;
  border: 4px solid var(--ink);
  padding: 14px 26px;
  overflow: hidden;
  box-shadow: 0 6px 0 var(--ink), 0 16px 36px rgba(8, 22, 54, 0.32);
}
.court.shake { animation: courtShake 0.4s ease; }
.court.drive-shake { animation: driveShake 0.18s ease; }
.court.bodybag-impact {
  animation: bodybagShake 0.55s ease;
  box-shadow: 0 6px 0 var(--ink), 0 0 0 6px rgba(239, 68, 68, 0.7), 0 16px 36px rgba(239, 68, 68, 0.5);
}
@keyframes bodybagShake {
  0%, 100% { transform: translate(0, 0) scale(1); }
  12% { transform: translate(-12px, 6px) scale(1.015); }
  28% { transform: translate(11px, -6px) scale(0.99); }
  45% { transform: translate(-9px, -4px); }
  65% { transform: translate(7px, 4px); }
  82% { transform: translate(-4px, 2px); }
}
@keyframes courtShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-8px, 4px); }
  40% { transform: translate(8px, -4px); }
  60% { transform: translate(-5px, -3px); }
  80% { transform: translate(5px, 3px); }
}
@keyframes driveShake {
  0%, 100% { transform: translate(0, 0); }
  35% { transform: translate(-3px, 2px); }
  70% { transform: translate(3px, -2px); }
}

.court-surface {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #14b8a6 0%, var(--court-play) 50%, var(--court-play-deep) 100%);
  border: 4px solid #ffffff;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 0 2px rgba(22, 32, 56, 0.18);
}
.court-half { flex: 1; display: flex; }
.service-box { flex: 1; }
.service-box.left { border-right: 3.5px solid rgba(255, 255, 255, 0.92); }

.kitchen {
  height: 17%;
  min-height: 34px;
  background: rgba(14, 165, 233, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fredoka", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.38);
  user-select: none;
}
.kitchen-top { border-top: 3.5px solid #ffffff; }
.kitchen-bottom { border-bottom: 3.5px solid #ffffff; }

.net-line {
  position: relative;
  height: 12px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.92) 0 4px,
    rgba(22, 32, 56, 0.42) 4px 10px
  );
  border-top: 3px solid #ffffff;
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 5px 10px rgba(22, 32, 56, 0.35);
  z-index: 5;
}
.net-post {
  position: absolute;
  top: -6px;
  width: 14px;
  height: 22px;
  background: #f8fafc;
  border: 3px solid var(--ink);
  border-radius: 5px;
}
.net-post.left { left: -14px; }
.net-post.right { right: -14px; }

/* SHOT TRAIL SVG LAYER */
.shot-trail-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 11;
}

/* CHARACTER SPOTS DIRECTLY ON COURT — dynamically vh-scaled for laptops */
.seat-slot {
  position: absolute;
  width: clamp(148px, 20vw, 196px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.seat-0 { top: clamp(24px, 3vh, 34px); left: 12%; transform: translateX(-12%); }
.seat-1 { top: clamp(24px, 3vh, 34px); right: 12%; transform: translateX(12%); }
.seat-2 { bottom: clamp(6px, 1.4vh, 16px); right: 12%; transform: translateX(12%); }
.seat-3 { bottom: clamp(6px, 1.4vh, 16px); left: 12%; transform: translateX(-12%); }

.court-player {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  transition: opacity 0.25s ease, filter 0.25s ease;
}
.court-player.eliminated { opacity: 0.48; filter: grayscale(0.75); }

/* Glowing target ring under active player's feet */
.turn-ring {
  position: absolute;
  top: clamp(46px, 8vh, 72px);
  width: clamp(68px, 12vh, 104px);
  height: clamp(18px, 3vh, 26px);
  border-radius: 50%;
  border: 3.5px solid var(--lime);
  background: rgba(217, 245, 54, 0.22);
  box-shadow: 0 0 18px rgba(217, 245, 54, 0.55);
  z-index: 0;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.court-player.active-turn .turn-ring { opacity: 1; transform: scale(1); animation: ringPulse 1.1s ease-in-out infinite; }
.court-player.tension-warm.active-turn .turn-ring { border-color: #fbbf24; background: rgba(251, 191, 36, 0.26); }
.court-player.tension-hot.active-turn .turn-ring { border-color: #fb923c; background: rgba(251, 146, 60, 0.34); animation-duration: 0.6s; }
.court-player.tension-critical.active-turn .turn-ring { border-color: #ef4444; background: rgba(239, 68, 68, 0.42); animation-duration: 0.32s; }
@keyframes ringPulse {
  0%, 100% { transform: scale(0.96); }
  50% { transform: scale(1.07); }
}

.char-stage {
  position: relative;
  width: clamp(64px, 11.2vh, 98px);
  height: clamp(64px, 11.2vh, 98px);
  z-index: 2;
  animation: idleBob 2.4s ease-in-out infinite;
}
.court-player.active-turn .char-stage { animation: readyBounce 0.85s ease-in-out infinite; }
.court-player.tension-critical.active-turn .char-stage { animation: panicShake 0.16s linear infinite; }
.court-player.eliminated .char-stage { animation: none; }

@keyframes idleBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes readyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.03); }
}
@keyframes panicShake {
  0% { transform: translate(-2px, 0) rotate(-1.5deg); }
  50% { transform: translate(2px, -2px) rotate(1.5deg); }
  100% { transform: translate(-2px, 0) rotate(-1.5deg); }
}

.char-svg { width: 100%; height: 100%; overflow: visible; }
.char-svg .paddle-arm {
  transform-box: fill-box;
  transform-origin: 20% 80%;
  transition: transform 0.14s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.court-player.swing .char-svg .paddle-arm {
  animation: swingArc 0.34s cubic-bezier(0.16, 1.2, 0.3, 1);
}
@keyframes swingArc {
  0% { transform: translate(80px, 76px) rotate(0deg); }
  35% { transform: translate(74px, 68px) rotate(-62deg) scale(1.12); }
  100% { transform: translate(80px, 76px) rotate(0deg); }
}

.sweat-drop { animation: sweatDrip 0.8s ease-in-out infinite; }
.sweat-drop.delay { animation-delay: 0.35s; }
@keyframes sweatDrip {
  0%, 100% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(7px); opacity: 0.7; }
}

/* FLASHING "YOUR TURN" ARROW OVER LOCAL PLAYER'S HEAD */
.your-turn-indicator {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  z-index: 15;
  pointer-events: none;
  color: var(--lime);
  animation: turnArrowBounce 0.65s ease-in-out infinite;
}
.your-turn-pill {
  background: var(--lime);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 1px 8px;
  font-family: "Fredoka", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
  box-shadow: 0 2px 0 var(--ink);
  animation: turnPillFlash 0.65s ease-in-out infinite;
}
.turn-arrow-svg {
  width: 22px;
  height: 20px;
  margin-top: -3px;
  filter: drop-shadow(0 2px 0 rgba(22, 32, 56, 0.35));
}
.court-player.tension-hot .your-turn-indicator,
.court-player.tension-critical .your-turn-indicator {
  color: #ff5733;
  animation-duration: 0.36s;
}
.court-player.tension-hot .your-turn-pill,
.court-player.tension-critical .your-turn-pill {
  background: #ff5733;
  color: #ffffff;
  animation-duration: 0.36s;
}
@keyframes turnArrowBounce {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  50% { transform: translateX(-50%) translateY(-6px) scale(1.08); }
}
@keyframes turnPillFlash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.22); }
}
.court-player.is-my-turn .speech-bubble {
  top: 14px;
  left: auto;
  right: -18px;
  transform: none;
  max-width: 130px;
}
.seat-1 .court-player.is-my-turn .speech-bubble,
.seat-2 .court-player.is-my-turn .speech-bubble {
  right: auto;
  left: -18px;
}

/* SECRET BOT BODY-BAG FINISHER ANIMATIONS */
.court-player.bot-charge .char-stage {
  animation: botCharge 0.32s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.95)) drop-shadow(0 0 6px rgba(250, 204, 21, 0.9));
}
.court-player.bot-charge .char-svg .paddle-arm {
  transform: translate(88px, 72px) rotate(48deg) scale(1.22);
}
@keyframes botCharge {
  0%, 100% { transform: scale(1.06) translateX(-2px); }
  50% { transform: scale(1.16) translateX(2px); }
}
.court-player.bodybag-ko {
  animation: bodybagKO 0.85s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.court-player.bodybag-ko .char-stage {
  filter: drop-shadow(0 0 14px rgba(239, 68, 68, 0.95));
}
@keyframes bodybagKO {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  18% { transform: scale(1.22) rotate(-14deg); opacity: 1; }
  100% { transform: translateY(-38px) translateX(34px) rotate(520deg) scale(0.35); opacity: 0.15; }
}
.pickleball.shot-bodybag {
  background: radial-gradient(circle at 35% 35%, #fef08a 0%, #f97316 48%, #dc2626 100%);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.95), 0 0 32px rgba(250, 204, 21, 0.85);
}

/* CARTOON SPEECH BUBBLE */
.speech-bubble {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 2px 9px;
  font-family: "Fredoka", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  max-width: 175px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 3px 0 var(--ink);
  z-index: 9;
}
.speech-bubble.empty {
  color: #64748b;
  font-size: 0.7rem;
}
.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--ink);
}

/* FLOATING NAMEPLATE PILL UNDER CHARACTER */
.nameplate {
  position: relative;
  z-index: 3;
  margin-top: -5px;
  background: var(--card-bg);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 3px 8px 4px;
  min-width: 132px;
  max-width: 185px;
  box-shadow: 0 3px 0 var(--ink);
}
.nameplate-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}
.seat-name {
  font-weight: 900;
  font-size: 0.82rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-mini {
  font-size: 0.58rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 6px;
  background: #e0f2fe;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  text-transform: uppercase;
}
.tag-mini.host { background: var(--lime); }
.tag-mini.out { background: #fecaca; color: #991b1b; }
.tag-mini.team-north { background: #bae6fd; color: #0c4a6e; }
.tag-mini.team-south { background: #fed7aa; color: #9a3412; }
.remove-bot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  border: 2px solid var(--ink);
  border-radius: 6px;
  color: #991b1b;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
.ui-icon-xs {
  width: 11px;
  height: 11px;
  display: block;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ui-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.callout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.callout-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}
.trophy-svg {
  width: 48px;
  height: 48px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}

/* THEMATIC ANIMATED PICKLEBALL LIFE HUD */
.life-hud {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #0f172a;
  border: 2px solid var(--ink);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.45);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.life-hud.last-life {
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.55), inset 0 2px 3px rgba(0, 0, 0, 0.45);
}
.life-socket {
  position: relative;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.life-pip-svg {
  width: 18px;
  height: 18px;
  display: block;
}
.life-socket.filled .life-pip-svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}
.life-socket.danger-pulse .life-pip-svg {
  animation: lastLifePulse 0.65s ease-in-out infinite;
}
@keyframes lastLifePulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.7)); }
  50% { transform: scale(1.22); filter: drop-shadow(0 0 8px rgba(239, 68, 68, 1)); }
}
.life-socket.pip-lost .life-pip-svg {
  animation: pipShatter 0.65s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
@keyframes pipShatter {
  0% { transform: scale(1.25) rotate(0deg); opacity: 1; }
  35% { transform: scale(1.45) rotate(-18deg); opacity: 1; }
  100% { transform: translateY(-14px) scale(0.35) rotate(42deg); opacity: 0; }
}
.life-socket.pip-gained .life-pip-svg {
  animation: pipGain 0.6s cubic-bezier(0.18, 1.55, 0.35, 1) forwards;
}
@keyframes pipGain {
  0% { transform: scale(0.2) rotate(-35deg); opacity: 0; }
  60% { transform: scale(1.38) rotate(12deg); opacity: 1; filter: drop-shadow(0 0 10px #facc15); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.nameplate-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 3px;
}
.seat-substat {
  font-size: 0.65rem;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 900;
}
.meter-track {
  position: relative;
  margin-top: 4px;
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: #1e293b;
  border: 2px solid var(--ink);
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.4);
}
.meter-fill {
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    #38bdf8 0 8px,
    #7dd3fc 8px 16px
  );
  background-size: 22.6px 22.6px;
  animation: meterStripe 1.2s linear infinite;
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45);
}
.meter-fill.charged {
  background: repeating-linear-gradient(
    -45deg,
    #d9f536 0 8px,
    #fde047 8px 16px
  );
  background-size: 22.6px 22.6px;
  box-shadow: 0 0 8px rgba(217, 245, 54, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.6);
}
@keyframes meterStripe {
  0% { background-position: 0 0; }
  100% { background-position: 22.6px 0; }
}

/* EMPTY COURT SPOT */
.seat-empty {
  background: rgba(255, 253, 247, 0.82);
  border: 3px dashed var(--ink);
  border-radius: 18px;
  padding: 12px 10px;
  text-align: center;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  margin-top: 28px;
  box-shadow: 0 4px 0 rgba(22, 32, 56, 0.3);
}
.seat-empty-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

/* ANIMATED PICKLEBALL */
.pickleball {
  position: absolute;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  margin-top: -18px;
  z-index: 15;
  pointer-events: none;
  will-change: transform, left, top;
  filter: drop-shadow(0 3px 6px rgba(22, 32, 56, 0.35));
}
.pickleball.tension-warm { filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.95)); }
.pickleball.tension-hot { filter: drop-shadow(0 0 18px rgba(249, 115, 22, 1)); }
.pickleball.tension-critical { filter: drop-shadow(0 0 24px rgba(239, 68, 68, 1)); }

.ball-shadow {
  position: absolute;
  width: 28px;
  height: 10px;
  margin-left: -14px;
  margin-top: -5px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.42);
  filter: blur(1.5px);
  z-index: 12;
  pointer-events: none;
}

.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}
.callout {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 700;
  font-size: 1rem;
  padding: 5px 13px;
  border-radius: 999px;
  background: #ffffff;
  border: 3px solid var(--ink);
  color: var(--ink);
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--ink);
  animation: calloutPop 1.3s ease-out forwards;
}
@keyframes calloutPop {
  0% { opacity: 0; transform: translate(-50%, -15%) scale(0.6); }
  16% { opacity: 1; transform: translate(-50%, -65%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(0.95); }
}

.bounce-ring {
  position: absolute;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  border: 3.5px solid #ffffff;
  animation: ringExpand 0.52s ease-out forwards;
}
@keyframes ringExpand {
  0% { transform: scale(0.4); opacity: 0.95; }
  100% { transform: scale(3.4); opacity: 0; }
}

/* LOBBY & PLAY PANELS — compact so everything fits in 100dvh */
.control-panel, .play-panel {
  flex: 0 0 auto;
  background: var(--card-bg);
  border: 3.5px solid var(--ink);
  border-radius: 18px;
  padding: 9px 14px;
  box-shadow: 0 4px 0 var(--ink);
}

.lobby-char-bar {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.lobby-char-bar .setting-label { margin-bottom: 0; white-space: nowrap; }
.char-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  flex: 1;
}
.char-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  border: 2.5px solid var(--ink);
  border-radius: 11px;
  padding: 2px 8px 2px 4px;
  cursor: pointer;
  font-weight: 900;
  font-size: 0.74rem;
  color: var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}
.char-chip.selected { background: var(--lime); }
.char-chip .char-svg { width: 26px; height: 26px; }

.pack-bar {
  margin-bottom: 8px;
}
.pack-bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.pack-bar-head .setting-label {
  margin-bottom: 0;
}
.pack-desc {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pack-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pack-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: #f1f5f9;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.12s ease;
}
.pack-chip:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #e2e8f0;
}
.pack-chip.selected {
  background: var(--ink);
  color: #ffffff;
}
.pack-chip.yungs-chip.selected {
  background: #7c3aed;
  border-color: var(--ink);
  color: #ffffff;
}
.pack-chip:disabled {
  cursor: default;
  opacity: 0.85;
}
.pack-count {
  font-size: 0.66rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(22, 32, 56, 0.12);
}
.pack-chip.selected .pack-count {
  background: rgba(255, 255, 255, 0.22);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}
.setting-label {
  display: block;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 3px;
}
.seg-control {
  display: flex;
  background: #e2e8f0;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}
.seg {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 900;
  padding: 5px 4px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.seg.active {
  background: var(--ink);
  color: #ffffff;
}
.seg:disabled { cursor: default; opacity: 0.8; }

.lobby-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lobby-actions .btn { padding: 8px 14px; font-size: 0.9rem; }
.lobby-actions .btn-primary { flex: 1; min-width: 185px; }
.lobby-hint {
  margin: 6px 0 0;
  font-size: 0.73rem;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}

/* PLAY PANEL */
.override-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 9px 14px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.12s ease;
}
.override-bar:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--ink);
  background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
}
.override-bar:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}
.override-text {
  line-height: 1.25;
}
.override-word {
  display: inline-block;
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 1px 7px;
  margin: 0 2px;
  color: #065f46;
}
.override-bar .btn-override {
  padding: 8px 14px;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.kbd-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Nunito", sans-serif;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 1px 5px;
  line-height: 1.1;
  box-shadow: 0 2px 0 var(--ink);
}
.answer-form { display: flex; gap: 8px; }
.answer-form input {
  flex: 1;
  background: #ffffff;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 1rem;
  font-weight: 800;
  outline: none;
}
.answer-form .btn { padding: 9px 18px; }
.answer-form .btn.btn-count-it {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  color: var(--ink);
  border-color: var(--ink);
  padding: 9px 18px;
  min-width: 158px;
  font-size: 0.96rem;
  box-shadow: 0 4px 0 var(--ink), 0 0 0 3px rgba(34, 197, 94, 0.35);
  animation: countItPulse 1.15s ease-in-out infinite;
}
.answer-form .btn.btn-count-it:hover {
  background: linear-gradient(180deg, #86efac 0%, #4ade80 100%);
}
.answer-form .btn.btn-count-it .btn-icon svg {
  width: 18px;
  height: 18px;
}
@keyframes countItPulse {
  0%, 100% { box-shadow: 0 4px 0 var(--ink), 0 0 0 3px rgba(34, 197, 94, 0.32); }
  50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 7px rgba(34, 197, 94, 0.58); }
}
.answer-form input:focus { border-color: #0284c7; background: #f8fdff; }
.answer-form input.reject-shake {
  border-color: var(--danger);
  background: #fef2f2;
  animation: courtShake 0.28s ease;
}

.alphabet-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  margin-top: 7px;
}
.alpha-chip {
  width: 23px;
  height: 23px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  background: #f1f5f9;
  border: 2px solid #94a3b8;
  color: #64748b;
}
.alpha-chip.used {
  background: var(--lime);
  border-color: var(--ink);
  color: var(--ink);
}

.answer-form.your-turn input {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(217, 245, 54, 0.65), inset 0 3px 0 rgba(22, 32, 56, 0.08);
}
.answer-form.drafting input {
  border-color: #0284c7;
  background: #f0f9ff;
}
.answer-form.wait-nudge input {
  animation: rejectShake 0.28s ease;
}

.recent-strip {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  margin-top: 7px;
  min-height: 26px;
  padding-bottom: 2px;
}
.recent-pill {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f8fafc;
  border: 2px solid var(--ink);
  color: var(--ink);
}
.recent-pill small { margin-left: 5px; font-weight: 900; }

.spectator-bar {
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.9);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* WINNER MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 410px;
  background: var(--card-bg);
  border: 4px solid var(--ink);
  border-radius: 26px;
  padding: 24px 22px;
  text-align: center;
  box-shadow: 0 10px 0 var(--ink);
}
.winner-avatar {
  width: 120px;
  height: 120px;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.winner-avatar.team-win {
  width: 224px;
  height: 112px;
  gap: 4px;
}
.winner-avatar.team-win .char-svg {
  width: 110px;
  height: 110px;
}
.modal-card h2 { margin: 0 0 4px; font-size: 1.8rem; color: var(--ink); }
.winner-sub { margin: 0 0 14px; color: var(--muted); font-size: 0.92rem; font-weight: 800; }
.match-stats {
  background: #f0f9ff;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 16px;
  text-align: left;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-row { display: flex; justify-content: space-between; gap: 10px; }
.stat-row span { color: var(--muted); font-weight: 800; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #ffffff;
  border: 3px solid var(--lime);
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 60;
}

@media (max-width: 720px) {
  .room-view { height: auto; max-height: none; min-height: 100dvh; overflow: visible; }
  .char-picker-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .char-option .char-svg { width: 40px; height: 40px; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lobby-char-bar { flex-direction: column; align-items: stretch; gap: 4px; }
  .court {
    min-height: 380px;
    height: 380px;
    padding: 12px 14px;
  }
  .seat-slot { width: 145px; }
  .seat-0 { top: 8px; left: 4%; transform: none; }
  .seat-1 { top: 8px; right: 4%; transform: none; }
  .seat-2 { bottom: 8px; right: 4%; transform: none; }
  .seat-3 { bottom: 8px; left: 4%; transform: none; }
  .char-stage { width: 76px; height: 76px; }
  .turn-ring { top: 52px; width: 78px; height: 20px; }
  .nameplate { min-width: 120px; padding: 3px 7px 4px; }
  .seat-name { font-size: 0.72rem; }
  .speech-bubble { font-size: 0.72rem; max-width: 140px; top: -15px; }
}
