/* Flashcard Styles with Mobile Height Fix */
.flashcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
  perspective: 1000px;
  min-height: auto;
  height: auto;
}

.flashcard-content {
  width: 100%;
  max-width: 500px;
  height: 300px;
  perspective: 1000px;
  cursor: pointer;
  margin-bottom: 20px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  flex-shrink: 0;
}

.front, .back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  background-color: white;
  box-sizing: border-box;
}

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

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

.flip-back {
  transform: rotateY(0deg);
  transition: transform 0.6s;
}

.ngas-word {
  font-size: 36px;
  font-weight: bold;
  color: #0050ef;
  text-align: center;
  word-break: break-word;
}

.flip-hint {
  font-size: 14px;
  color: #666;
  margin-top: 10px;
}

.english-word {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: center;
  word-break: break-word;
}

.word-tags {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.word-tag {
  background: #0050ef;
  color: white;
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.next-button, .restart-button {
  padding: 10px 20px;
  background: #0050ef;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.next-button:hover, .restart-button:hover {
  background: #0040c7;
  transform: translateY(-2px);
}

.progress-container {
  margin: 20px 0;
  text-align: center;
  width: 100%;
  max-width: 500px;
}

.progress-text {
  font-size: 14px;
  margin-bottom: 5px;
  color: #0050ef;
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  background: #e9ecef;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}

.progress {
  background: #0050ef;
  height: 100%;
  transition: width 0.3s;
}

/* Flashcard Skeleton Loading */
.flashcard-skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

.skeleton-flashcard {
  width: 100%;
  max-width: 500px;
  height: 300px;
  background: #e9ecef;
  border-radius: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-progress {
  width: 100%;
  max-width: 500px;
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Mobile Height Fix */
@media (max-width: 768px) {
  .flashcard {
    margin-top: 10px;
    padding: 0 1rem;
    height: auto;
    min-height: auto;
  }
  
  .flashcard-content {
    height: 250px;
    max-width: 100%;
    margin-bottom: 15px;
  }
  
  .front, .back {
    padding: 20px;
  }
  
  .ngas-word, .english-word {
    font-size: 28px;
  }
  
  .progress-container {
    margin: 15px 0;
  }
  
  /* Ensure no overflow on mobile */
  .content .flashcard {
    overflow: visible !important;
    max-height: none !important;
  }
}

@media (max-width: 480px) {
  .flashcard-content {
    height: 220px;
  }
  
  .ngas-word, .english-word {
    font-size: 24px;
  }
  
  .front, .back {
    padding: 15px;
  }
  
  .word-tag {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  .next-button, .restart-button {
    padding: 8px 16px;
    font-size: 14px;
  }
}

/* Nuclear mobile fix - same as vocabulary */
@media (max-width: 768px) {
  .flashcard {
    all: unset;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem;
    perspective: 1000px;
    height: auto;
    min-height: auto;
  }
  
  .content {
    display: block;
    height: auto;
    min-height: auto;
    padding-bottom: 80px;
  }
}

/* Ad Containers */
.ad-container {
  margin: 1rem 0;
  text-align: center;
  width: 100%;
}

.ad-banner-bottom {
  position: fixed;
  bottom: 10px; /* Above mobile bottom nav */
  left: 0;
  right: 0;
  background: white;
  padding: 0.5rem;
  border-top: 1px solid #e9ecef;
  z-index: 999;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.completion-ad {
  margin: 2rem 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Completion Screen - Sleek Compact Version */
.completion-screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
  height: auto;
  overflow: visible;
  padding: 1rem;
}

.completion-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  text-align: center;
}

.completion-icon {
  width: 60px; /* Smaller */
  height: 60px;
  color: #ffd700;
  margin-bottom: 1rem;
}

.completion-screen h2 {
  color: #0050ef;
  font-size: 1.5rem; /* Smaller */
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.completion-screen p {
  color: #666;
  font-size: 0.95rem; /* Smaller */
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

/* Compact Buttons */
.completion-actions {
  display: flex;
  gap: 0.75rem; /* Tighter spacing */
  margin-top: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.action-button {
  padding: 0.6rem 1.2rem; /* Smaller padding */
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem; /* Tighter icon spacing */
  font-size: 0.9rem; /* Smaller text */
  min-width: 140px; /* Reasonable minimum */
  justify-content: center;
}

.action-button.primary {
  background: #0050ef;
  color: white;
}

.action-button.primary:hover {
  background: #0040c7;
  transform: translateY(-1px);
}

.action-button.secondary {
  background: #f8f9fa;
  color: #0050ef;
  border: 2px solid #0050ef;
}

.action-button.secondary:hover {
  background: #0050ef;
  color: white;
}

/* Ad Containers - More Compact */
.ad-container {
  margin: 1rem 0;
  text-align: center;
  width: 100%;
}

.completion-ad {
  margin: 1.5rem 0; /* Less margin */
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.ad-banner-bottom {
  background: white;
  padding: 0.5rem;
  border-top: 1px solid #e9ecef;
  margin-top: auto;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .completion-screen {
    padding: 0.5rem;
    min-height: calc(100vh - 120px);
  }
  
  .completion-content {
    padding: 1rem 0.5rem;
  }
  
  .completion-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 0.75rem;
  }
  
  .completion-screen h2 {
    font-size: 1.3rem;
  }
  
  .completion-screen p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
  
  .completion-actions {
    gap: 0.5rem;
    margin-top: 1rem;
    flex-direction: column;
    width: 100%;
    max-width: 280px;
  }
  
  .action-button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    min-width: auto;
    width: 100%;
  }
  
  .ad-container {
    margin: 0.75rem 0;
  }
}



/* Mobile-Specific Compact Buttons */
@media (max-width: 768px) {
  .completion-screen {
    padding: 0.5rem;
    min-height: auto; /* Remove fixed height */
    height: auto;
    overflow: visible;
  }
  
  .completion-content {
    padding: 0.75rem 0.25rem;
    justify-content: flex-start; /* Don't force center */
  }
  
  .completion-icon {
    width: 40px; /* Even smaller */
    height: 40px;
    margin-bottom: 0.5rem;
  }
  
  .completion-screen h2 {
    font-size: 1.1rem; /* Smaller */
    margin-bottom: 0.25rem;
    line-height: 1.2;
  }
  
  .completion-screen p {
    font-size: 0.8rem; /* Smaller */
    margin-bottom: 0.75rem;
    line-height: 1.3;
  }
  
  .completion-actions {
    gap: 0.4rem; /* Tighter */
    margin-top: 0.75rem;
    flex-direction: column;
    width: 100%;
    max-width: 220px; /* Narrower container */
  }
  
  .action-button {
    padding: 0.4rem 0.8rem; /* Much smaller */
    font-size: 0.75rem; /* Smaller text */
    min-width: auto;
    width: 100%;
    height: 36px; /* Fixed height */
  }
  
  .action-button i {
    width: 14px; /* Smaller icons */
    height: 14px;
  }
  
  /* Reduce ad margins */
  .ad-container {
    margin: 0.5rem 0;
  }
}

/* Bottom Ad Banner - Mobile Fix */
.ad-banner-bottom {
  background: white;
  padding: 0.5rem;
  border-top: 1px solid #e9ecef;
  margin-top: auto;
  position: relative; /* Ensure it stays in flow */
  z-index: 998; /* Below bottom nav */
}

/* Mobile bottom ad positioning */
@media (max-width: 768px) {
  .ad-banner-bottom {
    margin-top: 1rem;
    padding: 0.4rem;
    position: relative;
    bottom: auto;
  }
  
  /* Ensure content has space for bottom nav */
  .content {
    padding-bottom: 120px !important; /* Space for ad + nav */
  }
  
  /* Make sure completion screen accounts for bottom space */
  .completion-screen {
    padding-bottom: 0;
    margin-bottom: 0;
  }
}

/* Super Compact Mobile Alternative */
@media (max-width: 480px) {
  .completion-screen {
    padding: 0.25rem;
  }
  
  .completion-content {
    padding: 0.5rem 0.1rem;
  }
  
  .completion-icon {
    width: 35px;
    height: 35px;
    margin-bottom: 0.4rem;
  }
  
  .completion-screen h2 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
  }
  
  .completion-screen p {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
  }
  
  .completion-actions {
    max-width: 200px;
    gap: 0.3rem;
    margin-top: 0.5rem;
  }
  
  .action-button {
    padding: 0.35rem 0.7rem;
    font-size: 0.7rem;
    height: 32px;
  }
  
  .action-button i {
    width: 12px;
    height: 12px;
  }
  
  /* Even more compact ad spacing */
  .ad-container {
    margin: 0.3rem 0;
  }
}