html, body {
  width: 100%;
  height: 100%;
  overflow: auto;
}

:root {
  --primary: #ff0000; /* Red */
  --secondary: #ffff00; /* Yellow */
  --accent: #008000; /* Green */
  --background: linear-gradient(135deg, #000000 0%, #222222 50%, #000000 100%); /* Darker Background */
  --text: #ffffff;
  --red-light: #ff4d4d;
  --red-dark: #cc0000;
  --blue-light: #66b3ff;
  --blue-dark: #0066cc;
  --green-light: #80ff80;
  --green-dark: #008000;
  --yellow-light: #ffff66;
  --yellow-dark: #ffcc00;
  --black-light: #444444;
  --black-dark: #222222;

  --card-width-base: 8vw;
  --card-height-base: calc(var(--card-width-base) * 1.4);
  --card-radius: min(1.2vw, 12px);

  --card-value-font-size: calc(var(--card-width-base) * 0.3);
  --card-center-font-size: calc(var(--card-width-base) * 0.5);
}

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

body {
  font-family: 'Orbitron', sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.menu {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 2rem;
  padding: 2rem;
  position: relative;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%),
    var(--background);
  overflow: hidden;
}

.menu::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  animation: shine 8s linear infinite;
}

@keyframes shine {
  from { transform: translateX(-50%) translateY(-50%) rotate(0deg); }
  to { transform: translateX(-50%) translateY(-50%) rotate(360deg); }
}

.title {
  position: relative;
  cursor: pointer;
  padding: 20px; /* Increase padding for better mobile tap target */
  margin: -20px; /* Offset padding to maintain layout */
}

.title-clickable {
  font-size: 1.5rem;
  text-align: center;
  background: linear-gradient(135deg,
    var(--blue-light) 0%,
    var(--red-light) 33%,
    var(--yellow-light) 66%,
    var(--green-light) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow:
    0 0 10px rgba(255, 7, 58, 0.3),
    0 0 20px rgba(255, 240, 31, 0.2);
  animation: titlePulse 2s ease-in-out infinite;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.button {
  padding: 1.2rem 3rem;
  font-size: 1.5rem;
  font-family: 'Orbitron', sans-serif;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--red-light), var(--blue-light));
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 5px 10px rgba(255, 7, 58, 0.2), /* Reduced shadow */
    0 3px 3px rgba(0, 0, 0, 0.1),
    0 0 50px rgba(255, 0, 0, 0.1); /* Reduced glow */
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: 0.5s;
}

.button:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow:
    0 10px 20px rgba(255, 0, 0, 0.3), /* Reduced shadow */
    0 5px 5px rgba(0, 0, 0, 0.2),
    0 0 75px rgba(255, 0, 0, 0.2); /* Reduced glow */
}

.button:hover::before {
  left: 100%;
}

.game-board {
  flex: 1;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto; /* Added extra row for turn info and notification */
  gap: 2rem;
  padding: 2rem;
  padding-bottom: 15vh;
  background:
    radial-gradient(circle at top right, rgba(255,0,0,0.1), transparent 70%),
    radial-gradient(circle at bottom left, rgba(0,0,255,0.1), transparent 70%),
    var(--background);
}

.players-container {
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transform: translateZ(50px);
  display: flex;
  flex-direction: column;
}

.players-toggle-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: 'Orbitron', sans-serif;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  transition: background-color 0.3s ease;
}

.players-toggle-button:hover {
  background: rgba(0, 0, 0, 0.8);
}

.players-toggle-button svg {
  transition: transform 0.3s ease;
}

.players-toggle-button.open svg {
  transform: rotate(180deg);
}

.players-dropdown {
  display: none;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  overflow-y: auto;
  max-height: 30vh;
}

.players-dropdown.open {
  display: block;
}

.players {
  padding: 1rem;
  z-index: 1000;
  transform: translateZ(50px);
  box-shadow: none;
  background: transparent;
  backdrop-filter: none;
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
}

.player {
  transform: scale(0.7);
  margin: -0.3rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.2), /* Reduced shadow */
    inset 0 0 16px rgba(255, 255, 255, 0.05); /* Reduced inset shadow */
  transition: all 0.3s ease;
}

.player.active {
  transform: scale(0.8);
  box-shadow:
    0 6px 24px rgba(255, 0, 0, 0.2), /* Reduced shadow */
    inset 0 0 16px rgba(255, 255, 255, 0.1); /* Reduced inset shadow */
  background: rgba(255, 0, 0, 0.2);
}

.player span {
  font-size: 0.7em;
}

.avatar {
  width: 4vw !important;
  height: 4vw !important;
  min-width: 30px !important;
  min-height: 30px !important;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 0 5px rgba(255, 255, 255, 0.1), /* Reduced shadow */
    inset 0 0 5px rgba(255, 255, 255, 0.05); /* Reduced inset shadow */
  transition: all 0.3s ease;
}

.player.active .avatar {
  border-color: var(--primary);
  box-shadow:
    0 0 10px rgba(255, 0, 0, 0.2), /* Reduced shadow */
    inset 0 0 10px rgba(255, 0, 0, 0.1); /* Reduced inset shadow */
}

.card {
  width: var(--card-width-base);
  height: var(--card-height-base);
  min-width: 80px;
  min-height: 112px;
  max-width: 200px;
  max-height: 280px;
  position: relative;
  cursor: pointer;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  perspective: 2000px;
  margin: 0.5vw;
}

.card-inner {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: white;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.1), /* Reduced shadow */
    0 2px 4px rgba(0, 0, 0, 0.05); /* Reduced shadow */
}

.card-front {
  background: linear-gradient(135deg, var(--red-light), var(--red-dark));
  transform: rotateY(0deg);
}

.card-back {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  transform: rotateY(180deg);
}

.card:hover {
  transform:
    translateY(-20px)
    rotateX(20deg)
    rotateY(20deg)
    scale(1.1);
  box-shadow:
    10px 10px 30px rgba(0, 0, 0, 0.3), /* Reduced shadow */
    -10px -10px 30px rgba(255, 255, 255, 0.05), /* Reduced shadow */
    0 0 20px rgba(255, 0, 0, 0.2); /* Reduced glow */
}

.card.red .card-inner {
  background: linear-gradient(135deg, var(--red-light), var(--red-dark));
  box-shadow:
    0 0 15px rgba(255, 7, 58, 0.3); /* Reduced glow */
}

.card.blue .card-inner {
  background: linear-gradient(135deg, var(--blue-light), var(--blue-dark));
  box-shadow:
    0 0 15px rgba(0, 102, 204, 0.3); /* Reduced glow - adjusted color */
}

.card.green .card-inner {
  background: linear-gradient(135deg, var(--green-light), var(--green-dark));
  box-shadow:
    0 0 15px rgba(0, 128, 0, 0.3); /* Reduced glow - adjusted color */
}

.card.yellow .card-inner {
  background: linear-gradient(135deg, var(--yellow-light), var(--yellow-dark));
  box-shadow:
    0 0 15px rgba(255, 204, 0, 0.3); /* Reduced glow - adjusted color */
}

.card.black .card-inner {
  background: linear-gradient(135deg, var(--black-light), var(--black-dark));
  box-shadow:
    0 0 15px rgba(0, 0, 0, 0.3), /* Reduced glow */
    inset 0 0 10px rgba(255, 255, 255, 0.05); /* Reduced inset shadow */
}

.card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  color: white;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  transform-style: preserve-3d;
  z-index: 2;
}

.card-corner .card-value {
  font-size: calc(var(--card-center-font-size) * 0.4);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.top-left {
  top: 0;
  left: 0;
  transform: translateZ(20px);
}

.bottom-right {
  bottom: 0;
  right: 0;
  transform: rotate(180deg) translateZ(20px);
}

.card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(30px);
  font-size: var(--card-center-font-size);
  color: white;
  text-shadow:
    3px 3px 6px rgba(0, 0, 0, 0.3),
    0 0 10px rgba(255, 255, 255, 0.2); /* Reduced glow */
  font-weight: 900;
  animation: floatingSymbol 3s ease-in-out infinite;
}

@keyframes floatingSymbol {
  0%, 100% { transform: translate(-50%, -50%) translateZ(30px); }
  50% { transform: translate(-50%, -50%) translateZ(40px); }
}

.card-border {
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: calc(var(--card-radius) - 5px);
  transform: translateZ(10px);
  box-shadow:
    inset 0 0 15px rgba(255, 255, 255, 0.15), /* Reduced inset shadow */
    0 0 10px rgba(0, 0, 0, 0.1); /* Reduced shadow */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );
  backdrop-filter: blur(5px);
}

.color-select-overlay {
  position: fixed; /* Fixed position to cover the entire viewport */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5); /* Optional: a semi-transparent background overlay */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001; /* Ensure it's on top of other elements */
  backdrop-filter: blur(10px); /* Optional: blur effect for the background */
}

.color-select-dialog {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 30px;
  padding: 1rem;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.3), /* Reduced shadow */
    inset 0 0 20px rgba(255, 255, 255, 0.05); /* Reduced inset shadow */
  transform-style: preserve-3d;
  perspective: 1000px;
  position: relative; /* Changed from margin-top to relative positioning if needed */
  top: 0; /* Reset top to allow absolute positioning to work from overlay */
  margin-top: 0; /* Remove margin-top that was pushing it down */
}

.color-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
  transform-style: preserve-3d;
}

.color-button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  transform: translateZ(10px);
}

.color-button::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  background: inherit;
  filter: blur(10px);
  opacity: 0.7;
  z-index: -1;
  transition: all 0.3s ease;
}

.color-button:hover {
  transform: translateZ(30px) scale(1.1);
}

.color-button:hover::before {
  opacity: 1;
  filter: blur(15px);
}

.color-button.red {
  background: linear-gradient(135deg, var(--red-light), var(--red-dark));
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.3); /* Reduced glow */
}

.color-button.blue {
  background: linear-gradient(135deg, var(--blue-light), var(--blue-dark));
  box-shadow: 0 0 15px rgba(0, 102, 204, 0.3); /* Reduced glow - adjusted color */
}

.color-button.green {
  background: linear-gradient(135deg, var(--green-light), var(--green-dark));
  box-shadow: 0 0 15px rgba(0, 128, 0, 0.3); /* Reduced glow - adjusted color */
}

.color-button.yellow {
  background: linear-gradient(135deg, var(--yellow-light), var(--yellow-dark));
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.3); /* Reduced glow - adjusted color */
}

.pile {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 3rem;
  perspective: 1000px;
  margin-top: -75px;
  margin-bottom: 2rem; /* Added margin to separate pile and action log */
}

.draw-pile, .discard-pile {
  position: relative;
  transform-style: preserve-3d;
}

.draw-pile {
  cursor: pointer;
  transform: translateZ(0);
  transition: all 0.3s ease;
}

.draw-pile:hover {
  transform: translateY(-10px) rotateX(10deg);
}

.draw-pile .card {
  animation: cardStackPulse 2s infinite ease-in-out;
}

.discard-pile .card {
  animation: cardPlacedEffect 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardStackPulse {
  0%, 100% { transform: translateZ(0); }
  50% { transform: translateZ(10px); }
}

@keyframes cardPlacedEffect {
  0% {
    transform:
      translateY(-100px)
      rotateX(-45deg)
      rotateY(45deg)
      scale(1.2);
    opacity: 0;
  }
  100% {
    transform:
      translateY(0)
      rotateX(0)
      rotateY(0)
      scale(1);
    opacity: 1;
  }
}

.cards-remaining {
  position: relative;
  bottom: auto;
  right: auto;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  padding: 0.7rem;
  min-width: 2.5rem;
  border-radius: 50%;
  font-weight: bold;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1), /* Reduced shadow */
    0 0 10px rgba(255, 255, 255, 0.15); /* Reduced glow */
  text-align: center;
  animation: countPulse 2s infinite;
  margin: 0 1rem;
}

.cards-remaining::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background-color: var(--blue-light);
  box-shadow: 0 0 7px var(--blue-light); /* Reduced glow */
  animation: colorGlow 1.5s ease-in-out infinite;
}

@keyframes colorGlow {
  0%, 100% {
    opacity: 0.8;
    transform: translateX(-50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.2);
    box-shadow: 0 0 10px currentColor; /* Reduced glow */
  }
}

@keyframes countPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.winner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: overlayFadeIn 0.5s ease-out;
}

.winner-dialog {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  padding: 3rem;
  border-radius: 30px;
  text-align: center;
  animation: winnerPopIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.3), /* Reduced shadow */
    inset 0 0 20px rgba(255, 255, 255, 0.05); /* Reduced inset shadow */
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes winnerPopIn {
  0% { transform: scale(0.8) translateY(50px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.winner-dialog h2 {
  font-size: 3.5rem;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #ffd700, #ffa500);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); /* Reduced glow */
}

.hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 1rem;
  max-width: 100%;
  overflow-x: auto;
  margin-top: -75px;
}

.hand .card {
  margin-left: -5%;
  transition: margin 0.3s ease, transform 0.3s ease;
}

.hand .card:first-child {
  margin-left: 0;
}

.hand .card:hover {
  margin-left: -10%;
  transform: translateY(-20px) rotateX(20deg) rotateY(20deg) scale(1.1);
  z-index: 2;
}

.hand .card {
  position: relative;
  z-index: 1;
}

.draw-pile .card-corner .card-value {
  font-size: 80%;
}

.discard-pile .card-corner .card-value {
  font-size: 100%;
}

.chat-toggle-container {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1001;
}

.chat-toggle-button {
  position: relative;
  padding: 0.5rem 1rem;
  background: rgba(0,0,0,0.7);
  color: var(--text);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.chat-toggle-button:hover {
  background: rgba(0,0,0,0.8);
}

.chat-notification-counter {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  background-color: var(--yellow-light);
  color: var(--black-dark);
  border-radius: 50%;
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  font-weight: bold;
  z-index: 1;
}

.top-chat {
  position: fixed;
  top: 50px;
  right: 10px;
  width: min(300px, 90vw);
  max-height: 50vh;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3); /* Reduced shadow */
}

.chatbox-container {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.chat-messages {
  padding: 0.5rem;
  max-height: 15vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
}

.chat-input-area {
  display: flex;
  padding: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  margin-right: 0.5rem;
}

.chat-input:focus {
  outline: none;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.1); /* Reduced shadow */
}

.send-button {
  background: var(--blue-light);
  color: var(--text);
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.send-button:hover {
  background: var(--blue-dark);
}

.message {
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  margin-bottom: 0.3rem;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  word-wrap: break-word;
}

.message strong {
  color: var(--yellow-light);
  margin-right: 0.3rem;
}

.menu .chat-toggle-container {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1001;
}

.menu .chatbox-container {
  background: rgba(0, 0, 0, 0.7);
  max-height: 40vh;
  width: min(300px, 90vw);
}

.action-log-container {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 0 10px rgba(0,0,0,0.3); /* Reduced shadow */
  overflow-y: auto;
  max-height: 20vh; /* Adjust max height as needed */
}

.action-log-title {
  color: var(--text);
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.action-log {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.action-message {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.6rem;
  border-radius: 5px;
  font-size: 0.9rem;
  word-wrap: break-word;
}

.turn-info-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
}

.turn-info-player {
  color: var(--yellow-light);
}

.turn-timer {
  color: var(--green-light);
  transition: color 0.3s ease;
}

.turn-timer.warning {
  color: var(--red-light);
  animation: pulse 1s infinite;
}

.time-warning {
  color: var(--red-light);
  animation: shake 0.5s infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.my-turn-notification {
  color: var(--green-light);
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 10px var(--green-light), 0 0 20px var(--green-light);
  animation: pulseWarning 2s infinite alternate;
}

@keyframes pulseWarning {
  0% { opacity: 0.5; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}

.donate-button-container {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1002;
  display: flex;
  gap: 10px;
}

.leave-button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-family: 'Orbitron', sans-serif;
  border: none;
  border-radius: 20px;
  background-color: #ff4444;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.leave-button:hover {
  background-color: #cc0000;
}

.donate-button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-family: 'Orbitron', sans-serif;
  border: none;
  border-radius: 20px;
  background-color: #4CAF50; /* Green background */
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 
    0 2px 5px rgba(0,0,0,0.3),
    0 0 10px rgba(76, 175, 80, 0.5); /* Glow effect */
}

.donate-button:hover {
  background-color: #45a049; /* Slightly darker green on hover */
  box-shadow: 
    0 2px 5px rgba(0,0,0,0.3),
    0 0 15px rgba(76, 175, 80, 0.7); /* Increased glow on hover */
}

.shop-button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-family: 'Orbitron', sans-serif;
  border: none;
  border-radius: 20px;
  background-color: #66b3ff; /* Blue background */
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 
    0 2px 5px rgba(0,0,0,0.3),
    0 0 10px rgba(102, 179, 255, 0.5); /* Glow effect */
}

.shop-button:hover {
  background-color: #0066cc; /* Slightly darker blue on hover */
  box-shadow: 
    0 2px 5px rgba(0,0,0,0.3),
    0 0 15px rgba(0, 102, 204, 0.7); /* Increased glow on hover */
}

.games-button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-family: 'Orbitron', sans-serif;
  border: none;
  border-radius: 20px;
  background-color: #ffeb3b; /* UNO Yellow */
  color: #222; /* Dark text for visibility */
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.games-button:hover {
  background-color: #f0e100; /* Slightly darker yellow on hover */
  box-shadow: 0 2px 5px rgba(0,0,0,0.3), 0 0 15px rgba(255, 235, 59, 0.7); /* Glow effect */
}

.game-board .donate-button-container,
.winner-overlay .donate-button-container,
.color-select-overlay .donate-button-container {
  display: none;
}

.bottom-buttons {
  position: fixed;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
}

.bottom-button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-family: 'Orbitron', sans-serif;
  border: none;
  border-radius: 20px;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3), 0 0 10px rgba(0,0,0,0.1);
}

.green-button {
  background-color: #4CAF50; /* Green */
}

.red-button {
  background-color: #f44336; /* Red */
}

.yellow-button {
  background-color: #ffeb3b; /* Yellow */
  color: #222;
}

.green-button:hover {
  background-color: #45a049;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3), 0 0 15px rgba(76, 175, 80, 0.7);
}

.red-button:hover {
  background-color: #d32f2f;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3), 0 0 15px rgba(244, 67, 54, 0.7);
}

.yellow-button:hover {
  background-color: #f0e100;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3), 0 0 15px rgba(255, 235, 59, 0.7);
}

.blue-button {
  background-color: #2196F3; /* UNO Blue */
}

.blue-button:hover {
  background-color: #1976D2;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3), 0 0 15px rgba(33, 150, 243, 0.7);
}

@media (max-width: 768px) {
  :root {
    --card-width-base: 20vw;
    --card-height-base: calc(var(--card-width-base) * 1.4);
    --card-radius: min(2vw, 8px);
  }

  .hand {
    gap: 2vw;
    justify-content: start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .hand::-webkit-scrollbar {
    display: none;
  }

  .players-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateZ(50px);
  }

  .players-toggle-button {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  .players-dropdown {
    max-height: 40vh;
  }

  .players {
    padding: 0.5rem;
    overflow-x: auto;
    white-space: nowrap;
  }

  .player {
    display: inline-flex;
    flex-direction: column;
    margin: 0 2px;
    transform: scale(0.6);
    padding: 0.3rem;
  }

  .avatar {
    width: 8vw !important;
    height: 8vw !important;
  }

  .chat-messages {
    max-height: 10vh;
  }

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

  .my-turn-notification {
    font-size: 1.5rem;
  }

  .turn-info-container {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  .time-warning {
    font-size: 0.8rem;
  }
}

.private-indicator {
  background: rgba(255, 0, 0, 0.2);
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--red-light);
}

.lobby-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.close-lobby-button {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--red-light), var(--red-dark));
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.close-lobby-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .title {
    padding: 30px; /* Even larger padding on mobile */
    margin: -30px;
  }

  .lobby-actions {
    flex-direction: row; /* Keep buttons in a row */
    justify-content: center;
    width: 100%;
    margin-top: 0.5rem;
  }

  .close-lobby-button,
  .join-button {
    padding: 0.8rem 1.2rem; /* Larger padding for better touch targets */
    font-size: 1rem;
    min-width: 80px; /* Ensure minimum touch target size */
  }
}

/* New Lobby Styles */
.lobby-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.lobby-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.code-input {
  flex: 1;
  min-width: 200px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.code-input:focus {
  outline: none;
  border-color: var(--blue-light);
  box-shadow: 0 0 15px rgba(102, 179, 255, 0.3);
}

.create-lobby-button {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--green-light), var(--green-dark));
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.create-lobby-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 128, 0, 0.3);
}

.join-button {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--blue-light), var(--blue-dark));
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.join-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 102, 204, 0.3);
}

.lobbies-list {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.lobby-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
  animation: fadeIn 0.5s ease-out;
}

.lobby-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
}

.lobby-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lobby-status {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.2);
}

.visibility-select {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  cursor: pointer;
}

.visibility-select option {
  background: #222;
  color: var(--text);
}

.lobby-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.9);
  color: var(--text);
  border-radius: 10px;
  font-family: 'Orbitron', sans-serif;
  z-index: 1000;
  animation: notificationSlide 0.5s ease-out;
}

@keyframes notificationSlide {
  from {
    top: -50px;
    opacity: 0;
  }
  to {
    top: 20px;
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.padlock-icon {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
  fill: currentColor;
  opacity: 0.7;
}

.lobby-create-dialog {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(20px);
  padding: 3rem;
  border-radius: 30px;
  text-align: center;
  max-width: 500px;
  width: 90%;
}

.lobby-create-dialog h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg,
    var(--green-light) 0%,
    var(--green-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lobby-create-dialog .lobby-code-display {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--yellow-light);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.lobby-code-display .code {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.2em;
}

.lobby-code-display .copy-button {
  position: absolute;
  right: 1rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s ease;
}

.lobby-code-display .copy-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lobby-create-dialog .buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.lobby-create-dialog .join-button {
  background: linear-gradient(135deg, var(--green-light), var(--green-dark));
}

@media (max-width: 768px) {
  .lobby-container {
    padding: 1rem;
  }

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

  .code-input,
  .create-lobby-button,
  .join-button {
    width: 100%;
  }

  .lobby-card {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .lobby-info {
    flex-direction: column;
  }
}

.waiting-room {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--background);
  position: relative;
}

.waiting-room-container {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 2rem;
  max-width: 800px;
  width: 100%;
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
  animation: fadeIn 0.5s ease-out;
}

.waiting-room h2 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  background: linear-gradient(135deg,
    var(--blue-light) 0%,
    var(--red-light) 33%,
    var(--yellow-light) 66%,
    var(--green-light) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.waiting-players {
  margin: 2rem 0;
}

.waiting-players h3 {
  margin-bottom: 1rem;
  text-align: center;
  color: var(--yellow-light);
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.waiting-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  transition: transform 0.3s ease;
}

.waiting-player:hover {
  transform: translateY(-5px);
}

.waiting-player.empty {
  opacity: 0.5;
}

.empty-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  margin-bottom: 0.5rem;
}

.waiting-player span {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  text-align: center;
}

.start-game-button {
  width: 100%;
  padding: 1rem;
  margin-top: 2rem;
  background: linear-gradient(135deg, var(--green-light), var(--green-dark));
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.start-game-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 128, 0, 0.3);
}

.start-game-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-info {
  margin-top: 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

.game-info p {
  margin: 0.5rem 0;
}

@media (max-width: 768px) {
  .waiting-room-container {
    padding: 1rem;
  }

  .players-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .waiting-player {
    padding: 0.8rem;
  }

  .lobby-create-dialog {
    padding: 1.5rem;
  }

  .lobby-code-display {
    font-size: 1.8rem;
  }
}

.admin-login-dialog {
  background: rgba(0, 0, 0, 0.9);
  padding: 2rem;
  min-width: 300px;
}

.admin-password-input {
  width: 100%;
  padding: 0.8rem;
  margin: 1rem 0;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  transition: all 0.3s ease;
}

.admin-password-input:focus {
  outline: none;
  border-color: var(--blue-light);
  box-shadow: 0 0 15px rgba(102, 179, 255, 0.3);
}

.admin-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.admin-submit-button,
.admin-cancel-button {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-family: 'Orbitron', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
}

.admin-submit-button {
  background: linear-gradient(135deg, var(--green-light), var(--green-dark));
  color: var(--text);
}

.admin-cancel-button {
  background: linear-gradient(135deg, var(--red-light), var(--red-dark));
  color: var(--text);
}

.admin-submit-button:hover,
.admin-cancel-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}