/* Main styling for Plant Identification Game */

/* Global Colors - Consistent across all themes */
:root {
  /* Brand Colors */
  --primary-color: #33b5a6;
  --primary-hover: #238b7e;
  --secondary-color: #e9c46a;
  
  /* Status Colors */
  --success-color: #43a047;
  --error-color: #e63946;
  --warning-color: #ff9800;
  --danger-color: #f44336;
  
  /* Level Colors for Game Modes */
  --level-1: var(--primary-color);
  --level-1-hover: var(--primary-hover);
  --level-2: #d024ff;
  --level-3: #816bff;
  --level-4: #95c3ff;
  --level-5: #95eaff;
  --level-6: #95fffd;
  --level-7: #95ffdd;
  --level-8: #f2fafd;
  --level-10: #fff1ab;
  --filter-bg: #6d9490;
  
  /* Level Indentation */
  --level-indent-size: 3px; /* Base indentation per level */
}

/* Light Theme - Adaptive Colors */
:root {
  /* Text Colors */
  --text-primary: #264653;
  --text-secondary: #555;
  --text-muted: #666;
  --text-inverse: white;
  --text-inverse-muted: rgba(255, 255, 255, 0.8);
  
  /* Background Colors */
  --bg-primary: white;
  --bg-secondary: #f8f9fa;
  --bg-surface: white;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  
  /* Border Colors */
  --border-light: #f0f0f0;
  --border-medium: #e0e0e0;
  --border-dark: #ddd;
  --border-disabled: #cccccc;
  
  /* Interactive States */
  --hover-overlay: rgba(102, 178, 255, 0.1);
  --focus-overlay: rgba(255, 255, 255, 0.7);
  --focus-overlay-medium: rgba(255, 255, 255, 0.9);
  
  /* Shadows */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Dark Theme - Adaptive Colors Only */
[data-theme="dark"] {
  /* Text Colors */
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-muted: #888;
  --text-inverse: #1a1a1a;
  --text-inverse-muted: rgba(26, 26, 26, 0.8);
  
  /* Background Colors */
  --bg-primary: #1a1a1a;
  --bg-secondary: #121212;
  --bg-surface: #2d2d2d;
  --bg-overlay: rgba(255, 255, 255, 0.1);
  
  /* Border Colors */
  --border-light: #404040;
  --border-medium: #555;
  --border-dark: #666;
  --border-disabled: #444;
  
  /* Interactive States */
  --hover-overlay: rgba(74, 144, 217, 0.2);
  --focus-overlay: rgba(255, 255, 255, 0.1);
  --focus-overlay-medium: rgba(255, 255, 255, 0.2);
  
  /* Shadows */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  /* margin: 0; */
  /* padding: 0; */
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

#app {
  max-width: 2000px;
  margin: 0 auto;
  padding: 20px;
}

/* Fullscreen game play view - no scrolling */
#game-play {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  background-color: #000; /* Black background for fullscreen image experience */
  overflow: hidden; /* Prevent any scrolling */
}

/* Page scrolling rules moved to consolidated mobile section below */

#game-play.hidden {
  display: none;
}

/* Shared content wrapper for game settings and controls */
.content-wrapper {
  max-width: 800px;
  width: 100%; /* CRITICAL: Expand to fill parent, then constrain to max-width */
  margin: 0 auto;
  padding: 0;
}

.view {
  background-color: var(--bg-primary);
  border-radius: 8px;
  padding: 30px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  transition: background-color 0.3s ease;
}

/* Timer background color states */
.view.timer-warning {
  background-color: var(--warning-color) !important;
}

.view.timer-danger {
  background-color: var(--danger-color) !important;
}

.hidden {
  display: none;
}

h1, h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
}

/* Introduction Section */
.introduction-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 25px;
  margin: 30px 0;
  line-height: 1.6;
}

.introduction-section h2 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 15px;
  text-align: center;
}

.introduction-section p {
  margin-bottom: 15px;
  color: var(--text-primary);
}

.introduction-section p:last-child {
  margin-bottom: 0;
}

/* Game Mode Dropdown */
.game-mode-toggle {
  text-align: center;
  margin: 30px 0;
}

.game-mode-toggle p {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  color: var(--text-primary);
}

.timing-mode-dropdown {
  display: flex;
  justify-content: center;
}

.timing-mode-select {
  padding: 12px 24px;
  background-color: var(--bg-surface);
  border: 2px solid var(--border-medium);
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.3s ease;
  outline: none;
  min-width: 200px;
}

.timing-mode-select:hover {
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.timing-mode-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

/* Game Selection Screen */
.game-options {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 30px;
}

.game-option {
  background-color: var(--primary-color);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  padding: 15px 30px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 200px;
  box-shadow: var(--shadow);
}

.game-option:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

/* Fullscreen Image Container */
.fullscreen-image-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-color: #000;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Dual image wrapper */
.dual-image-wrapper {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 2px;
}

/* Mobile navigation arrows */
.mobile-nav {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.3s ease;
}

.mobile-nav:hover {
  background-color: rgba(0, 0, 0, 0.9);
}

.mobile-nav-left {
  left: 10px;
}

.mobile-nav-right {
  right: 10px;
}

/* Image numbers removed */

.image-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Prevent default browser drag behavior */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#plant-image-1,
#plant-image-2 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  object-fit: contain;
  transition: transform 0.3s ease, opacity 0.3s ease;
  cursor: move;
  /* Prevent default browser drag behavior */
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: auto;
}

/* Species Title Overlay */
.species-title-overlay {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 500;
  z-index: 20;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Guess Input Overlay */
.guess-overlay {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  width: min(94vw, 600px); /* Constrain maximum width */
  z-index: 30;
}

.guess-overlay .autocomplete-container {
  position: relative;
  flex: 1; /* Take available space */
  min-width: 200px; /* Minimum width for usability */
  background-color: var(--bg-primary);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-medium);
}

.guess-overlay #species-guess {
  width: 100%;
  height: 45px;
  padding: 12px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  font-size: 16px;
  background-color: transparent;
  color: var(--text-primary);
  outline: none;
}

.guess-overlay #species-guess::placeholder {
  color: var(--text-muted);
}

.guess-overlay #submit-guess {
  padding: 12px;
  background-color: var(--primary-color);
  color: var(--text-inverse);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  font-size: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  width: 150px;
  height: 45px;
}

.guess-overlay #submit-guess:disabled {
  background-color: rgba(150, 150, 150, 0.8);
  cursor: not-allowed;
}

.guess-overlay #submit-guess:not(:disabled):hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

/* Autocomplete positioned above input */
.guess-overlay .autocomplete-items {
  position: absolute;
  bottom: calc(100% + 5px); /* Position above with gap */
  left: 0;
  right: 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  max-height: 70vh; /* Desktop: 70% of screen height */
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
  z-index: 31;
  display: none;
}

.guess-overlay .autocomplete-items.active {
  display: block;
}

.guess-overlay .autocomplete-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.guess-overlay .autocomplete-item:hover {
  background-color: var(--hover-overlay);
}

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

.guess-overlay .autocomplete-item .common-name {
  font-weight: bold;
  color: var(--text-primary);
}

.guess-overlay .autocomplete-item .scientific-name {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.9em;
}

/* Central Feedback Overlay */
.feedback-overlay {
  position: absolute;
  bottom: 140px; /* Position closer to the guess overlay (reduced spacing) */
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 600px); /* Constrain maximum width */
  height: auto;
  min-height: 45px;
  background-color: transparent;
  backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.feedback-overlay.hidden {
  display: none;
}

.feedback-content {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  width: 100%; /* Use full width of parent container */
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  animation: none;
  backdrop-filter: none;
}

.feedback-content .feedback {
  flex: 1; /* Take available space */
  min-width: 200px; /* Minimum width for usability */
  padding: 12px; /* 1px less padding to compensate for 1px border */
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 0;
  background-color: var(--bg-primary);
  backdrop-filter: blur(10px);
  border: 0;
  box-sizing: border-box;
}

.feedback-content .feedback.correct {
  background-color: var(--bg-primary);
  border: 1px solid var(--success-color);
  color: var(--success-color);
}

.feedback-content .feedback.incorrect {
  background-color: var(--bg-primary);
  border: 1px solid var(--error-color);
  color: var(--error-color);
}

.feedback-content .next-button {
  padding: 12px;
  height: 45px;
  background-color: var(--primary-color);
  color: var(--text-inverse);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  width: 150px;
}

.feedback-content .next-button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

/* Map Toggle Button - moved to top right with other controls */
.map-toggle-btn {
  position: fixed;
  top: 140px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  z-index: 1000;
}

.map-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

/* Return Home Button - moved to top right with other controls */
.return-home-overlay {
  position: fixed;
  top: 200px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  z-index: 1000;
}

.return-home-overlay:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

/* Loading State */
.loading-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  color: var(--text-inverse);
  z-index: 5;
}

.loading-state.hidden {
  display: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid var(--text-inverse);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  font-size: 18px;
  font-weight: 500;
  text-align: center;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Zoom controls removed - using mouse wheel zoom only */

/* Per-image attribution */
.attribution {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 14px;
  color: white;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 5px 10px;
  border-radius: 4px;
  z-index: 10;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(5px);
}

.attribution a {
  color: white;
  text-decoration: none;
}

.attribution a:hover {
  text-decoration: underline;
}

/* Mobile attribution and dropdown styles moved to consolidated mobile section below */

.guess-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: visible; /* Allow dropdown to overflow */
  width: 100%; /* Expand to fill content-wrapper like game-mode-selector */
}

/* Create a flex container for the input and button */
.input-submit-container {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.autocomplete-container {
  position: relative;
  flex-grow: 1; /* Take up available space */
  z-index: 1000; /* Ensure dropdown appears above map */
}

/* Removed duplicate form input styles - now consolidated under .guess-overlay selectors */

/* Game End Screen */
.final-score {
  font-size: 24px;
  text-align: center;
  margin: 30px 0;
}

.game-actions {
  text-align: center;
  margin-bottom: 30px;
}

#play-again, #return-home {
  padding: 12px 20px;
  margin: 10px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#play-again {
  background-color: var(--primary-color);
  color: var(--text-inverse);
}

#play-again:hover {
  background-color: var(--primary-hover);
}

#return-home {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

#return-home:hover {
  background-color: var(--border-medium);
}

.game-method {
  text-align: center;
  margin-bottom: 30px;
  padding: 15px;
  background-color: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.game-method p {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
  color: var(--text-primary);
}

.game-summary {
  margin-top: 30px;
}

.game-summary h3 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 20px;
}

.summary-table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-primary);
  font-size: 14px;
}

.summary-table th {
  background-color: var(--primary-color);
  color: var(--text-inverse);
  padding: 12px 8px;
  text-align: left;
  font-weight: bold;
  border-bottom: 2px solid var(--primary-hover);
}

.summary-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.summary-table tr:nth-child(even) {
  background-color: var(--bg-surface);
}

.summary-table tr:hover {
  background-color: var(--hover-overlay);
}

.result-correct {
  color: var(--success-color);
  font-weight: bold;
}

.result-incorrect {
  color: var(--error-color);
  font-weight: bold;
}

.result-timeout {
  color: var(--text-muted);
  font-style: italic;
}

.species-name {
  font-style: italic;
}

.guess-none {
  color: var(--text-muted);
  font-style: italic;
}

/* Responsive adjustments moved to consolidated mobile section below */ 

/* Map container styles moved to modal-specific section above */

.obscured-notice {
  background-color: rgba(255, 193, 7, 0.1);
  border-left: 4px solid var(--secondary-color);
  padding: 10px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-secondary);
} 

.feedback {
  padding: 15px;
  border-radius: 4px;
  flex-grow: 1;
}

.feedback.correct {
  background-color: rgba(67, 160, 71, 0.1);
  border: 1px solid var(--success-color);
  color: var(--success-color);
}

.feedback.incorrect {
  background-color: rgba(230, 57, 70, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
}

.feedback a {
  color: var(--primary-color);
  text-decoration: underline;
  font-weight: bold;
}

.feedback a:hover {
  color: var(--primary-hover);
}

/* Next button styles consolidated under .feedback-content .next-button */ 

/* High Scores Section */
.high-scores-section {
  margin-top: 40px;
  padding: 20px;
  background-color: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.high-scores-section h3 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: bold;
}

.scores-table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.scores-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-primary);
  font-size: 14px;
}

.scores-table th {
  background-color: var(--primary-color);
  color: var(--text-inverse);
  padding: 12px 8px;
  text-align: left;
  font-weight: bold;
  border-bottom: 2px solid var(--primary-hover);
}

.scores-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.scores-table tr:nth-child(even) {
  background-color: var(--bg-surface);
}

.scores-table tr:hover {
  background-color: var(--hover-overlay);
}

.scores-table td:first-child {
  font-weight: bold;
  color: var(--secondary-color);
}

.scores-table td:last-child {
  font-weight: bold;
  color: var(--success-color);
}

/* Game Mode Selector Styles */
.game-mode-selector {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 30px;
  width: 100%;
}

.mode-dropdown {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
}

.selected-mode {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: var(--level-1);
  color: var(--text-inverse);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background-color 0.3s ease;
}

.selected-mode:hover {
  background-color: var(--level-1-hover);
}

.dropdown-arrow {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.dropdown-arrow-right {
  width: 16px;
  height: 16px;
  fill: currentColor;
  margin-left: auto;
}

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  background-color: var(--bg-primary);
  border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow);
  z-index: 100;
  transition: max-height 0.3s ease;
  /* Prevent touch scrolling from affecting page */
  touch-action: pan-y;
}

/* Desktop only: hover and focus show dropdown */
@media (min-width: 769px) {
  .mode-dropdown:hover .dropdown-content,
  .mode-dropdown:focus-within .dropdown-content {
    max-height: 500px; /* Increased to accommodate more game modes */
    overflow-y: auto; /* Enable vertical scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }
}

/* All devices: open class shows dropdown */
.mode-dropdown.open .dropdown-content {
  max-height: 500px; /* Increased to accommodate more game modes */
  overflow-y: auto; /* Enable vertical scrolling */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.mode-dropdown.closed .dropdown-content {
  max-height: 0 !important;
  overflow: hidden !important;
}

.dropdown-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
  border-bottom: 1px solid var(--border-light);
}

/* Level-based indentation for dropdown items */
.dropdown-item[data-level="1"] { padding-left: calc(20px + var(--level-indent-size) * 0); }
.dropdown-item[data-level="2"] { padding-left: calc(20px + var(--level-indent-size) * 1); }
.dropdown-item[data-level="3"] { padding-left: calc(20px + var(--level-indent-size) * 2); }
.dropdown-item[data-level="4"] { padding-left: calc(20px + var(--level-indent-size) * 3); }
.dropdown-item[data-level="5"] { padding-left: calc(20px + var(--level-indent-size) * 4); }
.dropdown-item[data-level="6"] { padding-left: calc(20px + var(--level-indent-size) * 5); }
.dropdown-item[data-level="7"] { padding-left: calc(20px + var(--level-indent-size) * 6); }
.dropdown-item[data-level="8"] { padding-left: calc(20px + var(--level-indent-size) * 7); }
.dropdown-item[data-level="10"] { padding-left: calc(20px + var(--level-indent-size) * 9); }

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

.dropdown-item:hover {
  background-color: var(--hover-overlay);
}

.dropdown-item .mode-name {
  font-weight: bold;
  margin-right: 10px;
}

.dropdown-item .mode-description {
  font-size: 0.9em;
  color: var(--text-muted);
}

/* Level-specific styles with background colors */
.dropdown-item[data-level="1"] {
  background-color: var(--level-1);
  color: black;
}

.dropdown-item[data-level="1"]:hover {
  filter: brightness(0.9);
}

.dropdown-item[data-level="1"] .mode-description {
  color: black;
}

.dropdown-item[data-level="2"] {
  background-color: var(--level-2);
  color: black;
}

.dropdown-item[data-level="2"]:hover {
  filter: brightness(0.9);
}

.dropdown-item[data-level="2"] .mode-description {
  color: black;
}

.dropdown-item[data-level="3"] {
  background-color: var(--level-3);
  color: black;
}

.dropdown-item[data-level="3"]:hover {
  filter: brightness(0.9);
}

.dropdown-item[data-level="3"] .mode-description {
  color: black;
}

.dropdown-item[data-level="4"] {
  background-color: var(--level-4);
  color: black;
}

.dropdown-item[data-level="4"]:hover {
  filter: brightness(0.95);
}

.dropdown-item[data-level="4"] .mode-description {
  color: black;
}

.dropdown-item[data-level="5"] {
  background-color: var(--level-5);
  color: black;
}

.dropdown-item[data-level="5"]:hover {
  filter: brightness(0.95);
}

.dropdown-item[data-level="5"] .mode-description {
  color: black;
}

.dropdown-item[data-level="6"] {
  background-color: var(--level-6);
  color: black;
}

.dropdown-item[data-level="6"]:hover {
  filter: brightness(0.95);
}

.dropdown-item[data-level="6"] .mode-description {
  color: black;
}

.dropdown-item[data-level="7"] {
  background-color: var(--level-7);
  color: black;
}

.dropdown-item[data-level="7"]:hover {
  filter: brightness(0.95);
}

.dropdown-item[data-level="7"] .mode-description {
  color: black;
}

.dropdown-item[data-level="8"] {
  background-color: var(--level-8);
  color: black;
}

.dropdown-item[data-level="8"]:hover {
  filter: brightness(0.95);
}

.dropdown-item[data-level="8"] .mode-description {
  color: black;
}

.dropdown-item[data-level="10"] {
  background-color: var(--level-10);
  color: black;
}

.dropdown-item[data-level="10"]:hover {
  filter: brightness(0.95);
}

.dropdown-item[data-level="10"] .mode-description {
  color: black;
}

/* Iconic taxa toggle styling */
.dropdown-item.iconic-toggle {
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--filter-bg);
  border-top: 1px solid var(--border-medium);
  border-bottom: 1px solid var(--border-medium);
}

.dropdown-item.iconic-toggle .toggle-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-color);
}

/* Start button */
.start-button {
  padding: 15px 30px;
  background-color: var(--primary-color);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  box-shadow: var(--shadow);
}

.start-button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

/* Controls on Top Right */
/* Theme Toggle Button */
.theme-toggle-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.theme-toggle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  background-color: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

.theme-icon {
  transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(15deg);
}

/* Instructions Toggle Button */
.instructions-toggle-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1000;
}

.instructions-toggle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  background-color: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.instructions-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

.instructions-icon {
  transition: transform 0.3s ease;
}

.instructions-toggle:hover .instructions-icon {
  transform: rotate(15deg);
}

/* Information on Top Left */
/* Floating Round */
.floating-round-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
}

.floating-timer {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  background-color: var(--bg-primary);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

/* Floating Score */
.floating-score-container {
  position: fixed;
  top: 80px;
  left: 20px;
  z-index: 1000;
}

.floating-round {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  background-color: var(--bg-primary);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  color: var(--text-primary);
}

/* Floating Timer */
.floating-timer-container {
  position: fixed;
  top: 140px;
  left: 20px;
  z-index: 1000;
}

.floating-score {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  background-color: var(--bg-primary);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  color: var(--text-primary);
}

/* Timer States */
.floating-timer.inactive {
  background-color: #333;
  border-color: #333;
  color: white;
}

.floating-timer.green {
  background-color: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.floating-timer.yellow {
  background-color: var(--warning-color);
  border-color: var(--warning-color);
  color: white;
}

.floating-timer.red {
  background-color: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
}

.floating-timer.flashing {
  animation: flash 0.5s ease-in-out infinite alternate;
}

@keyframes flash {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Return Home Button in Game */
.return-home-container {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

.return-home-btn {
  padding: 10px 20px;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 2px solid var(--border-medium);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.return-home-btn:hover {
  background-color: var(--border-medium);
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
}

/* Confirmation Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  max-width: 400px;
  width: 90%;
  margin: 20px;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
  padding: 20px 20px 10px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
}

.modal-body {
  padding: 20px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-body p {
  margin: 0;
}

.modal-actions {
  padding: 15px 20px 20px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.cancel-btn {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.cancel-btn:hover {
  background-color: var(--border-light);
}

.confirm-btn {
  background-color: var(--error-color);
  color: var(--text-inverse);
}

.confirm-btn:hover {
  background-color: #d32f2f;
  transform: translateY(-1px);
}

/* Content Warning Modal specific styles */
.content-warning-modal .modal-overlay {
  background-color: rgba(0, 0, 0, 0.8); /* Darker overlay for content warning */
}

.content-warning-modal .modal-content {
  max-width: 500px;
  width: 90%;
}

.content-warning-modal .modal-header h3 {
  color: var(--warning-color, #f59e0b);
  font-size: 20px;
  margin-bottom: 0;
}

.content-warning-modal .modal-body p {
  margin-bottom: 15px;
  line-height: 1.5;
}

.content-warning-modal .modal-body p:last-child {
  margin-bottom: 0;
}

.content-warning-notice {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 12px;
  margin-top: 20px;
}

.content-warning-notice p {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

.content-warning-modal .modal-actions {
  justify-content: center;
  margin-top: 25px;
}

.content-warning-modal .confirm-btn {
  min-width: 150px;
  font-weight: 600;
}

/* Instructions Modal Specific Styling */
.instructions-modal-content {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.instructions-body {
  max-height: 60vh;
  overflow-y: auto;
}

.instructions-section {
  margin-bottom: 25px;
}

.instructions-section h4 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 20px;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 5px;
}

.instructions-section h5 {
  color: var(--text-primary);
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: bold;
}

.instructions-section p {
  margin-bottom: 15px;
  line-height: 1.6;
}

.instructions-section ul {
  margin-left: 20px;
  margin-bottom: 15px;
}

.instructions-section li {
  margin-bottom: 5px;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: var(--text-primary);
}

/* Map Modal Specific Styling */
.map-modal-content {
  max-width: 800px;
  max-height: 80vh;
}

.map-modal-content .modal-body {
  padding: 0;
}

.map-modal-content .map-container {
  height: 60vh;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.map-modal-content .map {
  height: 100%;
  width: 100%;
}

/* Add mobile optimization at the end of the file */

/* Mobile Optimization for New Fullscreen Layout */
@media (max-width: 768px) {
  /* Mobile: Completely disable page scrolling during gameplay */
  body:has(#game-play:not(.hidden)) {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* Fullscreen remains same on mobile */
  #game-play {
    width: 100vw;
    height: 100vh;
  }

  /* Mobile dual image layout - show only one image at a time */
  .dual-image-wrapper {
    flex-direction: column;
    position: relative;
  }
  
  .image-wrapper {
    display: none;
    width: 100%;
  }
  
  .image-wrapper.active {
    display: block;
  }
  
  /* Show mobile navigation arrows */
  .mobile-nav {
    display: block;
  }

  /* Mobile attribution display */
  .attribution-1 {
    display: block;
  }
  
  .attribution-2 {
    display: none;
  }
  
  /* When second image is active, show its attribution */
  .image-wrapper:not(.active) .attribution {
    display: none;
  }
  
  .image-wrapper.active .attribution {
    display: block;
  }

  /* Image container and zoom button adjustments */
  .image-container {
    height: 70vh; /* Slightly smaller on mobile */
  }
  
  .zoom-btn {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
  
  /* Mobile bottom spacer to prevent cutoff by browser controls */
  #game-play::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px; /* Adjust this height as needed */
    pointer-events: none;
    z-index: 5;
  }

  /* Adjust overlays for mobile */
  .guess-overlay {
    bottom: 60px;
    width: min(94vw, 600px); /* Match desktop constraint */
  }
  
  .guess-overlay .autocomplete-container {
    min-width: 180px; /* Smaller minimum for mobile */
  }

  /* Mobile: limit dropdown height to 40% screen height */
  .guess-overlay .autocomplete-items {
    max-height: 40vh;
  }
  
  /* Feedback overlay mobile adjustments */
  .feedback-overlay {
    bottom: 120px; /* Position above the mobile guess overlay (60px + 60px for spacing) */
    width: min(94vw, 600px); /* Match desktop constraint */
  }
  
  .feedback-content .feedback {
    min-width: 180px; /* Smaller minimum for mobile */
    font-size: 14px;
    padding: 11px; /* Adjusted to compensate for border on mobile too */
  }
  
  .feedback-content .next-button {
    font-size: 14px;
    padding: 10px 16px;
    width: 100px;
    border: 1px solid var(--border-medium);
  }
  
  .guess-overlay #species-guess {
    font-size: 14px;
    padding: 12px;
  }
  
  .guess-overlay #submit-guess {
    font-size: 14px;
    padding: 10px 16px;
    width: 100px;
    height: 45px;
    border: 1px solid var(--border-medium);
  }
  
  /* Species title overlay mobile */
  .species-title-overlay {
    top: 15px;
    font-size: 14px;
    padding: 6px 12px;
  }
  
  /* Adjust overlay buttons for mobile */
  .map-toggle-btn,
  .return-home-overlay {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  
  /* Floating buttons adjustments for mobile */
  /* Controls on right */
  .theme-toggle-container {
    top: 15px;
    right: 15px;
  }
  
  .instructions-toggle-container {
    top: 70px;
    right: 15px;
  }
  
  .map-toggle-btn {
    top: 125px;
    right: 15px;
  }
  
  .return-home-overlay {
    top: 180px;
    right: 15px;
  }
  
  /* Information on left */
  .floating-round-container {
    top: 15px;
    left: 15px;
  }
  
  .floating-score-container {
    top: 70px;
    left: 15px;
  }
  
  .floating-timer-container {
    top: 125px;
    left: 15px;
  }
  
  .theme-toggle,
  .instructions-toggle,
  .floating-timer,
  .floating-round,
  .floating-score {
    width: 45px;
    height: 45px;
    font-size: 16px;
  }
  
  .floating-round {
    font-size: 12px;
  }
  
  .floating-score {
    font-size: 12px;
  }
  
  /* Modal adjustments for mobile */
  .modal-content {
    max-width: 350px;
    margin: 10px;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .modal-btn {
    width: 100%;
  }
  
  /* Map modal mobile */
  .map-modal-content {
    max-width: 95vw;
    max-height: 85vh;
  }
  
  .map-modal-content .map-container {
    height: 50vh;
  }
  
  /* Feedback content mobile rules consolidated in main mobile section above */
  
  /* Other mobile adjustments for non-game screens */
  #app {
    padding: 10px 0;
    max-width: 100%;
  }
  
  .view:not(#game-play) {
    padding: 15px 10px;
    border-radius: 0;
  }
  
  /* Game summary table mobile adjustments */
  .summary-table {
    font-size: 12px;
  }
  
  .summary-table th,
  .summary-table td {
    padding: 8px 4px;
  }
  
  /* High scores table mobile adjustments */
  .scores-table {
    font-size: 12px;
  }
  
  .scores-table th,
  .scores-table td {
    padding: 8px 4px;
  }
  
  .high-scores-section {
    margin-top: 30px;
    padding: 15px;
  }
  
  .high-scores-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
  }
  
  /* Full-screen dropdown on mobile */
  .mode-dropdown {
    position: static;
  }
  
  .mode-dropdown.open .dropdown-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    max-height: 100vh !important;
    z-index: 1000;
    border-radius: 0;
    padding-top: 60px;
    overflow-y: auto;
    box-shadow: none;
    background-color: var(--bg-primary);
  }
  
  .mode-dropdown.open .dropdown-content::before {
    content: "×";
    position: fixed;
    top: 15px;
    right: 20px;
    font-size: 30px;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background-color: var(--bg-surface);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 1001;
  }
  
  .dropdown-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-medium);
  }
  
  .dropdown-item .mode-name {
    font-size: 18px;
  }
  
  .dropdown-item .mode-description {
    font-size: 14px;
    margin-top: 4px;
  }
  
  /* Introduction section mobile */
  .introduction-section {
    padding: 15px;
    margin: 20px 0;
  }
  
  .introduction-section h2 {
    font-size: 1.3rem;
  }
} 