/* Modern NBA Teammate Game Styling */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@900&display=swap');


:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #dc2626;
  --secondary-hover: #b91c1c;
  --accent-color: #059669;
  --danger-color: #ef4444;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  
  --text-primary: #1e293b;        /* Dark text on light backgrounds */
  --text-secondary: #475569;      /* Medium gray text */
  --text-muted: #64748b;          /* Light gray text */
  
  /* Lightened background colors */
  --bg-primary: #ffffff;          /* Pure white */
  --bg-secondary: #f8fafc;        /* Very light blue-gray */
  --bg-card: #ffffff;             /* White cards */
  --border-color: #e2e8f0;        /* Light gray borders */
  --border-hover: #cbd5e1;        /* Slightly darker borders */
  
  --border-hover: #cbd5e1;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
  min-height: 100vh;
  color: var(--text-primary);
  font-weight: 400;
  display: flex;
  flex-direction: column;
}

/* Navigation with dark overhang */
nav {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid #475569;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  box-sizing: border-box;
  margin: 0; /* Ensure no margin */
  position: relative;
  top: 0; /* Ensure it's at the very top */
}


#nav-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.025em;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}


/* Subtle underline accent for nav-title */
#nav-title::after {
  content: "";
  position: absolute;
  bottom: -0.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, white, transparent);
  border-radius: 2px;
  opacity: 0.8;
}


#nav-home-link {
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
  flex-shrink: 0;
}

#nav-title-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}


#nav-home-link:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#nav-title-link:hover #nav-title {
  color: #007bff;
  transition: color 0.2s ease;
}

/* Dropdown styles */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  background: none;
  border: 1px solid #dee2e6;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.nav-dropdown-btn:hover {
  background-color: #e9ecef;
}

.dropdown-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-content {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  min-width: 120px;
  z-index: 1000;
  display: none;
}

.nav-dropdown.open .nav-dropdown-content {
  display: block;
}

.nav-dropdown-content a {
  display: block;
  padding: 10px 15px;
  text-decoration: none;
  color: #333;
  border-bottom: 1px solid #f8f9fa;
  transition: background-color 0.2s ease;
}

.nav-dropdown-content a:last-child {
  border-bottom: none;
}

.nav-dropdown-content a:hover {
  background-color: #f8f9fa;
}


.main-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
}

#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid #475569;
  z-index: 1000;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}


/* Game Introduction Styles */
.game-intro {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.game-intro h1 {
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-size: 2.5rem;
  font-weight: 700;
}

.game-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
  line-height: 1.5;
}


.nba-loader {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.basketball-icon {
  width: 32px;
  height: 32px;
  animation: bounce 1.4s infinite ease-in-out;
}

.basketball-icon:nth-child(1) {
  animation-delay: -0.32s;
}
.basketball-icon:nth-child(2) {
  animation-delay: -0.16s;
}
.basketball-icon:nth-child(3) {
  animation-delay: 0s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: translateY(0);
  } 
  40% {
    transform: translateY(-12px);
  }
}


/* Game Setup Container */
.game-setup-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

/* Step Progress Indicator */
.setup-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 3rem;
  gap: 2rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  opacity: 0.6;
}

.step.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--primary-color);
  opacity: 1;
}

.step-number {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.step-label {
  font-weight: 600;
  color: var(--text-primary);
}

/* Selection Grid Layout */
.selection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.selection-grid.fade-out {
  opacity: 0;
  transform: translateY(-10px);
}

.selection-grid.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Era selection specific styling */
#eraSelection {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#eraSelection.show {
  opacity: 1;
  transform: translateY(0);
}

.era-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

/* Selection Card Styling */
.selection-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.selection-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 
    0 10px 30px rgba(37, 99, 235, 0.2),
    0 0 0 1px rgba(37, 99, 235, 0.1);
}

.selection-card.selected {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.15);
  transform: translateY(-3px);
}

.selection-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.selection-card:hover::before,
.selection-card.selected::before {
  opacity: 1;
}

/* Selection Card Content */
.selection-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.selection-card h3 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.selection-era {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.selection-description {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.selection-features {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.selection-features li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.25rem 0;
  position: relative;
  padding-left: 1.5rem;
}

.selection-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success-color);
  font-weight: bold;
}

.selection-btn {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: auto;
}

.selection-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Make steps clickable when not active */
.step {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.step:hover:not(.active) {
  opacity: 0.8;
}

.step.active {
  cursor: default;
}

/* Visual feedback for clickable steps */
.step:not(.active):hover .step-number {
  background-color: var(--primary-color);
  color: white;
}



/* Era Step Animation */
.era-step {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.5s ease;
  pointer-events: none;
}

.era-step.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.era-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.era-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  text-align: center;
}


/* Settings page styling */
.settings-section {
  margin: 2rem 0;
}

.section-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.era-options, .time-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.era-option, .time-option {
  cursor: pointer;
}

.era-option input, .time-option input {
  display: none;
}

.era-card, .time-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  width: 100%;
  min-height: 80px;
}

.era-option input:checked + .era-card,
.time-option input:checked + .time-card {
  border-color: var(--primary-color);
  background: rgba(var(--primary-color-rgb), 0.1);
}

.era-card:hover, .time-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.era-name, .time-name {
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.era-years, .time-duration {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.time-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.settings-actions {
  margin-top: 2rem;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  grid-column: 1 / -1; 
  justify-content: center;
}

.settings-header .settings-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.start-game-btn {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  min-width: 200px;
}

.selection-grid.fade-out {
  opacity: 0;
  transform: translateY(-10px);
}

#gameSettings:not(.hidden) {
  display: block !important;
  max-width: 800px !important;
  margin: 0 auto !important;
  padding: 2rem !important;
}


.settings-unified-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

.settings-section {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.settings-section:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 
    0 10px 30px rgba(37, 99, 235, 0.2),
    0 0 0 1px rgba(37, 99, 235, 0.1);
}

/* Section titles */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* Options within each section */
.era-options, .time-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-grow: 1;
}

/* Individual option styling */
.era-card, .time-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  cursor: pointer;
}

.era-option input:checked + .era-card,
.time-option input:checked + .time-card {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}

/* Start button spans full width */
.settings-actions {
  grid-column: 1 / -1;
  margin-top: 2rem;
  text-align: center;
}

#gameSettings .settings-subtitle {
  grid-column: 1 / -1; /* Span full width */
  text-align: center;
  margin-bottom: 1rem;
}

#gameSettings .settings-section {
  margin: 0; /* Remove default margin since grid handles spacing */
}

#gameSettings .settings-actions {
  grid-column: 1 / -1; /* Span full width */
  margin-top: 1rem;
}


/* Integrated game info display */
.game-info {
  display: inline-flex;
  align-items: center;
  margin-left: 1rem;
  font-size: 0.9rem;
}

.info-separator {
  margin: 0 0.5rem;
  color: var(--text-secondary);
  font-weight: bold;
}

.era-label {
  color: var(--text-secondary);
  margin-right: 0.25rem;
}

.era-value {
  color: var(--primary-color);
  font-weight: 600;
  background: rgba(var(--primary-color-rgb), 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Hide private-only elements by default */
.private-only {
  display: none !important;
}

/* Show private-only elements when in private game */
.private-game .private-only {
  display: inline-flex !important;
}

/* Matched Screen Styling */
#matchedScreen {
  background: var(--bg-card);
  border: 2px solid var(--success-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  margin: 2rem auto;
}

#matchedMessage {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.2) 100%);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-weight: 600;
}

#countdownContainer {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid var(--border-color);
}

#countdownTimer {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
  animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}


/* Fixed height for message container to prevent layout shifts */
#messageContainer {
  min-height: 60px; /* Adjust this value based on your typical message height */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

/* Ensure messages are properly centered within the fixed container */
#messageContainer .message {
  margin: 0; /* Remove top margin since container handles spacing */
  width: 100%;
  max-width: 100%;
}


.message.opponent-incorrect {
  background-color: #fff3cd !important;
  border: 1px solid #ffeaa7 !important;
  color: #856404 !important;
  font-weight: 500;
}


/* How to Play Styles */
.how-to-play {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.how-to-play h3 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.rule-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.rule-number {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.rule-item p {
  margin: 0;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
}


/* Typography */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}


h2 {
  font-size: 1.875rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Cards and Containers */
section[data-route] {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-xl);
  margin: 1rem auto;
  border: 2px solid var(--border-color);
  max-width: 800px;
  width:100%;
}


section[data-route="/gameover"] {
  order: 1;
  position: relative;
  z-index: 10;
}


/* Form Elements */
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s ease;
  font-family: inherit;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="text"]::placeholder, input[type="email"]::placeholder, input[type="password"]::placeholder {
  color: var(--text-muted);
}

/* Buttons */
button {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  background: var(--text-muted);
  color: var(--bg-primary);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Game Mode Buttons */
#privateGameBtn, #findGameBtn {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  padding: 1.25rem 2rem;
  font-size: 1.125rem;
  margin: 0.75rem;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  border: 2px solid #1e40af;
  color: white;
  font-weight: 600;
}

#privateGameBtn:hover, #findGameBtn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
  transform: translateY(-2px);
  border-color: #1e3a8a;
}

#privateGameBtn:active, #findGameBtn:active {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  transform: translateY(0);
}


/* Secondary action button for back navigation */
.secondary-action {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 10;
  box-shadow: none;
}

.secondary-action:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

/* Game Area */
#gameArea, #waitingRoom {
  display: block;
  overflow: visible;
  overflow-x: hidden;
  padding-bottom: 1rem;
  max-width: 800px;
  min-height: 600px;
  width: 100%;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.game-content,
.guess-section,
#successful-guesses-container {
  max-width: 100%;
  width: 100%;
}

#playersDisplay {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  margin: 0.125rem 0;
  font-size: 0.8rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
}

.opponent-label {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
}

.player-name.opponent {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: rgba(30, 64, 175, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(30, 64, 175, 0.2);
  font-size: 0.8rem;
}

.player-name {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  border: 1px solid transparent;
}



.player-name.active-turn {
  border-color: var(--primary-color);
  color: var(--primary-color);
  /* Remove heavy glow animation */
}



@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(34, 197, 94, 0.5); }
  50% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.8); }
}

.vs-separator {
  color: var(--text-muted);
  font-weight: 400;
  padding: 0 1rem;
}



@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 30px rgba(34, 197, 94, 0.5); }
}


/* Timer */
#timer-container {
  display: flex;
  justify-content: center;
  width: 100px;        /* ✅ Add default size */
  height: 100px;       /* ✅ Add default size */
  margin: 0 auto;      /* ✅ Add centering */
  position: relative;  /* ✅ Add positioning */
  grid-column: 2;
  justify-self: center;
}

/* Progress Ring SVG */
.progress-ring {
  width: 100px;        /* ✅ Match container size */
  height: 100px;       /* ✅ Match container size */
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
  z-index: 1001;
}
.progress-ring-track {
  stroke: #e5e7eb;
  stroke-width: 6;
  fill: transparent;
}

.progress-ring-circle {
  fill: none;
  stroke: #00cc99; /* Default color */
  stroke-width: 6;
  transition: stroke-dashoffset 0.3s linear, stroke 0.3s ease;
  transform: none;
  transform-origin: 50% 50%;
}

/* Timer Text */
 #timer {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  z-index: 1002 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
  line-height: 1 !important;
  background: none !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Color States */
.progress-ring-circle.low-time {
  stroke: #f59e0b;
}

.progress-ring-circle:not(.low-time):not(.critical-time) {
  stroke: #fbbf24 !important;
}

.progress-ring-circle.critical-time {
  stroke: #ef4444;
  animation: critical-pulse 0.5s infinite;
}

@keyframes critical-pulse {
  0%, 100% { 
    stroke-width: 6;
    opacity: 1;
  }
  50% { 
    stroke-width: 8;
    opacity: 0.8;
  }
}


/* Leadoff career section in main game area */
.leadoff-career-content {
  padding: 12px;
  background: #fafafa;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  font-size: 13px;
  width: 100%; /* Ensure it matches header width */
  box-sizing: border-box; /* Include padding in width calculation */
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.career-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  transition: background 0.3s ease;
}

.career-header:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.career-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.toggle-career-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  pointer-events: none; /* Prevent double-click since header is clickable */
}

.toggle-career-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.toggle-icon {
  font-size: 10px;
  transition: transform 0.3s ease;
}

.leadoff-career-content {
  padding: 15px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
    padding-top: 20px;
    padding-bottom: 20px;
  }
}

.career-summary {
  margin-bottom: 20px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.total-years {
  font-size: 15px;
  color: #495057;
}

.team-stints-section h4 {
  margin: 0 0 15px 0;
  color: #343a40;
  font-size: 15px;
  font-weight: 600;
}

.team-stints {
  display: grid;
  gap: 4px;
}

.team-stint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  transition: all 0.2s ease;
  min-height: 20px;
}

.team-stint:last-child {
  border-bottom: none;
}

.team-stint:hover {
  background: #f1f3f4;
  transform: translateX(2px);
}

.team-name {
  font-weight: 500;
  color: #343a40;
  font-size: 14px;
  flex: 0 0 auto; /* Don't shrink */
  margin-right: 8px; /* Add space between team and years */
}

.years {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  flex: 0 0 auto;
  text-align: right;
}

.career-loading {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 30px 20px;
  font-size: 14px;
}

.career-error {
  text-align: center;
  color: #dc3545;
  padding: 30px 20px;
  font-size: 14px;
  background: #f8d7da;
  border-radius: 6px;
  border: 1px solid #f5c6cb;
}


/* Compact Turn Section - All Devices */
#turnSection {
  margin-bottom: 1rem;
  padding: 1rem;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  min-height: 200px;
}

/* Compact Turn Prompt */
.turn-prompt {
  text-align: center;
  margin: 0;
}

.prompt-header {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.player-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

#currentPlayerHeadshot {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-color);
  flex-shrink: 0;
  overflow: hidden;
  display: block;
}

.player-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.turn-player-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
}

/* Career Link Styling */
.career-link {
  font-size: 0.875rem;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.career-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.career-arrow {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

/* Timer-Skip Row */
.timer-skip-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: 1rem;
  gap: 1rem;
}


/* Skip Link Styling */
.skip-link {
  grid-column: 3;
  justify-self: start;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.2);
  white-space: nowrap;
  grid-column: 3;
  justify-self: start;
}

.skip-link:hover:not(.disabled) {
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.3);
  text-decoration: none;
  transform: translateY(-1px);
}

.skip-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  color: var(--text-muted);
  background: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.2);
}

.skip-link.disabled::after {
  font-size: 0.75rem;
  font-style: italic;
}

.game-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  grid-column: 3;
  justify-self: start;
  align-items: flex-start;
}

.resign-btn {
  background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
  min-width: 100px;
}

.resign-btn:hover:not(.disabled) {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.resign-btn.hidden {
  display: none !important;
}

/* Leadoff Career Section - Compact */
.leadoff-career-section {
  width: 100%;
  margin: 0.5rem 0;
}

.leadoff-career-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.5rem;
}



/* Guess Controls */
#guessControls {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: stretch;
  position: relative;
  /* Remove any height constraints */
  min-height: auto !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

#guessControls input {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.25rem;
  font-size: 1.125rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
}

#submitGuessBtn {
  padding: 1rem 2rem;
  font-size: 1.125rem;
  min-width: 140px;
  min-height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-color) 0%, #047857 100%);
  font-weight: 600;
}

#submitGuessBtn:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857 0%, var(--accent-color) 100%);
}


/* Autocomplete */
#autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 140px;
  z-index: 9999; /* High z-index to appear above everything */
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: visible;
  box-shadow: var(--shadow-lg);
  margin-top: 0.25rem;
  /* Ensure it's not clipped by parent containers */
  clip-path: none !important;
}

.autocomplete-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid var(--border-color);  /* Light border */
  color: var(--text-primary);  /* Dark text */
}

.autocomplete-item:last-child {
  border-bottom: none;
}

/* Enhanced hover/selection state */
.autocomplete-item:hover,
.autocomplete-item.selected {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 
    inset 0 0 0 2px rgba(37, 99, 235, 0.3),
    0 2px 8px rgba(37, 99, 235, 0.4);
  transform: translateX(4px);
}

/* Active/pressed state for mobile */
.autocomplete-item:active {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #1e3a8a 100%);
  transform: translateX(2px) scale(0.98);
}

/* Enhanced career years styling in selected state */
.autocomplete-item:hover .career-years,
.autocomplete-item.selected .career-years {
  color: #dbeafe;
  font-weight: 600;
}

/* Selection indicator arrow */
.autocomplete-item:hover::after,
.autocomplete-item.selected::after {
  content: "→";
  position: absolute;
  right: 0.5rem;
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
  animation: slideIn 0.2s ease;
}

.career-years {
  font-size: 0.875rem;
  color: var(--text-secondary);  /* Dark gray text */
  font-weight: 500;
  margin-left: 5px;
}


@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}


/* Messages */
.message {
  margin-top: 1rem;
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  text-align: center;
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  font-weight: 500;
}

.message:not(.error) {
  /* background: rgba(34, 197, 94, 0.2); */
  color: var(--text-secondary);
  /* border: 1px solid rgba(34, 197, 94, 0.3); */
}

.message.error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.message.fade-out {
  opacity: 0;
  transform: translateY(-10px);
}

/* Successful Guesses */
#successful-guesses-container {
  order: 2;
  position: relative;
  z-index: 5;
  margin-top: 1rem;
  text-align: center;
  clear: both;
  display: block;
  width: 100%;
}

#successful-guesses-list {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
}

#successful-guesses-list > div {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin: 1rem 0;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  color: var(--text-primary);
}

#successful-guesses-list > div:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Waiting Room */
#waitingRoom {
  text-align: center;
  padding: 2rem;
}

#waitingRoom p {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

#displayRoomCode {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);  /* Changed from #3b82f6 to use variable */
  background: var(--bg-secondary);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  display: inline-block;
  margin: 1rem 0;
  font-family: 'Monaco', 'Menlo', monospace;
}

#inviteLinkWrapper {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

#inviteLinkWrapper p {
  color: var(--text-secondary);
}

#inviteLink {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.875rem;
  margin: 0.5rem 0;
  background: var(--bg-primary);
}

#copyInviteBtn {
  background: linear-gradient(135deg, var(--accent-color) 0%, #047857 100%);
  margin-top: 0.75rem;
}

#shareInviteBtn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

#shareInviteBtn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}




/* Game Over */
#gameOverContainer {
  text-align: center;
  padding: 2rem;
  background: var(--bg-card) !important;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  position: relative;
  margin-bottom: 1rem;
  max-width: 800px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Remove separate container styling for game over message */
#gameOverContainer > div:first-child {
  background: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  margin-bottom: 1.5rem !important;
  border: none !important;
  font-weight: 700 !important;
  font-size: 1.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

/* Style the message text directly based on content */
#gameOverContainer > div[style*="color: green"] {
  color: #059669 !important;
  background: none !important;  /* No separate background */
  border: none !important;      /* No separate border */
}

#gameOverContainer > div[style*="color: darkred"] {
  color: #dc2626 !important;
  background: none !important;
  border: none !important;
}

#gameOverContainer > div[style*="color: gray"] {
  color: var(--text-primary) !important;
  background: none !important;
  border: none !important;
}

/* Centered rematch button */
#rematchBtn {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  padding: 1rem 2rem;
  font-size: 1.125rem;
  margin: 1.5rem auto 0 auto;
  font-weight: 600;
  display: block;
  width: fit-content;
}

/* Integrate Game Over Results into main container */
#gameOverResults {
  color: var(--text-primary) !important;
  background: var(--bg-secondary) !important;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0 1rem 0;
  border: 1px solid var(--border-color);
  max-width: 100%;
  box-sizing: border-box;
}

#gameOverResults p {
  margin: 0.5rem 0;
  font-weight: 500;
}

#gameOverResults strong {
  color: var(--primary-color) !important;
}



/* Auth Forms */
.auth-tabs-container {
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
}

.auth-tabs {
  display: flex;
  background: var(--bg-secondary);  /* Light container background */
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-color);  /* Light border */
  gap: 0.25rem;
}

.auth-tab {
  flex: 1;
  padding: 0.875rem 1.5rem;
  background: var(--bg-card);  /* Light background for inactive tabs */
  border: none;
  color: var(--text-secondary);  /* Dark gray text for inactive tabs */
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  border: 2px solid var(--border-color);  /* Light border */
  position: relative;
  opacity: 0.8;  /* Slightly transparent when inactive */
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 
    inset 0 -2px 8px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(37, 99, 235, 0.3),
    0 0 0 2px rgba(37, 99, 235, 0.2);  /* Blue glow */
  border-color: var(--primary-hover);
  transform: translateY(-2px);
  z-index: 2;
  opacity: 1;  /* Full opacity when active */
}

.auth-tab:hover:not(.active) {
  background: var(--bg-primary);  /* White on hover */
  color: var(--text-primary);     /* Darker text on hover */
  border-color: var(--border-hover);
  transform: translateY(-1px);
  opacity: 1;  /* Full visibility on hover */
  box-shadow: var(--shadow-sm);
}

.auth-tab.active::after {
  content: "";
  position: absolute;
  bottom: -0.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 4px;
  background: linear-gradient(90deg, transparent, white, transparent);
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


.auth-forms-row {
  display: flex;
  justify-content: center;
}

.auth-form {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 2.5rem 2rem;
  width: 100%; /* Full width of container */
  max-width: 800px; /* Match the container max-width */
  display: none;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-form.active {
  display: flex;
  border-color: var(--primary-color);
}

.auth-form h2 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

.auth-form input {
  padding: 1rem 1.25rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.auth-form input:focus {
  border-color: var(--primary-color);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-form input::placeholder {
  color: var(--text-muted);
}

.auth-form button {
  padding: 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
}

.auth-form p, .auth-form a {
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
}

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

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


/* Home Page Tabs - Similar to Auth Tabs */
.home-tabs-container {
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
}

.home-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-color);
  gap: 0.25rem;
}

.home-tab {
  flex: 1;
  padding: 0.875rem 1.5rem;
  background: var(--bg-card);
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  border: 2px solid var(--border-color);
  position: relative;
  opacity: 0.8;
}

.home-tab.active {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 
    inset 0 -2px 8px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(37, 99, 235, 0.3),
    0 0 0 2px rgba(37, 99, 235, 0.2);
  border-color: var(--primary-hover);
  transform: translateY(-2px);
  z-index: 2;
  opacity: 1;
}

.home-tab:hover:not(.active) {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  opacity: 1;
  box-shadow: var(--shadow-sm);
}

.home-tab.active::after {
  content: "";
  position: absolute;
  bottom: -0.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 4px;
  background: linear-gradient(90deg, transparent, white, transparent);
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}





/* Profile Section Styling */
.profile-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
}

/* Keep actions always at the bottom and full width */
.profile-actions {
  grid-column: 1 / -1; /* Span all columns */
  text-align: center;
  margin-top: 1rem;
}

.profile-info-card,
.profile-stats-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.profile-info-card h2,
.profile-stats-card h2 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
}

.profile-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.profile-field:last-child {
  border-bottom: none;
}

.profile-field label {
  font-weight: 600;
  color: var(--text-secondary);
}

.profile-field span {
  color: var(--text-primary);
  font-weight: 500;
}

section[data-route="/profile"] {
  padding: 0 !important;
  margin: 2rem auto !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.era-breakdown {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.era-breakdown h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.era-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.era-stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.era-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.era-record {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}


.signout-button {
  background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
  color: white;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.signout-button:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Ensure home section has relative positioning for absolute button */
#homeSelection {
  position: relative;
  flex-shrink: 0;
}



/* Utility Classes */
.hidden {
  display: none !important;
}



 /* Proper Playing Card Styling */
.card-deck-container {
  position: relative;
  width: 800px;
  max-width: 100%;
  height: 300px;
  margin: 2rem auto;
  perspective: 1000px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;
  -webkit-overscroll-behavior-x: none;
}

.player-card {
  position: relative;
  width: 200px;
  height: 280px;
  background: white;
  border: 2px solid #333;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  font-family: 'Georgia', serif;
  flex-shrink: 0;
  min-width: 200px;
  margin-right: -1px;
  opacity: 1 !important;
}


/* .player-card:nth-child(1) { 
  z-index: 10; 
  top: 0; 
  left: 0px;           
  transform: rotate(0deg);
  opacity: 1;
}

.player-card:nth-child(2) { 
  z-index: 9; 
  top: 0px;            
  left: 75px;          /
  transform: rotate(0deg);
  opacity: 1;
}

.player-card:nth-child(3) { 
  z-index: 8; 
  top: 0px; 
  left: 150px;         
  transform: rotate(0deg);
  opacity: 1;
}

.player-card:nth-child(4) { 
  z-index: 7; 
  top: 0px; 
  left: 225px;         
  transform: rotate(0deg);
  opacity: 1;
} */


/* Card suit corners */
.player-card::before,
.player-card::after {
  content: "" !important;
  position: absolute;
  width: 40px;
  height: 40px;
  background-image: var(--headshot-url);
  background-size: cover;
  background-position: center;
  border-radius: 50%;
  border: 2px solid #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}


.player-card::before {
  top: 0.5rem;
  left: 0.5rem;
}


.player-card::after {
  bottom: 0.5rem;
  right: 0.5rem;
}


/* Fallback for missing headshots */
.player-card:not([style*="--headshot-url"])::before,
.player-card:not([style*="--headshot-url"])::after {
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAvklEQVRoge3XsQ2AIBBF0ZLpDoBuwHFHqK8cQvMrIo3FLPHom/b2mX9rcNqZmZmZmZmZmZmdFz5ec3m6F3+v4PYs3PmR7JbiDD1N9g5IuT16CWYExozP7G9Czzxq/cE8ksYbFxExk2RcMUfYHNk0RMYPhk0QcMbJHUYyNsi9h5YDyYFSNqLD6c+5h3tGn+MO9ZftHJz5nz/rq3ZTzRzqkIxuYwAAAABJRU5ErkJggg==') !important;
}


/* Card types with different suits */
.player-card.leadoff {
  background: linear-gradient(135deg, #fff 0%, #f0f8ff 100%);
  border-color: var(--accent-color);
  color: var(--accent-color);
}



.player-card.your-guess {
  background: linear-gradient(135deg, #fff 0%, #f0fff0 100%);
  border-color: var(--success-color);
  color: #2d5a2d;
}



.player-card.opponent-guess {
  background: linear-gradient(135deg, #fff 0%, #f0f0ff 100%);
  border-color: var(--primary-color);
  color: #2d2d5a;
}


/* Card content */
.card-header {
  text-align: center;
  margin: 1rem 0 0.5rem 0;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 20px;  /* Increased padding to avoid headshots */
}

.card-player-name {
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  margin: 0.5rem 0;
  line-height: 1.2;
  padding: 0 20px;  /* Increased padding to avoid headshots */
}

.card-connection {
  font-size: 0.8rem;
  text-align: center;
  margin: 0.5rem 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 20px;  /* Increased padding to avoid headshots */
}

.card-footer {
  text-align: center;
  font-size: 0.7rem;
  margin-top: auto;
  padding: 0.5rem 20px;  /* Increased padding */
  border-top: 1px solid rgba(0,0,0,0.1);
}




/* Hover effects */
.player-card:hover {
  transform: translateY(-10px) rotate(0deg) !important;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  z-index: 20 !important;
}

/* Fan out effect on container hover
.card-deck-container:hover .player-card:nth-child(2) {
  transform: rotate(-8deg) translateX(-20px);
}

.card-deck-container:hover .player-card:nth-child(3) {
  transform: rotate(-12deg) translateX(-35px);
} */

/* New card animation */
.player-card.new-card {
  animation: dealCard 0.8s ease-out;
}

@keyframes dealCard {
  0% {
    transform: translateX(-300px) rotate(-45deg);
    opacity: 0;
  }
  50% {
    transform: translateX(0) rotate(10deg);
    opacity: 0.8;
  }
  100% {
    transform: rotate(0deg);
    opacity: 1;
  }
}

/* Game End Card Spread Animation */
/* .card-deck-container.game-ended {
  width: 100%;
  max-width: 800px;
  height: 350px;
  margin: 2rem auto;
  display: flex;
  justify-content: flex-start;  
  align-items: center;
  gap: 0;  
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 1rem;
  
  
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; 
  
  overscroll-behavior-x: none;
  -webkit-overscroll-behavior-x: none;
} */

.card-deck-container .player-card {
  position: relative;              /* Change from absolute */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: none;
  transform: rotate(0deg);
  opacity: 1 !important;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  z-index: auto;
  
  /* Maintain card dimensions */
  width: 200px !important;
  height: 280px !important;
  flex-shrink: 0;
  min-width: 200px;
  
  /* Cards touch each other */
  margin-right: -1px;              /* Slight overlap to prevent gaps */
  border: 2px solid #333;
}

/* Last card doesn't need margin */
.card-deck-container .player-card:last-child {
  margin-right: 0;
}


.card-deck-container .player-card:hover {
  transform: translateY(-10px) scale(1.02) !important;
  z-index: 20 !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
  margin-left: 5px;
  margin-right: 5px;
}


/* Responsive Design */

/* DESKTOP ONLY - Remove height constraints ONLY when game is active */
@media (min-width: 769px) {

  #gameOverContainer:not(.hidden) {
  display: block !important;
  overflow: visible !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  padding-bottom: 2rem;
  max-width: 800px !important;
  width: 100%;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

  
  /* Only apply to visible game area (when not hidden) */
  #gameArea:not(.hidden) {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding-bottom: 1rem;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  
  /* Only apply to sections within visible game area */
  #gameArea:not(.hidden) #turnSection,
  #gameArea:not(.hidden) #guessControls,
  #gameArea:not(.hidden) #successful-guesses-container {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #gameArea:not(.hidden) #timer-container {
    height: 100px !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  /* Autocomplete - only when game area is visible */
  #gameArea:not(.hidden) #autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 140px;
    z-index: 9999;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: 0.25rem;
    
    /* No height constraints only during active gameplay */
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }
  
  /* Hide scrollbars only in active game area */
  #gameArea:not(.hidden)::-webkit-scrollbar,
  #gameArea:not(.hidden) #autocomplete-list::-webkit-scrollbar,
  #gameArea:not(.hidden) #guessControls::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }


}

/* Ensure game area is properly hidden when not in use */
#gameArea.hidden {
  display: none !important;
  visibility: hidden !important;
  overflow: hidden !important;
}


/* Skip Toast Notification */
.skip-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 10000;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  animation: skipToastSlide 0.4s ease-out;
  border: 2px solid #92400e;
  min-width: 280px;
  max-width: 90vw;
}

@keyframes skipToastSlide {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.skip-toast.fade-out {
  animation: skipToastFadeOut 0.3s ease-in forwards;
}

@keyframes skipToastFadeOut {
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
}




@media (max-width: 768px) {
html {
    height: auto;
    min-height: 100vh;
  }

 body {
    min-height: 100vh;
    height: auto; /* Allow body to grow */
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100vw !important;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
  }

  section[data-route],
  #gameArea,
  #waitingRoom,
  #gameOverContainer,
  .main-content,
  .auth-tabs-container,
  .home-tabs-container {
    max-width: 100vw !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

    nav {
        padding: 0 1rem;
        height: 48px;
        margin: 0;
        width: 100vw;
        /* Ensure full viewport width */
    }

    #nav-title {
        font-size: 1.1rem;
    }

    #nav-home-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }

    .nav-dropdown-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

   .game-intro h1 {
    font-size: 2rem;
  }
  
  .game-subtitle {
    font-size: 1.1rem;
  }
  
  .rules-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .rule-item {
    padding: 0.875rem;
  }
  
  .how-to-play {
    padding: 1.5rem;
  }
  
  h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    min-height: 2rem;
  }
  
  h1::before {
    font-size: 1.25rem;
  }
  
  h1::after {
    width: 50px;
    height: 2px;
  }

   .profile-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem; /* Reduced from 1.5rem for more screen space */
  }
  
  .profile-info-card,
  .profile-stats-card {
    padding: 1.5rem;
  }
  
  .profile-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  #matchedScreen {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  #matchedMessage {
    font-size: 1.25rem;
    padding: 1rem;
  }
  
  #countdownTimer {
    font-size: 2.5rem;
  }

  .leadoff-career-section {
    margin: 5px 0;
  }
  
  .career-header {
    padding: 12px 15px;
  }
  
  .career-header h3 {
    font-size: 14px;
  }
  
  .leadoff-career-content {
    padding: 15px;
  }
  
  .team-stint {
    padding: 10px 6px; /* Even more spacing on mobile */
    min-height: 28px;
  }

  .team-name {
    font-size: 14px;
    margin-right: 16px;
  }
  
  .years {
     font-size: 13px;
  }
  
  .toggle-career-btn {
    font-size: 11px;
    padding: 5px 10px;
  } */



   .setup-progress {
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  .step {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }
  
  .step-label {
    font-size: 0.9rem;
  }
  
  .selection-grid,
  .era-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .selection-card {
    padding: 1.5rem;
  }
  
  .selection-icon {
    font-size: 2.5rem;
  }
  
  .era-title {
    font-size: 1.5rem;
  }

    #gameSettings {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  
  .settings-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    justify-content:center;
  }

    .settings-unified-grid {
      grid-template-columns: 1fr;
      gap: 1.5rem;
      max-width: 100%;
    }

    .settings-section {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  /* Match the selection-card styling for consistency */
  min-height: auto;
}
  
 section[data-route] {
    padding: 1rem 1.5rem;  /* Even more compact on mobile */
    margin-bottom: 1rem;
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
  }

  .timer-skip-row {
    gap: 1rem;
  }

  .skip-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    margin-top: 0.5rem;
    grid-column: 3;
    /* justify-self: center; */
  }

   .game-actions {
    gap: 0.4rem;
  }
  
  .resign-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    min-width: 90px;
  }
  
    #currentPlayerHeadshot {
      width: 60px !important;
      height: 60px !important;
      flex-shrink: 0;
    }
  
    .turn-player-name {
      font-size: 1.1rem !important;
    }
  
    .player-info {
      gap: 0.5rem;
    }

  
  #turnSection {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.5rem !important;
    text-align: center !important;
    margin-bottom: 1rem;
    padding: 0.75rem;
    overflow: visible !important;
  }

  #timer-container {
    width: 80px !important;
    height: 80px !important;
    margin: 0 auto !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
    z-index: 1000 !important;
    grid-column: unset !important;
    justify-self: center !important;
  }
  
  .progress-ring {
    width: 80px !important;
    height: 80px !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    overflow: visible !important;
    transform: rotate(-90deg) !important;
  }
  


 .progress-ring-circle {
    stroke-width: 5;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease !important;
  }
  
  #timer {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    z-index: 1002 !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
    line-height: 1 !important;
    background: none !important;
    border: none !important;
  }

  .home-tabs {
    flex-direction: row;
    padding: 0.375rem;
  }
  
  .home-tab {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  .home-tab-content {
    padding: 2rem 1.5rem;
    min-height: 350px;
  }
  
  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }

  .turn-player-name {
    font-size: 1.1rem !important;
    margin: 0 !important;
    color: #3b82f6;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
    min-width: 0;  /* Allow text to shrink if needed */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;  /* Keep on one line, truncate if too long */
  }

  #gameArea {
    min-height: auto !important; /* Remove any fixed height constraints */
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important; /* Allow natural scrolling */
    overflow-x: hidden;
    padding-bottom: 1rem !important;
  }

  #gameArea * {
  max-height: none !important;
  overflow: visible !important;
}

 #gameOverContainer {
  margin: 1rem;
  padding: 1.5rem;
  max-width: 100%; /* ✅ Use percentage instead of calc */
  width: 100%;     /* ✅ Use percentage instead of calc */
  box-sizing: border-box; /* ✅ Include padding in width */
}
  
  #gameOverContainer > div:first-child {
    font-size: 1.25rem;
    line-height: 1.4;
    /* Force text wrapping on mobile */
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  
   #successful-guesses-container {
    margin-bottom: 4rem !important; /* Extra space at bottom */
    padding-bottom: 2rem;
  }
  
  #guessControls {
    flex-direction: column;
    gap: 1rem;
  }
  
  #guessControls input, #submitGuessBtn {
    width: 100%;
  }
  
  #autocomplete-list {
    left: 0;
    right: 0;
  }

.autocomplete-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  min-height: 60px;
  text-align: left !important;
}

  /* More pronounced selection on mobile */
 .autocomplete-item:hover,
  .autocomplete-item.selected {
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
    border-left-width: 6px;
    box-shadow: 
      inset 0 0 0 3px rgba(96, 165, 250, 0.4),
      0 4px 12px rgba(30, 64, 175, 0.5);
    transform: translateX(6px);
  }

  /* Larger selection arrow on mobile */
  .autocomplete-item:hover::after,
  .autocomplete-item.selected::after {
    font-size: 1.5rem;
    right: 1rem;
  }

   .career-years {
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 5px;  /* Keep inline spacing */
    text-align: right !important; 
  }
  
  .auth-forms-row {
    flex-direction: column;
    gap: 1.5rem;
    padding: 0 1rem;
  }
  
  .auth-form {
    max-width: 100%;
    padding: 2rem 1.5rem;
  }
  
  #privateGameBtn, #findGameBtn {
    min-width: auto;
    width: 100%;
    margin: 0.5rem 0;
  }

    #playersDisplay {
      font-size: 0.75rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .game-info {
    margin-left: 0;
  }
  
  .info-separator {
    display: none;
  }
  
  
  .opponent-label {
    font-size: 0.75rem;
  }
  
  .player-name.opponent {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
  }

  .player-name {
    padding: 0.375rem 0.75rem;  /* Smaller padding */
    border-radius: var(--radius-md);
    margin: 0;  /* Remove horizontal margins */
    transition: all 0.2s ease;
    font-size: 0.9rem;  /* Smaller text */
  }

 
  .card-deck-container {
  width: 100%;
  height: 320px;
  margin: 1.5rem auto;
  margin-bottom: 3rem !important;
}

.player-card {
  width: 180px;
  height: 240px;
  padding: 0.875rem;
}

 .card-player-name {
    font-size: 1rem;
    margin: 0.5rem 0;
    padding: 0 12px;  /* Adjust for smaller mobile headshots */
  }

  .card-connection {
    font-size: 0.75rem;
    margin: 0.375rem 0;
    padding: 0 45px;  /* Adjust for smaller mobile headshots */
  }

.card-header {
    font-size: 0.7rem;
    margin: 0.75rem 0 0.375rem 0;
    padding: 0 12px;  /* Adjust for smaller mobile headshots */
  }

.card-footer {
    font-size: 0.65rem;
    padding: 0.5rem 12px;  /* Adjust for smaller mobile headshots */
  }

.player-card::before,
  .player-card::after {
    content: "" !important;
    width: 35px;
    height: 35px;
    background-image: var(--headshot-url);
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    border: 2px solid #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
  
  .player-card::before {
    top: 0.375rem;
    left: 0.375rem;
  }
  
  .player-card::after {
    bottom: 0.375rem;
    right: 0.375rem;
  }

   /* Fallback for missing headshots on mobile */
  .player-card:not([style*="--headshot-url"])::before,
  .player-card:not([style*="--headshot-url"])::after {
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAvklEQVRoge3XsQ2AIBBF0ZLpDoBuwHFHqK8cQvMrIo3FLPHom/b2mX9rcNqZmZmZmZmZmZmdFz5ec3m6F3+v4PYs3PmR7JbiDD1N9g5IuT16CWYExozP7G9Czzxq/cE8ksYbFxExk2RcMUfYHNk0RMYPhk0QcMbJHUYyNsi9h5YDyYFSNqLD6c+5h3tGn+MO9ZftHJz5nz/rq3ZTzRzqkIxuYwAAAABJRU5ErkJggg==') !important;
  }


  .card-deck-container.game-ended {
    height: 280px;
    padding: 0 0.5rem;
  }
  
  .card-deck-container.game-ended .player-card {
    width: 180px !important;
    height: 240px !important;
    min-width: 180px;
  }

   #inviteLinkWrapper div {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  #copyInviteBtn, #shareInviteBtn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
  }


   .skip-toast {
    top: 60px;
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
    min-width: 260px;
  }
}



@media (max-width: 480px) {
html, body {
    margin: 0;
    padding: 0;
  }
  
  nav {
    padding: 0 0.75rem;
    height: 48px;
    margin: 0;
    width: 100vw;
  }
  
  #nav-title {
    font-size: 1rem;
  }
  
  #nav-home-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }

  .home-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .game-intro {
    padding: 1.5rem 1rem;
  }
  
  .game-intro h1 {
    font-size: 1.75rem;
  }
  
  .game-subtitle {
    font-size: 1rem;
  }
  
  .how-to-play {
    padding: 1rem;
  }
  
 h1 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.015em;
  }
  
  h1::before {
    font-size: 1rem;
  }
  
  h1::after {
    width: 40px;
  }
  
  section[data-route] {
    padding: 1rem;
  }

 #gameArea {
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: 1rem !important;
  }

  #successful-guesses-container {
    margin-bottom: 5rem !important;
    padding-bottom: 3rem;
  }

 #timer-container {
    width: 70px !important;
    height: 70px !important;
    margin: 0 auto !important;
    position: relative !important;
    display: block !important;
    overflow: visible !important;
    z-index: 1000 !important;
  }
  
  .progress-ring {
    width: 70px !important;
    height: 70px !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    overflow: visible !important;
    transform: rotate(-90deg) !important;
  }
  
 
 .progress-ring-circle {
    stroke-width: 4;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease !important;
  }
  
  #timer {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    z-index: 1002 !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
    line-height: 1 !important;
    background: none !important;
    border: none !important;
  }


  #turnSection {
    padding: 0.5rem !important;
    margin-bottom: 0.75rem !important;
    position: relative;
    z-index: 10;
  }

  .timer-skip-row {
  gap: 1rem;
}


.turn-player-name {
  font-size: 1rem !important;
}

.career-link {
  font-size: 0.8rem;
}

 .resign-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
    min-width: 80px;
  }

  /* Ensure guess controls are properly positioned */
  #guessControls {
    margin-top: 0.5rem !important;
    margin-bottom: 1rem !important;
    position: relative;
    z-index: 5;
  }
  
  /* Prevent viewport jumping when keyboard appears */
  #guessInput:focus {
    transform: none !important;
    transition: border-color 0.2s ease;
  }


  .turn-prompt .turn-player-name {
    font-size: 1.8rem;  /* Much larger - up from 1.4rem */
    font-weight: bold;   /* Make it bolder */
    white-space: nowrap;
    flex-shrink: 0;
  }

  #playersDisplay {
    font-size: 0.7rem;
    gap: 0.3rem;
  }
  
  .opponent-label {
    font-size: 0.7rem;
  }
  
  .player-name.opponent {
    font-size: 0.7rem;
  }

#gameOverContainer {
    margin: 0.5rem;
    padding: 1rem;
    max-width: 100%;
    /* ✅ Use percentage instead of calc */
    width: 100%;
    /* ✅ Use percentage instead of calc */
    box-sizing: border-box;
    /* ✅ Include padding in width */
}
  
  #gameOverContainer > div:first-child {
    font-size: 1.1rem;
    line-height: 1.3;
    /* Aggressive text wrapping for small screens */
    word-break: break-all;
    overflow-wrap: anywhere;
  }


  .player-name {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    max-width: 100%;
  }


.autocomplete-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
  min-height: 55px;
  text-align: left !important;
}

 .autocomplete-item > span:first-child {
  flex: 1;
  margin-right: 0.25rem; /* Reduce from 0.5rem to 0.25rem */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

 .career-years {
  font-size: 0.8rem;
  margin-left: 0.25rem; /* Reduce from 5px to 0.25rem for consistency */
  flex-shrink: 0;
  text-align:right !important;
}

  /* Adjust arrow position for stacked layout */
  .autocomplete-item:hover::after,
  .autocomplete-item.selected::after {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
  }

/* Card Deck Small Mobile */
.card-deck-container {
  width: 100%;
  height: 300px;
  margin: 1rem auto;
  margin-bottom: 4rem !important;
}

.player-card {
  width: 160px;
  height: 220px;
  padding: 0.75rem;
}

.card-player-name {
    font-size: 0.9rem;
    line-height: 1.1;
    padding: 0 10px;  /* Adjust for smallest mobile headshots */
  }


  .card-connection {
    font-size: 0.7rem;
    line-height: 1.3;
    padding: 0 10px;  /* Adjust for smallest mobile headshots */
  }

.card-header {
    font-size: 0.65rem;
    margin: 0.5rem 0 0.25rem 0;
    padding: 0 10px;  /* Adjust for smallest mobile headshots */
  }

.card-footer {
    font-size: 0.6rem;
    padding: 0.5rem 10px 0.25rem 10px;  /* Adjust for smallest mobile headshots */
    margin-bottom: 0.25rem;
  }

  .player-card::before,
  .player-card::after {
    content: "" !important;
    width: 30px;
    height: 30px;
    background-image: var(--headshot-url);
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    border: 2px solid #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
  
  .player-card::before {
    top: 0.25rem;
    left: 0.25rem;
  }
  
  .player-card::after {
    bottom: 0.25rem;
    right: 0.25rem;
  }

  .player-card:not([style*="--headshot-url"])::before,
  .player-card:not([style*="--headshot-url"])::after {
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAvklEQVRoge3XsQ2AIBBF0ZLpDoBuwHFHqK8cQvMrIo3FLPHom/b2mX9rcNqZmZmZmZmZmZmdFz5ec3m6F3+v4PYs3PmR7JbiDD1N9g5IuT16CWYExozP7G9Czzxq/cE8ksYbFxExk2RcMUfYHNk0RMYPhk0QcMbJHUYyNsi9h5YDyYFSNqLD6c+5h3tGn+MO9ZftHJz5nz/rq3ZTzRzqkIxuYwAAAABJRU5ErkJggg==') !important;
  }

Adjust stacking for smaller cards
/* .player-card:nth-child(1) { left: 40px; }
.player-card:nth-child(2) { left: 36px; }
.player-card:nth-child(3) { left: 32px; }
.player-card:nth-child(4) { left: 28px; } */

/* Reduce hover effects on mobile */
.player-card:hover {
  transform: translateY(-5px) rotate(0deg) !important;
}

/* .card-deck-container:hover .player-card:nth-child(2) {
  transform: rotate(-6deg) translateX(-15px);
}

.card-deck-container:hover .player-card:nth-child(3) {
  transform: rotate(-9deg) translateX(-25px);
} */

.card-deck-container.game-ended {
    height: 240px;
    padding: 0 0.25rem;
  }
  
  .card-deck-container.game-ended .player-card {
    width: 160px !important;
    height: 220px !important;
    min-width: 160px;
  }


   .skip-toast {
    top: 55px;
    font-size: 0.9rem;
    padding: 0.75rem 1.25rem;
    min-width: 240px;
  }



}