:root {
  --bg: #0b1533;
  --panel: #0f214b;
  --panel-2: rgba(255,255,255,0.06);
  --accent: #ffd54a;
  --accent-2: #ffe484;
  --text: #f4f7ff;
  --muted: #a8b7d9;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #4a90e2;
  --ring: rgba(255, 213, 74, 0.55);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.45);
  --shadow-md: 0 10px 24px rgba(0,0,0,0.35);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(255,255,255,0.06), transparent 60%),
              radial-gradient(900px 500px at 100% 0%, rgba(255, 213, 74, 0.08), transparent 55%),
              linear-gradient(160deg, #08102a, #0b1533 50%, #0a1330);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: clamp(12px, 3vw, 24px);
  padding-right: clamp(12px, 3vw, 24px);
}

/* Header & Logo */
.header {
  padding: 24px 0;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  backdrop-filter: blur(6px);
}

.nav {
  display: flex;
  gap: 12px;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}
/* Sticky bottom action bar for game page */
.game-action-bar {
  margin: 24px auto 0 auto;
  padding: 12px 16px;
  max-width: 1200px;
  background: linear-gradient(180deg, rgba(8,16,36,0.25), rgba(8,16,36,0.5));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  display: flex;
  gap: 12px;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.game-action-bar .btn-secondary {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.22);
}


.logo {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}

.logo-icon {
  font-size: 52px;
  filter: drop-shadow(0 6px 12px rgba(255, 213, 74, 0.35));
}

.logo-text h1 {
  margin: 0;
  font-size: clamp(3.2rem, 5.6vw, 4.8rem);
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
  letter-spacing: -0.02em;
}

.logo-text p {
  margin: 4px 0 0 0;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 44px 0;
  margin-bottom: 40px;
}

.hero-content h2 {
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 700;
  margin: 0 0 16px 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--muted);
  margin: 0 0 32px 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-features {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.feature {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  font-weight: 500;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.feature:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.18);
}

.feature-icon {
  font-size: 1.5rem;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1a1a;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 8px 22px rgba(255, 213, 74, 0.24);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(255, 213, 74, 0.34);
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 12px 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
}

button:focus-visible, .btn-primary:focus-visible, .btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* Authentication */
.auth-section {
  max-width: 400px;
  margin: 0 auto 48px auto;
  text-align: center;
}

.auth-buttons {
  display: flex !important;
  flex-direction: row !important;
  gap: 16px;
  justify-content: center;
  margin-bottom: 24px;
  align-items: center;
}

.auth-form {
  background: linear-gradient(180deg, rgba(14, 30, 70, 0.55), rgba(16, 34, 78, 0.6));
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
  max-width: 350px;
  margin: 0 auto;
}

.auth-form h3 {
  margin: 0 0 24px 0;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  color: var(--accent);
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  color: var(--muted);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Welcome Section */
.welcome-section {
  text-align: center;
  padding: 48px 0;
}

.welcome-content h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: var(--accent);
}

.welcome-content p {
  font-size: 1.25rem;
  color: var(--muted);
  margin: 0 0 32px 0;
}

.welcome-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* User Dashboard */
.user-dashboard {
  max-width: 800px;
  margin: 0 auto;
}

.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 24px;
  background: rgba(15, 42, 98, 0.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  backdrop-filter: blur(6px);
}

.user-welcome h2 {
  margin: 0 0 8px 0;
  font-size: 1.75rem;
  font-weight: 600;
}

.user-welcome p {
  margin: 0;
  color: var(--muted);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.saved-games {
  min-height: 200px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h4 {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.empty-state p {
  margin: 0;
  font-size: 1rem;
}

/* Game Setup */
.game-setup {
  max-width: 800px;
  margin: 0 auto;
}

.setup-header {
  text-align: center;
  margin-bottom: 32px;
}

.setup-header h2 {
  margin: 0 0 8px 0;
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
}

.setup-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
}

form#setup-form {
  display: grid;
  gap: 16px;
  background: rgba(15, 42, 98, 0.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(6px);
}

.setup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
}

.setup-field {
  display: grid;
  gap: 8px;
}

.setup-field:last-child {
  min-width: 120px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #1a1a1a;
  font-weight: bold;
  font-size: 12px;
}

.custom-categories {
  margin-top: 8px;
}

.custom-categories textarea {
  width: 100%;
  background: rgba(10, 20, 50, 0.6);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}

label { 
  font-size: 14px; 
  color: var(--muted); 
  font-weight: 500;
}

input, select {
  background: rgba(10, 20, 50, 0.55);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

button:disabled { 
  opacity: 0.6; 
  cursor: not-allowed; 
}

#status { 
  margin: 12px 0; 
  color: var(--muted); 
  text-align: center;
}

.hidden { 
  display: none; 
}

#scoreboard.hidden, #board.hidden, .modal.hidden { 
  display: none; 
}

#scores { 
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.player-card {
  background: linear-gradient(180deg, rgba(16, 34, 78, 0.6), rgba(12, 26, 60, 0.6));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  position: relative;
  box-shadow: var(--shadow-md);
}

.player-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

.player-card h3 { 
  margin: 0 0 16px 0; 
  font-size: 18px; 
  font-weight: 600;
  color: var(--text);
}

.player-score { 
  font-size: 30px; 
  font-weight: 800; 
  color: var(--accent);
  margin-bottom: 16px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.player-card button {
  font-size: 12px;
  padding: 8px 12px;
  margin: 4px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  min-width: 60px;
}

.player-card button:first-child {
  background: var(--accent);
  color: #1a1a1a;
}

.player-card button:nth-child(2) {
  background: var(--info);
  color: white;
}

.player-card button:nth-child(3) {
  background: var(--success);
  color: white;
}

.player-card button:nth-child(4) {
  background: var(--danger);
  color: white;
}

.player-card button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Player card feedback */
.player-card.flash-gain {
  box-shadow: 0 0 0 2px #1fa971, 0 0 24px rgba(31,169,113,0.5);
}
.player-card.flash-loss {
  box-shadow: 0 0 0 2px #dc3545, 0 0 24px rgba(220,53,69,0.5);
}

.score-float {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 28px;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
  animation: floatUp 900ms ease-out forwards;
}
.score-float.gain { color: #28a745; }
.score-float.loss { color: #dc3545; }

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -28px); }
}

.current-player { 
  text-align: center; 
  font-weight: 600; 
  color: var(--accent); 
  margin-bottom: 4px; 
}

.player-card.current-turn { 
  outline: 2px solid var(--accent); 
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.3);
}

/* Scoreboard Header */
#scoreboard h2 {
  text-align: center;
  color: var(--accent);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Timer */
.timer {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  margin: 12px 0;
  transition: color 0.3s ease;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.timer.warning { 
  color: var(--warning); 
}

.timer.danger { 
  color: var(--danger); 
  animation: pulse 1s infinite; 
}

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

/* Loading spinner */
.status-loading { 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
  color: var(--muted); 
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.spinner-label { 
  font-size: 14px; 
}

@keyframes spin { 
  to { transform: rotate(360deg); } 
}

/* Board */
#board {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  overflow-x: hidden;
}

.cell, .header-cell {
  background: linear-gradient(180deg, rgba(17, 36, 82, 0.85), rgba(14, 30, 70, 0.9));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  min-height: clamp(56px, 14vw, 100px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(6px, 2.5vw, 14px);
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.cell::before, .header-cell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
  pointer-events: none;
}

.cell:hover {
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}

.header-cell {
  font-weight: 700;
  color: var(--accent);
  min-height: clamp(48px, 12vw, 80px);
  font-size: clamp(0.8rem, 2.6vw, 1rem);
  background: linear-gradient(180deg, rgba(20, 42, 92, 0.9), rgba(16, 34, 78, 0.9));
  border-color: rgba(255,255,255,0.12);
}

.cell { 
  cursor: pointer; 
  font-size: clamp(14px, 5vw, 32px); 
  font-weight: 800; 
  color: var(--text);
}

.cell.answered { 
  opacity: 0.6; 
  cursor: pointer; 
  transform: none;
  background: rgba(10, 20, 50, 0.5);
  color: var(--accent);
  font-size: 20px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: grid;
  place-items: center;
  z-index: 1000;
}

.modal-content {
  background: linear-gradient(180deg, rgba(11, 27, 61, 0.92), rgba(10, 24, 54, 0.95));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  min-width: 320px;
  max-width: 720px;
  width: min(92vw, 720px);
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal-body { 
  margin: 16px 0; 
}

#modal-question { 
  font-size: 18px; 
  margin: 8px 0; 
  line-height: 1.5;
}

#modal-answer { 
  width: 100%; 
  margin: 8px 0; 
}

.modal-actions { 
  display: flex; 
  gap: 8px; 
  flex-wrap: wrap;
}

#modal-result { 
  margin-top: 12px; 
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  font-weight: 500;
}

#modal-result.success {
  background: rgba(40, 167, 69, 0.18);
  border-left: 3px solid #28a745;
}
#modal-result.error {
  background: rgba(220, 53, 69, 0.2);
  border-left: 3px solid #dc3545;
}
#modal-result.warning {
  background: rgba(255, 193, 7, 0.18);
  border-left: 3px solid #ffc107;
}

/* Emphasize action buttons */
#modal-correct { background: var(--success); color: #fff; }
#modal-incorrect { background: var(--danger); color: #fff; }
#modal-steal { background: var(--warning); color: #1a1a1a; }
#modal-show-answer { background: var(--info); color: #fff; }
#modal-regenerate { background: rgba(255,255,255,0.1); color: var(--text); }

#modal-steal.active { box-shadow: 0 0 0 2px var(--warning), 0 0 16px rgba(255,193,7,0.5); }

/* Flip card styles */
.flip-card {
  perspective: 1000px;
  width: 100%;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  min-height: 160px;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.flip-card-inner.flipped {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(10, 20, 50, 0.7);
  backface-visibility: hidden;
}

.flip-card-front {
  color: var(--text);
}

.flip-card-back {
  transform: rotateY(180deg);
  color: var(--accent);
  font-weight: 700;
}

/* Steal functionality */
.steal-button {
  background: var(--warning);
  color: white;
  font-weight: 600;
}

.steal-section {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 107, 53, 0.1);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 8px;
}

.steal-section h4 {
  margin: 0 0 8px 0;
  color: var(--warning);
  font-size: 14px;
}

.steal-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.steal-buttons button {
  background: var(--warning);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}

.steal-buttons button:hover {
  background: #e55a2b;
}

.steal-buttons button:disabled {
  background: #666;
  cursor: not-allowed;
}

/* Chatbot Sidebar */
.chatbot-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 350px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(10, 24, 54, 0.96), rgba(9, 22, 50, 0.96));
  border-left: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-xl);
}

.chatbot-sidebar.open {
  transform: translateX(0);
}

.chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.chatbot-header h3 { 
  margin: 0; 
  color: var(--accent); 
}

.chatbot-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  padding: 8px 12px;
  border-radius: 8px;
  max-width: 80%;
  word-wrap: break-word;
}

.chat-message.user {
  background: var(--accent);
  color: #1a1a1a;
  align-self: flex-end;
}

.chat-message.assistant {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  align-self: flex-start;
}

.chatbot-input {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.chatbot-input input {
  flex: 1;
  background: rgba(10, 20, 50, 0.6);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 8px 12px;
}

.chatbot-input button {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  cursor: pointer;
  font-size: 24px;
  z-index: 999;
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
  transition: transform 0.2s ease;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
}

.chatbot-toggle.hidden {
  display: none;
}

/* Jar scoring visuals */
.jar-wrapper { 
  position: relative; 
  width: 60px; 
  height: 90px; 
  margin: 8px auto 0; 
}

.jar-body { 
  position: absolute; 
  inset: 0; 
  border: 3px solid var(--accent); 
  border-radius: 6px 6px 10px 10px; 
  background: rgba(255, 255, 255, 0.05); 
  overflow: hidden; 
}

.jar-fill { 
  position: absolute; 
  bottom: 0; 
  width: 100%; 
  background: var(--accent); 
  height: 0%; 
  transition: height 0.4s ease-in-out; 
}

.jar-total { 
  position: absolute; 
  top: -20px; 
  left: 50%; 
  transform: translateX(-50%); 
  color: var(--accent); 
  font-weight: 700; 
}

/* Coin animation */
.coin { 
  position: absolute; 
  left: 50%; 
  top: -24px; 
  width: 20px; 
  height: 20px; 
  border-radius: 50%; 
  background: var(--accent); 
  transform: translateX(-50%); 
  animation: coin-drop 0.7s ease-out forwards; 
  pointer-events: none; 
}

@keyframes coin-drop {
  0% { transform: translate(-50%, -40px) scale(0.8); opacity: 0; }
  70% { opacity: 1; }
  100% { transform: translate(-50%, 60px) scale(1); opacity: 1; }
}

.modal-note { 
  margin-top: 12px; 
  font-size: 12px; 
  color: var(--muted); 
  text-align: center; 
  font-style: italic; 
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .auth-buttons {
    gap: 12px;
  }
  
  .auth-form {
    max-width: 100%;
  }
  
  .hero-content h2 {
    font-size: 2rem;
  }
  
  .hero-content p {
    font-size: 1rem;
  }
  
  .hero-features {
    flex-direction: column;
    align-items: center;
  }
  
  .setup-row {
    grid-template-columns: 1fr;
  }
  
  .user-header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .section-header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .modal-actions {
    justify-content: center;
  }
  
  .chatbot-sidebar {
    width: 100%;
  }
  
  #scores {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  
  .player-card {
    min-width: 180px;
    padding: 16px;
  }
  
  #board { gap: 6px; max-width: 100%; }
  
  .cell, .header-cell {
    min-height: clamp(52px, 16vw, 70px);
    padding: 8px;
  }
  
  .header-cell {
    font-size: 0.8rem;
    min-height: 60px;
  }
  
  .cell {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  #board { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .cell, .header-cell { min-height: 56px; font-size: 0.85rem; padding: 6px; }
}


/* Site Footer */
.footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 40px;
  padding: 20px 0;
  background: rgba(10, 20, 50, 0.4);
  backdrop-filter: blur(4px);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 24px; /* new: give breathing room on small & large screens */
}

.footer small {
  color: var(--muted);
}

.footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-nav a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .footer-content { flex-direction: column; text-align: center; }
}

/* Footer container fixes */
.footer > .footer-content { max-width: 1200px; margin: 0 auto; box-sizing: border-box; }

/* Hero image */
.hero-image {
  margin-top: 32px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
