:root {
  --primary: #2c3e50;
  --secondary: #ecf0f1;
  --accent: #e74c3c;
  --text: #34495e;
  --green: #2ecc71;
  --red: #e74c3c;
  --blue: #3498db;
  --yellow: #f1c40f;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  margin: 0;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text);
  width: 100dvw;
  height: 100dvh;
}

.hidden {
  display: none !important;
}

.container {
  flex: 1;
  max-width: 920px;
  flex-direction: row;
  height: 100%;
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  /* overflow: hidden; */
}

.section {
  background: var(--secondary);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  /* transition: transform 0.2s ease; */
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section:hover {
  /* transform: translateY(-2px); */
  /* transform: scaleY(0.98); */
}

.section h2 {
  color: var(--primary);
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.card-parent {
  flex: 1;
  height: 100%;
  display: flex;
  justify-content: center;
}

.card {
  aspect-ratio: 13/16;
  width: 100%;
  border: none;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 2.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform-origin: center bottom;
  animation: cardAppear 0.6s cubic-bezier(0.4, 0, 0.2, 1.5) both;
}

.playerCard {}

@keyframes cardAppear {
  0% {
    transform: scale(0.8) rotateY(-90deg) translateY(50px);
    opacity: 0;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
  }

  50% {
    transform: scale(1.1) rotateY(20deg) translateY(-10px);
    opacity: 1;
  }

  75% {
    transform: scale(0.95) rotateY(-5deg);
  }

  100% {
    transform: scale(1) rotateY(0deg) translateY(0);
    opacity: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  }
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.4),
      transparent);
  animation: cardShine 1s ease-out 0.6s;
  z-index: 2;
}

@keyframes cardShine {
  0% {
    left: -100%;
  }

  100% {
    left: 150%;
  }
}

.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2));
  z-index: 1;
}

.card:not(.selected):not(.boardCard):hover {
  transform: scale(1.05) rotateY(5deg) translateY(-5px) !important;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.selected {
  animation: bounce 1s infinite ease-in-out;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

@keyframes bounce {
  0% {
    transform: scale(1.1) translateY(-5px);
  }

  50% {
    transform: scale(1.1) translateY(-20px);
  }

  100% {
    transform: scale(1.1) translateY(-5px);
  }
}

/* Card colors with gradients */
.card.red {
  background: linear-gradient(135deg, var(--red) 0%, #c0392b 100%);
  color: white;
}

.card.green {
  background: linear-gradient(135deg, var(--green) 0%, #27ae60 100%);
  color: white;
}

.card.blue {
  background: linear-gradient(135deg, var(--blue) 0%, #2980b9 100%);
  color: white;
}

.card.yellow {
  background: linear-gradient(135deg, var(--yellow) 0%, #f39c12 100%);
  color: var(--text);
}

.mission {
  padding: 1rem;
  margin: 0.5rem 0;
  background: white;
  border-radius: 8px;
  position: relative;
  transition:
    all 0.3s ease,
    opacity 0.6s;
  border-left: 4px solid var(--accent);
  animation: missionEntrance 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.mission-exit {
  animation: missionExit 0.6s cubic-bezier(0.4, 0, 0.6, 1) forwards;
  pointer-events: none;
}

@keyframes missionExit {
  0% {
    transform: scale(1) translateX(0);
    opacity: 1;
  }

  30% {
    transform: scale(1.1) translateX(20px);
    background-color: rgba(231, 76, 60, 0.3);
  }

  100% {
    transform: scale(0.5) translateX(100px);
    opacity: 0;
    background-color: rgba(231, 76, 60, 0.1);
  }
}

@keyframes missionEntrance {
  0% {
    transform: scale(0.8) translateX(-20px);
    opacity: 0;
    background-color: rgba(231, 76, 60, 0.3);
  }

  50% {
    transform: scale(1.05) translateX(0);
    background-color: rgba(231, 76, 60, 0.15);
  }

  100% {
    transform: scale(1) translateX(0);
    opacity: 1;
    /* background-color: white; */
  }
}

.mission::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.6),
      transparent);
  animation: missionShine 1.2s ease-out 0.3s;
}

@keyframes missionShine {
  0% {
    left: -100%;
  }

  100% {
    left: 150%;
  }
}

.mission:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.mission::before {
  /* content: "🎯"; */
  margin-right: 0.8rem;
}

.boardSection {
  flex: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.boardCardsContainer {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.cardsContainer {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.lobby-container {
  display: flex;
  gap: 2rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  max-width: 800px;
  width: 90%;
}

.option-section {
  flex: 1;
  padding: 2rem;
  justify-content: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 15px;
  transition: transform 0.3s ease;
}

.option-section:hover {
  transform: translateY(-5px);
}

.create-section {
  background: linear-gradient(135deg, var(--green) 0%, #27ae60 100%);
}

.join-section {
  background: linear-gradient(135deg, var(--blue) 0%, #2980b9 100%);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 2rem 0;
}

#gameCode {
  flex: 1;
  padding: 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#gameCode:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.action-button {
  background: white;
  color: var(--text);
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.action-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Error state */
.error {
  animation: shake 0.4s;
  border: 2px solid var(--red) !important;
}

@keyframes shake {

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

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

.waiting-room {
  max-width: 600px;
  display: flex;
  flex-direction: row;
  width: 90%;
  padding: 2rem;
  gap: 36px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.game-code-display {
  font-size: 2.5rem;
  letter-spacing: 0.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, #1a252f 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 15px;
  margin: 2rem 0;
  display: inline-block;
  position: relative;
}

.copy-code {
  position: absolute;
  right: -10px;
  top: -10px;
  background: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.copy-code:hover {
  transform: scale(1.05);
  background: var(--secondary);
}

.players-list {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

.player-card {
  background: white;
  height: 24px;
  padding: 12px;
  margin: 4px 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s ease;
  width: 100%;
  z-index: 1002;
}

.current-player {
  background: var(--secondary) !important;
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.start-button {
  background: linear-gradient(135deg, var(--green) 0%, #27ae60 100%);
  color: white;
  border: none;
  padding: 1rem 3rem;
  border-radius: 50px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 2rem;
}

.start-button:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dark Mode using a .dark-mode class on <body> */
body.dark-mode {
  /* Override CSS variables */
  --primary: #ecf0f1;
  /* Lighter for headings */
  --secondary: #2c3e50;
  /* Dark background for panels */
  --accent: #e74c3c;
  /* Accent can remain unchanged */
  --text: #ecf0f1;
  /* Light text color */
  --green: #2ecc71;
  --red: #e74c3c;
  --blue: #3498db;
  --yellow: #f1c40f;

  /* Darken the overall background */
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: var(--text);
}

body.dark-mode .container {
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

body.dark-mode .section {
  background: var(--secondary);
  color: var(--text);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.6);
}

/* Adjust card styles if necessary */
body.dark-mode .card {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Ensure the color-specific cards work with dark backgrounds */
body.dark-mode .card.red {
  background: linear-gradient(135deg, var(--red) 0%, #c0392b 100%);
}

body.dark-mode .card.green {
  background: linear-gradient(135deg, var(--green) 0%, #27ae60 100%);
}

body.dark-mode .card.blue {
  background: linear-gradient(135deg, var(--blue) 0%, #2980b9 100%);
}

body.dark-mode .card.yellow {
  background: linear-gradient(135deg, var(--yellow) 0%, #f39c12 100%);
  color: var(--text);
}

/* Update other elements with hardcoded white backgrounds */
body.dark-mode input,
body.dark-mode .mission,
body.dark-mode .lobby-container,
body.dark-mode .action-button,
body.dark-mode .player-card,
body.dark-mode .waiting-room {
  background: #444;
  color: var(--text);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

body.dark-mode .copy-code {
  background: #555;
  color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

body.dark-mode .game-code-display {
  background: linear-gradient(135deg, var(--secondary) 0%, #1a252f 100%);
}

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

  50% {
    transform: scale(1.1);
  }

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

.pulse {
  animation: pulse 0.5s;
}

.menu-container {
  position: fixed;
  top: 20px;
  right: 20px;
  /* height: 100%; */
  z-index: 1000;
}

.hamburger {
  width: 35px;
  height: 25px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  transition: all 0.3s ease;
}

.hamburger:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hamburger .line {
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-dropdown {
  position: absolute;
  right: 0;
  top: 40px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  min-width: 180px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.menu-item {
  width: 100%;
  padding: 24px 16px;
  border: none;
  font-size: 20px;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  display: flex;
  gap: 8px;
  transition: all 0.2s ease;
}

.menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.exit-button {
  color: #e74c3c !important;
}

/* Dark mode adjustments */
body.dark-mode .menu-dropdown {
  background: rgba(40, 40, 40, 0.98);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

body.dark-mode .menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .hamburger {
  background: rgba(0, 0, 0, 0.2);
}

body.dark-mode .hamburger .line {
  background: var(--text);
}

.main-container {
  max-height: 800px;
  max-width: 1200px;
  display: flex;
  justify-content: center;
  flex: 1;
}

.cards-container {
  display: flex;
  flex-direction: column;
  flex: 2;
  gap: 8px;
  padding: 8px 0px;
  padding-left: 8px;
  z-index: 1000;
}

.missions-container {
  display: flex;
  flex: 1;
  padding: 8px 0px;
  padding-right: 8px;
}

#missionsContainer {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 420px;
}

.score-header {
  display: flex;
  justify-content: space-between;

  >div:first-of-type {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  >div:last-of-type {
    flex: 1;
  }
}

/* Portrait orientation specific fixes */
.card {
  user-select: none;
  -webkit-user-select: none;
}

/* Better touch targets */
button {
  min-height: 44px;
  min-width: 44px;
}

.toggle-container {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  margin: 1rem 0;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 1.1rem;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 24px;
  background-color: #ccc;
  border-radius: 12px;
  transition: background-color 0.3s;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: white;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.toggle-switch {
  background-color: var(--green);
}

input:checked+.toggle-switch::after {
  transform: translateX(24px);
}

input[type="checkbox"] {
  display: none;
}

/* Dark mode adjustments */
body.dark-mode .toggle-switch {
  background-color: #666;
}

body.dark-mode input:checked+.toggle-switch {
  background-color: var(--green);
}

.timer {
  font-size: 1.4rem;
  font-weight: 700;
  padding: 0.5rem 1.2rem;
  border-radius: 25px;
  background: var(--green);
  color: white;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.timer.urgent {
  background: var(--red);
  animation: urgent-pulse 0.5s infinite;
}

@keyframes urgent-pulse {

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

  50% {
    transform: scale(1.1);
    opacity: 0.9;
  }
}

.game-over {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.5s ease;
}

.game-over-content {
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  transform: scale(0.8);
  animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

body.dark-mode .game-over-content {
  background: rgba(40, 40, 40, 0.98);
  color: var(--text);
}

.final-stats {
  margin: 2rem 0;
  font-size: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.final-stats span {
  font-weight: bold;
  color: var(--green);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes popIn {
  to {
    transform: scale(1);
  }
}

.players-turn-container {
  position: absolute;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 1.5rem;
  align-items: center;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
  transform: translateY(120%);
  bottom: 0;
}

body.dark-mode .players-turn-container {
  background: rgba(40, 40, 40, 0.9);
}

.player-turn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  min-width: 80px;
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  position: relative;
}

.current-turn {
  font-size: 1.2rem;
  /* box-shadow: 0 0 0 3px var(--green); */
  animation: pulse-turn 1.5s infinite;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.current-turn::after {
  content: "📍";
  /* position: absolute;
    left: -16px; */
  left: -5px;
  font-size: 1.2rem;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.player {
  color: var(--green);
}

@keyframes pulse-turn {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

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

.players-in-game {
  display: flex;
  flex: 1;
  justify-content: space-evenly;
  align-items: center;
}

.medals-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 1rem;
  z-index: 1001;
}

.medal-notification {
  padding: 1.2rem 2rem;
  border-radius: 50px;
  color: white;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  animation: medalSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

/* Medal circle design */
.medal-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Ribbon effect */
.medal-circle::before {
  content: "";
  position: absolute;
  top: -5px;
  width: 20px;
  height: 10px;
  border-radius: 3px;
}

/* Inner circle */
.medal-circle::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Medal types */
.bronze .medal-circle {
  background: linear-gradient(135deg, #cd7f32 0%, #8b4513 100%);
}

.bronze .medal-circle::before {
  background: linear-gradient(45deg, #a0522d, #cd7f32);
}

.silver .medal-circle {
  background: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
}

.silver .medal-circle::before {
  background: linear-gradient(45deg, #a0a0a0, #d0d0d0);
}

.gold .medal-circle {
  background: linear-gradient(135deg, #ffd700 0%, #daa520 100%);
}

.gold .medal-circle::before {
  background: linear-gradient(45deg, #ffdf00, #ffaa00);
}

/* Star decoration */
.medal-star {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.8);
  clip-path: polygon(50% 0%,
      61% 35%,
      98% 35%,
      68% 57%,
      79% 91%,
      50% 70%,
      21% 91%,
      32% 57%,
      2% 35%,
      39% 35%);
}

/* Animation */
@keyframes medalSlideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.medal-notification.fade-out {
  animation: medalFadeOut 0.5s ease forwards;
}

@keyframes medalFadeOut {
  to {
    opacity: 0;
    transform: translateY(-50%);
  }
}

/* Dark mode adjustments */
body.dark-mode .medal-notification {
  background: rgba(255, 255, 255, 0.15);
}

/* Disabled start button */
.start-button:disabled {
  display: none;
}

body.dark-mode .start-button:disabled {
  background: linear-gradient(135deg, #3a3f42 0%, #2c3e50 100%) !important;
}

#gameCodeDisplay {
  text-decoration: none;
  color: inherit;
}

#gameCodeDisplay:hover,
#gameCodeDisplay:active,
#gameCodeDisplay:visited {
  text-decoration: none;
  color: inherit;
}

.win-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.win-content {
  background: linear-gradient(135deg, #ffd700 0%, #daa520 100%);
  padding: 2rem;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

body.dark-mode .win-content {
  background: linear-gradient(135deg, #c5a642 0%, #8a6c1f 100%);
}

.remove-button {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  padding: 0 8px;
  margin-left: auto;
  /* Pushes button to the right */
  transition: opacity 0.2s;
}

.remove-button:hover {
  opacity: 0.8;
}

/* Dark mode adjustment */
body.dark-mode .remove-button {
  color: #ff6666;
}

.player-name-input {
  background: var(--secondary) !important;
  border: none;
  /* border-bottom: 2px solid transparent; */
  font: inherit;
  color: inherit;
  width: 100%;
  /* padding: 4px; */
  /* width: 120px; */
  transition: all 0.3s ease;
  box-shadow: none !important;
}

.player-name-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
  background: var(--secondary);
}

.disconnect-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: var(--text);
  padding: 1.5rem 3rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.2),
    0 10px 30px rgba(0, 0, 0, 0.15);
  animation:
    floatIn 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    float 3s ease-in-out infinite;
  z-index: 2000;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 1.2rem;
}

.disconnect-notification.fade-out {
  animation: floatOut 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 30px));
    filter: blur(10px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%);
    filter: blur(0);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translate(-50%, calc(-50% - 5px));
  }

  50% {
    transform: translate(-50%, calc(-50% + 5px));
  }
}

@keyframes floatOut {
  to {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 30px));
    filter: blur(10px);
  }
}

/* Dark mode adjustment */
body.dark-mode .disconnect-notification {
  background: rgba(40, 40, 40, 0.95);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Add loading spinner */
.loading-spinner {
  width: 32px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Mobile-first adjustments */
@media (max-width: 768px) {
  body {
    height: 100dvh;
    width: 100%;
    /* height: auto; */
  }

  .main-container {
    max-width: unset;
    max-height: unset;
    height: calc(100% - 8px);
    padding: 4px;
  }

  .missions-container {
    padding: unset;
    padding-right: unset;
    overflow-y: auto;
    flex: 1;
  }

  .cards-container {
    padding: unset;
    padding-left: unset;
    /* flex: 1; */
    flex: 0;
    gap: 4px;
    justify-content: flex-end;
  }

  .container {
    flex-direction: column-reverse;
    padding: 4px;
    box-sizing: border-box;
    height: 100%;
    /* max-width: 100%;
        height: unset; */
    /* padding: 8px; */
    gap: 4px;
  }

  .card {
    font-size: 1.5rem;
    width: unset;
  }

  .lobby-container,
  .waiting-room {
    width: 100%;
    padding: 1rem;
    gap: 1rem;
    flex-direction: column;
  }

  .game-code-display {
    font-size: 1.5rem;
    padding: 1rem;
    letter-spacing: 0.2rem;
    margin: 1rem 0;
  }

  .menu-container {
    top: 10px;
    right: 10px;
  }

  .hamburger {
    width: 30px;
    height: 20px;
  }

  .menu-dropdown {
    top: 35px;
    /* min-width: 160px; */
  }

  .section {
    /* padding: 1rem; */
    padding: 8px;
    border-radius: 12px;
  }

  .players-list {
    margin: 1rem 0;
    padding: 0px 8px;
  }

  .boardCardsContainer,
  .cardsContainer {
    flex-wrap: wrap;
    height: 100%;
  }

  /* Adjust mission display */
  #missionsContainer {
    flex: 1;
    flex-direction: row;
    display: flex;
    max-height: unset;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
  }

  .mission {
    box-sizing: border-box;
    max-width: calc(50% - 4px);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
  }

  /* Stack mission counters vertically */
  #missionCount,
  #cardsCount {
    display: block;
    margin: 5px 0;
  }

  .start-button {
    padding: 1rem 2rem;
    font-size: 1rem;
  }

  #boardSection {
    flex: unset;
    height: calc(100dvh * 0.18);
    position: relative;
    display: flex;
  }

  #cardsSection {
    height: calc(100dvh * 0.18);
  }

  .copy-code {
    display: none;
  }

  .timer {
    font-size: 1.2rem;
    padding: 0.4rem 1rem;
  }

  .score-header {
    display: flex;
    justify-content: space-between;

    >div:first-of-type {
      flex: 2;
      display: flex;
      flex-direction: row;
      gap: 8px;
      align-items: center;
      justify-content: center;

      >div {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 8px;
      }
    }

    >div:last-of-type {
      flex: 1;
      display: flex;
      justify-content: flex-end;
    }
  }

  .players-turn-container {
    gap: 1rem;
    padding: 0.5rem;
    position: relative;
    transform: unset;
    bottom: unset;
  }

  .player-turn-item {
    min-width: 60px;
  }

  .player-avatar {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }

  .player-name {
    font-size: 0.8rem;
    max-width: 60px;
  }
}
