/* ===== Fonts ===== */
@font-face {
  font-family: 'Bitcount Grid Single';
  src: url('/fonts/BitcountGridSingle_Roman-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #2C3E50;
  color: #ECF0F1;
  font-family: 'Bitcount Grid Single', system-ui, sans-serif;
}

h1 { color: #4DB399; }
h2 { color: #ECF0F1; }
a { color: #4DB399; }
.error { color: #E74C3C; margin: 8px 0; }

/* ===== Canvas ===== */
/* Make canvas ignore pointer events when menu is visible */
#menu[style*="display: block"] ~ #gameCanvas {
  pointer-events: none;
}

canvas {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

@media screen and (max-width: 768px) {
  body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
}

/* ===== Shared Form Styles (login, join, menu) ===== */
.page-form {
  max-width: 400px;
  margin: 80px auto;
  padding: 0 20px;
  text-align: center;
}

.page-form input {
  display: block;
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid #4DB39950;
  border-radius: 4px;
  background: #1a2634;
  color: #ECF0F1;
  box-sizing: border-box;
  font-family: 'Bitcount Grid Single', system-ui, sans-serif;
}

.page-form button {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 12px 0;
  border: none;
  border-radius: 4px;
  background: #4DB399;
  color: #2C3E50;
  font-weight: bold;
  cursor: pointer;
  font-size: 16px;
  font-family: 'Bitcount Grid Single', system-ui, sans-serif;
}

.page-form button:hover { background: #3A8C75; }

/* ===== Index (menu) page ===== */
#user-email { color: #ECF0F1; opacity: 0.7; margin-bottom: 24px; }
#logout-btn { background: #1a2634; color: #ECF0F1; }
#logout-btn:hover { background: #2C3E50; }

#invite-link {
  display: none;
  margin: 16px 0;
  padding: 12px;
  background: #1a2634;
  border-radius: 4px;
  word-break: break-all;
}
#invite-link a { color: #4DB399; }

#status { color: #ECF0F1; opacity: 0.7; margin: 12px 0; }

/* ===== Game Over UI ===== */
#game-over-ui {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 20px 40px;
  max-width: 500px;
  margin: 0 auto;
}
#game-over-ui button {
  display: inline-block;
  padding: 14px 40px;
  border: none;
  border-radius: 4px;
  background: #4DB399;
  color: #2C3E50;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  margin-top: 12px;
  font-family: 'Bitcount Grid Single', system-ui, sans-serif;
}
#game-over-ui button:hover { background: #3A8C75; }
.game-over-thanks {
  font-size: 22px;
  color: #ECF0F1;
  margin-bottom: 8px;
}
.game-over-email-prompt {
  font-size: 15px;
  color: #ECF0F1;
  opacity: 0.7;
  margin-bottom: 12px;
}
#guest-email-input {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 12px;
  padding: 10px;
  border: 1px solid #4DB39950;
  border-radius: 4px;
  background: #1a2634;
  color: #ECF0F1;
  font-size: 16px;
  box-sizing: border-box;
  font-family: 'Bitcount Grid Single', system-ui, sans-serif;
}
#guest-email-status {
  color: #4DB399;
  margin-top: 8px;
}
/* Canvas wrapper with gradient vignette overlay */
#game-over-canvas-wrapper {
  position: relative;
  width: 80vw;
  max-width: 900px;
  margin: 24px auto 0;
}
#game-over-canvas-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 120px 60px #2C3E50,
    inset 0 0 60px 30px #2C3E50,
    inset 0 0 20px 10px #2C3E50;
}
/* Canvas in game-over mode: not fullscreen, proportionally shrunk, centered */
.game-over-canvas {
  position: relative !important;
  width: 100% !important;
  height: 60vh !important;
  display: block;
  margin: 0 !important;
  pointer-events: none;
}

/* ===== Login page ===== */
#login-form h1 { margin-bottom: 8px; }

/* ===== Join page ===== */
#join-btn { margin-top: 12px; }

/* ===== Admin page ===== */
.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  color: #ECF0F1;
  font-family: 'Bitcount Grid Single', monospace;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.admin-header h1 { margin: 0; font-size: 1.5rem; }
.admin-header a { color: #4DB399; text-decoration: none; }
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid #4DB39950;
}
.tab {
  padding: 8px 20px;
  cursor: pointer;
  background: #1a2634;
  color: #ECF0F1;
  opacity: 0.6;
  border: 1px solid #4DB39950;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  font-family: 'Bitcount Grid Single', monospace;
  font-size: 0.9rem;
}
.tab.active {
  background: #2C3E50;
  color: #ECF0F1;
  opacity: 1;
  border-color: #4DB399;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.admin-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-container th, .admin-container td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #4DB39950;
}
.admin-container th {
  background: #1a2634;
  color: #4DB399;
  font-weight: bold;
  position: sticky;
  top: 0;
}
.admin-container tr:hover td { background: #1a2634; }
.count { color: #ECF0F1; opacity: 0.5; font-size: 0.85rem; margin-left: 8px; }
.loading { color: #ECF0F1; opacity: 0.5; padding: 20px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}
.badge-active { background: #3A8C7533; color: #4DB399; }
.badge-waiting { background: #F39C1233; color: #F39C12; }
.badge-finished { background: #2C3E50; color: #ECF0F1; opacity: 0.6; }
.badge-admin { background: #4DB39933; color: #4DB399; }
.badge-expired { background: #E74C3C33; color: #E74C3C; }
.badge-valid { background: #3A8C7533; color: #4DB399; }
