@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-deep: #101116;
  --bg-panel: #181920;
  --bg-card: #20222b;
  --bg-card-hover: #292c38;
  --border-subtle: #313544;
  --text-main: #f3f4f6;
  --text-muted: #9aa0b6;
  --bomb-color: #17181c;
  --bomb-rim: #2d3039;
  --accent-red: #ff4757;
  --accent-orange: #ffa502;
  --accent-gold: #ffd32a;
  --accent-green: #2ed573;
  --accent-cyan: #00d2d3;
  --accent-blue: #1e90ff;
  --accent-purple: #9b59b6;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-glow-red: 0 0 25px rgba(255, 71, 87, 0.4);
  --shadow-glow-gold: 0 0 25px rgba(255, 211, 42, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #101116;
  /* Subtle dark brick pattern with soft atmospheric radial vignette */
  background-image: 
    radial-gradient(circle at 50% 45%, rgba(28, 30, 39, 0.35) 0%, rgba(9, 10, 13, 0.94) 85%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60' viewBox='0 0 120 60'%3E%3Crect width='120' height='60' fill='%230f1014'/%3E%3Crect x='2' y='2' width='56' height='26' rx='2' fill='%23191a21' stroke='%2313141a' stroke-width='1.5'/%3E%3Crect x='62' y='2' width='56' height='26' rx='2' fill='%23181920' stroke='%2313141a' stroke-width='1.5'/%3E%3Crect x='32' y='32' width='56' height='26' rx='2' fill='%2317181f' stroke='%2313141a' stroke-width='1.5'/%3E%3Crect x='-28' y='32' width='56' height='26' rx='2' fill='%23191a21' stroke='%2313141a' stroke-width='1.5'/%3E%3Crect x='92' y='32' width='56' height='26' rx='2' fill='%23191a21' stroke='%2313141a' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat;
  background-attachment: fixed;
  background-size: cover, 120px 60px;
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  user-select: none;
}

#app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* TOP NAVBAR */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(19, 22, 34, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
}

.nav-logo-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 8px rgba(255, 71, 87, 0.5));
  animation: logo-bounce 3s infinite ease-in-out;
}

@keyframes logo-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-5deg); }
}

.nav-title {
  font-family: 'Fredoka', cursive;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff 0%, #ff6b81 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-room-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-room-badge:hover {
  border-color: var(--accent-orange);
  background: var(--bg-card-hover);
  box-shadow: 0 0 15px rgba(255, 165, 2, 0.3);
}

.nav-room-badge .copy-icon {
  font-size: 0.85rem;
  color: var(--accent-orange);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  transform: scale(1.05);
}

/* VIEWS WRAPPER */
.view {
  display: none;
  flex: 1;
  flex-direction: column;
}

.view.active {
  display: flex;
}

/* -------------------------------------------------------------
   HOME / LOBBY VIEW
   ------------------------------------------------------------- */
#home-view {
  max-width: 960px;
  margin: 0 auto;
  padding: 30px 20px 60px;
  width: 100%;
  gap: 30px;
}

.home-hero {
  text-align: center;
  margin-top: 10px;
}

.home-hero h1 {
  font-family: 'Fredoka', cursive;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ffffff 30%, #ffa502 70%, #ff4757 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 15px rgba(255, 71, 87, 0.3));
}

.home-hero p {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 550px;
  margin: 0 auto;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-family: 'Fredoka', cursive;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

/* User Profile Setup Card */
.profile-preview-box {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.avatar-preview-wrapper {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.avatar-preview-wrapper:hover {
  transform: scale(1.08);
}

.avatar-edit-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--accent-orange);
  color: #111;
  font-size: 0.75rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

.profile-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-text {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.input-text:focus {
  border-color: var(--accent-orange);
  box-shadow: 0 0 10px rgba(255, 165, 2, 0.2);
}

.auth-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--accent-green);
  margin-top: 4px;
}

.auth-status-pill.unauthenticated {
  color: var(--text-muted);
}

.auth-sso-link {
  color: var(--accent-blue);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

/* Play / Create Cards */
.btn-primary {
  background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
  color: #fff;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Fredoka', cursive;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 20px rgba(255, 71, 87, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(255, 71, 87, 0.5);
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  color: #fff;
}

.join-code-row {
  display: flex;
  gap: 10px;
}

.input-code {
  text-transform: uppercase;
  font-family: 'Fredoka', cursive;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  max-width: 140px;
}

/* Public lobbies list */
.lobbies-card {
  grid-column: 1 / -1;
}

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

.rooms-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 5px;
}

.room-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
}

.room-item:hover {
  border-color: var(--accent-orange);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.room-item-code {
  font-family: 'Fredoka', cursive;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-gold);
}

.room-item-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-item-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(46, 213, 115, 0.15);
  color: var(--accent-green);
  font-weight: 600;
}

.empty-lobbies {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-style: italic;
}

/* -------------------------------------------------------------
   GAME ROOM / ARENA VIEW
   ------------------------------------------------------------- */
#room-view {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 20px;
  min-height: calc(100vh - 70px);
  min-height: calc(100dvh - 70px);
}

.arena-wrapper {
  flex: 1;
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 16px;
}

/* CIRCULAR ARENA STAGE */
.arena-circle {
  position: relative;
  width: min(78vw, 68vh, 460px);
  height: min(78vw, 68vh, 460px);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Subtle ring outline behind players */
.arena-circle::before {
  content: '';
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

/* CENTRAL BOMB CONTAINER */
.bomb-container {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(140px, 30vw, 190px);
  height: clamp(140px, 30vw, 190px);
}

/* SVG TIMER RING CHART AROUND BOMB */
.bomb-timer-ring-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  width: 118%;
  height: 118%;
  pointer-events: none;
  z-index: 10;
}

.bomb-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.bomb-ring-progress {
  fill: none;
  stroke: var(--accent-green);
  stroke-width: 8.5;
  stroke-linecap: round;
  stroke-dasharray: 553; /* 2 * PI * 88 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
  filter: drop-shadow(0 0 8px currentColor);
}

/* The Bomb Sphere */
.bomb-sphere {
  position: relative;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a3d4a 0%, #1c1d24 50%, #0d0e12 100%);
  box-shadow: inset -5px -5px 15px rgba(0,0,0,0.8),
              inset 5px 5px 15px rgba(255,255,255,0.1),
              0 15px 35px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, box-shadow 0.2s, background 0.3s;
  z-index: 12;
}

/* Bomb urgency shaking and red flash */
.bomb-sphere.urgent {
  animation: bomb-shake 0.15s infinite;
  background: radial-gradient(circle at 35% 30%, #a0252f 0%, #451016 50%, #150508 100%);
  box-shadow: 0 0 35px rgba(255, 71, 87, 0.7),
              inset 0 0 20px rgba(255, 71, 87, 0.5);
}

@keyframes bomb-shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  25% { transform: translate(-2px, -1px) rotate(-1.5deg); }
  50% { transform: translate(1px, -2px) rotate(1.5deg); }
  75% { transform: translate(-1px, 2px) rotate(0.5deg); }
  100% { transform: translate(2px, 1px) rotate(-0.5deg); }
}

/* Bomb Cap */
.bomb-cap {
  position: absolute;
  top: -2px;
  width: 34px;
  height: 14px;
  background: linear-gradient(to right, #4a4e5d, #252830);
  border-radius: 4px;
  border-top: 2px solid #6b7082;
  z-index: 13;
}

/* Syllable Prompt Text */
.bomb-prompt {
  font-family: 'Fredoka', cursive;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9),
               0 0 20px rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 15;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bomb-prompt.pop {
  animation: prompt-pop 0.3s ease-out;
}

@keyframes prompt-pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}

.bomb-difficulty-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 2px;
  z-index: 15;
}

/* DYNAMIC DIRECTION ARROW POINTING TO ACTIVE PLAYER */
.bomb-arrow-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 50;
}

.bomb-arrow-pointer {
  position: absolute;
  top: clamp(-130px, -24vw, -102px);
  left: -16px;
  width: 32px;
  height: 40px;
  filter: drop-shadow(0 0 10px rgba(255, 71, 87, 0.95));
  animation: arrow-bounce 0.8s infinite alternate ease-in-out;
}

@keyframes arrow-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.arrow-svg {
  width: 100%;
  height: 100%;
}

/* PLAYERS IN CIRCLE */
.player-slot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(66px, 14vw, 84px);
  z-index: 15;
  transition: left 0.5s ease-out, top 0.5s ease-out, transform 0.3s ease;
}

.player-slot.active {
  transform: translate(-50%, -50%) scale(1.18);
  z-index: 25;
}

.player-slot.eliminated {
  opacity: 0.3;
  filter: grayscale(1);
}

.player-avatar-ring {
  position: relative;
  width: clamp(52px, 11vw, 68px);
  height: clamp(52px, 11vw, 68px);
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.player-slot.active .player-avatar-ring {
  border-color: var(--accent-orange);
  box-shadow: 0 0 20px rgba(255, 165, 2, 0.6);
  animation: active-player-pulse 1s infinite alternate;
}

@keyframes active-player-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.player-avatar-inner {
  width: 86%;
  height: 86%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Crown badge */
.player-crown-badge {
  position: absolute;
  top: -15px;
  font-size: 1.3rem;
  filter: drop-shadow(0 2px 6px rgba(255, 215, 0, 0.8));
  animation: crown-float 2s infinite ease-in-out;
  z-index: 10;
}

@keyframes crown-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.player-name-tag {
  font-weight: 700;
  font-size: clamp(0.72rem, 1.8vw, 0.85rem);
  text-align: center;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
  background: rgba(19, 22, 34, 0.85);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-slot.active .player-name-tag {
  border-color: var(--accent-red);
  background: rgba(255, 71, 87, 0.25);
  color: #fff;
}

/* Hearts Life Display */
.player-hearts {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}

.heart-icon {
  font-size: 0.75rem;
  color: var(--accent-red);
  filter: drop-shadow(0 0 3px rgba(255, 71, 87, 0.6));
  transition: transform 0.2s, opacity 0.2s;
}

.heart-icon.lost {
  color: #4b4b5c;
  filter: none;
  opacity: 0.35;
}

/* -------------------------------------------------------------
   ARENA CENTER CONTROLS (Word Input & Queue)
   ------------------------------------------------------------- */
.arena-center-controls {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  z-index: 30;
}

/* In-Game Active Word Input Form */
.word-input-form {
  width: 100%;
}

.word-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 6px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.word-input-wrapper:focus-within {
  border-color: var(--accent-orange);
  box-shadow: 0 0 20px rgba(255, 165, 2, 0.35);
}

.word-input-field {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: 'Fredoka', cursive;
  font-size: clamp(1.2rem, 3.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 1px;
  padding: 10px 14px;
  outline: none;
  text-align: center;
  text-transform: lowercase;
}

.word-input-field::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-size: 1rem;
}

.btn-submit-word {
  background: linear-gradient(135deg, #ffa502 0%, #ff6b81 100%);
  color: #111;
  border: none;
  font-family: 'Fredoka', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-submit-word:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 4px 15px rgba(255, 165, 2, 0.4);
}

.btn-submit-word:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Floating turn hint pill */
.turn-status-hint {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.turn-status-hint.my-turn {
  color: var(--accent-orange);
  font-weight: 700;
  animation: pulse-turn 1s infinite alternate;
}

@keyframes pulse-turn {
  0% { transform: scale(0.98); }
  100% { transform: scale(1.02); }
}

/* Waiting / Queue State Bar */
.queue-control-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.btn-queue {
  flex: 1;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-family: 'Fredoka', cursive;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #2ed573 0%, #10ac84 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(46, 213, 115, 0.3);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-queue.queued {
  background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
  box-shadow: 0 6px 18px rgba(255, 71, 87, 0.3);
}

.btn-queue:hover {
  transform: translateY(-2px);
}

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

.countdown-banner {
  background: rgba(255, 165, 2, 0.15);
  border: 1px solid var(--accent-orange);
  color: var(--accent-gold);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: pulse-countdown 1s infinite alternate;
}

@keyframes pulse-countdown {
  0% { transform: scale(0.98); }
  100% { transform: scale(1.02); }
}

/* FEEDBACK OVERLAYS (Ding / Buzz / Boom) */
.feedback-toast {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(19, 22, 34, 0.9);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(5px);
}

.feedback-toast.success {
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
}

.feedback-toast.error {
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
}

/* Confetti container for Victory */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 200;
}

/* CHAT DRAWER / POPUP */
.chat-drawer {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: min(340px, 92vw);
  height: 380px;
  background: rgba(19, 22, 34, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  z-index: 90;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

.chat-drawer.minimized {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

.chat-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
}

.chat-msg {
  display: flex;
  gap: 8px;
  line-height: 1.3;
}

.chat-msg.system {
  color: var(--accent-gold);
  font-style: italic;
  font-size: 0.8rem;
  justify-content: center;
  text-align: center;
}

.chat-msg-sender {
  font-weight: 700;
  color: var(--accent-cyan);
}

.chat-msg-text {
  color: var(--text-main);
  word-break: break-word;
}

.chat-input-row {
  padding: 8px 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 6px;
}

.chat-input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
}

.chat-btn-send {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
}

/* MODALS (Avatar & Settings) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

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

.modal-title {
  font-family: 'Fredoka', cursive;
  font-size: 1.4rem;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

/* Avatar Customizer UI */
.avatar-customizer-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
}

.palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-dot.selected {
  transform: scale(1.2);
  border-color: #fff;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.choice-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.choice-btn.selected {
  background: var(--accent-orange);
  color: #111;
  border-color: var(--accent-orange);
}

/* Settings Form Controls */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-info {
  display: flex;
  flex-direction: column;
}

.setting-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.setting-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: .3s;
  border-radius: 34px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--accent-green);
  border-color: var(--accent-green);
}

input:checked + .slider-round:before {
  transform: translateX(22px);
}

.range-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-slider {
  accent-color: var(--accent-orange);
  cursor: pointer;
}

.range-value {
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 30px;
  text-align: right;
}

/* Victory Screen Overlay */
.victory-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 20, 0.85);
  backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 180;
  text-align: center;
  padding: 20px;
}

.victory-overlay.open {
  display: flex;
}

.victory-title {
  font-family: 'Fredoka', cursive;
  font-size: clamp(2.5rem, 6vw, 3.8rem);
  color: var(--accent-gold);
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
  animation: victory-pulse 0.8s infinite alternate;
}

@keyframes victory-pulse {
  0% { transform: scale(0.96); }
  100% { transform: scale(1.04); }
}

.victory-winner-name {
  font-family: 'Fredoka', cursive;
  font-size: 1.8rem;
  margin-top: 10px;
  color: #fff;
}
