/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #1a0a2e 0%, #16213e 40%, #0f3460 100%);
  color: #f0e6ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* ===== Background Canvas ===== */
.bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===== Landing Container ===== */
.landing-container {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem 1rem 4rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

/* ===== Hero ===== */
.hero {
  margin-bottom: 0.5rem;
}

.title {
  font-family: 'Fredoka One', cursive;
  font-size: 3.5rem;
  background: linear-gradient(90deg, #ff6ec7, #ffde59, #00e5ff, #ff6ec7);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: title-shimmer 4s linear infinite;
  letter-spacing: 3px;
  filter: drop-shadow(0 0 12px rgba(255, 110, 199, 0.5));
}

@keyframes title-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.tagline {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffde59;
  margin-top: 0.25rem;
  text-shadow: 0 0 8px rgba(255, 222, 89, 0.4);
}

/* ===== Inputs ===== */
.name-section {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

.input-field {
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 2px solid #ff6ec7;
  border-radius: 4px;
  outline: none;
  width: 100%;
  max-width: 280px;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.input-field:focus {
  border-color: #00e5ff;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.3), 0 0 16px rgba(0, 229, 255, 0.15);
}

.input-field::placeholder {
  color: #a78bcc;
}

/* ===== Buttons ===== */
.btn-primary,
.btn-secondary {
  font-family: 'Fredoka One', cursive;
  font-size: 1.15rem;
  border: none;
  border-radius: 4px;
  padding: 0.85rem 2.25rem;
  transition: transform 0.15s, box-shadow 0.2s, background-color 0.2s;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6ec7, #e040fb);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 110, 199, 0.45), 0 0 12px rgba(224, 64, 251, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(255, 110, 199, 0.6), 0 0 20px rgba(224, 64, 251, 0.4);
  background: linear-gradient(135deg, #ff85d2, #e856ff);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #00e5ff;
  border: 2px solid #00e5ff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: #40efff;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.3);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* ===== Room Section ===== */
.room-section {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 110, 199, 0.3);
  border-radius: 4px;
  padding: 1.5rem;
}

.room-section h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: #ffde59;
  text-shadow: 0 0 8px rgba(255, 222, 89, 0.3);
}

.room-code {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: #00e5ff;
  background: rgba(0, 229, 255, 0.1);
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  letter-spacing: 4px;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.room-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ===== Join Modal ===== */
.join-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.join-modal-overlay[hidden] {
  display: none;
}

.join-modal {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  position: relative;
  min-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.join-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #999;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.join-modal-close:hover {
  color: #333;
}

.join-modal-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  color: #4a3aaa;
  margin-bottom: 1.5rem;
}

.join-modal .btn-primary {
  margin-top: 1.5rem;
  width: 100%;
  background: linear-gradient(135deg, #4a3aaa, #6c5ce7);
  box-shadow: 0 4px 16px rgba(74, 58, 170, 0.3);
}

.join-modal .btn-primary:hover {
  background: linear-gradient(135deg, #5a4abf, #7c6cf7);
  box-shadow: 0 6px 24px rgba(74, 58, 170, 0.4);
}

/* ===== MFA Code Inputs ===== */
.mfa-code-inputs {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.mfa-input {
  width: 3.5rem;
  height: 3.5rem;
  text-align: center;
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  border: 2px solid #d0d5dd;
  background: #fff;
  color: #1a1a2e;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mfa-input:focus {
  border-color: #4a3aaa;
  box-shadow: 0 0 0 3px rgba(74, 58, 170, 0.2);
}

.link-copied {
  display: block;
  font-size: 0.8rem;
  color: #00e5ff;
  margin-top: 0.35rem;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.4);
}

.room-countdown {
  display: block;
  font-size: 0.85rem;
  color: #ffde59;
  margin-top: 0.5rem;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(255, 222, 89, 0.4);
}

/* ===== Error Message ===== */
.error-message {
  background: rgba(220, 38, 38, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 4px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  width: 100%;
}

/* ===== Nav Links ===== */
.leaderboard-link {
  font-family: 'Fredoka One', cursive;
  font-weight: 900;
  color: #ffde59;
  text-decoration: none;
  font-size: 1.3rem;
  transition: color 0.2s, text-shadow 0.2s;
  letter-spacing: 0.5px;
}

.leaderboard-link:hover {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 222, 89, 0.6);
  text-decoration: underline;
}

.top-leaders {
  text-align: center;
  width: 100%;
}

.top5-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.top5-table th {
  font-family: 'Fredoka One', cursive;
  color: #ff6ec7;
  padding: 0.4rem 0.5rem;
  border-bottom: 2px solid rgba(255, 110, 199, 0.3);
  text-align: left;
}

.top5-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #e0c3fc;
}

.top5-table tr:hover td {
  background: rgba(255, 110, 199, 0.08);
}

.nav-links a {
  font-weight: 700;
  color: #ffde59;
  text-decoration: none;
  font-size: 1.05rem;
  transition: color 0.2s, text-shadow 0.2s;
}

.nav-links a:hover {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 222, 89, 0.6);
  text-decoration: underline;
}

/* ===== Dev Mode ===== */
.dev-mode-section {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 2px dashed #a78bcc;
  border-radius: 4px;
  background: rgba(167, 139, 204, 0.08);
  text-align: center;
}
.dev-mode-section h2 {
  margin-bottom: 0.25rem;
  font-size: 1.2rem;
  color: #e0c3fc;
}
.dev-hint {
  font-size: 0.85rem;
  color: #a78bcc;
  margin-bottom: 1rem;
}
.dev-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-dev {
  padding: 0.75rem 1.25rem;
  border: 2px solid #a78bcc;
  border-radius: 4px;
  background: rgba(167, 139, 204, 0.15);
  color: #e0c3fc;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-dev:hover {
  background: rgba(167, 139, 204, 0.3);
  border-color: #e0c3fc;
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(167, 139, 204, 0.3);
}

/* ===== Footer ===== */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 0.75rem;
  font-size: 0.85rem;
  color: #a78bcc;
  background: rgba(26, 10, 46, 0.9);
  backdrop-filter: blur(4px);
  border-top: 1px solid rgba(255, 110, 199, 0.2);
  z-index: 2;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  body {
    overflow-x: hidden;
  }

  .title {
    font-size: 2.5rem;
  }

  .tagline {
    font-size: 1.05rem;
  }

  .landing-container {
    padding: 1.5rem 1rem 5rem;
  }

  .input-field {
    font-size: 1rem;
    min-height: 44px;
    max-width: 100%;
  }

  .btn-primary,
  .btn-secondary {
    font-size: 1rem;
    padding: 0.75rem 1.75rem;
    min-height: 44px;
  }

  .room-actions {
    flex-direction: column;
    width: 100%;
  }

  .room-actions .btn-secondary {
    width: 100%;
  }

  .nav-links a {
    font-size: 1rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .error-message {
    font-size: 0.875rem;
  }
}
