/*
 * Enhanced stylesheet for the Terminology Practice site.
 * 
 * This builds upon the existing styles with significant visual improvements
 * while preserving all functionality. Includes book-themed colors, better
 * interactions, and modern visual effects.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Enhanced color palette inspired by the book design */
:root {
  --font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, sans-serif;
  --primary-color: #1a202c;        /* Deep blue-gray for text */
  --secondary-color: #4a5568;      /* Medium gray for secondary text */
  --accent-color: #f56500;         /* Book orange for primary actions */
  --accent-hover: #e55100;         /* Darker orange for hover states */
  --accent-light: #ff8a50;        /* Light orange for highlights */
  --background-color: #f8fafc;     /* Very light blue-gray background */
  --card-background: #ffffff;      /* White card backgrounds */
  --border-color: #e2e8f0;         /* Soft gray borders */
  --border-focus: #cbd5e0;         /* Focused border color */
  --correct-color: #38a169;        /* Rich green for correct answers */
  --correct-light: #68d391;        /* Light green for backgrounds */
  --incorrect-color: #e53e3e;      /* Rich red for incorrect answers */
  --incorrect-light: #fc8181;      /* Light red for backgrounds */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-focus: 0 0 0 3px rgba(245, 101, 0, 0.15);
  --transition: all 0.2s ease-in-out;
  --max-width: 1600px; /* Increased for wider grid layouts */
}

/* Dark mode with enhanced colors - applies to both system preference and manual toggle */
@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) {
    --primary-color: #f7fafc;        /* Light gray for text */
    --secondary-color: #a0aec0;      /* Medium light gray */
    --accent-color: #ff8a50;         /* Brighter orange for dark mode */
    --accent-hover: #ff7a3d;         /* Lighter orange hover */
    --background-color: #171923;     /* Very dark blue-gray */
    --card-background: #1a202c;      /* Dark card backgrounds */
    --border-color: #2d3748;         /* Dark border color */
    --border-focus: #4a5568;         /* Focused border in dark mode */
    --correct-color: #68d391;        /* Bright green */
    --correct-light: #38a169;        /* Darker green for dark mode */
    --incorrect-color: #fc8181;      /* Bright red */
    --incorrect-light: #e53e3e;      /* Darker red for dark mode */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
  }
}

/* Manual dark mode class */
body.dark-mode {
  --primary-color: #f7fafc;
  --secondary-color: #a0aec0;
  --accent-color: #ff8a50;
  --accent-hover: #ff7a3d;
  --background-color: #171923;
  --card-background: #1a202c;
  --border-color: #2d3748;
  --border-focus: #4a5568;
  --correct-color: #68d391;
  --correct-light: #38a169;
  --incorrect-color: #fc8181;
  --incorrect-light: #e53e3e;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
}

/* Enhanced base typography and layout */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--primary-color);
  line-height: 1.6;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

/* Font size variations */
body.font-small {
  font-size: 0.875rem;
}

body.font-medium {
  font-size: 1rem;
}

body.font-large {
  font-size: 1.125rem;
}

body.font-large h1 {
  font-size: 2.75rem;
}

body.font-large h2 {
  font-size: 2rem;
}

body.font-large .subtitle {
  font-size: 1.25rem;
}

body.font-small h1 {
  font-size: 2.25rem;
}

body.font-small h2 {
  font-size: 1.5rem;
}

body.font-small .subtitle {
  font-size: 1rem;
}

/* Enhanced header with dynamic gradient */
header {
  /* Fallback for browsers that don't support gradients or animations */
  background: var(--accent-color);
  background: -webkit-linear-gradient(135deg,
    var(--accent-color) 0%,
    #ff7043 25%,
    #ffa726 50%,
    var(--accent-light) 100%
  );
  background: linear-gradient(135deg,
    var(--accent-color) 0%,
    #ff7043 25%,
    #ffa726 50%,
    var(--accent-light) 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 10s ease-in-out infinite;
  color: white;
  padding: 2rem 1rem 1.5rem;
  position: relative;
  overflow: hidden;
}

/* Subtle gradient animation */
@-webkit-keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Disable animations for users who prefer reduced motion or on low-end devices */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Low-performance mode for Chromebooks and older devices */
@supports not (backdrop-filter: blur(1px)) {
  /* Simplified styles for low-end devices */

  header {
    background: var(--accent-color) !important;
    animation: none !important;
  }

  .question-card {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    animation: none !important;
  }

  .question-card:hover {
    transform: none !important;
  }

  .flashcard {
    transform: none !important;
    transform-style: flat !important;
    transition: none !important;
  }

  .flashcard.flipped .flashcard-front {
    display: none;
  }

  .flashcard.flipped .flashcard-back {
    display: flex;
    transform: none !important;
    position: relative;
  }

  .flashcard-front,
  .flashcard-back {
    backface-visibility: visible !important;
    position: relative;
  }

  .flashcard:not(.flipped) .flashcard-back {
    display: none;
  }

  button:hover,
  .primary-action-btn:hover {
    transform: none !important;
  }

  * {
    animation: none !important;
  }
}

/* Header content styling */
header .header-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  position: relative;
  z-index: 2;
}

/* Header top row with title and theme toggle */
header .header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 1rem;
}

header .header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

header .header-logo {
  width: 120px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
  flex-shrink: 0;
}

header .header-logo:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

header .header-text {
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.header-controls {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

header h1 {
  margin: 0;
  font-size: 3rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  opacity: 0.95;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  line-height: 1.3;
}

/* Control toggle buttons (theme, font size) */
.control-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  min-width: 40px;
  min-height: 40px;
  flex-shrink: 0;
}

.control-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.theme-icon {
  width: 20px;
  height: 20px;
  color: white;
  transition: var(--transition);
}

.theme-toggle .moon-icon {
  display: none;
}

/* Dark mode - switch icons */
body.dark-mode .control-toggle .sun-icon {
  display: none;
}

body.dark-mode .control-toggle .moon-icon {
  display: block;
}

/* Light mode (explicit) */
body.light-mode .control-toggle .sun-icon {
  display: block;
}

body.light-mode .control-toggle .moon-icon {
  display: none;
}

/* Term of the Day button */
.term-of-day-btn {
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  padding: 0.6rem 1.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  transition: var(--transition);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  height: 48px;
}

.term-of-day-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.term-of-day-btn .icon {
  width: 20px;
  height: 20px;
  color: white;
  flex-shrink: 0;
}

/* Mobile Mode Optimizations */
body.mobile-mode {
  font-size: 16px; /* Prevents zoom on iOS */
}

body.mobile-mode .header-logo {
  width: 60px;
}

body.mobile-mode header h1 {
  font-size: 1.5rem;
}

body.mobile-mode .subtitle {
  font-size: 0.9rem;
}

body.mobile-mode .control-box {
  padding: 0.75rem;
}

body.mobile-mode .question-card {
  padding: 1rem;
}

body.mobile-mode button,
body.mobile-mode select,
body.mobile-mode input,
body.mobile-mode textarea {
  font-size: 16px; /* Prevents zoom */
  min-height: 44px; /* Touch-friendly */
}

body.mobile-mode .modal-content {
  max-width: 95%;
  max-height: 90vh;
  padding: 1rem;
}

body.mobile-mode .term-of-day-btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

/* Mobile mode toggle active state */
body.mobile-mode #mobileToggle {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Enhanced secondary button */
.secondary-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  /* backdrop-filter: blur(4px); */ /* Removed for Chromebook compatibility */
  background: rgba(255, 255, 255, 0.2);
  margin-top: 1rem;
}

.secondary-btn:hover,
.secondary-btn:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  outline: none;
}

/* Enhanced icon styling */
.icon {
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.5em;
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.2s ease;
}

.secondary-btn:hover .icon {
  transform: scale(1.05);
}

/* Sticky controls section */
.sticky-controls {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--background-color);
  border-bottom: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.sticky-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
  width: 100%;
}

/* Main content improvements */
main {
  max-width: var(--max-width);
  margin: 2.5rem auto;
  padding: 0 1rem;
}

/* Enhanced controls section */
#controls {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

#controls::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
}

/* Letter range row */
.letter-range-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.letter-range-row label {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.85rem;
}

/* Controls container with responsive grid (up to 5 columns on large screens) */
.controls-container {
  /* Flexbox fallback for older browsers */
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  width: 100%;
}

/* Grid layout for modern browsers - default to 2 columns for safety */
@supports (display: grid) {
  .controls-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

.control-box {
  /* Fallback width for flexbox */
  flex: 1 1 calc(50% - 0.5rem);
  min-width: 0; /* Remove min-width to prevent overflow */
}

/* Control box styling */
.control-box {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: var(--transition);
  background: var(--card-background);
}

.control-box:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.control-box-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(245, 101, 0, 0.08) 0%, rgba(255, 138, 80, 0.08) 100%);
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-color);
  overflow: hidden;
}

.control-box-header .icon {
  width: 1em;
  height: 1em;
}

.control-box-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-box-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.checkbox-label,
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary-color);
  transition: var(--transition);
}

.checkbox-label:hover,
.radio-label:hover {
  color: var(--accent-color);
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
  cursor: pointer;
  width: 1em;
  height: 1em;
  accent-color: var(--accent-color);
}

.checkbox-label span,
.radio-label span {
  user-select: none;
}

/* Control box description text for games */
.control-box-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--secondary-color);
  line-height: 1.4;
}

/* Game box specific styling */
.game-box .control-box-header {
  background: linear-gradient(135deg, rgba(56, 161, 105, 0.08) 0%, rgba(104, 211, 145, 0.08) 100%);
  color: var(--correct-color);
}

/* Responsive breakpoints - progressively add columns as screen grows */

/* Mobile - 1 column */
@media (max-width: 767px) {
  .controls-container {
    grid-template-columns: 1fr !important;
  }
}

/* Tablet - 2 columns (this is also the default) */
@media (min-width: 768px) and (max-width: 1099px) {
  .controls-container {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Small laptop - 3 columns */
@media (min-width: 1100px) and (max-width: 1399px) {
  .controls-container {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* Medium laptop - 4 columns */
@media (min-width: 1400px) and (max-width: 1799px) {
  .controls-container {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* Large desktop - 5 columns (only on very wide screens) */
@media (min-width: 1800px) {
  .controls-container {
    grid-template-columns: repeat(5, 1fr) !important;
  }
}

/* Enhanced form elements - More compact */
select {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-background);
  font-size: 0.9rem;
  color: var(--primary-color);
  min-width: 3.5rem;
  min-height: 38px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

select:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
}

select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: var(--shadow-focus);
}

/* Primary action button (Generate Quiz / Start Flashcards) */
.primary-action-btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
  color: white;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.primary-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.primary-action-btn .icon {
  width: 1em;
  height: 1em;
}

/* Regular button styling */
button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
  color: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

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

button:disabled {
  background: #a0aec0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:focus {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Submit button specific styling */
/* Controls toggle button */
.controls-toggle-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(245, 101, 0, 0.1) 0%, rgba(255, 138, 80, 0.1) 100%);
  color: var(--accent-color);
  border: 2px solid var(--border-color);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}

.controls-toggle-btn:hover {
  background: linear-gradient(135deg, rgba(245, 101, 0, 0.15) 0%, rgba(255, 138, 80, 0.15) 100%);
  border-color: var(--accent-color);
  transform: none;
}

.controls-toggle-btn .toggle-icon {
  width: 1.2em;
  height: 1.2em;
  transition: var(--transition);
}

.controls-content {
  overflow: hidden;
  transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
  max-height: 1000px;
  opacity: 1;
}

.controls-content.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Submit button specific styling - now floats with quiz content */
#submitBtn {
  background: linear-gradient(135deg, var(--correct-color) 0%, #38a169 100%);
  margin: 1.5rem 0;
  width: 100%;
  max-width: 300px;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
}

#submitBtn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2f855a 0%, #2f855a 100%);
}

/* Progress bar and submit button container - sticky at top */
#progressBarContainer {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card-background);
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

/* Wrapper for progress bar and submit button side by side */
.progress-submit-wrapper {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.progress-submit-wrapper .progress-section {
  flex: 1;
  min-width: 300px;
}

.progress-submit-wrapper #submitBtn {
  margin: 0;
  flex-shrink: 0;
  width: auto;
}

/* Completion notices under progress bar */
.completion-notices {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.completion-notice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(56, 161, 105, 0.1);
  color: var(--correct-color);
  border-radius: 6px;
  font-weight: 600;
}

.completion-notice-icon {
  font-size: 1em;
}

/* Fixed quiz status bar - appears when controls are collapsed */
.quiz-status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: var(--card-background);
  border-bottom: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.quiz-status-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.status-progress {
  flex: 1;
  min-width: 200px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-color);
}

.status-submit-btn {
  background: linear-gradient(135deg, var(--correct-color) 0%, #38a169 100%);
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  white-space: nowrap;
}

.status-submit-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2f855a 0%, #2f855a 100%);
}

.status-submit-btn .icon {
  width: 1em;
  height: 1em;
  margin-right: 0.4em;
}

/* Section headings with enhanced styling and collapse functionality */
section h2 {
  margin: 3rem 0 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  position: relative;
  padding: 1rem 1.5rem;
  scroll-margin-top: 200px;
  cursor: pointer;
  user-select: none;
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

section h2:hover {
  background: linear-gradient(135deg, rgba(245, 101, 0, 0.05) 0%, rgba(255, 138, 80, 0.05) 100%);
  border-color: var(--accent-color);
}

section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
  border-radius: 2px;
}

/* Section title text */
.section-title-text {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Green checkmark for completed sections */
.section-complete-checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  background: var(--correct-color);
  color: white;
  border-radius: 50%;
  font-size: 0.9em;
  font-weight: 700;
}

/* Collapse/expand arrow */
.section-toggle-arrow {
  font-size: 1.2em;
  transition: transform 0.3s ease;
  color: var(--secondary-color);
}

section h2.collapsed .section-toggle-arrow {
  transform: rotate(-90deg);
}

/* Section content wrapper */
.section-content {
  border: 2px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
  background: var(--card-background);
}

.section-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 1.5rem;
  border-width: 0;
}

/* Enhanced question cards */
.question-card {
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.question-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

/* Enhanced correct/incorrect styling */
.question-card.correct {
  border-color: var(--correct-color);
  background: linear-gradient(135deg, var(--card-background) 0%, rgba(56, 161, 105, 0.05) 100%);
  animation: correctPulse 0.6s ease-out;
}

.question-card.incorrect {
  border-color: var(--incorrect-color);
  background: linear-gradient(135deg, var(--card-background) 0%, rgba(229, 62, 62, 0.05) 100%);
  animation: incorrectShake 0.5s ease-out;
}

/* Success animation */
@keyframes correctPulse {
  0% { transform: scale(1); box-shadow: var(--shadow-sm); }
  50% { transform: scale(1.02); box-shadow: 0 0 20px rgba(56, 161, 105, 0.3); }
  100% { transform: scale(1); box-shadow: var(--shadow-md); }
}

/* Error animation */
@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Enhanced feedback icons */
.question-card.correct::before,
.question-card.incorrect::before {
  font-size: 1.5rem;
  font-weight: 700;
  display: inline-block;
  margin-right: 0.75rem;
  padding: 0.25rem;
  border-radius: 50%;
  line-height: 1;
  animation: iconPop 0.4s ease-out 0.2s both;
}

.question-card.correct::before {
  content: "✓";
  color: white;
  background: var(--correct-color);
}

.question-card.incorrect::before {
  content: "✕";
  color: white;
  background: var(--incorrect-color);
}

@keyframes iconPop {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Enhanced form controls within cards */
.question-card select,
.question-card textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--primary-color);
  background: var(--card-background);
  transition: var(--transition);
  margin-top: 0.75rem;
}

.question-card select:hover,
.question-card textarea:hover {
  border-color: var(--border-focus);
}

.question-card select:focus,
.question-card textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: var(--shadow-focus);
}

.question-card textarea {
  min-height: 6rem;
  resize: vertical;
  font-family: var(--font-family);
}

/* Enhanced results section - More minimal */
#results {
  margin: 1rem 0;
  padding: 1rem 1.5rem;
  background: var(--card-background);
  border: 2px solid var(--correct-color);
  border-radius: 8px;
  display: none;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

#results::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--correct-color), var(--correct-light));
}

#results p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

#results p:first-of-type {
  font-size: 1.05rem;
  font-weight: 600;
}

/* Style links in results */
#results a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

#results a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Loading state for async operations */
.loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.loading::after {
  content: '';
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--accent-color);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Enhanced focus styles for accessibility */
button:focus-visible,
select:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

/* Progress indicator (could be added via JavaScript) */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Responsive improvements */
@media (max-width: 768px) {
  header {
    padding: 1.5rem 1rem 1rem;
  }

  header .header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  header .header-left {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    width: 100%;
  }

  header .header-logo {
    width: 80px;
  }

  header h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1.1rem;
  }

  .header-right {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
  }

  .term-of-day-btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    height: 40px;
  }

  .term-of-day-btn .term-of-day-text {
    display: none;
  }

  .theme-toggle {
    align-self: flex-end;
    margin-top: 0.5rem;
  }
  
  .control-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .control-row label {
    margin-bottom: 0.25rem;
  }
  
  select {
    width: 100%;
  }
  
  button {
    width: 100%;
  }
  
  section h2 {
    font-size: 1.5rem;
    scroll-margin-top: 150px; /* Smaller margin for mobile */
  }
  
  .question-card {
    padding: 1.25rem;
  }

  #controls {
    padding: 1rem;
  }

  .letter-range-row {
    flex-wrap: wrap;
  }

  .controls-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .control-box-options {
    flex-direction: column;
    align-items: stretch;
  }

  .checkbox-label,
  .radio-label {
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
  }
}

/* Flashcard Mode Styles */
.flashcard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 2rem;
}

.flashcard {
  width: 100%;
  max-width: 600px;
  min-height: 300px;
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.flashcard:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  backface-visibility: hidden;
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.flashcard-back {
  transform: rotateY(180deg);
}

.flashcard-term {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

.flashcard-definition {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--primary-color);
}

.flashcard-example {
  font-size: 0.95rem;
  color: var(--secondary-color);
  font-style: italic;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.flashcard-controls {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.flashcard-progress {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  padding: 0.75rem 1.5rem;
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  min-width: 120px;
  text-align: center;
}

.flashcard-hint {
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin-top: 1rem;
  font-style: italic;
}

/* Print styles */
@media print {
  .sticky-controls {
    position: static;
    box-shadow: none;
    border: none;
  }
  
  header {
    background: white !important;
    color: black !important;
  }
  
  .question-card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  button,
  .secondary-btn {
    display: none;
  }
}

/* Achievement Badge Tooltips */
.achievement-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 101, 0, 0.2);
}

.achievement-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-weight: 500;
  line-height: 1.4;
  max-width: 250px;
  white-space: normal;
  text-align: center;
}

.achievement-badge::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  border: 6px solid transparent;
  border-top-color: #2d3748;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 999;
}

.achievement-badge:hover::after,
.achievement-badge:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* Dark mode adjustments for tooltips */
body.dark-mode .achievement-badge::after {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body.dark-mode .achievement-badge::before {
  border-top-color: #4a5568;
}

/* ============================================
   HAMBURGER MENU STYLES
   ============================================ */

/* Hamburger Toggle Button */
.menu-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1001;
  width: 48px;
  height: 48px;
  padding: 0;
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.menu-toggle:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: scale(1.05);
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
  transition: var(--transition);
}

.menu-toggle:hover span {
  background: white;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Side Menu */
.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: var(--card-background);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.side-menu.active {
  transform: translateX(0);
}

/* Menu Header */
.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
  color: white;
  flex-shrink: 0;
}

.menu-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}

.menu-header h2::after {
  display: none;
}

.menu-close {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  line-height: 1;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: var(--transition);
  min-height: auto;
  box-shadow: none;
}

.menu-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Menu Content */
.menu-content {
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
}

/* Menu Sections */
.menu-section {
  margin-bottom: 1.5rem;
}

.menu-section h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--secondary-color);
  letter-spacing: 0.05em;
}

/* Menu Items */
.menu-item {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--primary-color);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 0.5rem;
  display: block;
  min-height: auto;
}

.menu-item:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: translateX(-4px);
}

.menu-item:active {
  transform: translateX(-4px) scale(0.98);
}

/* Danger item (for destructive actions) */
.menu-item-danger {
  color: var(--incorrect-color);
  border-color: var(--incorrect-color);
}

.menu-item-danger:hover {
  background: var(--incorrect-color);
  color: white;
  border-color: var(--incorrect-color);
}

/* Menu Backdrop */
.menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.menu-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Overlay for menu features */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Content */
.modal-content {
  background: var(--card-background);
  border-radius: 12px;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease-in-out;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.75rem;
  color: var(--primary-color);
  padding: 0;
  border: none;
  background: none;
  cursor: default;
  border-radius: 0;
  justify-content: flex-start;
}

.modal-header h2::after {
  display: none;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--secondary-color);
  border-radius: 4px;
  transition: var(--transition);
  min-height: auto;
  box-shadow: none;
}

.modal-close:hover {
  background: var(--border-color);
  color: var(--primary-color);
}

.modal-body {
  color: var(--primary-color);
}

.modal-body h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  color: var(--accent-color);
}

.modal-body p {
  margin: 0.75rem 0;
  line-height: 1.6;
}

.modal-body ul,
.modal-body ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.modal-body li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

/* Stats Display */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-card {
  background: linear-gradient(135deg, var(--card-background) 0%, var(--background-color) 100%);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-color);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--secondary-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Terms Browser */
.terms-search {
  margin-bottom: 1.5rem;
}

.terms-search input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--primary-color);
  background: var(--card-background);
  transition: var(--transition);
}

.terms-search input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: var(--shadow-focus);
}

.terms-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.term-item {
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  transition: var(--transition);
  cursor: pointer;
}

.term-item:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.term-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.term-definition {
  color: var(--primary-color);
  line-height: 1.6;
  font-size: 0.95rem;
}

/* File input styling for import */
.file-input-wrapper {
  margin: 1.5rem 0;
}

.file-input-wrapper input[type="file"] {
  display: block;
  width: 100%;
  padding: 0.875rem;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  background: var(--background-color);
  cursor: pointer;
  transition: var(--transition);
}

.file-input-wrapper input[type="file"]:hover {
  border-color: var(--accent-color);
  background: var(--card-background);
}

/* Responsive adjustments for menu */
@media (max-width: 768px) {
  .side-menu {
    width: 280px;
  }

  .modal-content {
    padding: 1.5rem;
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
  .menu-toggle {
    border-color: var(--border-color);
  }

  .menu-backdrop.active {
    background: rgba(0, 0, 0, 0.8);
  }
}

/* ==========================================
   ENHANCED VISUAL STYLING FOR LANDING PAGE
   ========================================== */

/* Subtle background pattern for depth */
body {
  background: var(--background-color);
  background-image:
    radial-gradient(circle at 20% 50%, rgba(245, 101, 0, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(56, 161, 105, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(99, 102, 241, 0.02) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Enhanced control box with better depth */
.control-box {
  position: relative;
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

.control-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(245, 101, 0, 0.05) 0%, rgba(255, 138, 80, 0.05) 100%);
}

.control-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--accent-color);
}

.control-box:hover::before {
  opacity: 1;
}

/* Unique styling for each game type */
.speed-match-box .control-box-header {
  background: linear-gradient(135deg, rgba(245, 101, 0, 0.1) 0%, rgba(255, 138, 80, 0.15) 100%);
  color: #f56500;
}

.speed-match-box:hover .control-box-header {
  background: linear-gradient(135deg, rgba(245, 101, 0, 0.15) 0%, rgba(255, 138, 80, 0.2) 100%);
}

.memory-match-box .control-box-header {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.15) 100%);
  color: #6366f1;
}

.memory-match-box:hover .control-box-header {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.2) 100%);
}

.lightning-box .control-box-header {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(250, 204, 21, 0.15) 100%);
  color: #eab308;
}

.lightning-box:hover .control-box-header {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(250, 204, 21, 0.2) 100%);
}

.detective-box .control-box-header {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(168, 85, 247, 0.15) 100%);
  color: #8b5cf6;
}

.detective-box:hover .control-box-header {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(168, 85, 247, 0.2) 100%);
}

.roulette-box .control-box-header {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(13, 148, 136, 0.15) 100%);
  color: #14b8a6;
}

.roulette-box:hover .control-box-header {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(13, 148, 136, 0.2) 100%);
}

/* Enhanced button styling with better hover effects */
.primary-action-btn {
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-action-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.primary-action-btn:hover::before {
  width: 300px;
  height: 300px;
}

.primary-action-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(245, 101, 0, 0.3);
}

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

/* Subtle pulse animation for active game boxes */
@keyframes subtlePulse {
  0%, 100% {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  }
  50% {
    box-shadow: 0 4px 12px rgba(245, 101, 0, 0.15);
  }
}

.game-box:not(:hover) {
  animation: subtlePulse 4s ease-in-out infinite;
}

/* Enhanced header with decorative elements */
header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 20%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0.3) 80%,
    rgba(255, 255, 255, 0) 100%
  );
}

/* Glossy effect on cards */
.control-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
  opacity: 0.5;
}

/* Enhanced shadows for better depth perception */
.control-box {
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.05);
}

.control-box:hover {
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.1),
    0 12px 32px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(245, 101, 0, 0.1);
}

/* Smooth icon rotation on hover */
.control-box-header .icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-box:hover .control-box-header .icon {
  transform: scale(1.1) rotate(5deg);
}

/* Gradient text for game titles */
.speed-match-box .control-box-header span {
  background: linear-gradient(135deg, #f56500 0%, #ff8a50 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.memory-match-box .control-box-header span {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.lightning-box .control-box-header span {
  background: linear-gradient(135deg, #eab308 0%, #facc15 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.detective-box .control-box-header span {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.roulette-box .control-box-header span {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Improved button gradients */
.primary-action-btn {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
  box-shadow: 0 4px 12px rgba(245, 101, 0, 0.2);
}

.primary-action-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #d44800 100%);
  box-shadow: 0 6px 20px rgba(245, 101, 0, 0.3);
}

/* Floating animation for game icons */
@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-3px) rotate(2deg);
  }
  75% {
    transform: translateY(3px) rotate(-2deg);
  }
}

.game-box .control-box-header .icon {
  animation: float 6s ease-in-out infinite;
}

/* Enhanced focus states for accessibility */
.control-box:focus-within {
  outline: 3px solid rgba(245, 101, 0, 0.3);
  outline-offset: 2px;
}

/* Shimmer effect on load */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.control-box-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 3s ease-in-out infinite;
  animation-delay: calc(var(--shimmer-delay, 0) * 0.2s);
}
