/* Fonts loaded via <link> in index.html */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffe156;
  font-family: 'Nunito', sans-serif;
  overflow-x: hidden;
  position: relative;
  color: #1a1a2e;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ========== BACKGROUND DOODLES ========== */
.doodle-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: strict;
}

.doodle-bg svg > *:not(defs) {
  will-change: transform;
}

.doodle-bg svg {
  width: 100%;
  height: 100%;
  transform: translateZ(0);
}

/* ========== CONTAINER ========== */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 8px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-height: 100dvh;
  overflow-y: auto;
}

.main-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* ========== LOGO ========== */
.logo {
  font-family: 'Fredoka One', cursive;
  font-size: 64px;
  letter-spacing: -1px;
  text-align: center;
  line-height: 1;
  margin-bottom: 0;
  animation: breathe 3s ease-in-out infinite;
  opacity: 0;
  animation: pop-in 0.6s 0.05s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, breathe 3s 0.7s ease-in-out infinite;
}

.logo span {
  display: inline-block;
  -webkit-text-stroke: 4px rgba(0, 0, 0, 0.5);
  paint-order: stroke fill;
  filter: url(#sketchy-text);
  text-shadow: 3px 4px 0 rgba(0, 0, 0, 0.15);
}

.logo .l1 {
  color: #00f5a0;
  transform: rotate(-5deg) translateY(2px);
}

.logo .l2 {
  color: #ff6b9d;
  transform: rotate(4deg) translateY(-3px);
}

.logo .l3 {
  color: #00d4ff;
  transform: rotate(-3deg) translateY(4px);
}

.logo .l4 {
  color: #ffe156;
  transform: rotate(5deg) translateY(-2px);
}

.logo .l5 {
  color: #c39bff;
  transform: rotate(-4deg) translateY(3px);
}

.logo .l6 {
  color: #ff9f43;
  transform: rotate(3deg) translateY(-4px);
}

.logo .l7 {
  color: #ff6b9d;
  transform: rotate(-2deg) translateY(1px);
}

.squiggle-line {
  display: block;
  margin: -4px auto 2px;
  width: 160px;
  height: 12px;
  opacity: 0;
  animation: pop-in 0.5s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.tagline {
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: rgba(26, 26, 46, 0.55);
  letter-spacing: 1.5px;
  text-align: center;
  margin-bottom: 4px;
  opacity: 0;
  filter: url(#sketchy-text);
  animation: pop-in 0.5s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========== AVATAR PANEL ========== */
.avatar-panel {
  width: 100%;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
  animation: pop-in 0.6s 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.avatar-container {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.avatar-container svg {
  width: 160px;
  height: 160px;
  margin-top: -10px;
  animation: blob-idle 2.5s ease-in-out infinite;
}

.avatar-container.squish svg {
  animation: squish 0.3s ease forwards;
}

/* ========== TRAIT BUTTONS ========== */
.trait-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.trait-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.trait-label {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #1a1a2e;
  text-align: center;
  min-width: 80px;
  padding: 8px 18px;
  position: relative;
  user-select: none;
  z-index: 1;
}

.trait-label-shape {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.trait-label-shape svg {
  width: 100%;
  height: 100%;
}

.trait-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #1a1a2e;
  opacity: 0.5;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.trait-arrow:hover {
  opacity: 1;
}

.trait-arrow-up:hover {
  transform: translateY(-3px) scale(1.2);
}

.trait-arrow-down:hover {
  transform: translateY(3px) scale(1.2);
}

.trait-arrow:active {
  transform: scale(0.8);
  transition-duration: 0.06s;
}

.trait-arrow svg {
  pointer-events: none;
  filter: url(#sketchy-small);
}

/* ========== RIGHT COLUMN (form + buttons on desktop) ========== */
.right-col {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ========== INPUTS ========== */
.form-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  animation: pop-in 0.6s 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.input-group {
  width: 100%;
}

.input-label {
  font-family: 'Fredoka One', cursive;
  font-size: 11px;
  color: rgba(26, 26, 46, 0.5);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  margin-bottom: 4px;
  padding-left: 4px;
  display: block;
  filter: url(#sketchy-text);
}

.input-field {
  width: 100%;
  padding: 11px 16px;
  border: 3px solid #1a1a2e;
  border-radius: 14px;
  font-size: 16px;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  background: #fff;
  color: #1a1a2e;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 3px 4px 0 #1a1a2e;
}

.input-field::placeholder {
  color: #bbb;
}

.input-field:focus {
  border-color: #c39bff;
  box-shadow: 3px 4px 0 #c39bff;
  transform: rotate(-0.5deg);
}

.input-field.room-code {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 18px;
  padding-right: calc(16px + 0.25em);
}

/* ========== BUTTONS ========== */
.btn-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  opacity: 0;
  animation: pop-in 0.6s 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.btn-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.btn-go,
.btn-create,
.btn-join {
  filter: url(#sketchy-btn);
}

.btn-go {
  width: 100%;
  padding: 13px 20px;
  border: 3.5px solid #1a1a2e;
  border-radius: 16px;
  font-size: 22px;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  background: #ff6b9d;
  color: #1a1a2e;
  letter-spacing: 4px;
  text-transform: uppercase;
  box-shadow: 4px 5px 0 #1a1a2e;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn-go::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: inherit;
  filter: url(#sketchy-small);
  z-index: -1;
}

.btn-go:hover {
  transform: translateY(-3px) rotate(-1deg) scale(1.03);
  box-shadow: 5px 8px 0 #1a1a2e;
}

.btn-go:active {
  transform: translateY(4px) rotate(0deg) scale(0.98);
  box-shadow: 1px 2px 0 #1a1a2e;
}

.btn-create {
  flex: 1;
  padding: 13px 20px;
  border: 3.5px solid #1a1a2e;
  border-radius: 16px;
  font-size: 22px;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  background: #00d4ff;
  color: #1a1a2e;
  letter-spacing: 1px;
  box-shadow: 3px 5px 0 #1a1a2e;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn-create::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: inherit;
  filter: url(#sketchy-small);
  z-index: -1;
}

.btn-create:hover {
  background: #33dfff;
  transform: translateY(-2px) rotate(0.5deg) scale(1.02);
  box-shadow: 4px 6px 0 rgba(50, 50, 70, 0.12);
}

.btn-create:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 1px 2px 0 rgba(50, 50, 70, 0.1);
}

.or-divider {
  font-family: 'Fredoka One', cursive;
  font-size: 13px;
  color: #1a1a2e;
  letter-spacing: 4px;
  text-transform: uppercase;
  opacity: 0.4;
  filter: url(#sketchy-text);
}

.btn-join {
  flex: 1;
  padding: 13px 20px;
  border: 3.5px solid #1a1a2e;
  border-radius: 16px;
  font-size: 22px;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  background: #c39bff;
  color: #1a1a2e;
  letter-spacing: 1px;
  box-shadow: 4px 5px 0 #1a1a2e;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn-join::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: inherit;
  filter: url(#sketchy-small);
  z-index: -1;
}

.btn-join:hover {
  background: #d4b3ff;
  transform: translateY(-2px) rotate(0.5deg) scale(1.02);
  box-shadow: 4px 6px 0 rgba(50, 50, 70, 0.12);
}

.btn-join:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 1px 2px 0 rgba(50, 50, 70, 0.1);
}

.home-join-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}

/* Join Room Popup */
.join-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.join-popup-overlay.active {
  display: flex;
}

.join-popup {
  position: relative;
  background: #fffbe6;
  border: 3.5px solid #1a1a2e;
  border-radius: 20px;
  padding: 28px 24px 24px;
  width: 88%;
  max-width: 380px;
  box-shadow: 6px 8px 0 rgba(26, 26, 46, 0.15);
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.join-popup-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 28px;
  color: #4a4a6a;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.join-popup-title {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: #4a4a6a;
  text-align: center;
  margin-bottom: 4px;
}

.join-popup-subtitle {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: rgba(74, 74, 106, 0.6);
  text-align: center;
  margin-bottom: 16px;
}

.join-popup-error {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #ff6b9d;
  text-align: center;
  margin-top: 10px;
  min-height: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.join-popup-error.visible {
  opacity: 1;
}

.home-join-row .input-field {
  flex: 1;
  min-width: 140px;
  text-transform: uppercase;
}

.home-join-row .home-join-btn {
  flex-shrink: 0;
  width: auto;
  padding: 10px 18px;
}

/* ========== FOOTER ========== */
.footer-flavor {
  margin-top: 18px;
  font-family: 'Fredoka One', cursive;
  font-size: 12px;
  color: rgba(26, 26, 46, 0.45);
  letter-spacing: 1.5px;
  text-align: center;
  opacity: 0;
  filter: url(#sketchy-text);
  animation: pop-in 0.5s 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========== ANIMATIONS ========== */
@keyframes pop-in {
  0% {
    transform: scale(0) rotate(-8deg);
    opacity: 0;
  }

  60% {
    transform: scale(1.08) rotate(2deg);
  }

  80% {
    transform: scale(0.96) rotate(-1deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes breathe {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.03);
  }
}

@keyframes blob-idle {

  0%,
  100% {
    transform: scaleX(1) scaleY(1);
  }

  50% {
    transform: scaleX(1.03) scaleY(0.97);
  }
}

@keyframes squish {
  0% {
    transform: scale(1, 1);
  }

  30% {
    transform: scale(1.1, 0.9);
  }

  60% {
    transform: scale(0.95, 1.05);
  }

  100% {
    transform: scale(1, 1);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-8px) rotate(-2deg);
  }

  40% {
    transform: translateX(8px) rotate(2deg);
  }

  60% {
    transform: translateX(-6px) rotate(-1deg);
  }

  80% {
    transform: translateX(6px) rotate(1deg);
  }
}

@keyframes float-drift {

  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  33% {
    transform: translate3d(5px, -12px, 0) rotate(3deg);
  }

  66% {
    transform: translate3d(-4px, -8px, 0) rotate(-2deg);
  }
}

/* ========== RESPONSIVE ========== */

/* Small phones */
@media (min-width: 420px) {
  .logo {
    font-size: 72px;
  }

  .squiggle-line {
    width: 180px;
  }

  .container {
    padding: 16px 24px 20px;
  }
}

/* Tablets and up — side by side layout */
@media (min-width: 768px) {
  .container {
    max-width: 100%;
    width: fit-content;
    padding: 32px 40px 36px;
    gap: 12px;
  }

  .logo {
    font-size: 84px;
  }

  .squiggle-line {
    width: 210px;
  }

  .tagline {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .main-content {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 32px;
  }

  /* Form/buttons on the left, avatar on the right */
  .avatar-panel {
    flex-shrink: 0;
    width: auto;
    order: 2;
  }

  .avatar-container svg {
    width: 180px;
    height: 180px;
  }

  .trait-label {
    font-size: 14px;
  }

  .right-col {
    width: 300px;
    flex-shrink: 0;
    gap: 10px;
  }

  .form-section {
    gap: 12px;
  }

  .input-field {
    padding: 14px 18px;
    font-size: 17px;
  }

  .input-field.room-code {
    font-size: 20px;
  }

  .btn-go {
    padding: 15px 24px;
    font-size: 24px;
  }

  .btn-create {
    padding: 15px 24px;
    font-size: 24px;
  }

  .btn-join {
    padding: 15px 24px;
    font-size: 24px;
  }

  .footer-flavor {
    font-size: 13px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .container {
    padding: 40px 48px 44px;
    gap: 16px;
  }

  .logo {
    font-size: 96px;
  }

  .squiggle-line {
    width: 240px;
    height: 14px;
  }

  .tagline {
    font-size: 17px;
    letter-spacing: 2px;
    margin-bottom: 12px;
  }

  .main-content {
    gap: 48px;
  }

  .avatar-container svg {
    width: 220px;
    height: 220px;
  }

  .trait-label {
    font-size: 15px;
  }

  .right-col {
    width: 340px;
    gap: 14px;
  }

  .form-section {
    gap: 16px;
  }

  .input-field {
    padding: 16px 20px;
    font-size: 18px;
    border-radius: 16px;
  }

  .input-field.room-code {
    font-size: 22px;
  }

  .input-label {
    font-size: 12px;
  }

  .btn-go {
    padding: 17px 28px;
    font-size: 26px;
    border-radius: 18px;
  }

  .btn-create {
    padding: 17px 28px;
    font-size: 26px;
    border-radius: 18px;
  }

  .btn-join {
    padding: 17px 28px;
    font-size: 26px;
    border-radius: 18px;
  }

  .btn-section {
    gap: 8px;
  }

  .or-divider {
    font-size: 14px;
  }

  .footer-flavor {
    font-size: 14px;
    margin-top: 10px;
  }
}

/* Large desktop */
@media (min-width: 1280px) {
  .container {
    padding: 48px 56px 52px;
  }

  .logo {
    font-size: 110px;
  }

  .squiggle-line {
    width: 280px;
  }

  .tagline {
    font-size: 18px;
  }

  .main-content {
    gap: 64px;
  }

  .avatar-container svg {
    width: 260px;
    height: 260px;
  }

  .trait-label {
    font-size: 16px;
  }

  .right-col {
    width: 380px;
    gap: 16px;
  }

  .form-section {
    gap: 18px;
  }

  .input-field {
    padding: 18px 22px;
    font-size: 19px;
  }

  .btn-go {
    padding: 19px 32px;
    font-size: 28px;
  }

  .btn-create {
    padding: 19px 32px;
    font-size: 28px;
  }

  .btn-join {
    padding: 19px 32px;
    font-size: 28px;
  }
}

/* ========== SCREEN TRANSITIONS ========== */
.screen-home,
.screen-lobby,
.screen-play-menu,
.screen-quiz-select,
.screen-gameplay {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen-home.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

.screen-lobby {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  gap: 4px;
  z-index: 1;
}

.screen-lobby.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  position: relative;
  visibility: visible;
}

/* ========== PLAY MENU SCREEN ========== */
.screen-play-menu {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  z-index: 1;
  gap: 12px;
}

.screen-play-menu.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  position: relative;
  visibility: visible;
}

.play-menu-back,
.screen-back-btn {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: #6b6b8a;
  cursor: pointer;
  padding: 6px 4px;
  filter: url(#sketchy-text);
  transition: color 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.play-menu-back:hover,
.screen-back-btn:hover {
  color: #4a4a6a;
  transform: translateX(-3px);
}

.play-menu-title {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: #5a5a7a;
  text-align: center;
  filter: url(#sketchy-text);
  margin-bottom: 4px;
}

.play-mode-cards {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 4px;
}

.play-mode-card {
  position: relative;
  background-color: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 28px 24px;
  cursor: pointer;
  color: #4a4a6a;
  text-shadow: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  z-index: 1;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
}

.play-mode-card::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  background-color: var(--card-color, #c39bff);
  border: 3.5px solid rgba(0, 0, 0, 0.15);
  box-shadow: 4px 5px 0 rgba(26, 26, 46, 0.45);
  filter: url(#wavy-box);
  z-index: -1;
}

@media (hover: hover) {
  .play-mode-card:hover {
    transform: translateY(-4px) rotate(-1deg) scale(1.03);
    filter: brightness(1.1) drop-shadow(5px 8px 0 rgba(26, 26, 46, 0.5));
  }
}

.play-mode-card:active {
  transform: translateY(3px) scale(0.98);
  filter: brightness(0.92) drop-shadow(1px 2px 0 rgba(26, 26, 46, 0.5));
  transition-duration: 0.06s;
}

.play-mode-card-icon {
  width: 80px;
  height: 80px;
}

.play-mode-card-icon svg {
  width: 100%;
  height: 100%;
}

.play-mode-card-title {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.play-mode-card-desc {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: rgba(74, 74, 106, 0.75);
  line-height: 1.3;
}

@media (min-width: 768px) {
  .play-mode-cards {
    flex-direction: row;
  }

  .play-mode-card {
    flex: 1;
  }

  .screen-play-menu {
    max-width: 600px;
  }
}

/* ========== LOBBY: One Big Card ========== */
.lobby-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 14px;
  background: #fff;
  border-radius: 20px;
  z-index: 1;
  opacity: 0;
  animation: pop-in 0.5s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.lobby-card::before {
  content: '';
  position: absolute;
  inset: -4px;
  border: 3px solid #4a4a6a;
  border-radius: 22px;
  box-shadow: 4px 5px 0 rgba(74, 74, 106, 0.3);
  filter: url(#wavy-box);
  z-index: -1;
}

.lobby-card .screen-back-btn {
  align-self: flex-start;
  opacity: 1;
  animation: none;
}

.lobby-card.solo-mode {
  padding: 0;
  background: none;
  border-radius: 0;
}

.lobby-card.solo-mode::before {
  display: none;
}

/* ========== LOBBY: Sections ========== */
.lobby-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 10px;
  border-radius: 16px;
  z-index: 1;
}

.lobby-section::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2.5px solid #1a1a2e;
  border-radius: 16px;
  box-shadow: 3px 4px 0 #1a1a2e;
  filter: url(#wavy-box);
  z-index: -1;
}

/* ---- Room Code Strip ---- */
.room-code-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 2px 0;
}

.room-code-label {
  font-family: 'Nunito', sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: rgba(74, 74, 106, 0.45);
  text-transform: uppercase;
  letter-spacing: 3px;
}

/* Character tiles row */
.room-code-chars {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Individual hand-drawn character */
.code-char {
  font-family: 'Fredoka One', cursive;
  font-size: 36px;
  color: #1a1a2e;
  line-height: 1;
  filter: url(#sketchy-text);
  opacity: 0;
  animation: char-pop 0.35s calc(0.15s + var(--char-delay)) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes char-pop {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(-12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.btn-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(74, 74, 106, 0.6);
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.2s ease;
}

.btn-copy-link svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke: rgba(74, 74, 106, 0.5);
}

.btn-copy-link:hover {
  transform: translateY(-1px);
  color: #4a4a6a;
}
.btn-copy-link:hover svg {
  stroke: #4a4a6a;
}

.btn-copy-link:active {
  transform: translateY(1px);
}

.btn-copy-link.copied {
  color: #00d4aa;
}

.btn-copy-link.copied svg {
  stroke: #00d4aa;
}

/* ---- Players Section ---- */
.lobby-section-players {
  gap: 2px;
  padding: 8px 10px;
  background: #00d4ff;
}
.lobby-section-players::before {
  background: #00d4ff;
}

/* ---- Game Setup Section ---- */
.lobby-section-setup {
  gap: 6px;
  padding: 10px 14px;
  background: #c39bff;
}
.lobby-section-setup::before {
  background: #c39bff;
}

/* ========== LOBBY: Player Count ========== */
.player-count {
  font-family: 'Fredoka One', cursive;
  font-size: 12px;
  color: #fff;
  letter-spacing: 2px;
  text-align: center;
  filter: url(#sketchy-text);
  margin: 0 0 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  opacity: 0;
  animation: pop-in 0.5s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========== LOBBY: Player Grid ========== */
.player-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 520px;
  margin-bottom: 0;
}

/* ========== LOBBY: Player Card ========== */
.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: 3px solid #1a1a2e;
  border-radius: 14px;
  padding: 6px 6px 5px;
  box-shadow: 3px 4px 0 #1a1a2e;
  filter: url(#sketchy-small);
  position: relative;
  opacity: 0;
  animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.player-card.no-anim {
  animation: none;
  opacity: 1;
}

.player-card.is-me {
  border-color: #c39bff;
  box-shadow: 3px 4px 0 #c39bff, 0 0 20px rgba(195, 155, 255, 0.25);
}

.player-card.opponent-entrance {
  opacity: 0;
  animation: opponent-drop 0.7s cubic-bezier(0.22, 1.2, 0.36, 1) forwards;
  border-color: #ff6b9d;
  box-shadow: 3px 4px 0 #ff6b9d, 0 0 24px rgba(255, 107, 157, 0.3);
}

@keyframes opponent-drop {
  0% {
    opacity: 0;
    transform: translateY(-60px) scale(0.3) rotate(-12deg);
  }
  50% {
    opacity: 1;
    transform: translateY(8px) scale(1.1) rotate(3deg);
  }
  70% {
    transform: translateY(-4px) scale(0.97) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.player-card-avatar {
  width: 42px;
  height: 42px;
  margin-bottom: 2px;
}

.player-card-avatar svg {
  width: 100%;
  height: 100%;
}

.player-card-name {
  font-family: 'Fredoka One', cursive;
  font-size: 11px;
  color: #1a1a2e;
  text-align: center;
  letter-spacing: 0.5px;
  word-break: break-word;
  line-height: 1.2;
}

/* ========== LOBBY: Host Badge ========== */
.host-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff6b9d;
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 8px;
  letter-spacing: 1.5px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 2px solid #1a1a2e;
  box-shadow: 2px 2px 0 #1a1a2e;
  filter: url(#sketchy-small);
  text-transform: uppercase;
}

/* ========== LOBBY: Bottom Area ========== */
.lobby-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.btn-start {
  width: 100%;
  padding: 10px 16px;
  border: 3.5px solid #1a1a2e;
  border-radius: 16px;
  font-size: 18px;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  background: #ff6b9d;
  color: #fff;
  letter-spacing: 4px;
  text-transform: uppercase;
  box-shadow: 4px 5px 0 #1a1a2e;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn-start::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: inherit;
  filter: url(#sketchy-small);
  z-index: -1;
}

.btn-start:hover {
  transform: translateY(-3px) rotate(-1deg) scale(1.03);
  box-shadow: 5px 8px 0 #1a1a2e;
}

.btn-start:active {
  transform: translateY(4px) rotate(0deg) scale(0.98);
  box-shadow: 1px 2px 0 #1a1a2e;
}

.waiting-text {
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: rgba(26, 26, 46, 0.5);
  letter-spacing: 1.5px;
  text-align: center;
  filter: url(#sketchy-text);
}

.waiting-dots::after {
  content: '';
  animation: waiting-dots 1.5s steps(4, end) infinite;
}

@keyframes waiting-dots {
  0% {
    content: '';
  }

  25% {
    content: '.';
  }

  50% {
    content: '..';
  }

  75% {
    content: '...';
  }

  100% {
    content: '';
  }
}

.solo-lobby-countdown {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: #4a4a6a;
  letter-spacing: 1px;
  text-align: center;
  filter: url(#sketchy-text);
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.solo-lobby-countdown #solo-countdown-num {
  color: #ff6b9d;
  font-size: 22px;
}

/* ========== QUIZ SELECT SCREEN ========== */
.screen-quiz-select {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 0;
  z-index: 1;
  transition: opacity 0.4s ease, transform 0.4s ease;
  overflow-y: auto;
  max-height: 100dvh;
}

.screen-quiz-select.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  position: relative;
  visibility: visible;
}

/* Hero section — centers search vertically in viewport */
.quiz-select-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55dvh;
  width: 100%;
  padding: 0 16px;
  flex-shrink: 0;
  transition: min-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen-quiz-select.search-active .quiz-select-hero {
  min-height: 0;
  padding-top: 16px;
}


.quiz-select-title {
  font-family: 'Fredoka One', cursive;
  font-size: 32px;
  color: #4a4a6a;
  text-align: center;
  margin-bottom: 20px;
  opacity: 0;
  animation: pop-in 0.6s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  z-index: 1;
}

.quiz-search-wrap {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 0;
  opacity: 0;
  animation: pop-in 0.5s 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  z-index: 1;
}

.quiz-search-input {
  width: 100%;
  padding: 14px 18px 14px 44px;
  border: 3px solid #1a1a2e;
  border-radius: 16px;
  font-size: 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  background: #fff;
  color: #1a1a2e;
  outline: none;
  box-shadow: 4px 5px 0 #1a1a2e;
  filter: url(#sketchy-small);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quiz-search-wrap::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 14px;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(74, 74, 106, 0.35);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

.quiz-search-wrap::after {
  content: '';
  position: absolute;
  top: 30px;
  left: 28px;
  width: 2.5px;
  height: 8px;
  background: rgba(74, 74, 106, 0.35);
  border-radius: 2px;
  transform: rotate(-45deg);
  pointer-events: none;
  z-index: 1;
}

.quiz-search-input::placeholder {
  color: #aaa;
}

/* ========== Browse Toggle ========== */

.browse-collection-toggle {
  display: block;
  margin: 20px auto 12px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(74, 74, 106, 0.45);
  letter-spacing: 0.3px;
  transition: color 0.2s ease;
}

.browse-collection-toggle:hover {
  color: rgba(74, 74, 106, 0.7);
}

.browse-collection-toggle.open {
  margin-bottom: 4px;
}

.browse-collection-toggle.hidden {
  display: none;
}

.quiz-picker-modal .browse-collection-toggle {
  font-size: 13px;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

/* ========== Collapsible Quiz Grid ========== */

.quiz-grid-collapsible {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-grid-collapsible.expanded {
  max-height: 2000px;
}

/* When user is searching, bypass collapse — show grid directly */
.quiz-grid-collapsible.search-active {
  max-height: none;
  overflow: visible;
}

.quiz-search-input:focus {
  border-color: #c39bff;
  box-shadow: 3px 4px 0 #c39bff;
}

/* ========== TYPE FILTER BAR ========== */

.swimlane.hidden-by-search {
  display: none;
}

.quiz-card.hidden-by-search {
  display: none;
}

#swimlane-container {
  width: 100%;
  align-self: stretch;
}

.swimlane {
  width: 100%;
  margin-bottom: 4px;
  opacity: 0;
  animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.swimlane-label {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: #4a4a6a;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding-left: 16px;
  position: relative;
  display: inline-block;
}

.swimlane-label::after {
  content: '';
  position: absolute;
  left: 16px;
  bottom: -2px;
  width: calc(100% - 16px);
  height: 3px;
  background: currentColor;
  opacity: 0.2;
  border-radius: 2px;
  transform: rotate(-0.5deg);
}

.swimlane-scroll-wrap {
  position: relative;
}

.swimlane-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 8px 16px 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.swimlane-row::-webkit-scrollbar {
  display: none;
}

.swimlane-row > :last-child {
  margin-right: 8px;
}

/* Swimlane scroll arrows */
.swimlane-arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(74, 74, 106, 0.75);
  color: #fff;
  cursor: pointer;
  z-index: 4;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 3px 0 rgba(74, 74, 106, 0.25);
  transition: opacity 0.2s, background 0.15s;
  padding: 0;
}

.swimlane-arrow.visible {
  display: flex;
}

.swimlane-arrow:hover {
  background: rgba(74, 74, 106, 0.9);
}

.swimlane-arrow:active {
  transform: translateY(-50%) scale(0.93);
}

.swimlane-arrow svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swimlane-arrow-left {
  left: 4px;
}

.swimlane-arrow-right {
  right: 4px;
}

.quiz-card {
  flex: 0 0 105px;
  min-width: 0;
  position: relative;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 12px 8px 10px;
  cursor: pointer;
  color: #4a4a6a;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  z-index: 1;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
}

/* Slight random rotations for a scattered, playful feel */
.quiz-card:nth-child(4n+1) { transform: rotate(-1.5deg); }
.quiz-card:nth-child(4n+2) { transform: rotate(1deg); }
.quiz-card:nth-child(4n+3) { transform: rotate(-0.5deg); }
.quiz-card:nth-child(4n)   { transform: rotate(2deg); }

.quiz-card::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  background-color: var(--card-color, #c39bff);
  opacity: 0.25;
  z-index: -2;
  transform: rotate(0.5deg);
}

.quiz-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 2.5px solid rgba(74, 74, 106, 0.15);
  border-style: dashed;
  z-index: -1;
}

@media (hover: hover) {
  .quiz-card:hover {
    transform: translateY(-5px) rotate(-2deg) scale(1.06) !important;
    z-index: 2;
  }
  .quiz-card:hover::after {
    border-color: var(--card-color, #c39bff);
    border-style: solid;
    background: #fff;
  }
}

.quiz-card:active {
  transform: translateY(2px) rotate(0deg) scale(0.97) !important;
  transition-duration: 0.06s;
}

.quiz-card-icon {
  width: 34px;
  height: 34px;
}

.quiz-card-icon svg {
  width: 100%;
  height: 100%;
}

.quiz-card-title {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: #4a4a6a;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

.quiz-card-tag {
  align-self: center;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: 'Nunito', sans-serif;
  font-size: 9px;
  font-weight: 800;
  color: rgba(74, 74, 106, 0.65);
  background: rgba(74, 74, 106, 0.06);
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Speed card styling */
.quiz-card-speed {
  position: relative;
}

.quiz-card-speed::before {
  border-style: dashed !important;
  border-width: 3px !important;
  border-color: rgba(0, 245, 160, 0.5) !important;
}

.quiz-card-speed-badge {
  position: absolute;
  top: -2px;
  right: 2px;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: 'Fredoka One', cursive;
  font-size: 9px;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, #00f5a0, #00d4ff);
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.15);
  z-index: 2;
  filter: url(#wavy-box);
}

/* Quiz select responsive */
@media (min-width: 768px) {
  .screen-quiz-select {
    padding: 0;
  }

  .quiz-select-title {
    font-size: 36px;
    margin-bottom: 24px;
  }

  .quiz-search-wrap {
    max-width: 480px;
  }

  .swimlane-label {
    font-size: 28px;
    padding-left: 24px;
  }

  .swimlane {
    margin-bottom: 0;
  }

  .swimlane-row {
    gap: 10px;
    padding: 2px 24px 12px;
  }

  .swimlane-arrow {
    width: 36px;
    height: 36px;
  }

  .swimlane-arrow svg {
    width: 18px;
    height: 18px;
  }

  .swimlane-arrow-left { left: 6px; }
  .swimlane-arrow-right { right: 6px; }

  .quiz-card {
    flex: 0 0 120px;
  }

  .quiz-card-icon {
    width: 42px;
    height: 42px;
  }

  .quiz-card-title {
    font-size: 14px;
  }

  .quiz-card-tag {
    font-size: 10px;
  }
}

@media (min-width: 1024px) {
  .screen-quiz-select {
    padding: 0;
    max-width: 1100px;
    margin: 0 auto;
  }

  .quiz-select-title {
    font-size: 42px;
    margin-bottom: 28px;
  }

  .quiz-search-wrap {
    max-width: 520px;
  }

  .swimlane-label {
    font-size: 32px;
    padding-left: 32px;
  }

  .swimlane {
    margin-bottom: 0;
  }

  .swimlane-arrow {
    width: 40px;
    height: 40px;
  }

  .swimlane-arrow svg {
    width: 20px;
    height: 20px;
  }

  .swimlane-arrow-left { left: 8px; }
  .swimlane-arrow-right { right: 8px; }

  .swimlane-row {
    gap: 12px;
    padding: 2px 32px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(195, 155, 255, 0.4) transparent;
  }

  .swimlane-row::-webkit-scrollbar {
    display: block;
    height: 6px;
  }

  .swimlane-row::-webkit-scrollbar-track {
    background: transparent;
  }

  .swimlane-row::-webkit-scrollbar-thumb {
    background: rgba(195, 155, 255, 0.4);
    border-radius: 3px;
  }

  .swimlane-row::-webkit-scrollbar-thumb:hover {
    background: rgba(195, 155, 255, 0.6);
  }

  .quiz-card {
    flex: 0 0 130px;
    padding: 14px 10px;
  }

  .quiz-card-icon {
    width: 46px;
    height: 46px;
  }

  .quiz-card-title {
    font-size: 15px;
  }
}

/* Body mode when quiz select is open — allow full scroll */
body.quiz-select-mode {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
}

/* Mobile: align to top so nothing overflows */
@media (max-width: 767px) {
  body {
    align-items: flex-start;
  }

  .logo {
    font-size: 52px;
  }

  .avatar-container svg {
    width: 130px;
    height: 130px;
  }

  .avatar-panel {
    padding: 4px 4px;
    gap: 2px;
  }

  .btn-go {
    padding: 10px 16px;
    font-size: 20px;
  }

  .btn-create {
    padding: 10px 16px;
    font-size: 20px;
  }

  .btn-join {
    padding: 10px 16px;
    font-size: 20px;
  }

  .footer-flavor {
    margin-top: 2px;
  }
}

body.gameplay-mode {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
}

/* Short mobile screens — extra compact lobby */
@media (max-height: 700px) {
  .screen-lobby {
    padding: 8px 12px;
  }

  .lobby-card {
    gap: 6px;
    padding: 10px 10px;
  }

  .lobby-section {
    padding: 6px 8px;
  }

  .code-char {
    font-size: 28px;
  }

  .room-code-chars {
    gap: 5px;
  }

  .player-card-avatar {
    width: 36px;
    height: 36px;
  }

  .player-card {
    padding: 4px 4px 3px;
    border-radius: 10px;
  }

  .player-card-name {
    font-size: 10px;
  }

  .player-grid {
    gap: 6px;
  }

  .mode-sticky {
    padding: 20px 8px 10px;
    max-width: 150px;
  }

  .sticky-icon {
    width: 28px;
    height: 28px;
  }

  .sticky-title {
    font-size: 11px;
  }

  .sticky-desc {
    font-size: 9.5px;
  }

  .lobby-bottom {
    margin-top: 2px;
  }

  .btn-start {
    padding: 8px 12px;
    font-size: 16px;
  }
}

/* Tall mobile screens — more breathing room */
@media (max-width: 767px) and (min-height: 800px) {
  body {
    align-items: center;
  }

  .container {
    gap: 8px;
    padding-top: 24px;
  }

  .avatar-container svg {
    width: 180px;
    height: 180px;
  }

  .player-card-avatar {
    width: 64px;
    height: 64px;
  }

  .player-card {
    padding: 10px 8px 8px;
  }

  .player-count {
    font-size: 14px;
    margin-bottom: 10px;
  }
}

/* Lobby responsive: 3 columns on tablets */
@media (min-width: 520px) {
  .player-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .player-card-avatar {
    width: 52px;
    height: 52px;
  }

  .code-char {
    font-size: 40px;
  }
}

/* Lobby responsive: 4 columns on desktop */
@media (min-width: 768px) {
  .screen-lobby {
    max-width: 700px;
    padding: 20px 24px;
  }

  .player-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  .code-char {
    font-size: 46px;
  }

  .player-count {
    font-size: 16px;
  }

  .btn-start {
    font-size: 20px;
    padding: 12px 20px;
  }
}

@media (min-width: 1024px) {
  .screen-lobby {
    max-width: 800px;
    padding: 24px 32px;
  }

  .code-char {
    font-size: 52px;
  }

  .room-code-chars {
    gap: 10px;
  }

  .player-card {
    padding: 10px 8px 8px;
  }

  .player-card-avatar {
    width: 64px;
    height: 64px;
  }

  .player-card-name {
    font-size: 13px;
  }
}

/* ========== GAMEPLAY SCREEN ========== */
.screen-gameplay {
  opacity: 0;
  transform: none;
  pointer-events: none;
  position: absolute;
  visibility: hidden;
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px;
  box-sizing: border-box;
  z-index: 1;
}

.screen-gameplay.visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  position: relative;
  visibility: visible;
}

/* Hide all phases by default */
.gameplay-phase {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

.gameplay-phase.active {
  display: flex;
}

/* ========== COUNTDOWN PHASE ========== */
.phase-countdown {
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  gap: 16px;
  text-align: center;
}

.countdown-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  animation: pop-in 0.5s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  z-index: 2;
}

.countdown-round-pill {
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
  color: #fff;
  background: #1a1a2e;
  padding: 6px 16px;
  border-radius: 50px;
  letter-spacing: 0.5px;
  filter: url(#sketchy-text);
  display: none;
}

.countdown-round-pill.visible {
  display: inline-block;
}

.countdown-q-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Fredoka One', cursive;
  background: rgba(26, 26, 46, 0.08);
  border: 3px solid #1a1a2e;
  border-radius: 50px;
  padding: 5px 16px;
  filter: url(#sketchy-text);
}

.countdown-q-label {
  font-size: 14px;
  color: #1a1a2e;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

.countdown-q-nums {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.countdown-q-current {
  font-size: 22px;
  color: #ff6b9d;
  -webkit-text-stroke: 1.5px #1a1a2e;
  paint-order: stroke fill;
}

.countdown-q-sep {
  font-size: 16px;
  color: rgba(26, 26, 46, 0.35);
}

.countdown-q-total {
  font-size: 16px;
  color: #1a1a2e;
  opacity: 0.5;
}

.countdown-number {
  font-family: 'Fredoka One', cursive;
  font-size: 120px;
  color: #ff6b9d;
  -webkit-text-stroke: 5px #1a1a2e;
  paint-order: stroke fill;
  filter: url(#sketchy-text);
  text-shadow: 6px 8px 0 rgba(26, 26, 46, 0.3);
  animation: countdown-pulse 0.8s ease-in-out infinite;
  line-height: 1;
}

@keyframes countdown-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }
}

/* ========== QUESTION PHASE ========== */
.phase-question {
  gap: 16px;
}

.question-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-counter {
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: rgba(26, 26, 46, 0.55);
  letter-spacing: 1px;
}

.question-timer-display {
  position: relative;
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: #4a4a6a;
  min-width: 44px;
  padding: 4px 8px;
  text-align: center;
  flex-shrink: 0;
  z-index: 1;
}

.question-timer-display::before {
  content: '';
  position: absolute;
  inset: -4px;
  background: #ffffff;
  border: 3px solid #d4d0e0;
  border-radius: 12px;
  box-shadow: 3px 4px 0 rgba(26, 26, 46, 0.35);
  z-index: -1;
}

.question-timer-display.timer-warning {
  color: #ff9f43;
}

.question-timer-display.timer-danger {
  color: #ff6b9d;
}

/* Combined timer bar + points */
.timer-points-bar {
  width: 100%;
  margin: 6px auto 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer-bar-track {
  position: relative;
  flex: 1;
  height: 36px;
  background: rgba(26, 26, 46, 0.12);
  border-radius: 18px;
  overflow: hidden;
}

.timer-bar-border {
  position: absolute;
  top: -2px;
  left: -1px;
  right: -1px;
  bottom: -2px;
  width: calc(100% + 2px);
  height: calc(100% + 4px);
  pointer-events: none;
  z-index: 2;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 16px;
  background: #00f5a0;
  transition: width 0.1s linear;
}

.timer-bar-fill.timer-green { background: #00f5a0; }
.timer-bar-fill.timer-yellow { background: #ffb830; }
.timer-bar-fill.timer-orange { background: #ff9f43; }
.timer-bar-fill.timer-red { background: #ff6b9d; }

.points-available {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka One', cursive;
  font-weight: 700;
  font-size: 17px;
  color: #4a4a6a;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  pointer-events: none;
  z-index: 1;
}

.timer-points-bar.locked-in {
  animation: lock-in-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.timer-points-bar.locked-in .timer-bar-fill {
  transition: none;
}

@keyframes lock-in-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}


/* Question card — hand-drawn style */
.question-card {
  width: 100%;
  position: relative;
  padding: 28px 32px;
  text-align: center;
  opacity: 0;
  animation: pop-in 0.5s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.question-card::before {
  content: '';
  position: absolute;
  inset: -6px;
  background-color: #ffffff;
  border: 3.5px solid #d4d0e0;
  border-radius: 14px;
  box-shadow: 4px 5px 0 rgba(26, 26, 46, 0.45);
  filter: url(#wavy-box);
  z-index: -1;
}

.question-text {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.4;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  overflow-wrap: break-word;
  word-break: break-word;
  width: 100%;
}

.question-text.long-question {
  font-size: 16px;
  line-height: 1.35;
}

/* Answer grid — 2×2 */
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 3px solid #1a1a2e;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  background: #fff;
  cursor: pointer;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-align: left;
  opacity: 0;
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.answer-btn:nth-child(1) {
  animation-delay: 0.15s;
}

.answer-btn:nth-child(2) {
  animation-delay: 0.2s;
}

.answer-btn:nth-child(3) {
  animation-delay: 0.25s;
}

.answer-btn:nth-child(4) {
  animation-delay: 0.3s;
}


@media (hover: hover) {
  .answer-btn:hover:not(.disabled) {
    transform: translateY(-4px) rotate(-1deg) scale(1.03);
    filter: brightness(1.1) drop-shadow(5px 8px 0 rgba(26, 26, 46, 0.5));
  }
}

.answer-btn:active:not(.disabled) {
  transform: translateY(3px) scale(0.98);
  filter: brightness(0.92) drop-shadow(1px 2px 0 rgba(26, 26, 46, 0.5));
}

.answer-btn:focus,
.answer-btn:focus-visible {
  outline: none;
}

/* Logo-palette answer colors & DOODLE SHAPES */
.answer-btn {
  position: relative;
  background-color: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 16px 20px;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 0, 0, 0.3);
  font-size: 16px;
  min-height: 68px;
  justify-content: center;
  z-index: 1;
}

.answer-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  border: 3.5px solid rgba(0, 0, 0, 0.15);
  box-shadow: 4px 5px 0 rgba(26, 26, 46, 0.45);
  filter: url(#wavy-box);
  z-index: -1;
}

.answer-a::before {
  background-color: #ff6b9d;
  border-color: #e0456e;
}

.answer-b::before {
  background-color: #00c8ff;
  border-color: #009fd4;
}

.answer-c::before {
  background-color: #a878f0;
  border-color: #8a5cd0;
}

.answer-d::before {
  background-color: #00c882;
  border-color: #00a86b;
}

.answer-btn.disabled {
  cursor: default;
  opacity: 0.35;
  transform: scale(0.95);
  filter: grayscale(0.4) drop-shadow(2px 3px 0 rgba(26, 26, 46, 0.3));
}

.answer-btn.selected {
  opacity: 1;
  transform: scale(1.08);
  filter: brightness(1.15) drop-shadow(0 0 12px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 24px rgba(255, 255, 255, 0.5)) drop-shadow(3px 4px 0 rgba(26, 26, 46, 0.6));
  animation: selected-pulse 1s ease-in-out infinite;
}

@keyframes selected-pulse {

  0%,
  100% {
    transform: scale(1.08);
  }

  50% {
    transform: scale(1.12);
  }
}

.answer-btn.correct-reveal {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(0, 245, 160, 0.6)) drop-shadow(0 0 20px rgba(0, 245, 160, 0.3)) drop-shadow(3px 4px 0 rgba(26, 26, 46, 0.5));
}

/* Doodle icon */
.answer-doodle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.answer-doodle svg {
  width: 100%;
  height: 100%;
}

/* ========== REVEAL PHASE ========== */
.phase-reveal {
  justify-content: center;
  align-items: center;
  min-height: 50vh;
  gap: 16px;
}

.reveal-result {
  font-family: 'Fredoka One', cursive;
  font-size: 48px;
  -webkit-text-stroke: 3px rgba(0, 0, 0, 0.4);
  paint-order: stroke fill;
  filter: url(#sketchy-text);
  text-shadow: 3px 5px 0 rgba(0, 0, 0, 0.15);
  animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.reveal-result.result-correct {
  color: #00f5a0;
}

.reveal-result.result-wrong {
  color: #ff6b9d;
}

.reveal-result.result-timeout {
  color: #ff9f43;
}

.reveal-correct-answer {
  position: relative;
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.4), 0 0 8px rgba(0, 0, 0, 0.15);
  background: transparent;
  padding: 14px 28px;
  border: none;
  opacity: 0;
  animation: pop-in 0.4s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  z-index: 1;
}

.reveal-correct-answer::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  box-shadow: 4px 5px 0 rgba(26, 26, 46, 0.45);
  filter: url(#wavy-box);
  z-index: -1;
  background-color: #fff;
  border: 3.5px solid rgba(0, 0, 0, 0.15);
}

.reveal-answer-0::before {
  background-color: #ff6b9d;
  border-color: #e0456e;
}

.reveal-answer-1::before {
  background-color: #00c8ff;
  border-color: #009fd4;
}

.reveal-answer-2::before {
  background-color: #a878f0;
  border-color: #8a5cd0;
}

.reveal-answer-3::before {
  background-color: #00c882;
  border-color: #00a86b;
}

.reveal-points {
  font-family: 'Fredoka One', cursive;
  font-size: 36px;
  color: #ffe156;
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.3);
  paint-order: stroke fill;
  filter: url(#sketchy-text);
  text-shadow: 2px 3px 0 rgba(0, 0, 0, 0.15);
  opacity: 0;
  animation: points-fly 0.6s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes points-fly {
  0% {
    transform: translateY(20px) scale(0.5);
    opacity: 0;
  }

  60% {
    transform: translateY(-10px) scale(1.2);
    opacity: 1;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.reveal-stats {
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: rgba(26, 26, 46, 0.55);
  letter-spacing: 1px;
  filter: url(#sketchy-text);
  opacity: 0;
  animation: pop-in 0.4s 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========== MINI LEADERBOARD (inline in question/reveal) ========== */
.mini-leaderboard {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.mini-lb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2.5px solid transparent;
  border-radius: 28px;
  padding: 5px 12px 5px 5px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.mini-lb-item::before {
  content: '';
  position: absolute;
  inset: -2.5px;
  border: 2.5px solid #4a4a6a;
  border-radius: 28px;
  box-shadow: 2px 3px 0 rgba(74, 74, 106, 0.45);
  filter: url(#sketchy-small);
  pointer-events: none;
}

.mini-lb-item:first-child::before {
  border-color: #ff6b9d;
  box-shadow: 2px 3px 0 rgba(255, 107, 157, 0.5);
}

.mini-lb-item:first-child {
  background: rgba(255, 107, 157, 0.06);
}

.mini-lb-item.is-me::before {
  border-color: #c39bff;
  box-shadow: 2px 3px 0 rgba(195, 155, 255, 0.5);
}

.mini-lb-item.is-me {
  background: rgba(195, 155, 255, 0.06);
}

.mini-lb-item.rank-up {
  animation: score-bump 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes score-bump {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

.mini-lb-rank {
  font-family: 'Fredoka One', cursive;
  font-size: 12px;
  color: #fff;
  background: #4a4a6a;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.mini-lb-item:nth-child(1) .mini-lb-rank {
  background: #ff6b9d;
}

.mini-lb-item:nth-child(2) .mini-lb-rank {
  background: #00d4ff;
}

.mini-lb-item:nth-child(3) .mini-lb-rank {
  background: #00f5a0;
  color: #4a4a6a;
}

.mini-lb-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.mini-lb-avatar svg {
  width: 100%;
  height: 100%;
}

.mini-lb-name {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #4a4a6a;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-lb-score {
  font-family: 'Fredoka One', cursive;
  font-size: 13px;
  color: #ff6b9d;
  min-width: 20px;
  text-align: right;
  letter-spacing: 0.5px;
}

/* Progress bar fill behind each mini-lb item */
.mini-lb-item::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--bar-pct, 0%);
  background: rgba(74, 74, 106, 0.06);
  border-radius: 28px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 0;
}

.mini-lb-item:nth-child(1)::after { background: rgba(255, 107, 157, 0.12); }
.mini-lb-item:nth-child(2)::after { background: rgba(0, 212, 255, 0.10); }
.mini-lb-item:nth-child(3)::after { background: rgba(0, 245, 160, 0.10); }
.mini-lb-item.is-me::after { background: rgba(195, 155, 255, 0.12); }

.mini-lb-rank,
.mini-lb-avatar,
.mini-lb-name,
.mini-lb-score {
  position: relative;
  z-index: 1;
}

/* ========== SPEED ROUND GUESSING GAME ========== */
.phase-speed-round.active {
  position: relative;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0 0;
  margin: 0 -24px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.speed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.speed-round-pill {
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: #4a4a6a;
  background: rgba(195, 155, 255, 0.15);
  border: 2px solid rgba(195, 155, 255, 0.4);
  border-radius: 20px;
  padding: 4px 14px;
}

.speed-instruction-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(26, 26, 46, 0.75);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.speed-instruction-overlay.visible {
  opacity: 1;
}

.speed-instruction-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.speed-instruction-text {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: #ffe156;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  animation: speed-instruction-pop 0.4s ease-out;
}

@keyframes speed-instruction-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.speed-timer-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #4a4a6a;
}

.speed-timer-icon {
  opacity: 0.5;
}

.speed-timer {
  font-family: 'Fredoka One', cursive;
  font-size: 26px;
  color: #4a4a6a;
  min-width: 36px;
  text-align: center;
  transition: color 0.3s;
}

.speed-timer.urgent {
  color: #ff9f43;
}
.speed-timer.urgent ~ .speed-timer-icon,
.speed-timer-wrap:has(.speed-timer.urgent) .speed-timer-icon {
  color: #ff9f43;
}

.speed-timer.critical {
  color: #ff6b9d;
  animation: pulse-text 0.5s ease-in-out infinite alternate;
}
.speed-timer-wrap:has(.speed-timer.critical) .speed-timer-icon {
  color: #ff6b9d;
}

@keyframes pulse-text {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

.speed-title {
  font-family: 'Fredoka One', cursive;
  font-size: 17px;
  color: #4a4a6a;
  text-align: center;
  padding: 0 12px;
  line-height: 1.2;
}

/* Board — 5x3 grid so all 15 slots are always visible */
.speed-board {
  flex: 1;
  padding: 4px 4px 16px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 5px;
  min-height: 0;
}

.speed-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 3px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px dashed rgba(74, 74, 106, 0.15);
  background: rgba(74, 74, 106, 0.06);
  transition: background 0.3s, border-color 0.3s;
}

.speed-rank {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: rgba(74, 74, 106, 0.35);
  line-height: 1;
}

.speed-check {
  font-size: 12px;
  font-weight: 800;
  color: #00f5a0;
  line-height: 1;
  visibility: hidden;
}

.speed-name {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 9px;
  color: #2a9d6a;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
  overflow: hidden;
  max-height: 2.4em;
  min-height: 2.4em;
  visibility: hidden;
}

.speed-slot.found {
  background: rgba(0, 245, 160, 0.15);
  border: 2px solid rgba(0, 245, 160, 0.4);
  animation: grid-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.speed-slot.found .speed-rank {
  color: rgba(42, 157, 106, 0.6);
}

.speed-slot.found .speed-check {
  visibility: visible;
}

.speed-slot.found .speed-name {
  visibility: visible;
}

@keyframes grid-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}


/* Player Race — horizontal row of player chips */
.speed-race {
  padding: 6px 10px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  background: rgba(74, 74, 106, 0.04);
  border-top: 2px solid rgba(74, 74, 106, 0.1);
  flex-shrink: 0;
  overflow-x: auto;
}

.speed-race-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 10px;
  transition: background 0.2s;
  min-width: 0;
}

.speed-race-bar.is-me {
  background: rgba(195, 155, 255, 0.12);
  border: 2px solid rgba(195, 155, 255, 0.3);
}

.speed-race-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.speed-race-avatar svg {
  width: 28px;
  height: 28px;
}

.speed-race-name {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 10px;
  color: #4a4a6a;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.speed-race-track {
  display: none;
}

.speed-race-fill {
  display: none;
}

.speed-race-count {
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: #4a4a6a;
  text-align: center;
}

.speed-race-bar.is-me .speed-race-count {
  color: #c39bff;
}

/* Input area — sticky at bottom, matching app's hand-drawn style */
.speed-input-area {
  display: flex;
  flex-direction: column;
  padding: 8px 12px 8px;
  flex-shrink: 0;
}

.speed-counter {
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: rgba(26, 26, 46, 0.5);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.speed-input-row {
  display: flex;
}

.speed-input {
  flex: 1;
  padding: 13px 18px;
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  font-weight: 400;
  color: #1a1a2e;
  border: 3px solid #1a1a2e;
  border-radius: 14px;
  outline: none;
  background: #fff;
  box-shadow: 3px 4px 0 #1a1a2e;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.speed-input::placeholder {
  color: #bbb;
}

.speed-input:focus {
  border-color: #c39bff;
  box-shadow: 3px 4px 0 #c39bff;
}

.speed-input:disabled {
  opacity: 0.35;
  border-color: rgba(26, 26, 46, 0.2);
  box-shadow: 2px 3px 0 rgba(26, 26, 46, 0.1);
  transform: none;
}

/* ========== SPEED ROUND REVEAL ========== */
.phase-speed-round-reveal {
  gap: 12px;
  padding-top: 12px;
}

.speed-reveal-title {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: #4a4a6a;
  text-align: center;
}

.speed-reveal-subtitle {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: rgba(74, 74, 106, 0.65);
  text-align: center;
}

.speed-reveal-board {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 12px;
  max-height: 45vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.speed-reveal-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  animation: fade-in-up 0.3s ease both;
}

.speed-reveal-slot.found {
  background: rgba(0, 245, 160, 0.1);
}

.speed-reveal-slot.missed {
  background: rgba(255, 107, 157, 0.08);
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.speed-reveal-rank {
  font-family: 'Fredoka One', cursive;
  font-size: 12px;
  color: rgba(74, 74, 106, 0.45);
  min-width: 26px;
  text-align: right;
}

.speed-reveal-name {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #4a4a6a;
  flex: 1;
}

.speed-reveal-slot.missed .speed-reveal-name {
  color: rgba(74, 74, 106, 0.55);
}

.speed-reveal-icon {
  font-size: 16px;
  font-weight: 800;
}

.speed-reveal-slot.found .speed-reveal-icon {
  color: #00f5a0;
}

.speed-reveal-slot.missed .speed-reveal-icon {
  color: rgba(255, 107, 157, 0.6);
}

.speed-reveal-points {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: #00f5a0;
  text-align: center;
  padding: 4px 0;
}

/* ========== TOP 15 MOBILE OPTIMIZATIONS ========== */

/* On mobile, the phase needs to fill available viewport height */
.phase-speed-round.active {
  max-height: calc(100dvh - 60px);
}

/* Small phones */
@media (max-width: 420px) {
  .speed-header {
    padding: 0 8px;
  }

  .speed-title {
    font-size: 15px;
    padding: 0 4px;
  }

  .speed-board {
    padding: 2px 4px;
    gap: 3px;
  }

  .speed-rank {
    font-size: 16px;
  }

  .speed-name {
    font-size: 8px;
  }

  .speed-race {
    padding: 4px 6px;
    gap: 6px;
  }

  .speed-race-bar {
    padding: 3px 6px;
  }

  .speed-race-avatar {
    width: 22px;
    height: 22px;
  }

  .speed-race-avatar svg {
    width: 22px;
    height: 22px;
  }

  .speed-race-name {
    font-size: 9px;
    max-width: 48px;
  }

  .speed-race-count {
    font-size: 12px;
  }

  .speed-input-area {
    padding: 6px 8px calc(44px + env(safe-area-inset-bottom, 0px));
  }

  .speed-input {
    padding: 10px 14px;
    font-size: 17px;
  }

  .speed-counter {
    font-size: 12px;
    margin-bottom: 5px;
  }
}

/* When virtual keyboard is open — reorder: header → input → race strip → board */
@media (max-height: 500px) {
  .phase-speed-round.active {
    gap: 2px;
    padding-top: 4px;
  }

  .speed-header {
    padding: 0 6px;
  }

  .speed-timer {
    font-size: 20px;
  }

  .speed-round-pill {
    font-size: 12px;
    padding: 2px 10px;
  }

  /* Hide title to save vertical space */
  .speed-title {
    display: none;
  }

  /* Move input to top (right after header) so it stays near the keyboard */
  .speed-input-area {
    order: -2;
    padding: 2px 8px calc(4px + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    background: #ffe156;
    z-index: 10;
  }

  .speed-counter {
    font-size: 11px;
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .speed-input-row {
    flex: 1;
  }

  .speed-input {
    padding: 8px 12px;
    font-size: 17px;
    border-width: 2.5px;
    box-shadow: 2px 3px 0 #1a1a2e;
  }

  /* Compact race — hide avatars, just names + counts inline */
  .speed-race {
    order: -1;
    gap: 2px 8px;
    padding: 3px 8px;
    border-top: none;
    border-bottom: 1.5px solid rgba(74, 74, 106, 0.08);
    background: rgba(74, 74, 106, 0.02);
  }

  .speed-race-bar {
    flex-direction: row;
    gap: 4px;
    padding: 1px 0;
    border-radius: 0;
  }

  .speed-race-bar.is-me {
    background: none;
    border: none;
  }

  .speed-race-avatar {
    display: none;
  }

  .speed-race-name {
    font-size: 10px;
    max-width: none;
  }

  .speed-race-bar.is-me .speed-race-name {
    color: #c39bff;
    font-weight: 800;
  }

  .speed-race-count {
    font-size: 10px;
  }

  /* Board fills remaining space — compact grid for keyboard-up */
  .speed-board {
    order: 0;
    gap: 2px;
    padding: 2px 4px;
  }

  .speed-slot {
    border-radius: 5px;
  }

  .speed-rank {
    font-size: 12px;
  }

  .speed-check {
    font-size: 10px;
  }

  .speed-name {
    display: none;
  }
}

/* Tablet and up — more spacious */
@media (min-width: 768px) {
  .speed-board {
    gap: 8px;
    padding: 6px 16px;
  }

  .speed-title {
    font-size: 20px;
  }

  .speed-rank {
    font-size: 24px;
  }

  .speed-check {
    font-size: 16px;
  }

  .speed-name {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }

  .speed-race {
    gap: 14px;
  }

  .speed-race-bar {
    padding: 6px 10px;
  }

  .speed-race-avatar {
    width: 34px;
    height: 34px;
  }

  .speed-race-avatar svg {
    width: 34px;
    height: 34px;
  }

  .speed-race-name {
    font-size: 12px;
    max-width: 80px;
  }

  .speed-race-count {
    font-size: 16px;
  }

  .speed-input {
    padding: 14px 20px;
    font-size: 20px;
  }

  .speed-reveal-board {
    max-height: 55vh;
  }
}

/* ========== FINAL RESULTS PHASE ========== */
.phase-final {
  gap: 20px;
  padding-top: 8px;
}

.final-title {
  font-family: 'Fredoka One', cursive;
  font-size: 36px;
  color: #1a1a2e;
  text-align: center;
  filter: url(#sketchy-text);
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.2);
  paint-order: stroke fill;
  opacity: 0;
  animation: pop-in 0.6s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Podium */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 200px;
  margin-bottom: 8px;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
  animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.podium-place:nth-child(1) {
  animation-delay: 0.4s;
}

.podium-place:nth-child(2) {
  animation-delay: 0.2s;
}

.podium-place:nth-child(3) {
  animation-delay: 0.6s;
}

.podium-avatar {
  width: 56px;
  height: 56px;
}

.podium-avatar svg {
  width: 100%;
  height: 100%;
}

.podium-crown {
  font-size: 28px;
  line-height: 1;
}

.podium-name {
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: #1a1a2e;
  text-align: center;
  max-width: 100px;
  word-break: break-word;
}

.podium-score {
  font-family: 'Fredoka One', cursive;
  font-size: 13px;
  color: #ff6b9d;
}

.podium-block {
  width: 90px;
  border: 3px solid #1a1a2e;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: #1a1a2e;
  filter: url(#sketchy-small);
}

.podium-block-1st {
  background: #ffe156;
  height: 100px;
}

.podium-block-2nd {
  background: #c0c0c0;
  height: 72px;
}

.podium-block-3rd {
  background: #cd7f32;
  height: 52px;
}

/* Full ranking below podium */
.final-ranking {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.final-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 3px solid #1a1a2e;
  border-radius: 14px;
  padding: 10px 16px;
  box-shadow: 3px 4px 0 #1a1a2e;
  filter: url(#sketchy-small);
  opacity: 0;
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.final-row.is-me {
  border-color: #c39bff;
  box-shadow: 3px 4px 0 #c39bff, 0 0 16px rgba(195, 155, 255, 0.2);
}

.final-rank {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: #1a1a2e;
  min-width: 28px;
  text-align: center;
}

.final-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.final-avatar svg {
  width: 100%;
  height: 100%;
}

.final-name {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  flex: 1;
}

.final-score {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: #ff6b9d;
  letter-spacing: 0.5px;
}

.final-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  margin-top: 8px;
}

.btn-play-again {
  flex: 1;
  padding: 13px 16px;
  border: 3.5px solid #1a1a2e;
  border-radius: 14px;
  font-size: 18px;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  background: linear-gradient(to right, #00d4ff var(--countdown-pct, 100%), rgba(0,212,255,0.3) var(--countdown-pct, 100%));
  color: #1a1a2e;
  letter-spacing: 1px;
  box-shadow: 3px 4px 0 #1a1a2e;
  filter: url(#sketchy-small);
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-play-again:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 4px 7px 0 #1a1a2e;
}

.btn-play-again:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 1px 2px 0 #1a1a2e;
}

.btn-home {
  flex: 1;
  padding: 13px 16px;
  border: 3.5px solid #1a1a2e;
  border-radius: 14px;
  font-size: 18px;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  background: #fff;
  color: #1a1a2e;
  letter-spacing: 1px;
  box-shadow: 3px 4px 0 #1a1a2e;
  filter: url(#sketchy-small);
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-home:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 4px 7px 0 #1a1a2e;
}

.btn-home:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 1px 2px 0 #1a1a2e;
}

/* Gameplay responsive */
@media (min-width: 768px) {
  .screen-gameplay {
    max-width: 700px;
    padding: 32px 24px;
  }

  .countdown-number {
    font-size: 140px;
  }

  .countdown-q-current {
    font-size: 26px;
  }

  .countdown-round-pill {
    font-size: 16px;
  }

  .question-card {
    padding: 32px 40px;
    min-height: 90px;
  }

  .question-text {
    font-size: 22px;
  }

  .question-text.long-question {
    font-size: 18px;
  }

  .answer-btn {
    padding: 18px 24px;
    font-size: 17px;
    gap: 14px;
    min-height: 82px;
  }

  .answer-doodle {
    width: 32px;
    height: 32px;
  }

  .reveal-result {
    font-size: 56px;
  }

  .podium-block {
    width: 110px;
  }
}

@media (min-width: 1024px) {
  .screen-gameplay {
    max-width: 800px;
    padding: 40px 32px;
  }

  .countdown-number {
    font-size: 160px;
  }

  .countdown-q-current {
    font-size: 28px;
  }

  .countdown-round-pill {
    font-size: 17px;
  }

  .question-card {
    padding: 36px 48px;
    min-height: 100px;
  }

  .question-text {
    font-size: 24px;
  }

  .question-text.long-question {
    font-size: 19px;
  }

  .answer-btn {
    padding: 20px 28px;
    font-size: 18px;
    gap: 16px;
    min-height: 76px;
  }

  .answer-doodle {
    width: 36px;
    height: 36px;
  }

  .answer-grid {
    gap: 14px;
  }

  .reveal-result {
    font-size: 64px;
  }

  .podium-block {
    width: 130px;
  }

  .podium-block-1st {
    height: 120px;
  }

  .podium-block-2nd {
    height: 88px;
  }

  .podium-block-3rd {
    height: 64px;
  }
}

/* ========== FONT OVERRIDE: Nunito for all non-landing screens ========== */
.code-char,
.player-count,
.player-card-name,
.host-badge,
.btn-start,
.waiting-text,
.solo-lobby-countdown,
.countdown-meta,
.countdown-number,
.question-counter,
.question-timer-display,
.question-text,
.answer-btn,
.reveal-result,
.reveal-correct-answer,
.reveal-points,
.reveal-stats,
.final-title,
.final-rank,
.final-name,
.final-score,
.podium-name,
.podium-score,
.podium-block,
.btn-play-again,
.btn-home,
.quiz-card-title,
.quiz-card-tag {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
}

/* ========== SPEED LIST ========== */
.speed-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  animation: pop-in 0.5s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.speed-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.speed-counter {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #c39bff;
  letter-spacing: 0.5px;
}

.speed-input-row {
  width: 100%;
  display: flex;
  gap: 8px;
}

.speed-input {
  flex: 1;
  padding: 13px 18px;
  border: 3px solid #1a1a2e;
  border-radius: 14px;
  font-size: 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  background: #fff;
  color: #1a1a2e;
  outline: none;
  box-shadow: 3px 4px 0 #1a1a2e;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.speed-input::placeholder {
  color: #bbb;
}

.speed-input:focus {
  border-color: #c39bff;
  box-shadow: 3px 4px 0 #c39bff;
}

.speed-input.input-wrong {
  animation: shake 0.35s ease;
  border-color: #ff6b9d;
  box-shadow: 3px 4px 0 #ff6b9d;
}

.speed-input.input-duplicate {
  animation: shake 0.35s ease;
  border-color: #ff9f43;
  box-shadow: 3px 4px 0 #ff9f43;
}

.speed-entries {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px 0;
}

.speed-entry {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: #c39bff;
  border: 2.5px solid #1a1a2e;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  box-shadow: 2px 2px 0 #1a1a2e;
  opacity: 0;
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========== KEYBOARD-OPEN: Speed game compact view ========== */
body.keyboard-open .phase-question {
  gap: 6px;
}

body.keyboard-open .question-header {
  display: none;
}

body.keyboard-open .question-card {
  padding: 10px 16px;
  min-height: 0;
}

body.keyboard-open .question-text {
  font-size: 14px;
  line-height: 1.2;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.keyboard-open .speed-container {
  gap: 6px;
}

body.keyboard-open .speed-stats {
  display: none;
}

body.keyboard-open .speed-input {
  padding: 9px 14px;
  font-size: 17px;
  border-width: 2.5px;
  box-shadow: 2px 3px 0 #1a1a2e;
}

body.keyboard-open .speed-entries {
  max-height: 70px;
  gap: 4px;
}

body.keyboard-open .speed-entry {
  padding: 3px 9px;
  font-size: 12px;
}

body.keyboard-open .timer-points-bar {
  margin-top: 2px;
}

body.keyboard-open .timer-bar-track {
  height: 24px;
}

body.keyboard-open .question-timer-display {
  font-size: 18px;
}

body.keyboard-open .mini-leaderboard {
  display: none;
}

body.keyboard-open .screen-gameplay {
  padding-top: 8px;
  padding-bottom: 8px;
}

body.keyboard-open .phase-speed-round.active {
  height: 100%;
}


/* Heavier weight for big display elements */
.code-char,
.countdown-number,
.reveal-result,
.reveal-points,
.final-title,
.podium-block,
.btn-start,
.btn-play-again,
.btn-home {
  font-weight: 800;
}

/* ========== QUIZ QUEUE SECTION (inside game-setup-panel) ========== */
.quiz-queue-section {
  background: rgba(26, 26, 46, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 6px;
  width: 100%;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fafafa;
  border: 2.5px solid #1a1a2e;
  border-radius: 12px;
  box-shadow: 2px 2px 0 #1a1a2e;
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.queue-item-number {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: rgba(26, 26, 46, 0.4);
  min-width: 20px;
  text-align: center;
}

.queue-item-emoji {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.queue-item-emoji svg {
  display: block;
  width: 100%;
  height: 100%;
}

.queue-item-title {
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  flex: 1;
}

.queue-item-badge {
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  border: 2px solid #1a1a2e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.queue-item-badge.badge-trivia {
  background: #ff6b9d;
  color: #fff;
}

.queue-item-badge.badge-speed {
  background: #00f5a0;
  color: #1a1a2e;
}

.queue-item-remove {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(26, 26, 46, 0.2);
  border-radius: 50%;
  background: none;
  font-size: 18px;
  color: rgba(26, 26, 46, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
  padding: 0;
}

.queue-item-remove:hover {
  background: #ff6b9d;
  color: #fff;
  border-color: #ff6b9d;
}

/* Loading placeholder in queue */
.queue-item-loading {
  background: rgba(255, 107, 157, 0.12);
  border-color: rgba(255, 107, 157, 0.5);
  animation: queue-loading-pulse 1.5s ease-in-out infinite;
}

.queue-item-loading .queue-item-title {
  color: #d4567a;
  font-style: italic;
}

.generating-dots span {
  animation: dot-blink 1.4s infinite;
  opacity: 0;
}

.generating-dots span:nth-child(1) { animation-delay: 0s; }
.generating-dots span:nth-child(2) { animation-delay: 0.2s; }
.generating-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes queue-loading-pulse {
  0%, 100% { background: rgba(255, 107, 157, 0.08); }
  50% { background: rgba(255, 107, 157, 0.2); }
}

@keyframes dot-blink {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

.queue-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-add-challenge {
  width: 100%;
  padding: 12px 16px;
  border: 3px dashed rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  background: rgba(195, 155, 255, 0.25);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.btn-add-challenge:hover {
  border-color: #fff;
  background: rgba(195, 155, 255, 0.4);
}

.queue-hint {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* ========== INLINE QUIZ PICKER (inside queue section) ========== */
.inline-picker {
  width: 100%;
  border: 3px dashed rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  background: rgba(195, 155, 255, 0.25);
  padding: 12px;
  display: none;
}

.inline-picker.open {
  display: block;
  animation: picker-fade 0.2s ease both;
}

@keyframes picker-fade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.inline-picker-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inline-picker-title {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.inline-picker-close {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  font-size: 16px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease;
}

.inline-picker-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.inline-picker-search-wrap {
  position: relative;
}

.inline-picker-search {
  width: 100%;
  padding: 10px 14px;
  border: 2.5px solid #1a1a2e;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  background: #fff;
  box-shadow: 2px 3px 0 #1a1a2e;
  outline: none;
  box-sizing: border-box;
}

.inline-picker-search:focus {
  box-shadow: 2px 3px 0 #c39bff;
  border-color: #c39bff;
}

.inline-picker-search::placeholder {
  color: rgba(74, 74, 106, 0.4);
  font-weight: 600;
}

.inline-picker-content {
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.inline-picker-content.browsing {
  max-height: 75vh;
}

.inline-picker-content .quiz-grid-collapsible.expanded {
  max-height: 2000px;
}

.inline-picker-content .quiz-grid-collapsible.search-active {
  max-height: none;
  overflow: visible;
}

/* Smaller cards inside inline picker */
.inline-picker-content .quiz-card {
  flex: 0 0 80px;
  padding: 8px 6px 8px;
  gap: 4px;
}

.inline-picker-content .quiz-card-icon {
  width: 32px;
  height: 32px;
}

.inline-picker-content .quiz-card-icon svg {
  width: 28px;
  height: 28px;
}

.inline-picker-content .quiz-card-title {
  font-size: 10px;
}

.inline-picker-content .quiz-card-tag {
  font-size: 8px;
  padding: 1px 5px;
}

.inline-picker-content .browse-collection-toggle {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  font-size: 14px;
  letter-spacing: 0.3px;
}


.inline-picker-content .browse-collection-toggle:hover {
  color: #fff;
}

.browse-cta-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.browse-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.browse-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
}

.browse-divider-text {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: lowercase;
}

.inline-picker-content .browse-collection-toggle.hidden {
  display: none;
}

/* ========== START BUTTON DISABLED ========== */
.btn-start:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ========== QUIZ PICKER MODAL ========== */
.quiz-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 46, 0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.quiz-picker-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.quiz-picker-modal {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  background: #ffe156;
  border: 3px solid #1a1a2e;
  border-radius: 20px;
  box-shadow: 6px 8px 0 #1a1a2e;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Doodles scattered across the entire modal */
.modal-doodles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.modal-doodles > *:not(defs) {
  will-change: transform;
}

.quiz-picker-modal > .quiz-picker-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

/* Hero section — centers search in the modal */
.quiz-picker-hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 30vh;
  padding: 20px 20px 0;
  flex-shrink: 0;
  transition: min-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
}

.quiz-picker-modal.search-active .quiz-picker-hero {
  min-height: 0;
  padding-top: 16px;
}

.quiz-picker-title {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: #4a4a6a;
  text-align: center;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.quiz-picker-close {
  width: 36px;
  height: 36px;
  border: 2.5px solid #1a1a2e;
  border-radius: 50%;
  background: #fff;
  font-size: 22px;
  color: #1a1a2e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 #1a1a2e;
  transition: transform 0.12s ease;
  line-height: 1;
  padding: 0;
}

.quiz-picker-close:hover {
  transform: scale(1.1);
}

/* Compact search inside picker modal */
.quiz-picker-modal .quiz-search-wrap {
  max-width: 380px;
  padding: 0;
  margin: 0;
  opacity: 1;
  animation: none;
}

.quiz-picker-modal .quiz-search-input {
  padding: 12px 16px 12px 42px;
  border-width: 3px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 3px 4px 0 #1a1a2e;
  filter: none;
}

.quiz-picker-modal .quiz-search-wrap::before {
  top: 13px;
  left: 14px;
  width: 16px;
  height: 16px;
}

.quiz-picker-modal .quiz-search-wrap::after {
  top: 27px;
  left: 26px;
  height: 7px;
}

.quiz-picker-modal .quiz-search-input:focus {
  box-shadow: 3px 4px 0 #c39bff;
}

.picker-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
  padding: 0 16px 6px;
  border-bottom: 2.5px solid rgba(26, 26, 46, 0.1);
  margin: 0 4px 8px;
  width: 100%;
  align-self: stretch;
}

.picker-tabs::-webkit-scrollbar {
  display: none;
}

.picker-tab {
  flex-shrink: 0;
  padding: 6px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: rgba(74, 74, 106, 0.55);
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.picker-tab::after {
  content: '';
  position: absolute;
  bottom: -2.5px;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 3px;
  background: transparent;
  transition: background 0.15s;
}

.picker-tab.active {
  color: #1a1a2e;
  font-weight: 800;
}

.picker-tab.active::after {
  background: #1a1a2e;
}

.quiz-picker-grid {
  overflow-y: auto;
  max-height: 60vh;
  padding: 0 12px 16px;
  position: relative;
  z-index: 1;
}

.quiz-picker-modal.no-tabs .quiz-picker-grid {
  max-height: 65vh;
}

/* Compact swimlane cards inside the picker modal */
.quiz-picker-modal .swimlane-label {
  font-size: 18px;
  padding-left: 4px;
  margin-bottom: 4px;
}

.quiz-picker-modal .swimlane-row {
  padding: 6px 6px 14px;
  gap: 8px;
}

.quiz-picker-modal .swimlane-arrow {
  width: 26px;
  height: 26px;
}

.quiz-picker-modal .swimlane-arrow svg {
  width: 14px;
  height: 14px;
}

.quiz-picker-modal .swimlane-arrow-left { left: 2px; }
.quiz-picker-modal .swimlane-arrow-right { right: 2px; }

.quiz-picker-modal .quiz-card {
  flex: 0 0 85px;
  padding: 8px 5px;
  gap: 3px;
}

.quiz-picker-modal .quiz-card::before {
  inset: -2px;
  border-radius: 11px;
}

.quiz-picker-modal .quiz-card-icon {
  width: 28px;
  height: 28px;
}

.quiz-picker-modal .quiz-card-title {
  font-size: 10px;
}

.quiz-picker-modal .quiz-card-tag {
  font-size: 8px;
  padding: 1px 5px;
}

/* "Added" badge on quiz cards */
.quiz-card .quiz-card-added {
  position: absolute;
  top: 4px;
  right: 4px;
  font-family: 'Nunito', sans-serif;
  font-size: 9px;
  font-weight: 800;
  color: #1a8a5a;
  background: rgba(0, 245, 160, 0.25);
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* Disabled state for quiz cards in picker */
.quiz-card.picker-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* ========== NEXT UP INTERSTITIAL ========== */
.phase-nextup {
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  gap: 16px;
}

.nextup-label {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: rgba(26, 26, 46, 0.5);
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0;
  animation: pop-in 0.5s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nextup-emoji {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  opacity: 0;
  animation: pop-in 0.6s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nextup-emoji svg {
  display: block;
  width: 100%;
  height: 100%;
}

.nextup-title {
  font-family: 'Nunito', sans-serif;
  font-size: 36px;
  font-weight: 800;
  color: #1a1a2e;
  text-align: center;
  opacity: 0;
  animation: pop-in 0.5s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nextup-type {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: #ff6b9d;
  padding: 6px 18px;
  border-radius: 20px;
  border: 2.5px solid #1a1a2e;
  box-shadow: 2px 3px 0 #1a1a2e;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0;
  animation: pop-in 0.5s 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* (game-setup-panel removed — lobby-card is now the single container) */

/* ========== GAME MODE TOGGLE (sticky notes) ========== */
.mode-sticky-notes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-bottom: 4px;
}

/* Heading label */
.mode-sticky-label {
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: #fff;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Row of sticky notes */
.mode-sticky-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  padding-top: 8px;
}

/* Each sticky note */
.mode-sticky {
  position: relative;
  flex: 1;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 24px 10px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease, filter 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Slight opposite tilts */
.mode-sticky:first-child { transform: rotate(-2deg); }
.mode-sticky:last-child  { transform: rotate(2deg); }

/* Wavy card background */
.mode-sticky::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px 4px 4px 14px;
  background-color: var(--sticky-color);
  border: 3px solid rgba(0, 0, 0, 0.12);
  box-shadow: 3px 4px 0 rgba(26, 26, 46, 0.35);
  filter: url(#wavy-box);
  z-index: -1;
  transition: box-shadow 0.2s ease;
}

/* Corner fold */
.mode-sticky::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, var(--sticky-color) 50%, var(--sticky-fold) 50%);
  border-radius: 0 0 3px 0;
  z-index: 2;
}

/* ---- Selected state ---- */
.mode-sticky.active { z-index: 2; }
.mode-sticky.active:first-child { transform: rotate(-2deg) scale(1.05); }
.mode-sticky.active:last-child  { transform: rotate(2deg) scale(1.05); }
.mode-sticky.active::before {
  box-shadow: 4px 5px 0 rgba(26, 26, 46, 0.4);
}

/* ---- Unselected state ---- */
.mode-sticky:not(.active) {
  opacity: 0.5;
  filter: saturate(0.4);
}
.mode-sticky:not(.active):first-child { transform: rotate(-2deg) scale(0.95); }
.mode-sticky:not(.active):last-child  { transform: rotate(2deg) scale(0.95); }

/* ---- Hover on unselected: lift + brighten ---- */
.mode-sticky:not(.active):hover {
  opacity: 0.85;
  filter: saturate(0.8);
}
.mode-sticky:not(.active):hover:first-child { transform: rotate(-1deg) scale(0.98) translateY(-2px); }
.mode-sticky:not(.active):hover:last-child  { transform: rotate(1deg) scale(0.98) translateY(-2px); }
.mode-sticky:not(.active):hover::before {
  box-shadow: 4px 6px 0 rgba(26, 26, 46, 0.3);
}

/* Pushpin */
.sticky-pin {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) translateY(-40px) scale(0.5);
  width: 22px;
  height: 22px;
  z-index: 3;
  opacity: 0;
}

.mode-sticky.active .sticky-pin {
  animation: pin-dart 0.4s cubic-bezier(0.2, 0, 0.8, 1) forwards;
}

.mode-sticky:not(.active) .sticky-pin {
  transform: translateX(-50%) translateY(-40px) scale(0.5);
  opacity: 0;
  transition: transform 0.15s ease-in, opacity 0.1s ease;
}

@keyframes pin-dart {
  0% {
    transform: translateX(-50%) translateY(-40px) scale(0.5);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  70% {
    transform: translateX(-50%) translateY(2px) scale(1.1);
  }
  85% {
    transform: translateX(-50%) translateY(-3px) scale(0.95);
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
}

/* Icon */
.sticky-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 1px;
}

/* Title */
.sticky-title {
  font-family: 'Fredoka One', cursive;
  font-size: 13px;
  color: #1a1a2e;
  text-align: center;
  line-height: 1.2;
}

/* Description */
.sticky-desc {
  font-family: 'Nunito', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(26, 26, 46, 0.55);
  text-align: center;
  line-height: 1.3;
  padding: 0 2px;
}

/* Non-host: disabled */
.mode-sticky-notes.non-host .mode-sticky {
  cursor: default;
  pointer-events: none;
}

/* ========== MYSTERY BOX PHASE ========== */
.phase-mystery-box {
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  gap: 12px;
  padding-top: 16px;
}

.mystery-box-round-label {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: #1a1a2e;
  letter-spacing: 2px;
  text-transform: uppercase;
  filter: url(#sketchy-text);
  opacity: 0;
  animation: pop-in 0.5s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.mystery-box-title {
  font-family: 'Fredoka One', cursive;
  font-size: 26px;
  color: #5a5a7a;
  letter-spacing: 1.5px;
  filter: url(#sketchy-text);
  opacity: 0;
  animation: pop-in 0.5s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========== ARENA ========== */
.mystery-box-arena {
  position: relative;
  width: 240px;
  height: 320px;
  margin: 20px auto 0;
  perspective: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

/* ========== MYSTERY BOX BODY ========== */
.mystery-box-body {
  width: 220px;
  height: 130px;
  position: relative;
  z-index: 2;
  opacity: 0;
  animation: mystery-pop-in 0.6s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: url(#wavy-box);
}

.mystery-box-body svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes mystery-pop-in {
  0% { opacity: 0; transform: scale(0.4) translateY(30px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ========== MYSTERY BOX LIDS ========== */
.mystery-box-lid {
  position: absolute;
  bottom: 128px;
  width: 110px;
  height: 26px;
  z-index: 3;
  opacity: 0;
  animation: mystery-pop-in 0.6s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.mystery-box-lid svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.mystery-box-lid-left {
  left: 10px;
  transform-origin: left center;
  animation: mystery-pop-in 0.6s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             lid-open-left 0.6s 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.mystery-box-lid-right {
  right: 10px;
  transform-origin: right center;
  animation: mystery-pop-in 0.6s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             lid-open-right 0.6s 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes lid-open-left {
  0%   { transform: rotateZ(0deg); }
  70%  { transform: rotateZ(-65deg); }
  85%  { transform: rotateZ(-57deg); }
  100% { transform: rotateZ(-60deg); }
}

@keyframes lid-open-right {
  0%   { transform: rotateZ(0deg); }
  70%  { transform: rotateZ(65deg); }
  85%  { transform: rotateZ(57deg); }
  100% { transform: rotateZ(60deg); }
}


/* ========== GLOW BEAM ========== */
.mystery-box-glow {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 0;
  opacity: 0;
  background: radial-gradient(ellipse at bottom, rgba(0,212,255,0.4) 0%, rgba(0,212,255,0.1) 40%, transparent 70%);
  border-radius: 50% 50% 0 0;
  z-index: 1;
  transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease, width 0.5s ease;
  pointer-events: none;
}

.mystery-box-glow.active {
  height: 200px;
  opacity: 1;
}

.mystery-box-glow.intense {
  width: 120px;
  height: 240px;
  opacity: 1;
  background: radial-gradient(ellipse at bottom, rgba(0,212,255,0.55) 0%, rgba(195,155,255,0.2) 40%, transparent 70%);
}

/* ========== ICON CYCLING VIEWPORT ========== */
/* Sits right above the box body so icons appear to emerge from the opening */
.mystery-box-icon-viewport {
  width: 80px;
  height: 80px;
  overflow: hidden;
  position: absolute;
  bottom: 132px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mystery-box-icon-viewport.cycling {
  opacity: 1;
}

.mystery-box-icon-viewport.winner-revealed {
  overflow: visible;
  animation: mystery-float-up 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.mystery-box-icon-track {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transition: transform 0.06s linear;
}

.mystery-box-cycle-icon {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.mystery-box-cycle-icon svg {
  width: 100%;
  height: 100%;
}

@keyframes mystery-float-up {
  0% { transform: translateX(-50%) translateY(0) scale(1); filter: drop-shadow(0 0 0 transparent); }
  100% { transform: translateX(-50%) translateY(-30px) scale(1.5); filter: drop-shadow(0 0 20px rgba(0,212,255,0.7)); }
}

/* ========== SPARKLE ACCENTS ========== */
.mystery-box-sparkles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  opacity: 0;
  animation: sparkle-twinkle 2s ease-in-out infinite;
}

.sparkle-1 { width: 20px; height: 20px; top: 10%; left: 8%; animation-delay: 0.2s; }
.sparkle-2 { width: 16px; height: 16px; top: 5%; right: 10%; animation-delay: 0.8s; }
.sparkle-3 { width: 18px; height: 18px; bottom: 30%; left: 5%; animation-delay: 1.4s; }
.sparkle-4 { width: 14px; height: 14px; bottom: 25%; right: 8%; animation-delay: 0.5s; }

@keyframes sparkle-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.1) rotate(20deg); }
}

/* ========== WINNER BANNER ========== */
.mystery-box-winner-banner {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 10;
  position: relative;
  min-height: 70px;
  margin-top: 28px;
}

.mystery-box-winner-banner.visible {
  display: flex;
  animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.mystery-box-winner-category {
  font-family: 'Fredoka One', cursive;
  font-size: 36px;
  color: #ff6b9d;
  -webkit-text-stroke: 2.5px #1a1a2e;
  paint-order: stroke fill;
  text-shadow: 3px 4px 0 rgba(26, 26, 46, 0.25);
  text-align: center;
}

.mystery-box-winner-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.mystery-box-winner-icon svg {
  width: 100%;
  height: 100%;
}

.mystery-box-winner-count {
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: #1a1a2e;
  letter-spacing: 1px;
}

/* ========== MYSTERY BOX PLAYER STRIP ========== */
.mystery-box-players {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 42px;
  padding: 0 12px;
  width: 100%;
  max-width: 500px;
}

.mystery-box-player-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2.5px solid transparent;
  border-radius: 24px;
  padding: 5px 12px 5px 5px;
  position: relative;
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.mystery-box-player-pill::before {
  content: '';
  position: absolute;
  inset: -2.5px;
  border: 2.5px solid #4a4a6a;
  border-radius: 24px;
  box-shadow: 2px 3px 0 rgba(74, 74, 106, 0.35);
  filter: url(#sketchy-small);
  pointer-events: none;
}

.mystery-box-player-pill.is-me::before {
  border-color: #c39bff;
  box-shadow: 2px 3px 0 rgba(195, 155, 255, 0.5);
}

.mystery-box-player-pill.is-me {
  background: rgba(195, 155, 255, 0.06);
}

.mystery-box-player-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.mystery-box-player-avatar svg {
  width: 100%;
  height: 100%;
}

.mystery-box-player-name {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #4a4a6a;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== MYSTERY BOX RESPONSIVE ========== */
@media (min-width: 768px) {
  .mystery-box-title {
    font-size: 34px;
  }

  .mystery-box-arena {
    width: 300px;
    height: 400px;
  }

  .mystery-box-body {
    width: 260px;
    height: 150px;
  }

  .mystery-box-lid {
    width: 130px;
    bottom: 148px;
  }

  .mystery-box-lid-left {
    left: 20px;
  }

  .mystery-box-lid-right {
    right: 20px;
  }

  .mystery-box-icon-viewport {
    bottom: 152px;
  }

  .mystery-box-glow {
    bottom: 150px;
  }

  .mystery-box-glow.active {
    height: 260px;
  }

  .mystery-box-glow.intense {
    height: 300px;
    width: 140px;
  }

  .mystery-box-winner-category {
    font-size: 40px;
  }
}

@media (min-width: 1024px) {
  .mystery-box-arena {
    width: 340px;
    height: 440px;
  }

  .mystery-box-body {
    width: 280px;
    height: 164px;
  }

  .mystery-box-lid {
    width: 140px;
    bottom: 162px;
  }

  .mystery-box-lid-left {
    left: 30px;
  }

  .mystery-box-lid-right {
    right: 30px;
  }

  .mystery-box-icon-viewport {
    bottom: 166px;
  }

  .mystery-box-glow {
    bottom: 164px;
  }

  .mystery-box-winner-category {
    font-size: 44px;
  }
}

/* Picker responsive */
@media (min-width: 768px) {
  .quiz-picker-modal {
    max-width: 600px;
  }

  .nextup-emoji {
    width: 100px;
    height: 100px;
  }

  .nextup-title {
    font-size: 42px;
  }
}

@media (min-width: 1024px) {
  .nextup-emoji {
    width: 120px;
    height: 120px;
  }

  .nextup-title {
    font-size: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .doodle-bg svg *,
  .modal-doodles * {
    animation: none !important;
  }
}

/* ========== MUTE BUTTON ========== */
#mute-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  width: 40px;
  height: 40px;
  border: 2.5px solid rgba(74, 74, 106, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(4px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 2px 3px 0 rgba(74, 74, 106, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#mute-btn:hover {
  transform: scale(1.1);
  box-shadow: 3px 4px 0 rgba(74, 74, 106, 0.2);
}

#mute-btn:active {
  transform: scale(0.95);
  box-shadow: 1px 2px 0 rgba(74, 74, 106, 0.1);
}

/* ========== Quiz Loading Overlay ========== */

#quiz-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(255, 225, 86, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#quiz-loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.quiz-loading-content {
  text-align: center;
  padding: 32px;
}

.quiz-loading-icon {
  display: inline-block;
  animation: quiz-icon-wobble 2s ease-in-out infinite;
}

.quiz-loading-icon svg {
  width: 64px;
  height: 64px;
}

.quiz-loading-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #5a5a7a;
  margin-top: 16px;
}

.quiz-loading-topic {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: #4a4a6a;
  margin-top: 4px;
}

.quiz-loading-dots {
  font-size: 32px;
  color: #ff6b9d;
  margin-top: 8px;
}

.quiz-loading-dots span {
  animation: quiz-dot-bounce 1.4s ease-in-out infinite;
  display: inline-block;
}

.quiz-loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.quiz-loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes quiz-icon-wobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(10deg) scale(1.1); }
  50% { transform: rotate(0deg) scale(1); }
  75% { transform: rotate(-10deg) scale(1.1); }
}

@keyframes quiz-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
}

/* ========== Search Skeleton Cards ========== */

.quiz-card-skeleton {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 100px;
}

.quiz-card-skeleton::before {
  background-color: rgba(195, 155, 255, 0.12) !important;
  border: 3px dashed rgba(195, 155, 255, 0.35) !important;
  box-shadow: 3px 4px 0 rgba(150, 100, 220, 0.15) !important;
}

.skeleton-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(195, 155, 255, 0.2);
  animation: skeleton-shimmer 1.2s ease-in-out infinite alternate;
}

.skeleton-line {
  width: 60%;
  height: 12px;
  border-radius: 6px;
  background: rgba(195, 155, 255, 0.18);
  animation: skeleton-shimmer 1.2s ease-in-out infinite alternate;
  animation-delay: 0.15s;
}

.quiz-card-skeleton:nth-child(2) .skeleton-icon { animation-delay: 0.1s; }
.quiz-card-skeleton:nth-child(2) .skeleton-line { animation-delay: 0.25s; }
.quiz-card-skeleton:nth-child(3) .skeleton-icon { animation-delay: 0.2s; }
.quiz-card-skeleton:nth-child(3) .skeleton-line { animation-delay: 0.35s; }
.quiz-card-skeleton:nth-child(4) .skeleton-icon { animation-delay: 0.3s; }
.quiz-card-skeleton:nth-child(4) .skeleton-line { animation-delay: 0.45s; }

@keyframes skeleton-shimmer {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}