:root {
  --bg-purple: #42138c;
  --bg-purple-deep: #260651;
  --bg-blue: #2e6ca8;
  --bg-blue-deep: #163b67;
  --ink: #111111;
  --paper: #fffdf8;
  --paper-shadow: #d6cfc3;
  --gold: #ffc84f;
  --orange: #ff8b3d;
  --cyan: #2fd0ff;
  --green: #7adf73;
  --pink: #ff86ec;
  --purple: #9f78ff;
  --sky: #72a7ff;
  --mint: #73f0c4;
  --lime: #b7ef68;
  --red: #ff687b;
  --shadow: 0 18px 0 rgba(0, 0, 0, 0.16), 0 26px 60px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  color: #ffffff;
  font-family: "DM Sans", sans-serif;
  background: linear-gradient(180deg, var(--bg-purple), var(--bg-purple-deep));
}

body.player-shell[data-phase="join"],
body.player-shell[data-phase="lobby"],
body.player-shell[data-phase="leaderboard"],
body.player-shell[data-phase="gameover"] {
  background: linear-gradient(180deg, #6517bb, #3b0a7a);
}

body.host-shell[data-phase="lobby"] {
  background: linear-gradient(180deg, #7a21d9, #410c84);
}

body.host-shell[data-phase="round_intro"] {
  background: linear-gradient(180deg, #7a21d9, #410c84);
}

body.host-shell[data-phase="answering"] {
  background: linear-gradient(180deg, #8f2b32, #53101a);
}

@keyframes fastSwirlSpin {
  from { transform: rotate(0deg) scale(1.2); }
  to { transform: rotate(360deg) scale(1.2); }
}

body.host-shell[data-phase="question"],
body.host-shell[data-phase="voting"],
body.host-shell[data-phase="results"] {
  background: #0d0421;
  position: relative;
  z-index: 0;
  overflow: hidden;
}

body.host-shell[data-phase="question"]::before,
body.host-shell[data-phase="question"]::after,
body.host-shell[data-phase="voting"]::before,
body.host-shell[data-phase="voting"]::after,
body.host-shell[data-phase="results"]::before,
body.host-shell[data-phase="results"]::after {
  content: "";
  position: fixed;
  pointer-events: none;
  border-radius: 48% 52% 54% 46% / 42% 38% 62% 58%;
}

body.host-shell[data-phase="question"]::before,
body.host-shell[data-phase="voting"]::before,
body.host-shell[data-phase="results"]::before {
  inset: -20% -10%;
  background:
    radial-gradient(circle at 35% 38%, rgba(255, 0, 195, 0.24), transparent 0 28%, rgba(87, 13, 153, 0.3) 28% 38%, transparent 38% 56%, rgba(79, 20, 171, 0.32) 56% 66%, transparent 66% 100%),
    radial-gradient(circle at center, rgba(150, 71, 255, 0.28), rgba(70, 10, 147, 0.1) 46%, transparent 47%);
  animation: fastSwirlSpin 8s linear infinite;
  opacity: 0.1;
  z-index: -2;
}

body.host-shell[data-phase="question"]::after,
body.host-shell[data-phase="voting"]::after,
body.host-shell[data-phase="results"]::after {
  inset: -10% -5%;
  background:
    radial-gradient(circle at 50% 50%, rgba(135, 34, 240, 0.4), transparent 0 38%, rgba(59, 10, 122, 0.28) 38% 54%, transparent 54% 100%);
  filter: blur(8px);
  animation: fastSwirlSpin 12s linear infinite reverse;
  opacity: 0.15;
  z-index: -1;
}

body.host-shell[data-phase="leaderboard"],
body.host-shell[data-phase="gameover"] {
  background: linear-gradient(180deg, #3480bc, #173f6c);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.show-app,
.controller-app {
  width: min(100% - 24px, 1400px);
  margin: 0 auto;
  padding: 18px 0 40px;
}

.controller-app {
  width: min(100% - 20px, 760px);
}

.show-stage,
.controller-stage {
  box-shadow: none !important;
  background: transparent !important;
  border: none !important;
}

.frame-card,
.show-stage,
.controller-stage,
.controller-card,
.speech-card,
.podium-card,
.leader-card,
.blackjack-card {
  position: relative;
  border: 4px solid rgba(0, 0, 0, 0.5);
  box-shadow: var(--shadow);
}

.frame-card {
  padding: 28px;
  border-radius: 28px;
  background: transparent;
  box-shadow: none;
}

.setup-scene,
.join-scene {
  display: grid;
  gap: 24px;
  justify-items: center;
  text-align: center;
  padding: 28px;
}

.scene-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: #111111;
  color: white;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.join-copy h1,
.setup-copy h1,
.scene-title,
.controller-title,
.phase-stamp,
.chip,
.logo-bubble span,
.logo-burst,
.cast-nameplate strong,
.cast-member strong,
.podium-name {
  font-family: "Bungee", sans-serif;
  letter-spacing: 0.03em;
}

.join-copy h1,
.setup-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 1.02;
}

.join-copy p,
.setup-copy p,
.scene-subtitle,
.controller-copy {
  max-width: 760px;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.join-form {
  display: grid;
  gap: 14px;
  width: min(100%, 520px);
}

.field {
  display: grid;
  gap: 8px;
  text-align: left;
}

.field span {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 3px solid rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.96);
  color: #121212;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.join-actions,
.hud-cluster,
.controller-foot,
.show-hud {
  display: flex;
  align-items: center;
  gap: 12px;
}

.join-actions {
  flex-wrap: wrap;
  justify-content: center;
}

.hud-cluster-right {
  justify-content: flex-end;
}

.big-button,
.alt-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 14px 20px;
  border-radius: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: transform 120ms ease, opacity 120ms ease;
}

.big-button:hover,
.alt-button:hover {
  transform: translateY(-1px);
}

.big-button:disabled,
.alt-button:disabled {
  opacity: 0.45;
  transform: none;
}

.big-button {
  background: var(--orange);
  color: #1a0f09;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
}

.alt-button {
  background: var(--cyan);
  color: #081723;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
}

.controller-stage,
.show-stage {
  display: grid;
  gap: 18px;
}

.controller-hud,
.show-hud {
  justify-content: space-between;
  flex-wrap: wrap;
}

.chip,
.phase-stamp,
.timer-chip,
.player-tag,
.counter-pill,
.stamp-badge,
.speech-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 3px solid rgba(0, 0, 0, 0.55);
  background: #121212;
  color: white;
}

.chip,
.phase-stamp,
.timer-chip {
  min-height: 48px;
  padding: 10px 16px;
  font-size: 0.95rem;
}

.phase-stamp {
  background: var(--cyan);
  color: #061521;
}

.timer-chip {
  background: transparent;
  color: #ffffff;
  border: none;
  box-shadow: none;
  font-family: "Bungee", sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  letter-spacing: 0.04em;
  min-height: auto;
  padding: 0;
}
.bare-vote-text {
  font-family: "Bungee", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 24px;
  color: white;
  opacity: 0.9;
}

.giant-host-prompt {
  font-family: "Bungee", sans-serif;
  font-size: 3.2rem;
  line-height: 1.25;
  margin-bottom: 48px;
  color: white;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.scene.scene-voting:not(.scene-question-intro),
.scene.scene-results {
  min-height: clamp(560px, 70vh, 760px);
  grid-template-rows: auto 1fr;
  align-content: stretch;
  gap: 10px;
  padding-top: 0;
}

.scene.scene-voting:not(.scene-question-intro) .scene-copy,
.scene.scene-results .scene-copy {
  gap: 6px;
  align-self: start;
}

.scene.scene-voting:not(.scene-question-intro) .bare-vote-text,
.scene.scene-results .bare-vote-text {
  margin: 0;
  font-size: 1.2rem;
}

.scene.scene-voting:not(.scene-question-intro) .giant-host-prompt,
.scene.scene-results .giant-host-prompt {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3.3rem);
  line-height: 1.06;
}

.vote-progress-copy {
  margin: 0;
  font-family: "Bungee", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.special-callout-copy {
  margin: 0;
  font-family: "Permanent Marker", cursive;
  font-size: clamp(1.1rem, 2.1vw, 1.7rem);
  color: #ffd589;
}

.scene.scene-voting:not(.scene-question-intro) .speech-grid,
.scene.scene-results .speech-grid {
  align-self: center;
}

.scene-round-intro-clean {
  min-height: 54vh;
  align-content: center;
}

.scene-round-intro-clean .scene-copy {
  gap: 16px;
}

.scene-round-intro-clean .bare-vote-text {
  margin-bottom: 0;
  opacity: 0.82;
}

.scene-round-intro-clean .giant-host-prompt {
  margin: 0;
  font-size: clamp(3.2rem, 10vw, 6.6rem);
  line-height: 0.95;
}

.round-intro-clean-copy {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.02em;
}
.player-tag {
  min-height: 48px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.92rem;
}

.ticker-banner {
  padding: 14px 18px;
  border-radius: 18px;
  border: 3px solid rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.16);
  font-weight: 700;
}

.controller-main,
.scene-root {
  display: grid;
  gap: 18px;
}

.controller-card {
  padding: 22px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.14);
}

.controller-card-wide {
  gap: 18px;
}

.controller-title {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  line-height: 1.05;
}

.prompt-progress {
  display: flex;
  gap: 10px;
}

.progress-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 3px solid rgba(0, 0, 0, 0.45);
  background: rgba(255, 255, 255, 0.35);
}

.progress-dot.is-done {
  background: var(--green);
}

.controller-bubble,
.result-speech,
.speech-card {
  position: relative;
  padding: 22px;
  border-radius: 28px;
  border: 4px solid rgba(0, 0, 0, 0.65);
  background: var(--paper);
  color: var(--ink);
}

.answer-clean .controller-bubble.answer-bubble {
  gap: 14px;
}

.answer-clean {
  gap: 14px;
  padding: 18px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(120, 72, 196, 0.85), rgba(76, 42, 141, 0.9));
}

.answer-clean .answer-header {
  display: grid;
  gap: 10px;
  justify-items: start;
  text-align: left;
  width: 100%;
}

.answer-clean .answer-header .controller-title {
  margin: 0;
  font-size: clamp(1.9rem, 7vw, 3rem);
  line-height: 1;
}

.answer-clean .answer-progress-row {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.answer-clean .prompt-progress {
  gap: 12px;
}

.answer-clean .progress-dot {
  width: 20px;
  height: 20px;
  border-width: 4px;
}

.answer-clean .controller-bubble.answer-bubble {
  background: #f4f2ed;
  border-radius: 34px;
  padding: 20px;
}

.answer-clean .answer-prompt-plaque {
  background: #ffffff;
  border-radius: 28px;
}

.answer-clean .answer-input {
  min-height: 210px;
  border-radius: 26px;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 700;
  padding: 18px 20px;
}

.answer-clean .answer-input::placeholder {
  color: rgba(17, 17, 17, 0.45);
}

.answer-clean .answer-foot {
  width: 100%;
  display: grid;
  gap: 14px;
}

.answer-clean .answer-counter,
.answer-clean .submit-button {
  width: 100%;
  justify-content: center;
}

.answer-clean .answer-counter {
  min-height: 56px;
  font-size: 1.9rem;
}

.answer-clean .submit-button {
  min-height: 64px;
  font-size: 1.05rem;
}

.answer-clean .controller-bubble.answer-bubble::after {
  left: 68px;
}

.answer-clean textarea {
  min-height: 120px;
}

.controller-bubble::after,
.result-speech::after,
.speech-card::after {
  content: "";
  position: absolute;
  bottom: -24px;
  width: 44px;
  height: 34px;
  background: var(--paper);
  border-left: 4px solid rgba(0, 0, 0, 0.65);
  border-bottom: 4px solid rgba(0, 0, 0, 0.65);
}

.controller-bubble::after,
.result-speech::after,
.speech-card-1::after {
  left: 54px;
  clip-path: polygon(0 0, 100% 0, 18% 100%);
}

.speech-card-2::after {
  right: 54px;
  left: auto;
  clip-path: polygon(0 0, 100% 0, 82% 100%);
}

.scribble-text,
.scribble-mini,
.speech-text {
  margin: 0;
  font-family: "Permanent Marker", cursive;
  line-height: 1.05;
}

.scribble-text {
  font-size: clamp(1.8rem, 7vw, 3rem);
}

.scribble-mini,
.speech-text {
  font-size: clamp(1.35rem, 4vw, 2.4rem);
}

.controller-foot {
  justify-content: space-between;
  flex-wrap: wrap;
}

.counter-pill,
.stamp-badge {
  min-height: 42px;
  padding: 8px 14px;
  font-weight: 800;
}

.counter-pill {
  background: var(--cyan);
  color: #081723;
}

.submit-button {
  min-width: 210px;
}

.prompt-plaque {
  padding: 14px 16px;
  border-radius: 20px;
  border: 4px solid rgba(0, 0, 0, 0.6);
  background: rgba(255, 255, 255, 0.16);
  font-family: "Bungee", sans-serif;
  line-height: 1.2;
}

.vote-stack,
.result-stack,
.speech-grid,
.podium-grid,
.leader-grid {
  display: grid;
  gap: 18px;
}

.vote-stack {
  gap: 24px;
}

.vote-card {
  text-align: left;
  padding: 18px;
  border-radius: 24px;
  border: 4px solid rgba(0, 0, 0, 0.6);
  color: #111111;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.vote-card-1 {
  transform: rotate(-2deg);
}

.vote-card-2 {
  transform: rotate(2deg);
}

.vote-card.selected,
.vote-card:not(:disabled):hover {
  outline: 5px solid rgba(255, 255, 255, 0.4);
}

.vote-card:disabled {
  opacity: 0.65;
}

.vote-helper,
.result-meta {
  font-size: 0.92rem;
  font-weight: 700;
  color: #4b4743;
}

.result-points,
.speech-points,
.podium-score {
  font-weight: 800;
}

.result-speech.is-quiplash {
  box-shadow:
    var(--shadow),
    0 0 0 8px rgba(255, 200, 79, 0.3) inset;
}

.stamp-badge,
.winner-stamp {
  width: fit-content;
  padding: 8px 14px;
  border-radius: 18px;
  border: 4px solid rgba(0, 0, 0, 0.6);
  background: var(--gold);
  color: #231402;
  font-family: "Bungee", sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.leader-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.leader-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.14);
}

.score-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.show-canvas {
  position: relative;
  min-height: 760px;
  padding: 28px 24px 150px;
  border-radius: 34px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.show-code-bug {
  position: fixed;
  bottom: 14px;
  left: 14px;
  top: auto;
  right: auto;
  z-index: 120;
  display: grid;
  align-items: start;
  gap: 2px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.06em;
  transition: transform 220ms ease, opacity 220ms ease;
}

.show-code-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.show-code-bug strong {
  font-family: "Bungee", sans-serif;
  font-size: 1.9rem;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.show-code-bug span {
  font-family: "DM Sans", sans-serif;
  font-size: 0.86rem;
  opacity: 0.9;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.show-code-url {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0.03em;
  opacity: 0.9;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.scene-root {
  position: relative;
  min-height: 560px;
  perspective: 1400px;
  isolation: isolate;
}

.scene {
  display: grid;
  gap: 24px;
  justify-items: center;
  text-align: center;
  width: 100%;
}

.scene.scene-leaderboard {
  gap: 12px;
  align-content: start;
}

.scene.scene-leaderboard .scene-copy {
  gap: 8px;
}

.scene-transition-enter {
  opacity: 1;
  transform: translateY(18px) scale(0.992);
  transform-origin: center top;
}

.scene-transition-enter.is-live {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.scene-transition-enter > * {
  opacity: 0.86;
  transform: translateY(12px);
}

.scene-transition-enter.is-live > * {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 220ms ease,
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.scene-transition-enter.is-live > :nth-child(1) {
  transition-delay: 70ms;
}

.scene-transition-enter.is-live > :nth-child(2) {
  transition-delay: 140ms;
}

.scene-transition-enter.is-live > :nth-child(3) {
  transition-delay: 210ms;
}

.scene-transition-enter.scene-voting .speech-card {
  opacity: 0;
}

.scene-transition-enter.is-live.scene-voting .speech-card-1 {
  animation: speechCardFlyUpLeft 640ms cubic-bezier(0.16, 1, 0.3, 1) 120ms both;
}

.scene-transition-enter.is-live.scene-voting .speech-card-2 {
  animation: speechCardFlyUpRight 680ms cubic-bezier(0.16, 1, 0.3, 1) 220ms both;
}

/* Results reveal: animate answer cards in, then pop winner/slapback stamp. */
.scene-transition-enter.scene-results .speech-card {
  opacity: 0;
  filter: brightness(0.85) saturate(0.85);
}

.scene-transition-enter.is-live.scene-results .speech-card-1.is-winner {
  animation: resultWinnerInLeft 700ms cubic-bezier(0.16, 1, 0.3, 1) 90ms both;
}

.scene-transition-enter.is-live.scene-results .speech-card-2.is-winner {
  animation: resultWinnerInRight 720ms cubic-bezier(0.16, 1, 0.3, 1) 140ms both;
}

.scene-transition-enter.is-live.scene-results .speech-card-1.is-loser {
  animation: resultLoserInLeft 700ms cubic-bezier(0.16, 1, 0.3, 1) 90ms both;
}

.scene-transition-enter.is-live.scene-results .speech-card-2.is-loser {
  animation: resultLoserInRight 720ms cubic-bezier(0.16, 1, 0.3, 1) 140ms both;
}

.scene-transition-enter.is-live.scene-results .speech-card-1.is-slapback {
  animation: resultSlapbackInLeft 760ms cubic-bezier(0.16, 1, 0.3, 1) 100ms both;
}

.scene-transition-enter.is-live.scene-results .speech-card-2.is-slapback {
  animation: resultSlapbackInRight 780ms cubic-bezier(0.16, 1, 0.3, 1) 150ms both;
}

.scene-transition-enter.is-live.scene-results .speech-card-1:not(.is-winner):not(.is-loser):not(.is-slapback) {
  animation: resultNeutralInLeft 620ms cubic-bezier(0.16, 1, 0.3, 1) 80ms both;
}

.scene-transition-enter.is-live.scene-results .speech-card-2:not(.is-winner):not(.is-loser):not(.is-slapback) {
  animation: resultNeutralInRight 680ms cubic-bezier(0.16, 1, 0.3, 1) 160ms both;
}

.scene-transition-enter.scene-results .winner-stamp,
.scene-transition-enter.scene-results .slapback-stamp {
  opacity: 0;
  transform: scale(0.7) rotate(-6deg);
}

.scene-transition-enter.is-live.scene-results .winner-stamp.is-visible,
.scene-transition-enter.is-live.scene-results .slapback-stamp.is-visible {
  animation: resultStampPop 420ms cubic-bezier(0.2, 1.2, 0.4, 1) 620ms both;
}

@keyframes speechCardFlyUpLeft {
  0% {
    opacity: 0;
    transform: rotate(-6deg) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(-4deg) scale(1);
  }
}

@keyframes speechCardFlyUpRight {
  0% {
    opacity: 0;
    transform: rotate(6deg) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(4deg) scale(1);
  }
}

@keyframes resultNeutralInLeft {
  0% {
    opacity: 0;
    transform: rotate(-7deg) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(-4deg) scale(1);
  }
}

@keyframes resultNeutralInRight {
  0% {
    opacity: 0;
    transform: rotate(7deg) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(4deg) scale(1);
  }
}

@keyframes resultWinnerInLeft {
  0% {
    opacity: 0;
    transform: rotate(-8deg) scale(0.9);
    filter: brightness(0.9) saturate(0.9);
  }
  68% {
    opacity: 1;
    transform: translateY(-8px) rotate(-1deg) scale(1.22);
    filter: brightness(1.22) saturate(1.22);
  }
  100% {
    opacity: 1;
    transform: scale(1.15) rotate(-2deg);
    filter: brightness(1.14) saturate(1.14);
  }
}

@keyframes resultWinnerInRight {
  0% {
    opacity: 0;
    transform: rotate(8deg) scale(0.9);
    filter: brightness(0.9) saturate(0.9);
  }
  68% {
    opacity: 1;
    transform: translateY(-8px) rotate(1deg) scale(1.22);
    filter: brightness(1.22) saturate(1.22);
  }
  100% {
    opacity: 1;
    transform: scale(1.15) rotate(2deg);
    filter: brightness(1.14) saturate(1.14);
  }
}

@keyframes resultLoserInLeft {
  0% {
    opacity: 0;
    transform: rotate(-8deg) scale(0.95);
    filter: brightness(0.95) saturate(0.95);
  }
  100% {
    opacity: 0.5;
    transform: scale(0.85) rotate(-6deg);
    filter: grayscale(50%) brightness(0.52) saturate(0.52);
  }
}

@keyframes resultLoserInRight {
  0% {
    opacity: 0;
    transform: rotate(8deg) scale(0.95);
    filter: brightness(0.95) saturate(0.95);
  }
  100% {
    opacity: 0.5;
    transform: scale(0.85) rotate(6deg);
    filter: grayscale(50%) brightness(0.52) saturate(0.52);
  }
}

@keyframes resultSlapbackInLeft {
  0% {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
    filter: brightness(0.95);
  }
  72% {
    opacity: 1;
    transform: translateY(-16px) rotate(-1deg) scale(1.48) translate(20%, 0);
    filter: brightness(1.24) saturate(1.18);
  }
  100% {
    opacity: 1;
    transform: scale(1.4) rotate(-3deg) translate(20%, 0);
    filter: brightness(1.18) saturate(1.12);
  }
}

@keyframes resultSlapbackInRight {
  0% {
    opacity: 0;
    transform: rotate(10deg) scale(0.9);
    filter: brightness(0.95);
  }
  72% {
    opacity: 1;
    transform: translateY(-16px) rotate(1deg) scale(1.48) translate(-20%, 0);
    filter: brightness(1.24) saturate(1.18);
  }
  100% {
    opacity: 1;
    transform: scale(1.4) rotate(3deg) translate(-20%, 0);
    filter: brightness(1.18) saturate(1.12);
  }
}

@keyframes resultStampPop {
  0% {
    opacity: 0;
    transform: scale(0.7) rotate(-6deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.12) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}



.scene-lobby-reference {
  width: 100%;
}

.lobby-reference-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  align-items: center;
  gap: 30px;
  width: 100%;
  min-height: 680px;
}

.lobby-invite {
  display: grid;
  gap: 16px;
  align-content: center;
  justify-items: start;
  text-align: left;
  padding-left: 24px;
}

.lobby-copy {
  margin: 0;
  font-family: "Bungee", sans-serif;
  line-height: 1.1;
  letter-spacing: 0.03em;
}

.lobby-copy.small {
  font-size: clamp(1rem, 2vw, 1.6rem);
}

.lobby-copy.tiny {
  max-width: 280px;
  font-family: "DM Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.4;
}

.lobby-room-code {
  font-family: "Bungee", sans-serif;
  font-size: clamp(3.4rem, 8vw, 5.6rem);
  line-height: 0.95;
  color: white;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.5),
    0 10px 24px rgba(0, 0, 0, 0.24);
}

.lobby-cast-stage {
  position: relative;
  min-height: 660px;
  width: 100%;
  padding: 24px 18px;
  border-radius: 32px;
  overflow: hidden;
}

.lobby-cast-stage::before,
.lobby-cast-stage::after {
  content: "";
  position: absolute;
  inset: 8% 6%;
  border-radius: 48% 52% 54% 46% / 42% 38% 62% 58%;
  pointer-events: none;
}

.lobby-cast-stage::before {
  background:
    radial-gradient(circle at 35% 38%, rgba(255, 0, 195, 0.24), transparent 0 28%, rgba(87, 13, 153, 0.3) 28% 38%, transparent 38% 56%, rgba(79, 20, 171, 0.32) 56% 66%, transparent 66% 100%),
    radial-gradient(circle at center, rgba(150, 71, 255, 0.28), rgba(70, 10, 147, 0.1) 46%, transparent 47%);
  transform: rotate(-8deg) scale(1.08);
  animation: swirlPulse 5s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.lobby-cast-stage::after {
  inset: 18% 16%;
  background:
    radial-gradient(circle at 50% 50%, rgba(135, 34, 240, 0.42), transparent 0 38%, rgba(59, 10, 122, 0.28) 38% 54%, transparent 54% 100%);
  filter: blur(8px);
  animation: swirlFloat 7s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.lobby-swirl-core {
  position: absolute;
  inset: 22% 20%;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(55, 7, 110, 0.9), rgba(134, 31, 222, 0.28) 38%, transparent 56%),
    radial-gradient(circle at 50% 50%, rgba(212, 71, 255, 0.2), transparent 0 26%, rgba(108, 23, 173, 0.28) 26% 40%, transparent 40% 100%);
  filter: blur(1px);
}

.lobby-cast-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  min-height: 100%;
}

.lobby-cast-seat {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg));
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  width: 136px;
  max-width: 136px;
  min-height: 122px;
  padding: 6px 8px;
  border-radius: 18px;
  background: rgba(17, 8, 45, 0.34);
  transition: opacity 200ms ease, background 200ms ease;
}

.lobby-cast-seat.empty {
  color: white;
  background: rgba(255, 255, 255, 0.07);
}

.join-orb {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 219, 255, 0.9);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.join-label {
  font-family: "Bungee", sans-serif;
  font-size: 0.9rem;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}

.avatar-badge {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
}

.lobby-cast-seat .avatar-badge {
  width: auto;
}

.lobby-cast-seat .cast-nameplate {
  width: auto;
  max-width: 132px;
  min-width: 0;
  padding: 6px 10px;
}

.lobby-cast-seat .cast-nameplate strong {
  font-size: 0.76rem;
}

.lobby-cast-seat .cast-nameplate span {
  font-size: 0.62rem;
}

.avatar-badge.is-vip .cast-token {
  box-shadow:
    0 0 0 3px rgba(255, 214, 96, 0.9),
    0 0 22px rgba(255, 210, 77, 0.9),
    0 12px 26px rgba(0, 0, 0, 0.26);
}

.avatar-badge.is-vip .cast-nameplate {
  background: linear-gradient(180deg, rgba(70, 45, 2, 0.95), rgba(42, 28, 4, 0.95));
  box-shadow: inset 0 0 0 2px rgba(255, 214, 108, 0.8);
}

.avatar-badge.is-vip .cast-nameplate span {
  color: #ffd76e;
}

.player-lobby-scene {
  position: relative;
  display: grid;
  gap: 22px;
  justify-items: center;
  text-align: center;
  padding: 18px 8px 10px;
}

.player-lobby-scene::before {
  content: "";
  position: absolute;
  inset: -18px -6px 24px;
  background:
    radial-gradient(circle at center, rgba(252, 0, 219, 0.22), transparent 0 18%, rgba(121, 16, 219, 0.25) 18% 34%, transparent 34% 52%, rgba(100, 20, 178, 0.2) 52% 68%, transparent 68% 100%);
  filter: blur(10px);
  opacity: 0.85;
  z-index: -1;
  animation: swirlPulse 5s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.player-lobby-scene.player-lobby-compact {
  gap: 10px;
  align-content: start;
  padding: 8px 4px 2px;
}

.player-lobby-scene.player-lobby-compact::before {
  inset: -10px -4px 12px;
  opacity: 0.62;
}

.player-roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 18px;
  width: 100%;
}

.scene-copy {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.character-selector {
  width: 100%;
  gap: 16px;
}

.character-selector.compact {
  gap: 8px;
}

.character-selector.compact .scene-copy {
  gap: 6px;
}

.character-selector.compact .controller-copy {
  font-size: 0.88rem;
  line-height: 1.3;
}

.character-selector.compact .character-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.character-selector.compact .character-option {
  gap: 6px;
  padding: 8px 4px;
  border-radius: 14px;
}

.character-selector.compact .cast-token {
  transform: scale(0.56);
  transform-origin: center;
  margin: -10px 0 -8px;
}

.character-selector.compact .cast-face {
  font-size: 10px;
  letter-spacing: 8px;
}

.character-selector.compact .character-name {
  font-size: 0.7rem;
  line-height: 1;
}

.character-selector.compact .character-status {
  font-size: 0.56rem;
  letter-spacing: 0.04em;
}

.player-lobby-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.player-lobby-actions.single {
  grid-template-columns: 1fr;
}

.player-lobby-actions .blackjack-toggle-row {
  justify-content: stretch;
}

.player-lobby-actions .blackjack-toggle-row .big-button,
.player-lobby-actions .big-button {
  min-width: 0;
  width: 100%;
}

.player-lobby-actions .big-button {
  min-height: 48px;
  padding: 10px 12px;
  font-size: 0.8rem;
}

.selector-title {
  margin: 0;
  font-family: "Bungee", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 12px;
  width: 100%;
}

.character-option {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

.character-option:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.14);
}

.character-option.is-selected {
  background: rgba(76, 220, 255, 0.18);
  box-shadow: inset 0 0 0 2px rgba(116, 229, 255, 0.55);
}

.character-option.is-taken {
  opacity: 0.45;
}

.character-name,
.character-status {
  text-align: center;
}

.character-name {
  font-size: 0.9rem;
}

.character-status {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.scene-title {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 1;
}

.logo-lockup {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 560px);
  height: 128px;
}

.logo-lockup-small {
  width: min(100%, 320px);
  height: 86px;
}

.logo-lockup-large {
  height: 152px;
}

.logo-bubble {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52%;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  border: 5px solid rgba(0, 0, 0, 0.7);
}

.logo-bubble-left {
  left: 0;
  transform: rotate(-7deg);
  clip-path: polygon(0 10%, 100% 0, 92% 82%, 28% 82%, 18% 100%, 18% 82%, 2% 82%);
}

.logo-bubble-right {
  right: 0;
  transform: rotate(8deg);
  clip-path: polygon(0 0, 100% 10%, 98% 82%, 82% 82%, 82% 100%, 66% 82%, 8% 82%);
}

.logo-bubble span {
  font-size: clamp(1.9rem, 5.2vw, 3.7rem);
}

.logo-burst {
  position: absolute;
  bottom: 0;
  padding: 16px 24px;
  border-radius: 999px;
  border: 5px solid rgba(0, 0, 0, 0.7);
  background: var(--cyan);
  color: #072131;
  transform: rotate(-4deg);
}

.host-prompt {
  max-width: 980px;
  font-size: clamp(1rem, 2vw, 1.5rem);
}

.stage-board {
  width: min(100%, 760px);
  padding: 22px;
  border-radius: 28px;
  border: 4px solid rgba(0, 0, 0, 0.65);
  background: rgba(255, 255, 255, 0.9);
  color: #171717;
}

.meter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.meter-tile {
  width: 140px;
  aspect-ratio: 1;
  padding: 12px 14px;
  border-radius: 18px;
  border: 4px solid rgba(0, 0, 0, 0.6);
  background: rgba(255, 255, 255, 0.86);
  color: #151515;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  transition: transform 220ms ease, background 220ms ease, opacity 220ms ease;
}

.meter-tile.is-ready {
  background: var(--green);
  transform: translateY(-6px) scale(1.03);
}

.speech-grid {
  width: min(100%, 1080px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.speech-card-1 {
  transform: rotate(-4deg);
}

.speech-card-2 {
  transform: rotate(4deg);
}

.speech-label {
  width: fit-content;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.speech-points {
  margin-top: 14px;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.speech-card {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease, filter 0.4s ease;
}

.speech-card.is-winner {
  z-index: 30;
  box-shadow:
    var(--shadow),
    0 0 0 8px rgba(255, 200, 79, 0.4) inset,
    0 0 30px rgba(255, 200, 79, 0.6);
}
.speech-card-1.is-winner { transform: scale(1.15) rotate(-2deg); }
.speech-card-2.is-winner { transform: scale(1.15) rotate(2deg); }

.speech-card.is-loser {
  opacity: 0.55;
  filter: grayscale(45%) brightness(0.58) saturate(0.58);
  z-index: 6;
}
.speech-card-1.is-loser { transform: scale(0.85) rotate(-6deg); }
.speech-card-2.is-loser { transform: scale(0.85) rotate(6deg); }

.speech-card.is-slapback {
  box-shadow:
    var(--shadow),
    0 0 0 12px rgba(255, 200, 79, 0.8) inset,
    0 20px 60px rgba(255, 200, 79, 0.9);
  z-index: 40;
}
.speech-card-1.is-slapback { transform: scale(1.4) rotate(-3deg) translate(20%, 0); }
.speech-card-2.is-slapback { transform: scale(1.4) rotate(3deg) translate(-20%, 0); }

.speech-card-1.is-flung { animation: flingOutLeft 1.2s cubic-bezier(0.8, -0.4, 0.2, 1.2) forwards; }
.speech-card-2.is-flung { animation: flingOutRight 1.2s cubic-bezier(0.8, -0.4, 0.2, 1.2) forwards; }

@keyframes flingOutLeft {
  0% { transform: scale(0.85) rotate(-6deg); opacity: 0.55; }
  15% { transform: scale(0.9) rotate(5deg) translate(40px, -40px); }
  100% { transform: scale(0.2) rotate(-720deg) translate(-200vw, 200vh); opacity: 0; }
}

@keyframes flingOutRight {
  0% { transform: scale(0.85) rotate(6deg); opacity: 0.55; }
  15% { transform: scale(0.9) rotate(-5deg) translate(-40px, -40px); }
  100% { transform: scale(0.2) rotate(720deg) translate(200vw, 200vh); opacity: 0; }
}

.speech-voters {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 16px 0 0 0;
}

.speech-voter {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.06);
  border: 2px solid rgba(0,0,0,0.1);
  padding: 0 12px 0 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 1;
  max-width: 220px;
  overflow: hidden;
  transform: translateY(0) scale(1);
  transition:
    transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
    background 200ms ease,
    opacity 220ms ease,
    max-width 240ms ease,
    padding 220ms ease,
    border-width 180ms ease;
  z-index: 2;
}

.speech-voter.is-hidden {
  opacity: 0;
  max-width: 0;
  transform: translateY(10px) scale(0.86);
  padding: 0;
  border-width: 0;
  margin: 0;
  pointer-events: none;
}

.speech-voter:hover {
  transform: translateY(-4px) scale(1.05);
  background: rgba(0, 0, 0, 0.1);
  z-index: 5;
}

.speech-voter .cast-token {
  transform: scale(0.5);
  transform-origin: center;
  margin: -12.5px 0px -12.5px -12.5px;
}

.voter-name {
  margin-left: 2px;
}

.scene.scene-results .winner-stamp,
.scene.scene-results .slapback-stamp {
  opacity: 0;
  transform: scale(0.72) rotate(-6deg);
  transition: opacity 280ms ease, transform 320ms cubic-bezier(0.2, 1.2, 0.4, 1);
  pointer-events: none;
}

.scene.scene-results .winner-stamp.is-visible,
.scene.scene-results .slapback-stamp.is-visible {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.leaderboard-showcase {
  display: grid;
  gap: 10px;
  width: min(100%, 1480px);
  margin-top: -6px;
}

.leaderboard-title {
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.95;
}

.leaderboard-subtitle {
  font-size: 1.05rem;
  opacity: 0.86;
}

.leader-top-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  width: 100%;
}

.leader-spot {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px 18px 20px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(11, 18, 34, 0.86), rgba(18, 45, 86, 0.88));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 18px 32px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.leader-spot-rank-1 {
  order: 2;
  min-height: 252px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 204, 82, 0.24), transparent 42%),
    linear-gradient(180deg, rgba(37, 16, 58, 0.92), rgba(18, 54, 102, 0.9));
}

.leader-spot-rank-2,
.leader-spot-rank-3 {
  min-height: 220px;
}

.leader-spot-rank-2 {
  order: 1;
}

.leader-spot-rank-3 {
  order: 3;
}

.leader-spot.is-offline {
  opacity: 0.68;
}

.leader-spot-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff8d5;
  font-family: "Bungee", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leader-spot-token {
  transform: scale(1.45);
  margin: 14px 0 8px;
}

.leader-spot-name {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1;
  color: white;
}

.leader-spot-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--gold);
  color: #241302;
  font-family: "Bungee", sans-serif;
  font-size: 0.95rem;
}

.standings-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.standing-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 12px 14px;
  border-radius: 22px;
  background: rgba(15, 37, 72, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 14px 24px rgba(0, 0, 0, 0.14);
}

.standing-card.is-offline {
  opacity: 0.66;
}

.standing-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(12, 18, 34, 0.88);
  color: white;
  font-family: "Bungee", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.standing-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.standing-identity .cast-token {
  flex: 0 0 auto;
  transform: scale(0.9);
  transform-origin: center;
  margin: -3px 0;
}

.standing-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  text-align: left;
}

.standing-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.18rem;
  font-weight: 800;
  color: white;
}

.standing-status {
  color: rgba(255, 202, 202, 0.82);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.standing-score {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(9, 13, 24, 0.88);
  color: #fff4c2;
  font-family: "Bungee", sans-serif;
  font-size: 0.88rem;
  white-space: nowrap;
}

.leader-spot,
.standing-card {
  transition:
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms ease,
    opacity 220ms ease,
    filter 260ms ease;
  will-change: transform, opacity, filter;
}

.leader-spot.is-hidden,
.standing-card.is-hidden {
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  filter: blur(6px) saturate(0.78);
  pointer-events: none;
}

.leader-spot:hover,
.standing-card:hover {
  transform: translateY(-4px);
}

.scene-leaderboard-dense .standings-board {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.scene-leaderboard-dense .standing-card {
  min-height: 78px;
  padding: 11px 12px;
}

.scene-leaderboard-dense .standing-name {
  font-size: 0.96rem;
}

.scene-leaderboard-dense .standing-score,
.scene-leaderboard-dense .standing-rank {
  font-size: 0.82rem;
}

.cast-strip {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
}

.cast-strip-inner {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
}

.cast-member {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cast-token {
  position: relative;
  width: 62px;
  height: 62px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.cast-token::before,
.cast-token::after {
  content: "";
  position: absolute;
  top: 19px;
  width: 10px;
  height: 14px;
  border-radius: 999px;
  background: white;
}

.cast-token::before {
  left: 15px;
}

.cast-token::after {
  right: 15px;
}

.cast-face {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: #171717;
  font-size: 10px;
  letter-spacing: 8px;
}

.cast-nameplate {
  display: grid;
  gap: 4px;
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  border-radius: 14px;
  background: #0f0f10;
}

.cast-nameplate strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.cast-nameplate span {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.shape-hex {
  clip-path: polygon(24% 2%, 76% 2%, 100% 50%, 76% 98%, 24% 98%, 0% 50%);
}

.shape-blob {
  border-radius: 46% 54% 40% 60% / 40% 38% 62% 60%;
}

.shape-ticket {
  clip-path: polygon(0 12%, 10% 0, 90% 0, 100% 12%, 100% 88%, 90% 100%, 10% 100%, 0 88%);
}

.shape-drop {
  clip-path: polygon(50% 0%, 82% 16%, 100% 56%, 74% 100%, 26% 100%, 0% 56%, 18% 16%);
}

.shape-diamond {
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.shape-pebble {
  border-radius: 36% 64% 58% 42% / 42% 38% 62% 58%;
}

.color-gold {
  background: linear-gradient(180deg, #ffd76e, #e1a326);
}

.color-mint {
  background: linear-gradient(180deg, #8effd0, #33b77e);
}

.color-blue {
  background: linear-gradient(180deg, #72deff, #3a88dd);
}

.color-pink {
  background: linear-gradient(180deg, #ff9cf6, #d55fd4);
}

.color-purple {
  background: linear-gradient(180deg, #c09cff, #825fe0);
}

.color-orange {
  background: linear-gradient(180deg, #ffbf73, #e1832b);
}

.color-sky {
  background: linear-gradient(180deg, #90b8ff, #5d7ae3);
}

.color-lime {
  background: linear-gradient(180deg, #c9ff86, #7ac93b);
}

.blackjack-wrap {
  display: grid;
  gap: 16px;
  margin-top: 6px;
}

.blackjack-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.blackjack-panel-title {
  font-family: "Bungee", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.blackjack-frame {
  display: grid;
}

.blackjack-toggle-row {
  display: flex;
  justify-content: center;
}

.player-score-card {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 16px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

.player-score-card.is-you {
  background: rgba(47, 208, 255, 0.2);
}

.player-score-place {
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  text-transform: uppercase;
}

.player-score-points {
  font-family: "Bungee", sans-serif;
  font-size: 1.5rem;
  line-height: 1;
}

.player-top-three {
  display: grid;
  gap: 10px;
  width: 100%;
}

.player-top-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

.player-top-card.is-you {
  background: rgba(47, 208, 255, 0.24);
}

.player-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-top-row .cast-token {
  transform: scale(0.7);
  transform-origin: center;
  margin: -8px -2px;
}

.player-top-place {
  font-family: "Bungee", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.player-top-name {
  font-size: 1rem;
  line-height: 1.1;
}

.player-top-score {
  font-weight: 800;
  color: rgba(255, 255, 255, 0.84);
}

.blackjack-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff8ff;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.blackjack-card {
  display: grid;
  gap: 16px;
  padding: 14px;
  border-radius: 32px;
  background: linear-gradient(180deg, #4b3523, #2d1d12);
  box-shadow:
    inset 0 2px 0 rgba(255, 236, 199, 0.22),
    0 22px 40px rgba(0, 0, 0, 0.3);
}

.blackjack-table-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 0;
}

.blackjack-title {
  display: grid;
  gap: 3px;
}

.blackjack-title h3 {
  margin: 0;
  font-family: "Bungee", sans-serif;
  font-size: 1rem;
  color: #fff3d9;
}

.blackjack-title p {
  margin: 0;
  color: rgba(255, 242, 217, 0.74);
  font-size: 0.82rem;
}

.blackjack-deck {
  position: relative;
  width: 62px;
  height: 74px;
}

.blackjack-deck-card {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.28), transparent 18%),
    linear-gradient(180deg, #5870df, #3148ad);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.72),
    inset 0 0 0 5px rgba(44, 58, 142, 0.98);
}

.blackjack-deck-card-back {
  transform: translate(-8px, 7px) rotate(-8deg);
  opacity: 0.76;
}

.blackjack-deck-card-mid {
  transform: translate(-4px, 3px) rotate(-4deg);
  opacity: 0.88;
}

.blackjack-deck-card-top::after,
.blackjack-card-hidden-pattern::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.65);
}

.blackjack-surface {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 460px;
  padding: 18px 16px 26px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.05), transparent 44%),
    linear-gradient(180deg, #1f8b4a, #116031);
  box-shadow:
    inset 0 0 0 4px rgba(214, 181, 109, 0.58),
    inset 0 0 0 12px rgba(18, 84, 43, 0.96);
}

.blackjack-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.04), transparent 50%),
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 6px);
  pointer-events: none;
}

.blackjack-betting-ring {
  position: absolute;
  left: 50%;
  bottom: 108px;
  width: min(88%, 360px);
  height: 140px;
  border-top: 4px solid rgba(233, 198, 121, 0.72);
  border-left: 4px solid rgba(233, 198, 121, 0.72);
  border-right: 4px solid rgba(233, 198, 121, 0.72);
  border-radius: 220px 220px 0 0;
  transform: translateX(-50%);
  opacity: 0.8;
}

.blackjack-seat {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.blackjack-seat-dealer {
  margin-top: 6px;
}

.blackjack-seat-player {
  margin-top: auto;
}

.blackjack-seat-label {
  color: rgba(255, 246, 222, 0.88);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

.blackjack-total {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(180deg, #274c2e, #16311a);
  box-shadow:
    inset 0 0 0 3px rgba(238, 213, 161, 0.9),
    0 10px 18px rgba(0, 0, 0, 0.18);
  color: #fff7e6;
  font-family: "Bungee", sans-serif;
  font-size: 1rem;
}

.blackjack-message {
  position: relative;
  z-index: 1;
  align-self: center;
  max-width: 76%;
  padding: 11px 16px;
  border-radius: 999px;
  background: rgba(12, 55, 31, 0.86);
  color: #fff9ec;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.14);
}

.blackjack-rule-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  color: rgba(244, 231, 194, 0.88);
  font-family: "Bungee", sans-serif;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.blackjack-hand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 136px;
}

.blackjack-hand > .blackjack-playing-card + .blackjack-playing-card {
  margin-left: -18px;
}

.blackjack-playing-card {
  position: relative;
  display: grid;
  align-content: space-between;
  width: 84px;
  height: 122px;
  padding: 8px 9px;
  border-radius: 11px;
  background: linear-gradient(180deg, #fffef9, #f1ead7);
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.08),
    0 10px 18px rgba(0, 0, 0, 0.18);
}

.blackjack-playing-card.is-hidden {
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.24), transparent 16%),
    linear-gradient(180deg, #5870df, #3148ad);
  overflow: hidden;
}

.blackjack-card-hidden-pattern {
  position: absolute;
  inset: 0;
}

.blackjack-card-corner {
  display: grid;
  justify-items: center;
  width: 20px;
  line-height: 1;
}

.blackjack-card-corner-top {
  justify-self: start;
  align-self: start;
}

.blackjack-card-corner-bottom {
  justify-self: end;
  align-self: end;
  transform: rotate(180deg);
}

.blackjack-card-rank {
  font-size: 1.32rem;
  font-weight: 800;
}

.blackjack-card-suit-small {
  font-size: 1rem;
}

.blackjack-card-center {
  place-self: center;
  font-size: 2.4rem;
  line-height: 1;
}

.blackjack-playing-card.is-red {
  color: #c72619;
}

.blackjack-playing-card.is-black {
  color: #121212;
}

.blackjack-controls {
  display: flex;
  gap: 10px;
}

.blackjack-action {
  flex: 1 1 0;
  min-height: 56px;
  border-radius: 18px;
  color: #fffdf6;
  font-family: "Bungee", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -6px 0 rgba(0, 0, 0, 0.2);
  transition: transform 120ms ease, opacity 120ms ease;
}

.blackjack-action:hover {
  transform: translateY(-1px);
}

.blackjack-action:disabled {
  opacity: 0.45;
  transform: none;
}

.blackjack-action-stand {
  background: linear-gradient(180deg, #bf3a31, #86170f);
}

.blackjack-action-deal {
  background: linear-gradient(180deg, #d5a13c, #a56a10);
}

.blackjack-action-hit {
  background: linear-gradient(180deg, #52b940, #237917);
}

.good {
  color: #7dffab;
}

.bad,
.error-text {
  color: #ffc2ca;
}

.error-text {
  min-height: 1.4em;
  margin: 0;
  font-weight: 800;
}

.frame-card,
.show-stage,
.controller-stage,
.controller-card,
.speech-card,
.podium-card,
.leader-card,
.blackjack-card,
.show-code-bug,
.prompt-plaque,
.vote-card,
.controller-bubble,
.result-speech,
.speech-label,
.chip,
.phase-stamp,
.timer-chip,
.player-tag,
.counter-pill,
.stamp-badge,
.winner-stamp,
.meter-tile,
.cast-nameplate,
.cast-token,
.logo-bubble,
.logo-burst,
input,
textarea,
.ticker-banner,
.scene-tag {
  border: none !important;
}

.controller-bubble::after,
.result-speech::after,
.speech-card::after {
  border: none !important;
}

.show-code-bug,
.phase-stamp,
.player-tag,
.ticker-banner,
.controller-card,
.frame-card,
.leader-card,
.podium-card,
.vote-card,
.controller-bubble,
.result-speech,
.speech-card,
.prompt-plaque,
.meter-tile,
.logo-bubble,
.logo-burst {
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

.show-code-bug {
  box-shadow: none !important;
}

.podium-card,
.runner-up-card,
.avatar-badge,
.show-code-bug,
.timer-chip {
  transition:
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease,
    box-shadow 220ms ease;
}

.podium-card:hover,
.runner-up-card:hover,
.avatar-badge:hover {
  transform: translateY(-4px);
}


@keyframes swirlPulse {
  0% {
    transform: rotate(-15deg) scale(0.95);
  }

  50% {
    transform: rotate(5deg) scale(1.15);
  }

  100% {
    transform: rotate(18deg) scale(1.05);
  }
}

@keyframes swirlFloat {
  0% {
    transform: translateY(-15px) scale(0.9);
  }

  33% {
    transform: translateY(12px) scale(1.1);
  }

  66% {
    transform: translateY(5px) scale(0.95);
  }

  100% {
    transform: translateY(-8px) scale(1.08);
  }
}

@media (max-width: 980px) {
  .lobby-reference-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .lobby-invite {
    justify-items: center;
    text-align: center;
    padding-left: 0;
  }

  .lobby-cast-stage {
    min-height: 520px;
  }

  .lobby-cast-seat {
    width: 122px;
    max-width: 122px;
    min-height: 112px;
  }

  .speech-grid {
    grid-template-columns: 1fr;
  }

  .show-canvas {
    min-height: 0;
    padding-bottom: 184px;
  }

  .show-hud {
    flex-direction: column;
    align-items: stretch;
  }

  .hud-cluster-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .leader-top-strip {
    grid-template-columns: 1fr;
  }

  .standings-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }
}

@media (max-width: 640px) {
  .show-app,
  .controller-app {
    width: min(100% - 12px, 100%);
    padding-top: 10px;
  }

  .frame-card,
  .controller-card,
  .show-canvas,
  .blackjack-card {
    padding: 18px;
  }

  .join-actions,
  .controller-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .big-button,
  .alt-button {
    width: 100%;
  }

  .blackjack-controls {
    flex-direction: column;
  }

  .player-lobby-actions {
    grid-template-columns: 1fr;
  }

  .logo-lockup {
    height: 160px;
  }

  .logo-burst {
    padding: 12px 18px;
  }

  .cast-member {
    width: 100%;
    justify-content: center;
  }

  .lobby-cast-stage {
    min-height: 420px;
  }

  .lobby-cast-seat {
    width: 104px;
    max-width: 104px;
    min-height: 98px;
  }

  .lobby-cast-seat .cast-nameplate {
    max-width: 100px;
    padding: 6px 8px;
  }

  .lobby-cast-seat .cast-nameplate strong {
    font-size: 0.7rem;
  }

  .standings-board {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .standing-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
  }

  .standing-score {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.rank-wrap,
.result-meta-line,
.speech-label-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.podium-name-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.meter-name-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  height: 100%;
  width: 100%;
  position: relative;
}

.rank-wrap {
  justify-content: flex-start;
}
.result-meta-line .cast-token,
.speech-label-line .cast-token,
.podium-name-line .cast-token,
.rank-wrap .cast-token,
.runner-up-card .cast-token {
  transform: scale(0.65);
  transform-origin: center;
  margin: -14px -6px;
}

.meter-name-line .cast-token {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.15);
  transform-origin: center;
  margin: 0;
}

.meter-name-line .meter-name {
  margin-top: auto;
  margin-bottom: 14px;
}


/* =====================================================
   PLAYER SHELL – Mobile-first phone controller
   ===================================================== */

/* Allow the player page to scroll naturally (global html is overflow:hidden) */
html:has(body.player-shell) {
  height: auto;
  overflow: auto;
}

body.player-shell {
  height: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(120% 120% at 8% -14%, rgba(138, 96, 232, 0.38), transparent 48%),
    linear-gradient(180deg, #4d129c, #280657) fixed;
}

body.player-shell .controller-app {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Join screen --- */
body.player-shell .join-scene {
  display: grid;
  gap: 20px;
  padding: 20px;
  border-radius: 24px;
  text-align: left;
  justify-items: stretch;
  background: linear-gradient(180deg, rgba(132, 87, 223, 0.34), rgba(69, 34, 136, 0.62));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

body.player-shell .join-copy {
  display: grid;
  gap: 8px;
}

body.player-shell .join-copy h1 {
  font-size: clamp(2.1rem, 8.6vw, 3.2rem);
  line-height: 0.98;
}

body.player-shell .join-copy p {
  font-size: 1rem;
  line-height: 1.34;
}

body.player-shell .join-form {
  display: grid;
  gap: 14px;
}

body.player-shell .field span {
  font-size: 0.82rem;
}

body.player-shell input,
body.player-shell textarea {
  border-radius: 16px;
  font-size: 1.05rem;
  padding: 15px 16px;
}

body.player-shell .join-actions {
  display: grid;
}

body.player-shell .join-actions .big-button {
  width: 100%;
  min-height: 62px;
  font-size: 1.1rem;
  border-radius: 20px;
}

/* Advanced server URL toggle */
body.player-shell .join-advanced {
  display: grid;
  gap: 10px;
}

body.player-shell .join-advanced summary {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

body.player-shell .join-advanced summary::-webkit-details-marker {
  display: none;
}

body.player-shell .join-advanced[open] summary {
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 4px;
}

/* --- HUD --- */
body.player-shell .controller-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.player-shell .controller-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
}

body.player-shell .controller-hud > .hud-cluster:first-child {
  display: none;
}

body.player-shell .hud-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

body.player-shell .hud-cluster-right {
  position: relative;
  justify-content: center;
  flex-shrink: 0;
  flex: 1;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
}

body.player-shell .chip,
body.player-shell .player-tag {
  min-height: 40px;
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 0.88rem;
  line-height: 1.2;
}

body.player-shell .player-tag {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  text-align: center;
  justify-content: center;
  flex: 1;
  font-size: clamp(1.3rem, 4.4vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  min-height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.player-shell #player-name-tag {
  font-size: clamp(1.45rem, 5.2vw, 2rem) !important;
  font-weight: 900 !important;
}

body.player-shell .timer-chip {
  font-size: 2rem;
  line-height: 1;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  text-align: right;
  justify-content: flex-end;
  min-width: 3.5ch;
}

/* Hide ticker — the scene cards already convey the context */
body.player-shell .ticker-banner {
  display: none;
}

/* --- Main content (natural page scroll, no nested overflow) --- */
body.player-shell .controller-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
}

body.player-shell .controller-main > * {
  width: 100%;
}

/* --- Shared scene tag / titles --- */
body.player-shell .scene-tag {
  padding: 7px 12px;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
}

body.player-shell .controller-title {
  font-size: clamp(1.65rem, 6.8vw, 2.4rem);
  line-height: 1.08;
}

body.player-shell .controller-copy {
  font-size: 1rem;
  line-height: 1.34;
}

/* --- Player panels (base) --- */
body.player-shell .player-panel {
  width: 100%;
  border-radius: 24px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(132, 87, 223, 0.34), rgba(69, 34, 136, 0.62));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

/* --- Lobby panel --- */
body.player-shell .player-panel-lobby {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(145, 93, 235, 0.5), rgba(78, 40, 155, 0.72));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

body.player-shell .player-panel-lobby::before {
  display: none;
}

body.player-shell .player-lobby-intro {
  display: grid;
  gap: 6px;
  text-align: left;
}

body.player-shell .player-lobby-intro .controller-title {
  margin: 0;
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  line-height: 0.98;
}

body.player-shell .player-lobby-intro .controller-copy {
  margin: 0;
  font-size: 0.94rem;
}

/* 4-column character grid */
body.player-shell .player-panel-lobby .lobby-character-selector {
  gap: 0;
}

body.player-shell .player-panel-lobby .lobby-character-selector .character-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body.player-shell .player-panel-lobby .character-option {
  min-height: 0;
  padding: 10px 6px;
  gap: 6px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.07));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

body.player-shell .player-panel-lobby .character-option:hover {
  transform: translateY(-1px);
}

body.player-shell .player-panel-lobby .character-option .cast-token {
  transform: scale(0.88);
  margin-bottom: 0;
}

body.player-shell .player-panel-lobby .character-name {
  font-size: 0.8rem;
  line-height: 1;
}

body.player-shell .player-panel-lobby .character-status {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

body.player-shell .player-panel-lobby .character-option.is-selected {
  background: linear-gradient(180deg, rgba(127, 214, 255, 0.2), rgba(122, 164, 255, 0.13));
  box-shadow:
    inset 0 0 0 3px rgba(121, 213, 255, 0.82),
    0 10px 24px rgba(19, 20, 72, 0.28);
}

body.player-shell .player-panel-lobby .character-option.is-taken {
  opacity: 0.42;
}

body.player-shell .player-panel-lobby .player-lobby-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 2px;
}

body.player-shell .player-panel-lobby .player-lobby-actions.single {
  grid-template-columns: 1fr;
}

body.player-shell .player-panel-lobby .player-lobby-actions .blackjack-toggle-row {
  justify-content: stretch;
}

body.player-shell .player-panel-lobby .player-lobby-actions .big-button,
body.player-shell .player-panel-lobby .player-lobby-actions .alt-button {
  min-height: 56px;
  min-width: 0;
  width: 100%;
  border-radius: 18px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* --- Answer panel --- */
body.player-shell .answer-clean {
  gap: 14px;
  padding: 16px;
  border-radius: 24px;
}

body.player-shell .answer-clean .answer-header {
  gap: 6px;
}

body.player-shell .answer-clean .answer-header .controller-title {
  font-size: clamp(1.4rem, 6.2vw, 2rem);
}

body.player-shell .answer-clean .progress-dot {
  width: 14px;
  height: 14px;
  border-width: 3px;
}

body.player-shell .controller-bubble,
body.player-shell .vote-card {
  border-radius: 20px;
  padding: 16px;
}

body.player-shell .controller-bubble::after {
  display: none;
}

body.player-shell .prompt-plaque,
body.player-shell .answer-clean .answer-prompt-plaque {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: clamp(1.05rem, 4.4vw, 1.4rem);
  line-height: 1.24;
}

body.player-shell .answer-clean .answer-input {
  min-height: clamp(160px, 26dvh, 260px);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  line-height: 1.15;
  resize: none;
}

body.player-shell .answer-clean .answer-foot {
  gap: 10px;
}

body.player-shell .answer-clean .answer-counter {
  min-height: 50px;
  font-size: 1.35rem;
  border-radius: 14px;
}

body.player-shell .submit-button {
  min-width: 0;
}

body.player-shell .answer-clean .submit-button {
  min-height: 58px;
  font-size: 1rem;
  border-radius: 18px;
}

/* --- Vote panel --- */
body.player-shell .vote-progress-copy {
  margin: 0;
  text-align: left;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

body.player-shell .vote-stack {
  gap: 14px;
}

body.player-shell .vote-card {
  transform: none !important;
  gap: 10px;
  min-height: 80px;
}

body.player-shell .scribble-mini {
  font-size: clamp(1.2rem, 5.5vw, 1.75rem);
  line-height: 1.12;
}

body.player-shell .vote-helper {
  font-size: 0.84rem;
  opacity: 0.9;
}

/* --- Game over / leaderboard --- */
body.player-shell .player-top-three {
  gap: 8px;
}

body.player-shell .player-top-card {
  padding: 12px 14px;
}

body.player-shell .player-score-card {
  padding: 12px 10px;
}

/* --- Blackjack minimal --- */
body.player-shell .blackjack-wrap {
  gap: 8px;
  margin-top: 0;
}

body.player-shell .blackjack-panel-top {
  gap: 8px;
}

body.player-shell .blackjack-panel-title {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

body.player-shell .blackjack-close {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.74rem;
}

body.player-shell .blackjack-minimal {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 18, 32, 0.86);
  box-shadow: none;
}

body.player-shell .blackjack-board,
body.player-shell .blackjack-surface {
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  gap: 8px;
}

body.player-shell .blackjack-surface::before,
body.player-shell .blackjack-betting-ring,
body.player-shell .blackjack-deck {
  display: none;
}

body.player-shell .blackjack-row {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
}

body.player-shell .blackjack-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body.player-shell .blackjack-seat-label {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: rgba(236, 241, 255, 0.82);
}

body.player-shell .blackjack-total {
  width: auto;
  height: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  box-shadow: none;
  color: #f4f7ff;
  font-family: "DM Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
}

body.player-shell .blackjack-hand {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 72px;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

body.player-shell .blackjack-hand::-webkit-scrollbar {
  display: none;
}

body.player-shell .blackjack-hand > .blackjack-playing-card + .blackjack-playing-card {
  margin-left: 0;
}

body.player-shell .blackjack-playing-card {
  width: 48px;
  height: 70px;
  padding: 4px 5px;
  border-radius: 6px;
  border: 1px solid #d6dde8;
  background: #f8fbff;
  box-shadow: none;
}

body.player-shell .blackjack-playing-card.is-hidden {
  background: #263146;
  border-color: rgba(213, 224, 245, 0.28);
}

body.player-shell .blackjack-card-hidden-pattern {
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.15) 4px,
    transparent 4px,
    transparent 8px
  );
}

body.player-shell .blackjack-card-hidden-pattern::after {
  display: none;
}

body.player-shell .blackjack-card-corner { width: 14px; }
body.player-shell .blackjack-card-rank { font-size: 0.76rem; }
body.player-shell .blackjack-card-suit-small { font-size: 0.62rem; }
body.player-shell .blackjack-card-center { font-size: 1.08rem; }

body.player-shell .blackjack-message {
  max-width: 100%;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  font-size: 0.76rem;
  font-weight: 700;
}

body.player-shell .blackjack-rule-copy {
  font-family: "DM Sans", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: rgba(230, 236, 250, 0.72);
}

body.player-shell .blackjack-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

body.player-shell .blackjack-action {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(220, 228, 246, 0.34);
  background: transparent;
  box-shadow: none;
  color: #eff4ff;
  font-family: "DM Sans", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: none;
}

body.player-shell .blackjack-action:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.07);
}

body.player-shell .blackjack-action:disabled { opacity: 0.4; }

body.player-shell .blackjack-action-deal {
  background: #edf3ff;
  border-color: #edf3ff;
  color: #151b2c;
}

body.player-shell .blackjack-action-hit {
  border-color: rgba(134, 239, 172, 0.55);
  color: #c8f8d9;
}

body.player-shell .blackjack-action-stand {
  border-color: rgba(253, 186, 116, 0.55);
  color: #ffe0ba;
}

/* --- Small phone (< 390px) --- */
@media (max-width: 390px) {
  body.player-shell .controller-app {
    padding-left: 12px;
    padding-right: 12px;
  }

  body.player-shell .player-tag {
    max-width: none;
    font-size: 1.25rem;
  }

  body.player-shell #player-name-tag {
    font-size: 1.25rem !important;
  }

  body.player-shell .timer-chip {
    font-size: 1.75rem;
  }

  body.player-shell .player-panel-lobby .lobby-character-selector .character-grid {
    gap: 8px;
  }

  body.player-shell .player-panel-lobby .character-option {
    padding: 8px 4px;
    gap: 4px;
  }

  body.player-shell .player-panel-lobby .player-lobby-actions .big-button,
  body.player-shell .player-panel-lobby .player-lobby-actions .alt-button {
    min-height: 52px;
    font-size: 0.88rem;
  }
}
