/* Thai Vocab Game Styles */

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1a1a1a;
  --text: #e8e6e3;
  --text-muted: #888;
  --teal: #2dd4bf;
  --teal-deep: #0d9488;
  --correct: #22c55e;
  --incorrect: #ef4444;
  --warning: #f59e0b;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #222;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--teal);
}

.stats-bar {
  display: flex;
  gap: 1.5rem;
  font-weight: 500;
}

.streak {
  color: var(--warning);
}

.score {
  color: var(--teal);
}

/* Main Game Container */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.game-state {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.hidden {
  display: none !important;
}

/* Loading State */
.loader {
  width: 48px;
  height: 48px;
  border: 3px solid var(--surface);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

#loading-state p {
  color: var(--text-muted);
}

/* Word Card */
.word-card,
.quiz-word-card,
.answer-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  width: 100%;
}

.thai-word,
.thai-word-large {
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 2.5rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.thai-word-large {
  font-size: 3rem;
}

.thai-script,
.thai-script-large {
  font-family: 'Noto Serif Thai', serif;
  font-size: 1.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.5rem;
}

.thai-script-large {
  font-size: 2.2rem;
}

.romanization {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 300;
}

.english {
  font-size: 1.3rem;
  color: var(--teal);
  margin-top: 1rem;
  font-weight: 500;
}

/* Instruction Text */
.instruction {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.question {
  font-size: 1.1rem;
  color: var(--text);
}

/* YouGlish Container */
#youglish-container {
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  min-height: 200px;
}

#yg-widget {
  width: 100%;
  min-height: 200px;
}


/* Video Controls */
.video-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.control-btn {
  background: var(--surface);
  border: 1px solid #333;
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.control-btn:hover {
  background: var(--surface-hover);
  border-color: var(--teal);
}

/* Primary Button */
.primary-btn {
  background: var(--teal-deep);
  border: none;
  color: white;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  max-width: 300px;
}

.primary-btn:hover {
  background: var(--teal);
  transform: translateY(-2px);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Skip Button */
.skip-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: color 0.2s;
}

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

.word-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.dislike-btn {
  color: var(--incorrect);
  opacity: 0.7;
}

.dislike-btn:hover {
  opacity: 1;
}

/* Multiple Choice Options */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

.option-btn {
  background: var(--surface);
  border: 2px solid #333;
  color: var(--text);
  padding: 1.25rem 1rem;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--teal);
  background: var(--surface-hover);
}

.option-btn.selected {
  border-color: var(--teal);
  background: rgba(45, 212, 191, 0.1);
}

.option-btn.correct {
  border-color: var(--correct);
  background: rgba(34, 197, 94, 0.15);
}

.option-btn.incorrect {
  border-color: var(--incorrect);
  background: rgba(239, 68, 68, 0.15);
}

.option-btn:disabled {
  cursor: default;
}

/* Typing Input */
#typing-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#answer-input {
  background: var(--surface);
  border: 2px solid #333;
  color: var(--text);
  padding: 1rem;
  border-radius: 12px;
  font-size: 1.2rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

#answer-input:focus {
  border-color: var(--teal);
}

#answer-input::placeholder {
  color: var(--text-muted);
}

/* Result State */
.result-icon {
  font-size: 4rem;
}

.result-message {
  font-size: 1.5rem;
  font-weight: 500;
}

.result-message.correct {
  color: var(--correct);
}

.result-message.incorrect {
  color: var(--incorrect);
}

.score-change {
  font-size: 1.1rem;
  font-weight: 500;
}

.score-change.positive {
  color: var(--correct);
}

.score-change.negative {
  color: var(--incorrect);
}

.next-review {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Session Complete */
.complete-icon {
  font-size: 4rem;
}

#complete-state h2 {
  font-size: 1.8rem;
  font-weight: 500;
}

.session-stats {
  display: flex;
  gap: 2rem;
  margin: 1rem 0;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 600;
  color: var(--teal);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.back-home {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.back-home:hover {
  color: var(--teal);
}

/* Progress Footer */
.progress-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #222;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--teal);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  min-width: 60px;
  text-align: right;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .game-container {
    padding: 1.5rem;
  }

  .thai-word {
    font-size: 2rem;
  }

  .thai-word-large {
    font-size: 2.5rem;
  }

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

  .session-stats {
    gap: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

/* Level Display */
.level {
  background: var(--teal-deep);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Assessment Popup */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.popup-content {
  background: var(--surface);
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  text-align: center;
}

.popup-content h3 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.popup-content p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.popup-content .primary-btn {
  width: 100%;
  margin-bottom: 0.75rem;
}

.popup-content .skip-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.popup-content .skip-btn:hover {
  color: var(--text);
}

/* Stats Popup */
.stats-content {
  max-width: 450px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-box {
  background: var(--bg);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--teal);
}

.stat-box .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#recent-words-list {
  max-height: 150px;
  overflow-y: auto;
  margin: 1rem 0;
}

.recent-word {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #222;
  font-size: 0.9rem;
}

.recent-word .thai {
  font-family: 'Noto Sans Thai', sans-serif;
}

.recent-word .score {
  color: var(--teal);
}

.level {
  cursor: pointer;
  transition: transform 0.2s;
}

.level:hover {
  transform: scale(1.05);
}
