@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

*,
:root,
body,
h1,
h2,
p,
button,
input,
a {
  font-family: 'Press Start 2P', cursive !important;
  text-transform: uppercase !important;
}

.starry-bg {
  position: relative;
  overflow: hidden;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0.4;
  animation: blink ease-in-out infinite;
}

@keyframes blink {
  0% { opacity: 0.4; }
  10% { opacity: 0.5; }
  20% { opacity: 0.6; }
  30% { opacity: 0.7; }
  40% { opacity: 0.85; }
  50% { opacity: 1.0; }
  60% { opacity: 0.85; }
  70% { opacity: 0.7; }
  80% { opacity: 0.6; }
  90% { opacity: 0.5; }
  100% { opacity: 0.4; }
}

input::placeholder {
  text-transform: uppercase !important;
}

.launchpad {
  box-sizing: border-box;
  overflow: hidden;
}

#chat-messages {
  box-sizing: border-box;
  width: 100%;
  max-width: 400px;
  overflow-x: hidden;
  padding-right: 12px;
}

#chat-messages p {
  overflow-wrap: break-word;
  white-space: normal;
  font-size: 10px;
}

#lobby-chat-messages p {
  overflow-wrap: break-word;
  white-space: normal;
  font-size: 10px;
}

.lobby-list {
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden;
  height: 616px;
  margin-top: 20px;
  margin-bottom: 16px;
  padding-right: 12px;
  overflow-y: auto;
}

#chat-messages,
.lobby-list {
  scrollbar-width: thin;
  scrollbar-color: #ffffff #00000080;
}

#chat-messages::-webkit-scrollbar,
.lobby-list::-webkit-scrollbar {
  width: 8px;
}

#chat-messages::-webkit-scrollbar-track,
.lobby-list::-webkit-scrollbar-track {
  background: #00000080;
}

#chat-messages::-webkit-scrollbar-thumb,
.lobby-list::-webkit-scrollbar-thumb {
  background: #ffffff;
  border: 1px solid #ffffff;
}

.footer-links a {
  color: white;
  font-size: 13px;
}

.footer-links a:hover {
  text-decoration: underline;
  text-decoration-color: white;
}

.contract-address {
  letter-spacing: 2px;
}

.ended-lobby {
  background-color: rgba(0, 0, 0, 0.3);
}

.public-lobby {
  background-color: rgba(255, 255, 255, 0.1);
}

.public-lobby:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.05);
}

.tab-all,
.tab-ended,
.tab-my-games {
  color: white;
  font-size: 10px;
  background: none;
  border: none;
}

.tab-all.active,
.tab-ended.active,
.tab-my-games.active {
  text-decoration: underline;
  text-decoration-color: white;
  text-decoration-thickness: 2px;
}

.text-3xl,
.text-lg,
.text-sm,
.text-[10px],
.text-[12px],
.text-[13px],
.text-[14px],
.text-[16px],
.text-[24px] {
  font-family: 'Press Start 2P', cursive !important;
  text-transform: uppercase !important;
}

.chat-message {
  padding: 8px 8px 20px 8px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 10px;
  overflow-wrap: break-word;
  white-space: normal;
  position: relative;
  min-height: 36px;
  opacity: 0; /* Start invisible for animation */
}

.chat-message:nth-child(odd) {
  background-color: rgba(255, 255, 255, 0.1);
}

.chat-message:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Fade-in animation for chat messages and lobby cards */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px); /* Slight upward movement */
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Class to trigger animation */
.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.chat-username {
  font-weight: bold;
  margin-right: 8px;
}

.chat-timestamp {
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 8px;
  color: #9CA3AF;
  line-height: 12px;
}

.lobby-card {
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 4px;
  width: 938px;
  height: 76px;
  position: relative;
  transition: background-color 0.2s;
  background-image: 
    linear-gradient(to right, rgba(0, 0, 0, 0.25) 0%, transparent 40%),
    linear-gradient(to left, rgba(0, 0, 0, 0.25) 0%, transparent 40%);
  opacity: 0; /* Start invisible for animation */
}

.lobby-card:hover.cursor-pointer {
  background-color: rgba(0, 0, 0, 0.08);
}

.tab-spacing {
  gap: 20px;
}

.game-slot {
  width: 80px;
  height: 80px;
  font-size: 24px;
  text-align: center;
  line-height: 80px;
  position: relative;
}

.game-slot span {
  display: inline-block;
  cursor: grab;
}

.game-slot span:active {
  cursor: grabbing;
}

.game-slot:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.win-label-creator {
  position: absolute;
  left: -150px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: white;
  font-family: 'Press Start 2P', cursive;
  text-transform: uppercase;
  z-index: 10;
}

.win-label-opponent {
  position: absolute;
  right: -150px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: white;
  font-family: 'Press Start 2P', cursive;
  text-transform: uppercase;
  z-index: 10;
}

.join-button {
  font-size: 10px;
  color: white;
  font-family: 'Press Start 2P', cursive;
  text-transform: uppercase;
  background: transparent;
  border: 2px solid white;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  width: 110px;
  text-align: center;
  transition: background-color 0.2s;
}

.join-button:hover {
  background: rgba(0, 0, 0, 0.08);
}

.join-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.press-to-play {
  font-size: 16px;
  color: white;
  font-family: 'Press Start 2P', cursive;
  text-transform: uppercase;
  position: absolute;
  bottom: 20px;
  z-index: 10;
}

#ready-overlay {
  z-index: 20;
}

#ready-overlay .ready {
  background-color: rgba(0, 128, 0, 0.5);
}

#countdown-overlay, #game-result-overlay {
  z-index: 20;
  flex-direction: column;
  gap: 16px;
}

.game-join-button {
  position: absolute;
  top: 50%;
  right: -125px;
  background: transparent;
  border: 2px solid white;
  color: white;
  padding: 2px 8px;
  font-size: 12px;
  font-family: 'Press Start 2P', cursive;
  font-weight: bold;
  text-align: center;
  transition: background-color 0.3s;
}

.game-join-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.aligned-player-count {
  width: 110px; /* Matches join-button width */
  text-align: center; /* Center player count text */
}

#close-popup:focus {
  outline: none; /* Remove focus outline */
}

.card-hover {
  background-color: rgba(0, 0, 0, 0.08);
}

.admin-badge {
  color: #FFD700; /* Gold color for admin badge */
  font-weight: bold;
  margin-right: 4px;
}