/* General Styles */
:root {
  --primary-color: #4a90e2;
  --secondary-color: #50c878;
  --wrong-color: #e74c3c;
  --correct-color: #2ecc71;
  --background-color: #f0f5ff;
  --card-bg-color: #ffffff;
  --text-color: #333;
  --hell-color: #d9534f;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  padding-top: 1rem;
  padding-bottom: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  background-color: var(--card-bg-color);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  width: 95%;
}

.screen {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Home Screen */
.app-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.app-subtitle {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: #666;
}

.game-settings {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  width: 100%;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  color: var(--primary-color);
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
}

.section-header i {
  font-size: 1.2rem;
}

.section-header h4 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.unit-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Unit Chips Styling */
.unit-checkbox-input {
  display: none;
}

.unit-chip {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin: 0.25rem;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  color: #666;
  background: #fff;
  user-select: none;
  font-weight: 500;
}

.unit-chip:hover {
  background-color: #f0f0f0;
  border-color: #d0d0d0;
}

.unit-checkbox-input:checked + .unit-chip {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  box-shadow: 0 2px 5px rgba(74, 144, 226, 0.3);
}

/* Disabled Unit Chip */
.unit-checkbox-input:disabled + .unit-chip {
  background-color: #f5f5f5;
  border-color: #eee;
  color: #bbb;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Difficulty Cards Styling */
.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  width: 100%;
}

.difficulty-card {
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background-color: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.difficulty-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.level-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #555;
}

.word-count {
  font-size: 0.9rem;
  color: #888;
}

.difficulty-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Selected States for Difficulty Cards */
.difficulty-card:has(input:checked) {
  background-color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-3px);
}

/* Easy - Green */
.option-easy:has(input:checked) {
  border-color: var(--correct-color);
}
.option-easy:has(input:checked) .level-title {
  color: var(--correct-color);
}

/* Medium - Yellow/Orange */
.option-medium:has(input:checked) {
  border-color: #f39c12;
}
.option-medium:has(input:checked) .level-title {
  color: #f39c12;
}

/* Hard - Red */
.option-hard:has(input:checked) {
  border-color: #e74c3c;
}
.option-hard:has(input:checked) .level-title {
  color: #e74c3c;
}

/* Hell - Dark Red */
.option-hell:has(input:checked) {
  border-color: var(--hell-color);
  background-color: rgba(217, 83, 79, 0.05);
}
.option-hell:has(input:checked) .level-title {
  color: var(--hell-color);
}

/* Game Screen */
.game-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--card-bg-color);
  padding-top: 0.5rem;
  padding-bottom: 0.75rem;
}

.word-display {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border-radius: 12px;
  background-color: #f8f9fa;
}

.word {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.phonetic {
  font-size: 1.3rem;
  color: #666;
}

.options-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.option-card {
  padding: 1.25rem;
  border-radius: 8px;
  background-color: #fff;
  border: 2px solid #ddd;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Apply hover effects only on devices that support hover */
@media (hover: hover) {
  .option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
  }
}

/* Touch device interaction */
.option-card:active {
  transform: translateY(-3px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.option-pos {
  font-size: 0.9rem;
  font-weight: 600;
  color: #888;
  margin-bottom: 0.5rem;
}

.option-meaning {
  font-size: 1.1rem;
}

.option-selected {
  border-color: var(--primary-color);
  background-color: rgba(74, 144, 226, 0.1);
}

.option-correct {
  border-color: var(--correct-color);
  background-color: rgba(46, 204, 113, 0.1);
}

.option-wrong {
  border-color: var(--wrong-color);
  background-color: rgba(231, 76, 60, 0.1);
}

.progress-bar-container {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.progress {
  height: 12px;
  margin-bottom: 1rem;
}

.progress-bar {
  background-color: var(--primary-color);
  transition: width 0.5s ease;
}

/* Animation Classes */
@keyframes correct-animation {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes wrong-animation {
  0% { transform: translateX(0); }
  25% { transform: translateX(10px); }
  50% { transform: translateX(-10px); }
  75% { transform: translateX(5px); }
  100% { transform: translateX(0); }
}

.animate-correct {
  animation: correct-animation 0.5s ease;
}

.animate-wrong {
  animation: wrong-animation 0.5s ease;
}

/* Victory Screen */
.victory-message {
  padding: 2rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  margin: 0 auto;
  max-width: 90%;
}

.victory-message h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

/* Multiple selection notification */
#multi-select-notification {
  margin-bottom: 1.5rem;
  font-weight: 500;
}

/* Ensure content below header has enough spacing when sticky */
.game-header + .row {
  margin-top: 0.5rem;
}

#remaining-count {
  font-weight: 600;
}

/* Responsive Adjustments */
/* Extra small devices (phones, 576px and down) */
@media (max-width: 576px) {
  .app-title {
    font-size: 2rem;
  }
  
  .app-subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .game-settings {
    padding: 1rem;
  }
  
  .word {
    font-size: 2rem;
  }
  
  .phonetic {
    font-size: 1rem;
  }
  
  .option-meaning {
    font-size: 1rem;
  }
  
  .victory-message h1 {
    font-size: 2rem;
  }
  
  .victory-message {
    padding: 1.5rem;
  }
  
  .unit-options {
    justify-content: center;
  }
  
  .difficulty-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Small devices (tablets, 576px to 767px) */
@media (min-width: 577px) and (max-width: 767px) {
  .app-title {
    font-size: 2.25rem;
  }
  
  .options-container {
    grid-template-columns: 1fr;
  }
}

/* Medium devices (tablets, 768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .options-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .word {
    font-size: 2.25rem;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .app-container {
    padding: 2rem;
  }
  
  .word {
    font-size: 3rem;
  }
  
  .options-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

/* Ensure form elements are responsive */
.form-select, .form-control, .btn {
  max-width: 100%;
}

/* Add meta viewport tag to ensure proper scaling */
@-ms-viewport {
  width: device-width;
}