body {
  background-color: var(--bg-color);
  margin: 0;
  padding: 0;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.card-container {
  width: 100%;
  max-width: 500px;
  background-color: var(--card-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.display-name {
  font-weight: 800;
  color: var(--primary);
  font-size: 1.2rem;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-text-only {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px;
}
.btn-text-only:hover { color: var(--primary); }

.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
  color: white;
}

.status-badge.connecting {
  background-color: #f59e0b;
}

.status-badge.connected {
  background-color: #10b981;
}

.status-badge.error {
  background-color: var(--danger);
}

.current-draw-area {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.current-draw-area .label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 5px;
}

.latest-draw-value {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  min-height: 3rem;
}

/* 5x5 Grid */
.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 5px;
  aspect-ratio: 1/1;
  /* keep it square on mobile */
}

.bingo-cell {
  background-color: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  text-align: center;
  word-break: break-all;
  padding: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bingo-cell:active {
  transform: scale(0.95);
}

/* Marked state */
.bingo-cell.drawn {
  background-color: var(--secondary);
  color: white;
  border-color: var(--secondary);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.2);
  transform: scale(0.98);
}

/* Center Free space */
.bingo-cell.free {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.game-info {
  text-align: center;
  font-weight: bold;
}

#bingo-message {
  font-size: 2.5rem;
  color: var(--danger);
  animation: bounce 1s infinite alternate;
  margin: 0;
}

#reach-message {
  font-size: 1.5rem;
  color: #f59e0b;
  margin: 0;
  animation: flash 1s infinite;
}

/* Animations */
@keyframes pop-in {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  80% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.just-drawn {
  animation: pop-in 0.4s ease-out forwards;
}

@keyframes bounce {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-10px);
  }
}

@keyframes flash {

  0%,
  100% {
    opacity: 1;
    text-shadow: 0 0 10px #f59e0b;
  }

  50% {
    opacity: 0.5;
    text-shadow: none;
  }
}

@media (max-width: 400px) {
  .bingo-cell {
    font-size: 1rem;
    border-width: 1px;
    border-radius: 6px;
  }
}

/* Modal / Join Flow */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    backdrop-filter: blur(4px);
    z-index: 2000;
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s;
}
.modal-overlay.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}
.modal-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal-card h2 { margin-top: 0; margin-bottom: 0.5rem; color: #333; }
.modal-card p { margin-bottom: 1.5rem; color: #666; font-size: 0.95rem; }
.modal-card input {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 1rem;
    background: var(--bg-color);
    color: var(--text-main);
}
.modal-card input:focus {
    border-color: #3b82f6;
    outline: none;
}